STRUCT THERMAL_ZONE_DEVICE(9)
π struct thermal_zone_device β structure for a thermal zone π
okay so this is `struct thermal_zone_device(9), from the Kernel API Manual β literally the blueprint for one single thermal zone in the kernel, bestie. every trip point, every governor, every little delay gets its own lil home in here. it's giving "everything bagel of thermal management" and honestly? iconic. β¨
πΈ SYNOPSIS πΈ
no cap, here's the whole struct, character for character, don't touch anything:
struct thermal_zone_device {
int id;
char type[THERMAL_NAME_LENGTH];
struct device device;
struct completion removal;
struct completion resume;
struct attribute_group trips_attribute_group;
struct list_head trips_high;
struct list_head trips_reached;
struct list_head trips_invalid;
enum thermal_device_mode mode;
void *devdata;
int num_trips;
unsigned long passive_delay_jiffies;
unsigned long polling_delay_jiffies;
unsigned long recheck_delay_jiffies;
int temperature;
int last_temperature;
int emul_temperature;
int passive;
int prev_low_trip;
int prev_high_trip;
struct thermal_zone_device_ops ops;
struct thermal_zone_params *tzp;
struct thermal_governor *governor;
void *governor_data;
struct ida ida;
struct mutex lock;
struct list_head node;
struct delayed_work poll_queue;
enum thermal_notify_event notify_event;
u8 state;
#ifdef CONFIG_THERMAL_DEBUGFS;
struct thermal_debugfs *debugfs;
#endif;
struct list_head user_thresholds;
struct thermal_trip_desc trips[];
};
π Members π
okay bestie, field-by-field tour, strap in, this is the main character section:
idβ the unique id number for each thermal zone. every zone gets its own little social security number fr fr.typeβ the thermal zone device type. it's the vibe label πdeviceβ thestruct devicefor this thermal zone. it's the actual kernel device hanging out underneath.removalβ removal completion. this one's the "im leaving, wait up" signal.resumeβ resume completion. the "we're so back" signal β¨trips_attribute_groupβ trip point sysfs attributes. that's your sysfs hookup for trips.trips_highβ trips above the current zone temperature.trips_reachedβ trips below or at the current zone temperature.trips_invalidβ trips with invalid temperature. not me putting the broken ones in a separate bucket πmodeβ current mode of this thermal zone.devdataβ private pointer for device private data. driver's lil secrets, kept safe π«Άnum_tripsβ number of trip points the thermal zone supports.passive_delay_jiffiesβ number of jiffies to wait between polls when performing passive cooling.polling_delay_jiffiesβ number of jiffies to wait between polls when checking whether trip points have been crossed (0for interrupt driven systems). so zero means "don't poll me, interrupt me instead." periodt.recheck_delay_jiffiesβ delay after a failed attempt to determine the zone temperature before trying again. it flopped once, give it a minute πtemperatureβ current temperature. important caveat bestie listen to me: this is only for core code, drivers should usethermal_zone_get_tempto get the current temperature. do not come for this field directly if you're a driver, i'm serious πlast_temperatureβ previous temperature read.emul_temperatureβ emulated temperature when usingCONFIG_THERMAL_EMULATION. fake it till you make it energy π§passiveβ1if you've crossed a passive trip point,0otherwise.prev_low_tripβ the low current temperature if you've crossed a passive trip point.prev_high_tripβ the above current temperature if you've crossed a passive trip point.opsβ operations this thermal_zone_device supports.tzpβ thermal zone parameters.governorβ pointer to the governor for this thermal zone. π the one in charge.governor_dataβ private pointer for governor data.idaβstruct idato generate unique id for this zone's cooling devices.lockβ lock to protect thermal_instances list. mutual exclusion is self care πnodeβ node in thermal_tz_list (in thermal_core.c).poll_queueβ delayed work for polling.notify_eventβ last notification event.stateβ current state of the thermal zone.debugfsβ this thermal zone device's thermal zone debug info.user_thresholdsβ list of userspace thresholds for temp. limit notifications. userspace said "text me when it hits this" πtripsβ array ofstruct thermal_tripobjects.
lowkey the most important takeaway:temperatureis core-only. drivers, usethermal_zone_get_temp. no cap. π₯
π¦ SEE ALSO π¦
- Kernel file
./drivers/thermal/thermal_core.h struct thermal_governor(9)
and that's the whole page, bestie! π«Ά this one lives in ./drivers/thermal, it's the Kernel API Manual, it's dated October 2026, and it answers to the name struct thermal_zone_device(9). go forth and manage those thermal zones, you absolute legend πβ¨π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms