Source
x
/*
* OMAP4 thermal driver.
*
* Copyright (C) 2011-2012 Texas Instruments Inc.
* Contact:
* Eduardo Valentin <eduardo.valentin@ti.com>
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
/*
* 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_SINGLE_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 530 to 923
*/
static const int
omap4430_adc_to_temp[OMAP4430_ADC_END_VALUE - OMAP4430_ADC_START_VALUE + 1] = {
-38000, -35000, -34000, -32000, -30000, -28000, -26000, -24000, -22000,
-20000, -18000, -17000, -15000, -13000, -12000, -10000, -8000, -6000,
-5000, -3000, -1000, 0, 2000, 3000, 5000, 6000, 8000, 10000, 12000,
13000, 15000, 17000, 19000, 21000, 23000, 25000, 27000, 28000, 30000,
32000, 33000, 35000, 37000, 38000, 40000, 42000, 43000, 45000, 47000,
48000, 50000, 52000, 53000, 55000, 57000, 58000, 60000, 62000, 64000,
66000, 68000, 70000, 71000, 73000, 75000, 77000, 78000, 80000, 82000,
83000, 85000, 87000, 88000, 90000, 92000, 93000, 95000, 97000, 98000,
100000, 102000, 103000, 105000, 107000, 109000, 111000, 113000, 115000,
117000, 118000, 120000, 122000, 123000,
};
/* 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,
.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