Lines Matching refs:ar
26 static int ath10k_thermal_get_active_vifs(struct ath10k *ar, in ath10k_thermal_get_active_vifs() argument
32 lockdep_assert_held(&ar->conf_mutex); in ath10k_thermal_get_active_vifs()
34 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_thermal_get_active_vifs()
60 struct ath10k *ar = cdev->devdata; in ath10k_thermal_get_cur_dutycycle() local
62 mutex_lock(&ar->conf_mutex); in ath10k_thermal_get_cur_dutycycle()
63 *state = ar->thermal.duty_cycle; in ath10k_thermal_get_cur_dutycycle()
64 mutex_unlock(&ar->conf_mutex); in ath10k_thermal_get_cur_dutycycle()
72 struct ath10k *ar = cdev->devdata; in ath10k_thermal_set_cur_dutycycle() local
76 mutex_lock(&ar->conf_mutex); in ath10k_thermal_set_cur_dutycycle()
77 if (ar->state != ATH10K_STATE_ON) { in ath10k_thermal_set_cur_dutycycle()
83 ath10k_warn(ar, "duty cycle %ld is exceeding the limit %d\n", in ath10k_thermal_set_cur_dutycycle()
93 num_bss = ath10k_thermal_get_active_vifs(ar, WMI_VDEV_TYPE_AP); in ath10k_thermal_set_cur_dutycycle()
95 ath10k_warn(ar, "no active AP interfaces\n"); in ath10k_thermal_set_cur_dutycycle()
104 ret = ath10k_wmi_pdev_set_quiet_mode(ar, period, duration, in ath10k_thermal_set_cur_dutycycle()
108 ath10k_warn(ar, "failed to set quiet mode period %u duarion %u enabled %u ret %d\n", in ath10k_thermal_set_cur_dutycycle()
112 ar->thermal.duty_cycle = duty_cycle; in ath10k_thermal_set_cur_dutycycle()
114 mutex_unlock(&ar->conf_mutex); in ath10k_thermal_set_cur_dutycycle()
128 struct ath10k *ar = dev_get_drvdata(dev); in ath10k_thermal_show_temp() local
131 mutex_lock(&ar->conf_mutex); in ath10k_thermal_show_temp()
134 if (ar->state != ATH10K_STATE_ON) { in ath10k_thermal_show_temp()
139 reinit_completion(&ar->thermal.wmi_sync); in ath10k_thermal_show_temp()
140 ret = ath10k_wmi_pdev_get_temperature(ar); in ath10k_thermal_show_temp()
142 ath10k_warn(ar, "failed to read temperature %d\n", ret); in ath10k_thermal_show_temp()
146 if (test_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags)) { in ath10k_thermal_show_temp()
151 ret = wait_for_completion_timeout(&ar->thermal.wmi_sync, in ath10k_thermal_show_temp()
154 ath10k_warn(ar, "failed to synchronize thermal read\n"); in ath10k_thermal_show_temp()
159 spin_lock_bh(&ar->data_lock); in ath10k_thermal_show_temp()
160 temperature = ar->thermal.temperature; in ath10k_thermal_show_temp()
161 spin_unlock_bh(&ar->data_lock); in ath10k_thermal_show_temp()
166 mutex_unlock(&ar->conf_mutex); in ath10k_thermal_show_temp()
170 void ath10k_thermal_event_temperature(struct ath10k *ar, int temperature) in ath10k_thermal_event_temperature() argument
172 spin_lock_bh(&ar->data_lock); in ath10k_thermal_event_temperature()
173 ar->thermal.temperature = temperature; in ath10k_thermal_event_temperature()
174 spin_unlock_bh(&ar->data_lock); in ath10k_thermal_event_temperature()
175 complete(&ar->thermal.wmi_sync); in ath10k_thermal_event_temperature()
187 int ath10k_thermal_register(struct ath10k *ar) in ath10k_thermal_register() argument
193 cdev = thermal_cooling_device_register("ath10k_thermal", ar, in ath10k_thermal_register()
197 ath10k_err(ar, "failed to setup thermal device result: %ld\n", in ath10k_thermal_register()
202 ret = sysfs_create_link(&ar->dev->kobj, &cdev->device.kobj, in ath10k_thermal_register()
205 ath10k_err(ar, "failed to create thermal symlink\n"); in ath10k_thermal_register()
209 ar->thermal.cdev = cdev; in ath10k_thermal_register()
214 if (ar->wmi.op_version != ATH10K_FW_WMI_OP_VERSION_10_2_4) in ath10k_thermal_register()
222 hwmon_dev = devm_hwmon_device_register_with_groups(ar->dev, in ath10k_thermal_register()
223 "ath10k_hwmon", ar, in ath10k_thermal_register()
226 ath10k_err(ar, "failed to register hwmon device: %ld\n", in ath10k_thermal_register()
234 sysfs_remove_link(&ar->dev->kobj, "thermal_sensor"); in ath10k_thermal_register()
240 void ath10k_thermal_unregister(struct ath10k *ar) in ath10k_thermal_unregister() argument
242 thermal_cooling_device_unregister(ar->thermal.cdev); in ath10k_thermal_unregister()
243 sysfs_remove_link(&ar->dev->kobj, "cooling_device"); in ath10k_thermal_unregister()