1 /* SPDX-License-Identifier: GPL-2.0 */ 2 3 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. 4 * Copyright (C) 2018-2024 Linaro Ltd. 5 */ 6 #ifndef _IPA_POWER_H_ 7 #define _IPA_POWER_H_ 8 9 #include <linux/types.h> 10 11 struct device; 12 13 struct ipa; 14 struct ipa_power_data; 15 enum ipa_irq_id; 16 17 /* IPA device power management function block */ 18 extern const struct dev_pm_ops ipa_pm_ops; 19 20 /** 21 * ipa_core_clock_rate() - Return the current IPA core clock rate 22 * @ipa: IPA structure 23 * 24 * Return: The current clock rate (in Hz), or 0. 25 */ 26 u32 ipa_core_clock_rate(struct ipa *ipa); 27 28 /** 29 * ipa_power_retention() - Control register retention on power collapse 30 * @ipa: IPA pointer 31 * @enable: Whether retention should be enabled or disabled 32 */ 33 void ipa_power_retention(struct ipa *ipa, bool enable); 34 35 /** 36 * ipa_power_setup() - Set up IPA power management 37 * @ipa: IPA pointer 38 * 39 * Return: 0 if successful, or a negative error code 40 */ 41 int ipa_power_setup(struct ipa *ipa); 42 43 /** 44 * ipa_power_teardown() - Inverse of ipa_power_setup() 45 * @ipa: IPA pointer 46 */ 47 void ipa_power_teardown(struct ipa *ipa); 48 49 /** 50 * ipa_power_init() - Initialize IPA power management 51 * @dev: IPA device 52 * @data: Clock configuration data 53 * 54 * Return: A pointer to an ipa_power structure, or a pointer-coded error 55 */ 56 struct ipa_power *ipa_power_init(struct device *dev, 57 const struct ipa_power_data *data); 58 59 /** 60 * ipa_power_exit() - Inverse of ipa_power_init() 61 * @power: IPA power pointer 62 */ 63 void ipa_power_exit(struct ipa_power *power); 64 65 #endif /* _IPA_POWER_H_ */ 66