blob: 3abb97f63b1edf6ef72b34bc0f684f1fcb996eb0 [file] [log] [blame]
Rajkumar Manoharanfe6f36d2014-12-17 12:22:07 +02001/*
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
Rajkumar Manoharanac2953f2014-12-17 12:22:26 +020022#define ATH10K_HWMON_NAME_LEN 15
Kalle Valo14e105c2016-04-13 14:13:21 +030023#define ATH10K_THERMAL_SYNC_TIMEOUT_HZ (5 * HZ)
Rajkumar Manoharan972f0512015-03-15 20:36:21 +053024#define ATH10K_THERMAL_THROTTLE_MAX 100
Rajkumar Manoharanfe6f36d2014-12-17 12:22:07 +020025
26struct ath10k_thermal {
27 struct thermal_cooling_device *cdev;
Rajkumar Manoharanac2953f2014-12-17 12:22:26 +020028 struct completion wmi_sync;
Rajkumar Manoharanfe6f36d2014-12-17 12:22:07 +020029
30 /* protected by conf_mutex */
Rajkumar Manoharan972f0512015-03-15 20:36:21 +053031 u32 throttle_state;
Rajkumar Manoharan63fb32d2015-03-15 20:36:20 +053032 u32 quiet_period;
Rajkumar Manoharanac2953f2014-12-17 12:22:26 +020033 /* temperature value in Celcius degree
34 * protected by data_lock
35 */
36 int temperature;
Rajkumar Manoharanfe6f36d2014-12-17 12:22:07 +020037};
38
Michal Marekde5315c2015-11-26 14:48:54 +010039#if IS_REACHABLE(CONFIG_THERMAL)
Rajkumar Manoharanfe6f36d2014-12-17 12:22:07 +020040int ath10k_thermal_register(struct ath10k *ar);
41void ath10k_thermal_unregister(struct ath10k *ar);
Rajkumar Manoharanac2953f2014-12-17 12:22:26 +020042void ath10k_thermal_event_temperature(struct ath10k *ar, int temperature);
Rajkumar Manoharan8515b5c2015-03-15 20:36:22 +053043void ath10k_thermal_set_throttling(struct ath10k *ar);
Rajkumar Manoharanfe6f36d2014-12-17 12:22:07 +020044#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}
Rajkumar Manoharanac2953f2014-12-17 12:22:26 +020053
54static inline void ath10k_thermal_event_temperature(struct ath10k *ar,
55 int temperature)
56{
57}
58
Rajkumar Manoharan8515b5c2015-03-15 20:36:22 +053059static inline void ath10k_thermal_set_throttling(struct ath10k *ar)
60{
61}
62
Rajkumar Manoharanfe6f36d2014-12-17 12:22:07 +020063#endif
64#endif /* _THERMAL_ */