1107120Sjulian/* SPDX-License-Identifier: BSD-3-Clause-Clear */
2107120Sjulian/*
3107120Sjulian * Copyright (c) 2020 The Linux Foundation. All rights reserved.
4107120Sjulian * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
5107120Sjulian */
6107120Sjulian
7107120Sjulian#ifndef _ATH11K_THERMAL_
8107120Sjulian#define _ATH11K_THERMAL_
9107120Sjulian
10107120Sjulian#define ATH11K_THERMAL_TEMP_LOW_MARK -100
11107120Sjulian#define ATH11K_THERMAL_TEMP_HIGH_MARK 150
12107120Sjulian#define ATH11K_THERMAL_THROTTLE_MAX     100
13107120Sjulian#define ATH11K_THERMAL_DEFAULT_DUTY_CYCLE 100
14107120Sjulian#define ATH11K_HWMON_NAME_LEN           15
15107120Sjulian#define ATH11K_THERMAL_SYNC_TIMEOUT_HZ (5 * HZ)
16107120Sjulian
17107120Sjulianstruct ath11k_thermal {
18107120Sjulian	struct thermal_cooling_device *cdev;
19107120Sjulian	struct completion wmi_sync;
20107120Sjulian
21107120Sjulian	/* protected by conf_mutex */
22107120Sjulian	u32 throttle_state;
23107120Sjulian	/* temperature value in Celsius degree
24107120Sjulian	 * protected by data_lock
25107120Sjulian	 */
26107120Sjulian	int temperature;
27107120Sjulian};
28121054Semax
29107120Sjulian#if IS_REACHABLE(CONFIG_THERMAL)
30107120Sjulianint ath11k_thermal_register(struct ath11k_base *ab);
31107120Sjulianvoid ath11k_thermal_unregister(struct ath11k_base *ab);
32121054Semaxint ath11k_thermal_set_throttling(struct ath11k *ar, u32 throttle_state);
33107120Sjulianvoid ath11k_thermal_event_temperature(struct ath11k *ar, int temperature);
34107120Sjulian#else
35107120Sjulianstatic inline int ath11k_thermal_register(struct ath11k_base *ab)
36107120Sjulian{
37107120Sjulian	return 0;
38107120Sjulian}
39107120Sjulian
40107120Sjulianstatic inline void ath11k_thermal_unregister(struct ath11k_base *ab)
41107120Sjulian{
42107120Sjulian}
43107120Sjulian
44107120Sjulianstatic inline int ath11k_thermal_set_throttling(struct ath11k *ar, u32 throttle_state)
45107120Sjulian{
46107120Sjulian	return 0;
47107120Sjulian}
48107120Sjulian
49107120Sjulianstatic inline void ath11k_thermal_event_temperature(struct ath11k *ar,
50107120Sjulian						    int temperature)
51107120Sjulian{
52107120Sjulian}
53107120Sjulian
54107120Sjulian#endif
55107120Sjulian#endif /* _ATH11K_THERMAL_ */
56107120Sjulian