18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: ISC */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2014-2016 Qualcomm Atheros, Inc.
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci#ifndef _THERMAL_
68c2ecf20Sopenharmony_ci#define _THERMAL_
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#define ATH10K_QUIET_PERIOD_DEFAULT     100
98c2ecf20Sopenharmony_ci#define ATH10K_QUIET_PERIOD_MIN         25
108c2ecf20Sopenharmony_ci#define ATH10K_QUIET_START_OFFSET       10
118c2ecf20Sopenharmony_ci#define ATH10K_HWMON_NAME_LEN           15
128c2ecf20Sopenharmony_ci#define ATH10K_THERMAL_SYNC_TIMEOUT_HZ (5 * HZ)
138c2ecf20Sopenharmony_ci#define ATH10K_THERMAL_THROTTLE_MAX     100
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_cistruct ath10k_thermal {
168c2ecf20Sopenharmony_ci	struct thermal_cooling_device *cdev;
178c2ecf20Sopenharmony_ci	struct completion wmi_sync;
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci	/* protected by conf_mutex */
208c2ecf20Sopenharmony_ci	u32 throttle_state;
218c2ecf20Sopenharmony_ci	u32 quiet_period;
228c2ecf20Sopenharmony_ci	/* temperature value in Celcius degree
238c2ecf20Sopenharmony_ci	 * protected by data_lock
248c2ecf20Sopenharmony_ci	 */
258c2ecf20Sopenharmony_ci	int temperature;
268c2ecf20Sopenharmony_ci};
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#if IS_REACHABLE(CONFIG_THERMAL)
298c2ecf20Sopenharmony_ciint ath10k_thermal_register(struct ath10k *ar);
308c2ecf20Sopenharmony_civoid ath10k_thermal_unregister(struct ath10k *ar);
318c2ecf20Sopenharmony_civoid ath10k_thermal_event_temperature(struct ath10k *ar, int temperature);
328c2ecf20Sopenharmony_civoid ath10k_thermal_set_throttling(struct ath10k *ar);
338c2ecf20Sopenharmony_ci#else
348c2ecf20Sopenharmony_cistatic inline int ath10k_thermal_register(struct ath10k *ar)
358c2ecf20Sopenharmony_ci{
368c2ecf20Sopenharmony_ci	return 0;
378c2ecf20Sopenharmony_ci}
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_cistatic inline void ath10k_thermal_unregister(struct ath10k *ar)
408c2ecf20Sopenharmony_ci{
418c2ecf20Sopenharmony_ci}
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_cistatic inline void ath10k_thermal_event_temperature(struct ath10k *ar,
448c2ecf20Sopenharmony_ci						    int temperature)
458c2ecf20Sopenharmony_ci{
468c2ecf20Sopenharmony_ci}
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_cistatic inline void ath10k_thermal_set_throttling(struct ath10k *ar)
498c2ecf20Sopenharmony_ci{
508c2ecf20Sopenharmony_ci}
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci#endif
538c2ecf20Sopenharmony_ci#endif /* _THERMAL_ */
54