xref: /openbmc/linux/drivers/net/ipa/ipa_power.h (revision 349f631d)
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_setup() - Set up IPA power management
45  * @ipa:	IPA pointer
46  *
47  * Return:	0 if successful, or a negative error code
48  */
49 int ipa_power_setup(struct ipa *ipa);
50 
51 /**
52  * ipa_power_teardown() - Inverse of ipa_power_setup()
53  * @ipa:	IPA pointer
54  */
55 void ipa_power_teardown(struct ipa *ipa);
56 
57 /**
58  * ipa_power_init() - Initialize IPA power management
59  * @dev:	IPA device
60  * @data:	Clock configuration data
61  *
62  * Return:	A pointer to an ipa_power structure, or a pointer-coded error
63  */
64 struct ipa_power *ipa_power_init(struct device *dev,
65 				 const struct ipa_power_data *data);
66 
67 /**
68  * ipa_power_exit() - Inverse of ipa_power_init()
69  * @power:	IPA power pointer
70  */
71 void ipa_power_exit(struct ipa_power *power);
72 
73 #endif /* _IPA_POWER_H_ */
74