Linux Audio

Check our new training course

Loading...
v6.8
 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
15struct 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)
29int ath10k_thermal_register(struct ath10k *ar);
30void ath10k_thermal_unregister(struct ath10k *ar);
31void ath10k_thermal_event_temperature(struct ath10k *ar, int temperature);
32void ath10k_thermal_set_throttling(struct ath10k *ar);
33#else
34static inline int ath10k_thermal_register(struct ath10k *ar)
35{
36	return 0;
37}
38
39static inline void ath10k_thermal_unregister(struct ath10k *ar)
40{
41}
42
43static inline void ath10k_thermal_event_temperature(struct ath10k *ar,
44						    int temperature)
45{
46}
47
48static inline void ath10k_thermal_set_throttling(struct ath10k *ar)
49{
50}
51
52#endif
53#endif /* _THERMAL_ */
v4.6
 
 1/*
 2 * Copyright (c) 2014 Qualcomm Atheros, Inc.
 3 *
 4 * Permission to use, copy, modify, and/or distribute this software for any
 5 * purpose with or without fee is hereby granted, provided that the above
 6 * copyright notice and this permission notice appear in all copies.
 7 *
 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16#ifndef _THERMAL_
17#define _THERMAL_
18
19#define ATH10K_QUIET_PERIOD_DEFAULT     100
20#define ATH10K_QUIET_PERIOD_MIN         25
21#define ATH10K_QUIET_START_OFFSET       10
22#define ATH10K_HWMON_NAME_LEN           15
23#define ATH10K_THERMAL_SYNC_TIMEOUT_HZ (5*HZ)
24#define ATH10K_THERMAL_THROTTLE_MAX     100
25
26struct ath10k_thermal {
27	struct thermal_cooling_device *cdev;
28	struct completion wmi_sync;
29
30	/* protected by conf_mutex */
31	u32 throttle_state;
32	u32 quiet_period;
33	/* temperature value in Celcius degree
34	 * protected by data_lock
35	 */
36	int temperature;
37};
38
39#if IS_REACHABLE(CONFIG_THERMAL)
40int ath10k_thermal_register(struct ath10k *ar);
41void ath10k_thermal_unregister(struct ath10k *ar);
42void ath10k_thermal_event_temperature(struct ath10k *ar, int temperature);
43void ath10k_thermal_set_throttling(struct ath10k *ar);
44#else
45static inline int ath10k_thermal_register(struct ath10k *ar)
46{
47	return 0;
48}
49
50static inline void ath10k_thermal_unregister(struct ath10k *ar)
51{
52}
53
54static inline void ath10k_thermal_event_temperature(struct ath10k *ar,
55						    int temperature)
56{
57}
58
59static inline void ath10k_thermal_set_throttling(struct ath10k *ar)
60{
61}
62
63#endif
64#endif /* _THERMAL_ */