xref: /openbmc/linux/drivers/net/ipa/ipa_power.h (revision 7419995a)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 
3 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
4  * Copyright (C) 2018-2020 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 
14 /* IPA device power management function block */
15 extern const struct dev_pm_ops ipa_pm_ops;
16 
17 /**
18  * ipa_core_clock_rate() - Return the current IPA core clock rate
19  * @ipa:	IPA structure
20  *
21  * Return: The current clock rate (in Hz), or 0.
22  */
23 u32 ipa_core_clock_rate(struct ipa *ipa);
24 
25 /**
26  * ipa_power_modem_queue_stop() - Possibly stop the modem netdev TX queue
27  * @ipa:	IPA pointer
28  */
29 void ipa_power_modem_queue_stop(struct ipa *ipa);
30 
31 /**
32  * ipa_power_modem_queue_wake() - Possibly wake the modem netdev TX queue
33  * @ipa:	IPA pointer
34  */
35 void ipa_power_modem_queue_wake(struct ipa *ipa);
36 
37 /**
38  * ipa_power_modem_queue_active() - Report modem netdev TX queue active
39  * @ipa:	IPA pointer
40  */
41 void ipa_power_modem_queue_active(struct ipa *ipa);
42 
43 /**
44  * ipa_power_retention() - Control register retention on power collapse
45  * @ipa:	IPA pointer
46  * @enable:	Whether retention should be enabled or disabled
47  */
48 void ipa_power_retention(struct ipa *ipa, bool enable);
49 
50 /**
51  * ipa_power_setup() - Set up IPA power management
52  * @ipa:	IPA pointer
53  *
54  * Return:	0 if successful, or a negative error code
55  */
56 int ipa_power_setup(struct ipa *ipa);
57 
58 /**
59  * ipa_power_teardown() - Inverse of ipa_power_setup()
60  * @ipa:	IPA pointer
61  */
62 void ipa_power_teardown(struct ipa *ipa);
63 
64 /**
65  * ipa_power_init() - Initialize IPA power management
66  * @dev:	IPA device
67  * @data:	Clock configuration data
68  *
69  * Return:	A pointer to an ipa_power structure, or a pointer-coded error
70  */
71 struct ipa_power *ipa_power_init(struct device *dev,
72 				 const struct ipa_power_data *data);
73 
74 /**
75  * ipa_power_exit() - Inverse of ipa_power_init()
76  * @power:	IPA power pointer
77  */
78 void ipa_power_exit(struct ipa_power *power);
79 
80 #endif /* _IPA_POWER_H_ */
81