1 /* SPDX-License-Identifier: ISC */
2 /*
3  * Copyright (c) 2014-2016 Qualcomm Atheros, Inc.
4  */
5 #ifndef _THERMAL_
6 #define _THERMAL_
7 
8 #define ATH10K_QUIET_PERIOD_DEFAULT     100
9 #define ATH10K_QUIET_PERIOD_MIN         25
10 #define ATH10K_QUIET_START_OFFSET       10
11 #define ATH10K_HWMON_NAME_LEN           15
12 #define ATH10K_THERMAL_SYNC_TIMEOUT_HZ (5 * HZ)
13 #define ATH10K_THERMAL_THROTTLE_MAX     100
14 
15 struct ath10k_thermal {
16 	struct thermal_cooling_device *cdev;
17 	struct completion wmi_sync;
18 
19 	/* protected by conf_mutex */
20 	u32 throttle_state;
21 	u32 quiet_period;
22 	/* temperature value in Celsius degree
23 	 * protected by data_lock
24 	 */
25 	int temperature;
26 };
27 
28 #if IS_REACHABLE(CONFIG_THERMAL)
29 int ath10k_thermal_register(struct ath10k *ar);
30 void ath10k_thermal_unregister(struct ath10k *ar);
31 void ath10k_thermal_event_temperature(struct ath10k *ar, int temperature);
32 void ath10k_thermal_set_throttling(struct ath10k *ar);
33 #else
ath10k_thermal_register(struct ath10k * ar)34 static inline int ath10k_thermal_register(struct ath10k *ar)
35 {
36 	return 0;
37 }
38 
ath10k_thermal_unregister(struct ath10k * ar)39 static inline void ath10k_thermal_unregister(struct ath10k *ar)
40 {
41 }
42 
ath10k_thermal_event_temperature(struct ath10k * ar,int temperature)43 static inline void ath10k_thermal_event_temperature(struct ath10k *ar,
44 						    int temperature)
45 {
46 }
47 
ath10k_thermal_set_throttling(struct ath10k * ar)48 static inline void ath10k_thermal_set_throttling(struct ath10k *ar)
49 {
50 }
51 
52 #endif
53 #endif /* _THERMAL_ */
54