STRUCT THERMAL_ZONE_DEVICE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’œ 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 β€” the struct device for 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 (0 for 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 use thermal_zone_get_temp to 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 using CONFIG_THERMAL_EMULATION. fake it till you make it energy 🧚
  • passive β€” 1 if you've crossed a passive trip point, 0 otherwise.
  • 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 ida to 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 of struct thermal_trip objects.
lowkey the most important takeaway: temperature is core-only. drivers, use thermal_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