drivers/thermal/tegra/soctherm.c
Source file repositories/reference/linux-study-clean/drivers/thermal/tegra/soctherm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/thermal/tegra/soctherm.c- Extension
.c- Size
- 66049 bytes
- Lines
- 2295
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/debugfs.hlinux/bitops.hlinux/clk.hlinux/delay.hlinux/err.hlinux/interrupt.hlinux/io.hlinux/irq.hlinux/irqdomain.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/reset.hlinux/thermal.hdt-bindings/thermal/tegra114-soctherm.hdt-bindings/thermal/tegra124-soctherm.h../thermal_core.hsoctherm.h
Detected Declarations
struct tegra_socthermstruct tegra_thermctl_zonestruct soctherm_oc_cfgstruct soctherm_throt_cfgstruct tegra_socthermstruct soctherm_oc_irq_chip_dataenum soctherm_throttle_idenum soctherm_oc_irq_idenum soctherm_throttle_dev_idfunction ccroc_writelfunction ccroc_readlfunction enable_tsensorfunction translate_tempfunction tegra_thermctl_get_tempfunction enforce_temp_rangefunction thermtrip_programfunction throttrip_programfunction find_throttle_cfg_by_namefunction tsensor_group_thermtrip_getfunction tegra_thermctl_set_trip_tempfunction thermal_irq_enablefunction thermal_irq_disablefunction tegra_thermctl_set_tripsfunction get_hot_trip_cbfunction tegra_soctherm_set_hwtripsfunction soctherm_thermal_isrfunction interruptfunction soctherm_oc_intr_enablefunction soctherm_handle_alarmfunction soctherm_edp_isr_threadfunction soctherm_edp_isrfunction soctherm_oc_irq_lockfunction soctherm_oc_irq_sync_unlockfunction soctherm_oc_irq_enablefunction soctherm_oc_irq_disablefunction soctherm_oc_irq_set_typefunction soctherm_oc_irq_mapfunction soctherm_irq_domain_xlate_twocellfunction soctherm_oc_int_initfunction regs_showfunction soctherm_debug_initfunction soctherm_debug_initfunction soctherm_clk_disablefunction throt_get_cdev_max_statefunction throt_get_cdev_cur_statefunction throt_set_cdev_statefunction soctherm_thermtrips_parsefunction soctherm_oc_cfg_parse
Annotated Snippet
struct tegra_thermctl_zone {
void __iomem *reg;
struct device *dev;
struct tegra_soctherm *ts;
struct thermal_zone_device *tz;
const struct tegra_tsensor_group *sg;
};
struct soctherm_oc_cfg {
u32 active_low;
u32 throt_period;
u32 alarm_cnt_thresh;
u32 alarm_filter;
u32 mode;
bool intr_en;
};
struct soctherm_throt_cfg {
const char *name;
unsigned int id;
u8 priority;
u8 cpu_throt_level;
u32 cpu_throt_depth;
u32 gpu_throt_level;
struct soctherm_oc_cfg oc_cfg;
struct thermal_cooling_device *cdev;
bool init;
};
struct tegra_soctherm {
struct reset_control *reset;
struct clk *clock_tsensor;
struct clk *clock_soctherm;
void __iomem *regs;
void __iomem *clk_regs;
void __iomem *ccroc_regs;
int thermal_irq;
int edp_irq;
u32 *calib;
struct thermal_zone_device **thermctl_tzs;
struct tegra_soctherm_soc *soc;
struct soctherm_throt_cfg throt_cfgs[THROTTLE_SIZE];
struct dentry *debugfs_dir;
struct mutex thermctl_lock;
};
struct soctherm_oc_irq_chip_data {
struct mutex irq_lock; /* serialize OC IRQs */
struct irq_chip irq_chip;
struct irq_domain *domain;
int irq_enable;
};
static struct soctherm_oc_irq_chip_data soc_irq_cdata;
/* Ensure that TEGRA114_* and TEGRA124_* counterparts are equal */
static_assert(TEGRA114_SOCTHERM_SENSOR_CPU == TEGRA124_SOCTHERM_SENSOR_CPU);
static_assert(TEGRA114_SOCTHERM_SENSOR_MEM == TEGRA124_SOCTHERM_SENSOR_MEM);
static_assert(TEGRA114_SOCTHERM_SENSOR_GPU == TEGRA124_SOCTHERM_SENSOR_GPU);
static_assert(TEGRA114_SOCTHERM_SENSOR_PLLX == TEGRA124_SOCTHERM_SENSOR_PLLX);
/**
* ccroc_writel() - writes a value to a CCROC register
* @ts: pointer to a struct tegra_soctherm
* @value: the value to write
* @reg: the register offset
*
* Writes @v to @reg. No return value.
*/
static inline void ccroc_writel(struct tegra_soctherm *ts, u32 value, u32 reg)
{
writel(value, (ts->ccroc_regs + reg));
}
/**
* ccroc_readl() - reads specified register from CCROC IP block
* @ts: pointer to a struct tegra_soctherm
* @reg: register address to be read
*
* Return: the value of the register
*/
static inline u32 ccroc_readl(struct tegra_soctherm *ts, u32 reg)
{
return readl(ts->ccroc_regs + reg);
}
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/bitops.h`, `linux/clk.h`, `linux/delay.h`, `linux/err.h`, `linux/interrupt.h`, `linux/io.h`, `linux/irq.h`.
- Detected declarations: `struct tegra_soctherm`, `struct tegra_thermctl_zone`, `struct soctherm_oc_cfg`, `struct soctherm_throt_cfg`, `struct tegra_soctherm`, `struct soctherm_oc_irq_chip_data`, `enum soctherm_throttle_id`, `enum soctherm_oc_irq_id`, `enum soctherm_throttle_dev_id`, `function ccroc_writel`.
- Atlas domain: Driver Families / drivers/thermal.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- 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.