Lines Matching +full:cooling +full:- +full:device
1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
3 * Copyright (C) 2024-2025 Intel Corporation
21 const struct ct_kill_notif *notif = (const void *)pkt->data; in iwl_mld_handle_ct_kill_notif()
24 "CT Kill notification: temp = %d, DTS = 0x%x, Scheme 0x%x - Enter CT Kill\n", in iwl_mld_handle_ct_kill_notif()
25 le16_to_cpu(notif->temperature), notif->dts, in iwl_mld_handle_ct_kill_notif()
26 notif->scheme); in iwl_mld_handle_ct_kill_notif()
30 wiphy_delayed_work_queue(mld->wiphy, &mld->ct_kill_exit_wk, in iwl_mld_handle_ct_kill_notif()
47 (const void *)pkt->data; in iwl_mld_handle_temp_notif()
51 temp = le32_to_cpu(notif->temp); in iwl_mld_handle_temp_notif()
57 ths_crossed = le32_to_cpu(notif->threshold_idx); in iwl_mld_handle_temp_notif()
73 if (mld->tzone) in iwl_mld_handle_temp_notif()
74 thermal_zone_device_update(mld->tzone, THERMAL_TRIP_VIOLATED); in iwl_mld_handle_temp_notif()
88 lockdep_assert_wiphy(mld->wiphy); in iwl_mld_get_temp()
101 ret = -EIO; in iwl_mld_get_temp()
105 resp = (const void *)cmd.resp_pkt->data; in iwl_mld_get_temp()
106 *temp = le32_to_cpu(resp->temp); in iwl_mld_get_temp()
119 return ((s16)le16_to_cpu(*(__le16 *)a) - in compare_temps()
132 if (trip->temperature == THERMAL_TEMP_INVALID) in iwl_trip_temp_iter()
135 twd->thresholds[twd->count++] = in iwl_trip_temp_iter()
136 cpu_to_le16((s16)(trip->temperature / 1000)); in iwl_trip_temp_iter()
151 if (!mld->tzone) in iwl_mld_config_temp_report_ths()
160 for_each_thermal_trip(mld->tzone, iwl_trip_temp_iter, &twd); in iwl_mld_config_temp_report_ths()
169 lockdep_assert_wiphy(mld->wiphy); in iwl_mld_config_temp_report_ths()
182 static int iwl_mld_tzone_get_temp(struct thermal_zone_device *device, in iwl_mld_tzone_get_temp() argument
185 struct iwl_mld *mld = thermal_zone_device_priv(device); in iwl_mld_tzone_get_temp()
189 wiphy_lock(mld->wiphy); in iwl_mld_tzone_get_temp()
191 if (!mld->fw_status.running) { in iwl_mld_tzone_get_temp()
205 wiphy_unlock(mld->wiphy); in iwl_mld_tzone_get_temp()
209 static int iwl_mld_tzone_set_trip_temp(struct thermal_zone_device *device, in iwl_mld_tzone_set_trip_temp() argument
213 struct iwl_mld *mld = thermal_zone_device_priv(device); in iwl_mld_tzone_set_trip_temp()
216 wiphy_lock(mld->wiphy); in iwl_mld_tzone_set_trip_temp()
218 if (!mld->fw_status.running) { in iwl_mld_tzone_set_trip_temp()
219 ret = -EIO; in iwl_mld_tzone_set_trip_temp()
224 ret = -EINVAL; in iwl_mld_tzone_set_trip_temp()
230 wiphy_unlock(mld->wiphy); in iwl_mld_tzone_set_trip_temp()
245 [0 ... IWL_MAX_DTS_TRIPS - 1] = { in iwl_mld_thermal_zone_register()
255 mld->tzone = in iwl_mld_thermal_zone_register()
260 if (IS_ERR(mld->tzone)) { in iwl_mld_thermal_zone_register()
263 PTR_ERR(mld->tzone)); in iwl_mld_thermal_zone_register()
264 mld->tzone = NULL; in iwl_mld_thermal_zone_register()
268 ret = thermal_zone_device_enable(mld->tzone); in iwl_mld_thermal_zone_register()
271 thermal_zone_device_unregister(mld->tzone); in iwl_mld_thermal_zone_register()
277 2400, /* cooling state 0 */
278 2000, /* cooling state 1 */
279 1800, /* cooling state 2 */
280 1600, /* cooling state 3 */
281 1400, /* cooling state 4 */
282 1200, /* cooling state 5 */
283 1000, /* cooling state 6 */
284 900, /* cooling state 7 */
285 800, /* cooling state 8 */
286 700, /* cooling state 9 */
287 650, /* cooling state 10 */
288 600, /* cooling state 11 */
289 550, /* cooling state 12 */
290 500, /* cooling state 13 */
291 450, /* cooling state 14 */
292 400, /* cooling state 15 */
293 350, /* cooling state 16 */
294 300, /* cooling state 17 */
295 250, /* cooling state 18 */
296 200, /* cooling state 19 */
297 150, /* cooling state 20 */
310 lockdep_assert_wiphy(mld->wiphy); in iwl_mld_config_ctdp()
321 mld->cooling_dev.cur_state = state; in iwl_mld_config_ctdp()
329 *state = ARRAY_SIZE(iwl_mld_cdev_budgets) - 1; in iwl_mld_tcool_get_max_state()
337 struct iwl_mld *mld = (struct iwl_mld *)(cdev->devdata); in iwl_mld_tcool_get_cur_state()
339 *state = mld->cooling_dev.cur_state; in iwl_mld_tcool_get_cur_state()
347 struct iwl_mld *mld = (struct iwl_mld *)(cdev->devdata); in iwl_mld_tcool_set_cur_state()
350 wiphy_lock(mld->wiphy); in iwl_mld_tcool_set_cur_state()
352 if (!mld->fw_status.running) { in iwl_mld_tcool_set_cur_state()
353 ret = -EIO; in iwl_mld_tcool_set_cur_state()
358 ret = -EINVAL; in iwl_mld_tcool_set_cur_state()
365 wiphy_unlock(mld->wiphy); in iwl_mld_tcool_set_cur_state()
381 mld->cooling_dev.cdev = in iwl_mld_cooling_device_register()
386 if (IS_ERR(mld->cooling_dev.cdev)) { in iwl_mld_cooling_device_register()
388 "Failed to register to cooling device (err = %ld)\n", in iwl_mld_cooling_device_register()
389 PTR_ERR(mld->cooling_dev.cdev)); in iwl_mld_cooling_device_register()
390 mld->cooling_dev.cdev = NULL; in iwl_mld_cooling_device_register()
397 if (!mld->tzone) in iwl_mld_thermal_zone_unregister()
400 IWL_DEBUG_TEMP(mld, "Thermal zone device unregister\n"); in iwl_mld_thermal_zone_unregister()
401 if (mld->tzone) { in iwl_mld_thermal_zone_unregister()
402 thermal_zone_device_unregister(mld->tzone); in iwl_mld_thermal_zone_unregister()
403 mld->tzone = NULL; in iwl_mld_thermal_zone_unregister()
409 if (!mld->cooling_dev.cdev) in iwl_mld_cooling_device_unregister()
412 IWL_DEBUG_TEMP(mld, "Cooling device unregister\n"); in iwl_mld_cooling_device_unregister()
413 if (mld->cooling_dev.cdev) { in iwl_mld_cooling_device_unregister()
414 thermal_cooling_device_unregister(mld->cooling_dev.cdev); in iwl_mld_cooling_device_unregister()
415 mld->cooling_dev.cdev = NULL; in iwl_mld_cooling_device_unregister()
422 wiphy_delayed_work_init(&mld->ct_kill_exit_wk, iwl_mld_exit_ctkill); in iwl_mld_thermal_initialize()
432 wiphy_delayed_work_cancel(mld->wiphy, &mld->ct_kill_exit_wk); in iwl_mld_thermal_exit()