include/linux/thermal.h
Source file repositories/reference/linux-study-clean/include/linux/thermal.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/thermal.h- Extension
.h- Size
- 13067 bytes
- Lines
- 395
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- 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/of.hlinux/idr.hlinux/device.hlinux/sysfs.hlinux/workqueue.huapi/linux/thermal.h
Detected Declarations
struct thermal_zone_devicestruct thermal_cooling_devicestruct thermal_instancestruct thermal_debugfsstruct thermal_attrstruct thermal_tripstruct cooling_specstruct thermal_zone_device_opsstruct thermal_cooling_device_opsstruct thermal_cooling_devicestruct thermal_zone_paramsenum thermal_trendenum thermal_notify_eventfunction devm_thermal_of_zone_unregisterfunction devm_thermal_of_cooling_device_registerfunction devm_thermal_of_child_cooling_device_registerfunction thermal_zone_device_unregisterfunction devm_thermal_cooling_device_registerfunction thermal_cooling_device_unregisterfunction thermal_zone_get_tempfunction thermal_zone_get_slopefunction thermal_zone_get_offsetfunction thermal_zone_device_idfunction thermal_zone_device_enablefunction thermal_zone_device_disablefunction thermal_pm_prepare
Annotated Snippet
struct thermal_trip {
int temperature;
int hysteresis;
enum thermal_trip_type type;
u8 flags;
void *priv;
};
#define THERMAL_TRIP_FLAG_RW_TEMP BIT(0)
#define THERMAL_TRIP_FLAG_RW_HYST BIT(1)
#define THERMAL_TRIP_FLAG_RW (THERMAL_TRIP_FLAG_RW_TEMP | \
THERMAL_TRIP_FLAG_RW_HYST)
#define THERMAL_TRIP_PRIV_TO_INT(_val_) (uintptr_t)(_val_)
#define THERMAL_INT_TO_TRIP_PRIV(_val_) (void *)(uintptr_t)(_val_)
struct cooling_spec {
unsigned long upper; /* Highest cooling state */
unsigned long lower; /* Lowest cooling state */
unsigned int weight; /* Cooling device weight */
};
struct thermal_zone_device_ops {
bool (*should_bind) (struct thermal_zone_device *,
const struct thermal_trip *,
struct thermal_cooling_device *,
struct cooling_spec *);
int (*get_temp) (struct thermal_zone_device *, int *);
int (*set_trips) (struct thermal_zone_device *, int, int);
int (*change_mode) (struct thermal_zone_device *,
enum thermal_device_mode);
int (*set_trip_temp) (struct thermal_zone_device *,
const struct thermal_trip *, int);
int (*get_crit_temp) (struct thermal_zone_device *, int *);
int (*set_emul_temp) (struct thermal_zone_device *, int);
int (*get_trend) (struct thermal_zone_device *,
const struct thermal_trip *, enum thermal_trend *);
void (*hot)(struct thermal_zone_device *);
void (*critical)(struct thermal_zone_device *);
};
struct thermal_cooling_device_ops {
int (*get_max_state) (struct thermal_cooling_device *, unsigned long *);
int (*get_cur_state) (struct thermal_cooling_device *, unsigned long *);
int (*set_cur_state) (struct thermal_cooling_device *, unsigned long);
int (*get_requested_power)(struct thermal_cooling_device *, u32 *);
int (*state2power)(struct thermal_cooling_device *, unsigned long, u32 *);
int (*power2state)(struct thermal_cooling_device *, u32, unsigned long *);
};
struct thermal_cooling_device {
int id;
const char *type;
unsigned long max_state;
struct device device;
void *devdata;
void *stats;
const struct thermal_cooling_device_ops *ops;
bool updated; /* true if the cooling device does not need update */
struct mutex lock; /* protect thermal_instances list */
struct list_head thermal_instances;
struct list_head node;
#ifdef CONFIG_THERMAL_OF
struct device_node *np;
u32 cdev_id;
#endif
#ifdef CONFIG_THERMAL_DEBUGFS
struct thermal_debugfs *debugfs;
#endif
};
DEFINE_GUARD(cooling_dev, struct thermal_cooling_device *, mutex_lock(&_T->lock),
mutex_unlock(&_T->lock))
/* Structure to define Thermal Zone parameters */
struct thermal_zone_params {
const char *governor_name;
/*
* a boolean to indicate if the thermal to hwmon sysfs interface
* is required. when no_hwmon == false, a hwmon sysfs interface
* will be created. when no_hwmon == true, nothing will be done
*/
bool no_hwmon;
/*
* Sustainable power (heat) that this thermal zone can dissipate in
* mW
*/
Annotation
- Immediate include surface: `linux/of.h`, `linux/idr.h`, `linux/device.h`, `linux/sysfs.h`, `linux/workqueue.h`, `uapi/linux/thermal.h`.
- Detected declarations: `struct thermal_zone_device`, `struct thermal_cooling_device`, `struct thermal_instance`, `struct thermal_debugfs`, `struct thermal_attr`, `struct thermal_trip`, `struct cooling_spec`, `struct thermal_zone_device_ops`, `struct thermal_cooling_device_ops`, `struct thermal_cooling_device`.
- Atlas domain: Core OS / Core Kernel Interface.
- 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.