drivers/thermal/ti-soc-thermal/omap4-thermal-data.c

Source file repositories/reference/linux-study-clean/drivers/thermal/ti-soc-thermal/omap4-thermal-data.c

File Facts

System
Linux kernel
Corpus path
drivers/thermal/ti-soc-thermal/omap4-thermal-data.c
Extension
.c
Size
9652 bytes
Lines
245
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.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0-only
/*
 * OMAP4 thermal driver.
 *
 * Copyright (C) 2011-2012 Texas Instruments Inc.
 * Contact:
 *	Eduardo Valentin <eduardo.valentin@ti.com>
 */

#include "ti-thermal.h"
#include "ti-bandgap.h"
#include "omap4xxx-bandgap.h"

/*
 * OMAP4430 has one instance of thermal sensor for MPU
 * need to describe the individual bit fields
 */
static struct temp_sensor_registers
omap4430_mpu_temp_sensor_registers = {
	.temp_sensor_ctrl = OMAP4430_TEMP_SENSOR_CTRL_OFFSET,
	.bgap_tempsoff_mask = OMAP4430_BGAP_TEMPSOFF_MASK,
	.bgap_soc_mask = OMAP4430_BGAP_TEMP_SENSOR_SOC_MASK,
	.bgap_eocz_mask = OMAP4430_BGAP_TEMP_SENSOR_EOCZ_MASK,
	.bgap_dtemp_mask = OMAP4430_BGAP_TEMP_SENSOR_DTEMP_MASK,

	.bgap_mode_ctrl = OMAP4430_TEMP_SENSOR_CTRL_OFFSET,
	.mode_ctrl_mask = OMAP4430_CONTINUOUS_MODE_MASK,

	.bgap_efuse = OMAP4430_FUSE_OPP_BGAP,
};

/* Thresholds and limits for OMAP4430 MPU temperature sensor */
static struct temp_sensor_data omap4430_mpu_temp_sensor_data = {
	.min_freq = OMAP4430_MIN_FREQ,
	.max_freq = OMAP4430_MAX_FREQ,
};

/*
 * Temperature values in milli degree celsius
 * ADC code values from 13 to 107, see TRM
 * "18.4.10.2.3 ADC Codes Versus Temperature".
 */
static const int
omap4430_adc_to_temp[OMAP4430_ADC_END_VALUE - OMAP4430_ADC_START_VALUE + 1] = {
	-40000, -38000, -35000, -34000, -32000, -30000, -28000, -26000, -24000,
	-22000,	-20000, -18500, -17000, -15000, -13500, -12000, -10000, -8000,
	-6500, -5000, -3500, -1500, 0, 2000, 3500, 5000, 6500, 8500, 10000,
	12000, 13500, 15000, 17000, 19000, 21000, 23000, 25000, 27000, 28500,
	30000, 32000, 33500, 35000, 37000, 38500, 40000, 42000, 43500, 45000,
	47000, 48500, 50000, 52000, 53500, 55000, 57000, 58500, 60000, 62000,
	64000, 66000, 68000, 70000, 71500, 73500, 75000, 77000, 78500, 80000,
	82000, 83500, 85000, 87000, 88500, 90000, 92000, 93500, 95000, 97000,
	98500, 100000, 102000, 103500, 105000, 107000, 109000, 111000, 113000,
	115000, 117000, 118500, 120000, 122000, 123500, 125000,
};

/* OMAP4430 data */
const struct ti_bandgap_data omap4430_data = {
	.features = TI_BANDGAP_FEATURE_MODE_CONFIG |
			TI_BANDGAP_FEATURE_CLK_CTRL |
			TI_BANDGAP_FEATURE_POWER_SWITCH |
			TI_BANDGAP_FEATURE_CONT_MODE_ONLY,
	.fclock_name = "bandgap_fclk",
	.div_ck_name = "bandgap_fclk",
	.conv_table = omap4430_adc_to_temp,
	.adc_start_val = OMAP4430_ADC_START_VALUE,
	.adc_end_val = OMAP4430_ADC_END_VALUE,
	.expose_sensor = ti_thermal_expose_sensor,
	.remove_sensor = ti_thermal_remove_sensor,
	.sensors = {
		{
		.registers = &omap4430_mpu_temp_sensor_registers,
		.ts_data = &omap4430_mpu_temp_sensor_data,
		.domain = "cpu",
		.slope_pcb = OMAP_GRADIENT_SLOPE_W_PCB_4430,
		.constant_pcb = OMAP_GRADIENT_CONST_W_PCB_4430,
		.register_cooling = ti_thermal_register_cpu_cooling,
		.unregister_cooling = ti_thermal_unregister_cpu_cooling,
		},
	},
	.sensor_count = 1,
};
/*
 * OMAP4460 has one instance of thermal sensor for MPU
 * need to describe the individual bit fields
 */
static struct temp_sensor_registers
omap4460_mpu_temp_sensor_registers = {
	.temp_sensor_ctrl = OMAP4460_TEMP_SENSOR_CTRL_OFFSET,
	.bgap_tempsoff_mask = OMAP4460_BGAP_TEMPSOFF_MASK,

Annotation

Implementation Notes