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 16 /* IPA device power management function block */ 17 extern const struct dev_pm_ops ipa_pm_ops; 18 19 /** 20 * ipa_core_clock_rate() - Return the current IPA core clock rate 21 * @ipa: IPA structure 22 * 23 * Return: The current clock rate (in Hz), or 0. 24 */ 25 u32 ipa_core_clock_rate(struct ipa *ipa); 26 27 /** 28 * ipa_power_retention() - Control register retention on power collapse 29 * @ipa: IPA pointer 30 * @enable: Whether retention should be enabled or disabled 31 */ 32 void ipa_power_retention(struct ipa *ipa, bool enable); 33 34 /** 35 * ipa_power_setup() - Set up IPA power management 36 * @ipa: IPA pointer 37 * 38 * Return: 0 if successful, or a negative error code 39 */ 40 int ipa_power_setup(struct ipa *ipa); 41 42 /** 43 * ipa_power_teardown() - Inverse of ipa_power_setup() 44 * @ipa: IPA pointer 45 */ 46 void ipa_power_teardown(struct ipa *ipa); 47 48 /** 49 * ipa_power_init() - Initialize IPA power management 50 * @dev: IPA device 51 * @data: Clock configuration data 52 * 53 * Return: A pointer to an ipa_power structure, or a pointer-coded error 54 */ 55 struct ipa_power *ipa_power_init(struct device *dev, 56 const struct ipa_power_data *data); 57 58 /** 59 * ipa_power_exit() - Inverse of ipa_power_init() 60 * @power: IPA power pointer 61 */ 62 void ipa_power_exit(struct ipa_power *power); 63 64 #endif /* _IPA_POWER_H_ */ 65