xref: /linux/drivers/net/ipa/ipa_power.h (revision 4b660dbd9ee2059850fd30e0df420ca7a38a1856)
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_retention() - Control register retention on power collapse
28  * @ipa:	IPA pointer
29  * @enable:	Whether retention should be enabled or disabled
30  */
31 void ipa_power_retention(struct ipa *ipa, bool enable);
32 
33 /**
34  * ipa_power_setup() - Set up IPA power management
35  * @ipa:	IPA pointer
36  *
37  * Return:	0 if successful, or a negative error code
38  */
39 int ipa_power_setup(struct ipa *ipa);
40 
41 /**
42  * ipa_power_teardown() - Inverse of ipa_power_setup()
43  * @ipa:	IPA pointer
44  */
45 void ipa_power_teardown(struct ipa *ipa);
46 
47 /**
48  * ipa_power_init() - Initialize IPA power management
49  * @dev:	IPA device
50  * @data:	Clock configuration data
51  *
52  * Return:	A pointer to an ipa_power structure, or a pointer-coded error
53  */
54 struct ipa_power *ipa_power_init(struct device *dev,
55 				 const struct ipa_power_data *data);
56 
57 /**
58  * ipa_power_exit() - Inverse of ipa_power_init()
59  * @power:	IPA power pointer
60  */
61 void ipa_power_exit(struct ipa_power *power);
62 
63 #endif /* _IPA_POWER_H_ */
64