drivers/thermal/imx_thermal.c
Source file repositories/reference/linux-study-clean/drivers/thermal/imx_thermal.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/thermal/imx_thermal.c- Extension
.c- Size
- 24179 bytes
- Lines
- 872
- Domain
- Driver Families
- Bucket
- drivers/thermal
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/clk.hlinux/cpufreq.hlinux/cpu_cooling.hlinux/delay.hlinux/interrupt.hlinux/io.hlinux/mfd/syscon.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/regmap.hlinux/thermal.hlinux/nvmem-consumer.hlinux/pm_runtime.h
Detected Declarations
struct thermal_soc_datastruct imx_thermal_dataenum imx_thermal_tripfunction imx_set_panic_tempfunction imx_set_alarm_tempfunction imx_get_tempfunction imx_change_modefunction imx_set_trip_tempfunction imx_should_bindfunction imx_init_calibfunction imx_init_temp_gradefunction imx_init_from_tempmon_datafunction imx_init_from_nvmem_cellsfunction imx_thermal_alarm_irqfunction imx_thermal_alarm_irq_threadfunction imx_thermal_register_legacy_coolingfunction imx_thermal_unregister_legacy_coolingfunction imx_thermal_register_legacy_coolingfunction imx_thermal_unregister_legacy_coolingfunction imx_thermal_removefunction imx_thermal_suspendfunction imx_thermal_resumefunction imx_thermal_runtime_suspendfunction imx_thermal_runtime_resume
Annotated Snippet
struct thermal_soc_data {
u32 version;
u32 sensor_ctrl;
u32 power_down_mask;
u32 measure_temp_mask;
u32 measure_freq_ctrl;
u32 measure_freq_mask;
u32 measure_freq_shift;
u32 temp_data;
u32 temp_value_mask;
u32 temp_value_shift;
u32 temp_valid_mask;
u32 panic_alarm_ctrl;
u32 panic_alarm_mask;
u32 panic_alarm_shift;
u32 high_alarm_ctrl;
u32 high_alarm_mask;
u32 high_alarm_shift;
u32 low_alarm_ctrl;
u32 low_alarm_mask;
u32 low_alarm_shift;
};
static struct thermal_trip trips[] = {
[IMX_TRIP_PASSIVE] = { .type = THERMAL_TRIP_PASSIVE,
.flags = THERMAL_TRIP_FLAG_RW_TEMP },
[IMX_TRIP_CRITICAL] = { .type = THERMAL_TRIP_CRITICAL },
};
static struct thermal_soc_data thermal_imx6q_data = {
.version = TEMPMON_IMX6Q,
.sensor_ctrl = IMX6_TEMPSENSE0,
.power_down_mask = IMX6_TEMPSENSE0_POWER_DOWN,
.measure_temp_mask = IMX6_TEMPSENSE0_MEASURE_TEMP,
.measure_freq_ctrl = IMX6_TEMPSENSE1,
.measure_freq_shift = IMX6_TEMPSENSE1_MEASURE_FREQ_SHIFT,
.measure_freq_mask = IMX6_TEMPSENSE1_MEASURE_FREQ,
.temp_data = IMX6_TEMPSENSE0,
.temp_value_mask = IMX6_TEMPSENSE0_TEMP_CNT_MASK,
.temp_value_shift = IMX6_TEMPSENSE0_TEMP_CNT_SHIFT,
.temp_valid_mask = IMX6_TEMPSENSE0_FINISHED,
.high_alarm_ctrl = IMX6_TEMPSENSE0,
.high_alarm_mask = IMX6_TEMPSENSE0_ALARM_VALUE_MASK,
.high_alarm_shift = IMX6_TEMPSENSE0_ALARM_VALUE_SHIFT,
};
static struct thermal_soc_data thermal_imx6sx_data = {
.version = TEMPMON_IMX6SX,
.sensor_ctrl = IMX6_TEMPSENSE0,
.power_down_mask = IMX6_TEMPSENSE0_POWER_DOWN,
.measure_temp_mask = IMX6_TEMPSENSE0_MEASURE_TEMP,
.measure_freq_ctrl = IMX6_TEMPSENSE1,
.measure_freq_shift = IMX6_TEMPSENSE1_MEASURE_FREQ_SHIFT,
.measure_freq_mask = IMX6_TEMPSENSE1_MEASURE_FREQ,
.temp_data = IMX6_TEMPSENSE0,
.temp_value_mask = IMX6_TEMPSENSE0_TEMP_CNT_MASK,
.temp_value_shift = IMX6_TEMPSENSE0_TEMP_CNT_SHIFT,
.temp_valid_mask = IMX6_TEMPSENSE0_FINISHED,
.high_alarm_ctrl = IMX6_TEMPSENSE0,
.high_alarm_mask = IMX6_TEMPSENSE0_ALARM_VALUE_MASK,
.high_alarm_shift = IMX6_TEMPSENSE0_ALARM_VALUE_SHIFT,
.panic_alarm_ctrl = IMX6_TEMPSENSE2,
.panic_alarm_mask = IMX6_TEMPSENSE2_PANIC_VALUE_MASK,
.panic_alarm_shift = IMX6_TEMPSENSE2_PANIC_VALUE_SHIFT,
.low_alarm_ctrl = IMX6_TEMPSENSE2,
.low_alarm_mask = IMX6_TEMPSENSE2_LOW_VALUE_MASK,
.low_alarm_shift = IMX6_TEMPSENSE2_LOW_VALUE_SHIFT,
};
static struct thermal_soc_data thermal_imx7d_data = {
.version = TEMPMON_IMX7D,
.sensor_ctrl = IMX7_TEMPSENSE1,
.power_down_mask = IMX7_TEMPSENSE1_POWER_DOWN,
Annotation
- Immediate include surface: `linux/clk.h`, `linux/cpufreq.h`, `linux/cpu_cooling.h`, `linux/delay.h`, `linux/interrupt.h`, `linux/io.h`, `linux/mfd/syscon.h`, `linux/module.h`.
- Detected declarations: `struct thermal_soc_data`, `struct imx_thermal_data`, `enum imx_thermal_trip`, `function imx_set_panic_temp`, `function imx_set_alarm_temp`, `function imx_get_temp`, `function imx_change_mode`, `function imx_set_trip_temp`, `function imx_should_bind`, `function imx_init_calib`.
- Atlas domain: Driver Families / drivers/thermal.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.