drivers/net/wireless/intel/iwlwifi/mld/thermal.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/iwlwifi/mld/thermal.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/intel/iwlwifi/mld/thermal.c- Extension
.c- Size
- 10950 bytes
- Lines
- 468
- 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/sort.hlinux/thermal.hfw/api/phy.hthermal.hmld.hhcmd.h
Detected Declarations
struct iwl_trip_walk_datafunction Copyrightfunction iwl_mld_exit_ctkillfunction iwl_mld_handle_temp_notiffunction iwl_mld_get_tempfunction compare_tempsfunction iwl_trip_temp_iterfunction iwl_mld_config_temp_report_thsfunction iwl_mld_tzone_get_tempfunction iwl_mld_tzone_set_trip_tempfunction iwl_mld_thermal_zone_registerfunction iwl_mld_config_ctdpfunction iwl_mld_tcool_get_max_statefunction iwl_mld_tcool_get_cur_statefunction iwl_mld_tcool_set_cur_statefunction iwl_mld_cooling_device_registerfunction iwl_mld_thermal_zone_unregisterfunction iwl_mld_cooling_device_unregisterfunction iwl_mld_ctdp_get_max_budgetfunction iwl_mld_thermal_initializefunction iwl_mld_thermal_exit
Annotated Snippet
struct iwl_trip_walk_data {
__le16 *thresholds;
int count;
};
static int iwl_trip_temp_iter(struct thermal_trip *trip, void *arg)
{
struct iwl_trip_walk_data *twd = arg;
if (trip->temperature == THERMAL_TEMP_INVALID)
return 0;
twd->thresholds[twd->count++] =
cpu_to_le16((s16)(trip->temperature / 1000));
return 0;
}
#endif
int iwl_mld_config_temp_report_ths(struct iwl_mld *mld)
{
struct temp_report_ths_cmd cmd = {0};
int ret;
#ifdef CONFIG_THERMAL
struct iwl_trip_walk_data twd = {
.thresholds = cmd.thresholds,
.count = 0
};
if (!mld->tzone)
goto send;
/* The thermal core holds an array of temperature trips that are
* unsorted and uncompressed, the FW should get it compressed and
* sorted.
*/
/* compress trips to cmd array, remove uninitialized values*/
for_each_thermal_trip(mld->tzone, iwl_trip_temp_iter, &twd);
cmd.num_temps = cpu_to_le32(twd.count);
if (twd.count)
sort(cmd.thresholds, twd.count, sizeof(s16),
compare_temps, NULL);
send:
#endif
lockdep_assert_wiphy(mld->wiphy);
ret = iwl_mld_send_cmd_pdu(mld, WIDE_ID(PHY_OPS_GROUP,
TEMP_REPORTING_THRESHOLDS_CMD),
&cmd);
if (ret)
IWL_ERR(mld, "TEMP_REPORT_THS_CMD command failed (err=%d)\n",
ret);
return ret;
}
#ifdef CONFIG_THERMAL
static int iwl_mld_tzone_get_temp(struct thermal_zone_device *device,
int *temperature)
{
struct iwl_mld *mld = thermal_zone_device_priv(device);
int temp;
int ret = 0;
wiphy_lock(mld->wiphy);
if (!mld->fw_status.running) {
/* Tell the core that there is no valid temperature value to
* return, but it need not worry about this.
*/
*temperature = THERMAL_TEMP_INVALID;
goto unlock;
}
ret = iwl_mld_get_temp(mld, &temp);
if (ret)
goto unlock;
*temperature = temp * 1000;
unlock:
wiphy_unlock(mld->wiphy);
return ret;
}
static int iwl_mld_tzone_set_trip_temp(struct thermal_zone_device *device,
const struct thermal_trip *trip,
int temp)
{
Annotation
- Immediate include surface: `linux/sort.h`, `linux/thermal.h`, `fw/api/phy.h`, `thermal.h`, `mld.h`, `hcmd.h`.
- Detected declarations: `struct iwl_trip_walk_data`, `function Copyright`, `function iwl_mld_exit_ctkill`, `function iwl_mld_handle_temp_notif`, `function iwl_mld_get_temp`, `function compare_temps`, `function iwl_trip_temp_iter`, `function iwl_mld_config_temp_report_ths`, `function iwl_mld_tzone_get_temp`, `function iwl_mld_tzone_set_trip_temp`.
- 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.