xref: /linux/drivers/net/ipa/ipa_power.h (revision 110d3047a3ec033de00322b1a8068b1215efa97a)
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_suspend_handler() - Handler for SUSPEND IPA interrupts
35  * @ipa:	IPA pointer
36  * @irq_id:	IPA interrupt ID (unused)
37  *
38  * If an RX endpoint is suspended, and the IPA has a packet destined for
39  * that endpoint, the IPA generates a SUSPEND interrupt to inform the AP
40  * that it should resume the endpoint.
41  */
42 void ipa_power_suspend_handler(struct ipa *ipa, enum ipa_irq_id irq_id);
43 
44 /**
45  * ipa_power_setup() - Set up IPA power management
46  * @ipa:	IPA pointer
47  *
48  * Return:	0 if successful, or a negative error code
49  */
50 int ipa_power_setup(struct ipa *ipa);
51 
52 /**
53  * ipa_power_teardown() - Inverse of ipa_power_setup()
54  * @ipa:	IPA pointer
55  */
56 void ipa_power_teardown(struct ipa *ipa);
57 
58 /**
59  * ipa_power_init() - Initialize IPA power management
60  * @dev:	IPA device
61  * @data:	Clock configuration data
62  *
63  * Return:	A pointer to an ipa_power structure, or a pointer-coded error
64  */
65 struct ipa_power *ipa_power_init(struct device *dev,
66 				 const struct ipa_power_data *data);
67 
68 /**
69  * ipa_power_exit() - Inverse of ipa_power_init()
70  * @power:	IPA power pointer
71  */
72 void ipa_power_exit(struct ipa_power *power);
73 
74 #endif /* _IPA_POWER_H_ */
75