xref: /linux/drivers/net/ipa/ipa_power.h (revision 0e685c3e7158d35626d6d76b9f859eae806d87fa)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 
3 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
4  * Copyright (C) 2018-2022 Linaro Ltd.
5  */
6 #ifndef _IPA_POWER_H_
7 #define _IPA_POWER_H_
8 
9 struct device;
10 
11 struct ipa;
12 struct ipa_power_data;
13 enum ipa_irq_id;
14 
15 /* IPA device power management function block */
16 extern const struct dev_pm_ops ipa_pm_ops;
17 
18 /**
19  * ipa_core_clock_rate() - Return the current IPA core clock rate
20  * @ipa:	IPA structure
21  *
22  * Return: The current clock rate (in Hz), or 0.
23  */
24 u32 ipa_core_clock_rate(struct ipa *ipa);
25 
26 /**
27  * ipa_power_modem_queue_stop() - Possibly stop the modem netdev TX queue
28  * @ipa:	IPA pointer
29  */
30 void ipa_power_modem_queue_stop(struct ipa *ipa);
31 
32 /**
33  * ipa_power_modem_queue_wake() - Possibly wake the modem netdev TX queue
34  * @ipa:	IPA pointer
35  */
36 void ipa_power_modem_queue_wake(struct ipa *ipa);
37 
38 /**
39  * ipa_power_modem_queue_active() - Report modem netdev TX queue active
40  * @ipa:	IPA pointer
41  */
42 void ipa_power_modem_queue_active(struct ipa *ipa);
43 
44 /**
45  * ipa_power_retention() - Control register retention on power collapse
46  * @ipa:	IPA pointer
47  * @enable:	Whether retention should be enabled or disabled
48  */
49 void ipa_power_retention(struct ipa *ipa, bool enable);
50 
51 /**
52  * ipa_power_suspend_handler() - Handler for SUSPEND IPA interrupts
53  * @ipa:	IPA pointer
54  * @irq_id:	IPA interrupt ID (unused)
55  *
56  * If an RX endpoint is suspended, and the IPA has a packet destined for
57  * that endpoint, the IPA generates a SUSPEND interrupt to inform the AP
58  * that it should resume the endpoint.
59  */
60 void ipa_power_suspend_handler(struct ipa *ipa, enum ipa_irq_id irq_id);
61 
62 /**
63  * ipa_power_setup() - Set up IPA power management
64  * @ipa:	IPA pointer
65  *
66  * Return:	0 if successful, or a negative error code
67  */
68 int ipa_power_setup(struct ipa *ipa);
69 
70 /**
71  * ipa_power_teardown() - Inverse of ipa_power_setup()
72  * @ipa:	IPA pointer
73  */
74 void ipa_power_teardown(struct ipa *ipa);
75 
76 /**
77  * ipa_power_init() - Initialize IPA power management
78  * @dev:	IPA device
79  * @data:	Clock configuration data
80  *
81  * Return:	A pointer to an ipa_power structure, or a pointer-coded error
82  */
83 struct ipa_power *ipa_power_init(struct device *dev,
84 				 const struct ipa_power_data *data);
85 
86 /**
87  * ipa_power_exit() - Inverse of ipa_power_init()
88  * @power:	IPA power pointer
89  */
90 void ipa_power_exit(struct ipa_power *power);
91 
92 #endif /* _IPA_POWER_H_ */
93