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