drivers/net/wireless/ath/ath12k/thermal.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath12k/thermal.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath12k/thermal.c- Extension
.c- Size
- 7801 bytes
- Lines
- 305
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hlinux/hwmon.hlinux/hwmon-sysfs.hlinux/sysfs.hlinux/thermal.hcore.hdebug.h
Detected Declarations
function ath12k_thermal_cfg_indexfunction ath12k_thermal_throttling_config_defaultfunction ath12k_thermal_init_configsfunction ath12k_thermal_get_max_throttle_statefunction ath12k_thermal_get_cur_throttle_statefunction ath12k_thermal_set_throttlingfunction ath12k_thermal_set_cur_throttle_statefunction scoped_guardfunction ath12k_thermal_temp_showfunction ath12k_thermal_event_temperaturefunction ath12k_thermal_setup_radiofunction ath12k_thermal_cleanup_radiofunction ath12k_thermal_registerfunction ath12k_thermal_unregister
Annotated Snippet
// SPDX-License-Identifier: BSD-3-Clause-Clear
/*
* Copyright (c) 2020 The Linux Foundation. All rights reserved.
* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
*/
#include <linux/device.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/sysfs.h>
#include <linux/thermal.h>
#include "core.h"
#include "debug.h"
static const struct ath12k_wmi_tt_level_config_param
tt_level_configs[ATH12K_TT_CFG_IDX_MAX][ENHANCED_THERMAL_LEVELS] = {
[ATH12K_TT_CFG_IDX_IPA] = {
[0] = { .tmplwm = -100, .tmphwm = 115, .dcoffpercent = 0,
.pout_reduction_db = 0 },
[1] = { .tmplwm = 110, .tmphwm = 120, .dcoffpercent = 0,
.pout_reduction_db = 12 },
[2] = { .tmplwm = 115, .tmphwm = 125, .dcoffpercent = 50,
.pout_reduction_db = 12 },
[3] = { .tmplwm = 120, .tmphwm = 130, .dcoffpercent = 90,
.pout_reduction_db = 12 },
[4] = { .tmplwm = 125, .tmphwm = 130, .dcoffpercent = 100,
.pout_reduction_db = 12 },
},
[ATH12K_TT_CFG_IDX_XFEM] = {
[0] = { .tmplwm = -100, .tmphwm = 105, .dcoffpercent = 0,
.pout_reduction_db = 0 },
[1] = { .tmplwm = 100, .tmphwm = 110, .dcoffpercent = 0,
.pout_reduction_db = 0 },
[2] = { .tmplwm = 105, .tmphwm = 115, .dcoffpercent = 50,
.pout_reduction_db = 0 },
[3] = { .tmplwm = 110, .tmphwm = 120, .dcoffpercent = 90,
.pout_reduction_db = 0 },
[4] = { .tmplwm = 115, .tmphwm = 120, .dcoffpercent = 100,
.pout_reduction_db = 0 },
},
};
static enum ath12k_thermal_cfg_idx ath12k_thermal_cfg_index(struct ath12k *ar)
{
if (test_bit(WMI_TLV_SERVICE_IS_TARGET_IPA, ar->ab->wmi_ab.svc_map))
return ATH12K_TT_CFG_IDX_IPA;
return ATH12K_TT_CFG_IDX_XFEM;
}
int ath12k_thermal_throttling_config_default(struct ath12k *ar)
{
struct ath12k_wmi_thermal_mitigation_arg param = {};
int ret;
if (test_bit(WMI_TLV_SERVICE_THERM_THROT_5_LEVELS, ar->ab->wmi_ab.svc_map))
param.num_levels = ENHANCED_THERMAL_LEVELS;
else
param.num_levels = THERMAL_LEVELS;
param.levelconf = ar->thermal.tt_level_configs;
ret = ath12k_wmi_send_thermal_mitigation_cmd(ar, ¶m);
if (ret)
ath12k_warn(ar->ab,
"failed to send thermal mitigation cmd for default config: %d\n",
ret);
return ret;
}
void ath12k_thermal_init_configs(struct ath12k *ar)
{
enum ath12k_thermal_cfg_idx cfg_idx;
cfg_idx = ath12k_thermal_cfg_index(ar);
ar->thermal.tt_level_configs = &tt_level_configs[cfg_idx][0];
}
static int
ath12k_thermal_get_max_throttle_state(struct thermal_cooling_device *cdev,
unsigned long *state)
{
*state = ATH12K_THERMAL_THROTTLE_MAX;
return 0;
}
static int
ath12k_thermal_get_cur_throttle_state(struct thermal_cooling_device *cdev,
unsigned long *state)
Annotation
- Immediate include surface: `linux/device.h`, `linux/hwmon.h`, `linux/hwmon-sysfs.h`, `linux/sysfs.h`, `linux/thermal.h`, `core.h`, `debug.h`.
- Detected declarations: `function ath12k_thermal_cfg_index`, `function ath12k_thermal_throttling_config_default`, `function ath12k_thermal_init_configs`, `function ath12k_thermal_get_max_throttle_state`, `function ath12k_thermal_get_cur_throttle_state`, `function ath12k_thermal_set_throttling`, `function ath12k_thermal_set_cur_throttle_state`, `function scoped_guard`, `function ath12k_thermal_temp_show`, `function ath12k_thermal_event_temperature`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.