drivers/net/wireless/intel/iwlwifi/mvm/tt.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/intel/iwlwifi/mvm/tt.c- Extension
.c- Size
- 22230 bytes
- Lines
- 865
- 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.hmvm.h
Detected Declarations
struct iwl_trip_walk_datafunction Copyrightfunction iwl_mvm_exit_ctkillfunction iwl_mvm_tt_temp_changedfunction iwl_mvm_temp_notif_parsefunction iwl_mvm_temp_notif_waitfunction iwl_mvm_temp_notiffunction iwl_mvm_ct_kill_notiffunction iwl_mvm_send_temp_cmdfunction iwl_mvm_get_tempfunction check_exit_ctkillfunction iwl_mvm_tt_smps_iteratorfunction iwl_mvm_tt_tx_protectionfunction iwl_mvm_tt_tx_backofffunction iwl_mvm_tt_handlerfunction iwl_mvm_ctdp_commandfunction compare_tempsfunction iwl_trip_temp_cbfunction iwl_mvm_send_temp_report_ths_cmdfunction iwl_mvm_tzone_get_tempfunction iwl_mvm_tzone_set_trip_tempfunction iwl_mvm_thermal_zone_registerfunction iwl_mvm_tcool_get_max_statefunction iwl_mvm_tcool_get_cur_statefunction iwl_mvm_tcool_set_cur_statefunction iwl_mvm_cooling_device_registerfunction iwl_mvm_thermal_zone_unregisterfunction iwl_mvm_cooling_device_unregisterfunction iwl_mvm_ctdp_get_max_budgetfunction iwl_mvm_thermal_initializefunction iwl_mvm_thermal_exit
Annotated Snippet
struct iwl_trip_walk_data {
__le16 *thresholds;
int count;
};
static int iwl_trip_temp_cb(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_mvm_send_temp_report_ths_cmd(struct iwl_mvm *mvm)
{
struct temp_report_ths_cmd cmd = {0};
int ret;
#ifdef CONFIG_THERMAL
struct iwl_trip_walk_data twd = { .thresholds = cmd.thresholds, .count = 0 };
lockdep_assert_held(&mvm->mutex);
if (!mvm->tz_device.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(mvm->tz_device.tzone, iwl_trip_temp_cb, &twd);
cmd.num_temps = cpu_to_le32(twd.count);
if (twd.count)
sort(cmd.thresholds, twd.count, sizeof(s16), compare_temps, NULL);
send:
#endif
ret = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(PHY_OPS_GROUP,
TEMP_REPORTING_THRESHOLDS_CMD),
0, sizeof(cmd), &cmd);
if (ret)
IWL_ERR(mvm, "TEMP_REPORT_THS_CMD command failed (err=%d)\n",
ret);
return ret;
}
#ifdef CONFIG_THERMAL
static int iwl_mvm_tzone_get_temp(struct thermal_zone_device *device,
int *temperature)
{
struct iwl_mvm *mvm = thermal_zone_device_priv(device);
int ret;
int temp;
guard(mvm)(mvm);
if (!iwl_mvm_firmware_running(mvm) ||
mvm->fwrt.cur_fw_img != IWL_UCODE_REGULAR) {
/*
* Tell the core that there is no valid temperature value to
* return, but it need not worry about this.
*/
*temperature = THERMAL_TEMP_INVALID;
return 0;
}
ret = iwl_mvm_get_temp(mvm, &temp);
if (ret)
return ret;
*temperature = temp * 1000;
return 0;
}
static int iwl_mvm_tzone_set_trip_temp(struct thermal_zone_device *device,
const struct thermal_trip *trip, int temp)
{
struct iwl_mvm *mvm = thermal_zone_device_priv(device);
guard(mvm)(mvm);
if (!iwl_mvm_firmware_running(mvm) ||
Annotation
- Immediate include surface: `linux/sort.h`, `mvm.h`.
- Detected declarations: `struct iwl_trip_walk_data`, `function Copyright`, `function iwl_mvm_exit_ctkill`, `function iwl_mvm_tt_temp_changed`, `function iwl_mvm_temp_notif_parse`, `function iwl_mvm_temp_notif_wait`, `function iwl_mvm_temp_notif`, `function iwl_mvm_ct_kill_notif`, `function iwl_mvm_send_temp_cmd`, `function iwl_mvm_get_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.