Lines Matching refs:ar
27 struct ath11k *ar = cdev->devdata; in ath11k_thermal_get_cur_throttle_state() local
29 mutex_lock(&ar->conf_mutex); in ath11k_thermal_get_cur_throttle_state()
30 *state = ar->thermal.throttle_state; in ath11k_thermal_get_cur_throttle_state()
31 mutex_unlock(&ar->conf_mutex); in ath11k_thermal_get_cur_throttle_state()
40 struct ath11k *ar = cdev->devdata; in ath11k_thermal_set_cur_throttle_state() local
44 ath11k_warn(ar->ab, "throttle state %ld is exceeding the limit %d\n", in ath11k_thermal_set_cur_throttle_state()
48 mutex_lock(&ar->conf_mutex); in ath11k_thermal_set_cur_throttle_state()
49 ret = ath11k_thermal_set_throttling(ar, throttle_state); in ath11k_thermal_set_cur_throttle_state()
51 ar->thermal.throttle_state = throttle_state; in ath11k_thermal_set_cur_throttle_state()
52 mutex_unlock(&ar->conf_mutex); in ath11k_thermal_set_cur_throttle_state()
66 struct ath11k *ar = dev_get_drvdata(dev); in ath11k_thermal_show_temp() local
70 mutex_lock(&ar->conf_mutex); in ath11k_thermal_show_temp()
73 if (ar->state != ATH11K_STATE_ON) { in ath11k_thermal_show_temp()
78 reinit_completion(&ar->thermal.wmi_sync); in ath11k_thermal_show_temp()
79 ret = ath11k_wmi_send_pdev_temperature_cmd(ar); in ath11k_thermal_show_temp()
81 ath11k_warn(ar->ab, "failed to read temperature %d\n", ret); in ath11k_thermal_show_temp()
85 if (test_bit(ATH11K_FLAG_CRASH_FLUSH, &ar->ab->dev_flags)) { in ath11k_thermal_show_temp()
90 time_left = wait_for_completion_timeout(&ar->thermal.wmi_sync, in ath11k_thermal_show_temp()
93 ath11k_warn(ar->ab, "failed to synchronize thermal read\n"); in ath11k_thermal_show_temp()
98 spin_lock_bh(&ar->data_lock); in ath11k_thermal_show_temp()
99 temperature = ar->thermal.temperature; in ath11k_thermal_show_temp()
100 spin_unlock_bh(&ar->data_lock); in ath11k_thermal_show_temp()
105 mutex_unlock(&ar->conf_mutex); in ath11k_thermal_show_temp()
109 void ath11k_thermal_event_temperature(struct ath11k *ar, int temperature) in ath11k_thermal_event_temperature() argument
111 spin_lock_bh(&ar->data_lock); in ath11k_thermal_event_temperature()
112 ar->thermal.temperature = temperature; in ath11k_thermal_event_temperature()
113 spin_unlock_bh(&ar->data_lock); in ath11k_thermal_event_temperature()
114 complete(&ar->thermal.wmi_sync); in ath11k_thermal_event_temperature()
126 int ath11k_thermal_set_throttling(struct ath11k *ar, u32 throttle_state) in ath11k_thermal_set_throttling() argument
128 struct ath11k_base *sc = ar->ab; in ath11k_thermal_set_throttling()
132 lockdep_assert_held(&ar->conf_mutex); in ath11k_thermal_set_throttling()
134 if (ar->state != ATH11K_STATE_ON) in ath11k_thermal_set_throttling()
138 param.pdev_id = ar->pdev->pdev_id; in ath11k_thermal_set_throttling()
148 ret = ath11k_wmi_send_thermal_mitigation_param_cmd(ar, ¶m); in ath11k_thermal_set_throttling()
161 struct ath11k *ar; in ath11k_thermal_register() local
167 ar = pdev->ar; in ath11k_thermal_register()
168 if (!ar) in ath11k_thermal_register()
171 cdev = thermal_cooling_device_register("ath11k_thermal", ar, in ath11k_thermal_register()
181 ar->thermal.cdev = cdev; in ath11k_thermal_register()
183 ret = sysfs_create_link(&ar->hw->wiphy->dev.kobj, &cdev->device.kobj, in ath11k_thermal_register()
193 hwmon_dev = devm_hwmon_device_register_with_groups(&ar->hw->wiphy->dev, in ath11k_thermal_register()
194 "ath11k_hwmon", ar, in ath11k_thermal_register()
197 ath11k_err(ar->ab, "failed to register hwmon device: %ld\n", in ath11k_thermal_register()
213 struct ath11k *ar; in ath11k_thermal_unregister() local
219 ar = pdev->ar; in ath11k_thermal_unregister()
220 if (!ar) in ath11k_thermal_unregister()
223 sysfs_remove_link(&ar->hw->wiphy->dev.kobj, "cooling_device"); in ath11k_thermal_unregister()
224 thermal_cooling_device_unregister(ar->thermal.cdev); in ath11k_thermal_unregister()