blob: 2151805d7fbb0fa40dec0a0984827fb152a6d6f1 [file] [log] [blame]
Alex Elderba764c42020-03-05 22:28:19 -06001/* 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 */
Alex Elder2775cbc2021-08-20 11:01:29 -05006#ifndef _IPA_POWER_H_
7#define _IPA_POWER_H_
Alex Elderba764c42020-03-05 22:28:19 -06008
9struct device;
10
11struct ipa;
Alex Elder7aa0e8b2021-08-20 11:01:28 -050012struct ipa_power_data;
Alex Elderba764c42020-03-05 22:28:19 -060013
Alex Elder73ff3162021-08-04 10:36:24 -050014/* IPA device power management function block */
15extern const struct dev_pm_ops ipa_pm_ops;
16
Alex Elderba764c42020-03-05 22:28:19 -060017/**
Alex Elder7aa0e8b2021-08-20 11:01:28 -050018 * ipa_core_clock_rate() - Return the current IPA core clock rate
Alex Elder78b348f2020-07-03 16:23:34 -050019 * @ipa: IPA structure
20 *
21 * Return: The current clock rate (in Hz), or 0.
22 */
Alex Elder7aa0e8b2021-08-20 11:01:28 -050023u32 ipa_core_clock_rate(struct ipa *ipa);
Alex Elder78b348f2020-07-03 16:23:34 -050024
25/**
Alex Elderb8e36e12021-08-19 16:12:28 -050026 * ipa_power_modem_queue_stop() - Possibly stop the modem netdev TX queue
27 * @ipa: IPA pointer
28 */
29void 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 */
35void 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 */
41void ipa_power_modem_queue_active(struct ipa *ipa);
42
43/**
Alex Elderafe1baa2021-08-04 10:36:25 -050044 * ipa_power_setup() - Set up IPA power management
45 * @ipa: IPA pointer
Alex Elderd430fe42021-08-12 14:50:30 -050046 *
47 * Return: 0 if successful, or a negative error code
Alex Elderafe1baa2021-08-04 10:36:25 -050048 */
Alex Elderd430fe42021-08-12 14:50:30 -050049int ipa_power_setup(struct ipa *ipa);
Alex Elderafe1baa2021-08-04 10:36:25 -050050
51/**
52 * ipa_power_teardown() - Inverse of ipa_power_setup()
53 * @ipa: IPA pointer
54 */
55void ipa_power_teardown(struct ipa *ipa);
56
57/**
Alex Elder7aa0e8b2021-08-20 11:01:28 -050058 * ipa_power_init() - Initialize IPA power management
Alex Elderba764c42020-03-05 22:28:19 -060059 * @dev: IPA device
Alex Elderdfccb8b2020-11-19 16:40:39 -060060 * @data: Clock configuration data
Alex Elderba764c42020-03-05 22:28:19 -060061 *
Alex Elder7aa0e8b2021-08-20 11:01:28 -050062 * Return: A pointer to an ipa_power structure, or a pointer-coded error
Alex Elderba764c42020-03-05 22:28:19 -060063 */
Alex Elder7aa0e8b2021-08-20 11:01:28 -050064struct ipa_power *ipa_power_init(struct device *dev,
65 const struct ipa_power_data *data);
Alex Elderba764c42020-03-05 22:28:19 -060066
67/**
Alex Elder7aa0e8b2021-08-20 11:01:28 -050068 * ipa_power_exit() - Inverse of ipa_power_init()
69 * @power: IPA power pointer
Alex Elderba764c42020-03-05 22:28:19 -060070 */
Alex Elder7aa0e8b2021-08-20 11:01:28 -050071void ipa_power_exit(struct ipa_power *power);
Alex Elderba764c42020-03-05 22:28:19 -060072
Alex Elder2775cbc2021-08-20 11:01:29 -050073#endif /* _IPA_POWER_H_ */