1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-only */ 2*4882a593Smuzhiyun /* 3*4882a593Smuzhiyun * OMAP4 Bandgap temperature sensor driver 4*4882a593Smuzhiyun * 5*4882a593Smuzhiyun * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ 6*4882a593Smuzhiyun * Contact: 7*4882a593Smuzhiyun * Eduardo Valentin <eduardo.valentin@ti.com> 8*4882a593Smuzhiyun */ 9*4882a593Smuzhiyun #ifndef __TI_BANDGAP_H 10*4882a593Smuzhiyun #define __TI_BANDGAP_H 11*4882a593Smuzhiyun 12*4882a593Smuzhiyun #include <linux/spinlock.h> 13*4882a593Smuzhiyun #include <linux/types.h> 14*4882a593Smuzhiyun #include <linux/err.h> 15*4882a593Smuzhiyun #include <linux/cpu_pm.h> 16*4882a593Smuzhiyun #include <linux/device.h> 17*4882a593Smuzhiyun #include <linux/pm_runtime.h> 18*4882a593Smuzhiyun #include <linux/pm.h> 19*4882a593Smuzhiyun 20*4882a593Smuzhiyun struct gpio_desc; 21*4882a593Smuzhiyun 22*4882a593Smuzhiyun /** 23*4882a593Smuzhiyun * DOC: bandgap driver data structure 24*4882a593Smuzhiyun * ================================== 25*4882a593Smuzhiyun * 26*4882a593Smuzhiyun * +----------+----------------+ 27*4882a593Smuzhiyun * | struct temp_sensor_regval | 28*4882a593Smuzhiyun * +---------------------------+ 29*4882a593Smuzhiyun * * (Array of) 30*4882a593Smuzhiyun * | 31*4882a593Smuzhiyun * | 32*4882a593Smuzhiyun * +-------------------+ +-----------------+ 33*4882a593Smuzhiyun * | struct ti_bandgap |-->| struct device * | 34*4882a593Smuzhiyun * +----------+--------+ +-----------------+ 35*4882a593Smuzhiyun * | 36*4882a593Smuzhiyun * | 37*4882a593Smuzhiyun * V 38*4882a593Smuzhiyun * +------------------------+ 39*4882a593Smuzhiyun * | struct ti_bandgap_data | 40*4882a593Smuzhiyun * +------------------------+ 41*4882a593Smuzhiyun * | 42*4882a593Smuzhiyun * | 43*4882a593Smuzhiyun * * (Array of) 44*4882a593Smuzhiyun * +------------+------------------------------------------------------+ 45*4882a593Smuzhiyun * | +----------+------------+ +-------------------------+ | 46*4882a593Smuzhiyun * | | struct ti_temp_sensor |-->| struct temp_sensor_data | | 47*4882a593Smuzhiyun * | +-----------------------+ +------------+------------+ | 48*4882a593Smuzhiyun * | | | 49*4882a593Smuzhiyun * | + | 50*4882a593Smuzhiyun * | V | 51*4882a593Smuzhiyun * | +----------+-------------------+ | 52*4882a593Smuzhiyun * | | struct temp_sensor_registers | | 53*4882a593Smuzhiyun * | +------------------------------+ | 54*4882a593Smuzhiyun * | | 55*4882a593Smuzhiyun * +-------------------------------------------------------------------+ 56*4882a593Smuzhiyun * 57*4882a593Smuzhiyun * Above is a simple diagram describing how the data structure below 58*4882a593Smuzhiyun * are organized. For each bandgap device there should be a ti_bandgap_data 59*4882a593Smuzhiyun * containing the device instance configuration, as well as, an array of 60*4882a593Smuzhiyun * sensors, representing every sensor instance present in this bandgap. 61*4882a593Smuzhiyun */ 62*4882a593Smuzhiyun 63*4882a593Smuzhiyun /** 64*4882a593Smuzhiyun * struct temp_sensor_registers - descriptor to access registers and bitfields 65*4882a593Smuzhiyun * @temp_sensor_ctrl: TEMP_SENSOR_CTRL register offset 66*4882a593Smuzhiyun * @bgap_tempsoff_mask: mask to temp_sensor_ctrl.tempsoff 67*4882a593Smuzhiyun * @bgap_soc_mask: mask to temp_sensor_ctrl.soc 68*4882a593Smuzhiyun * @bgap_eocz_mask: mask to temp_sensor_ctrl.eocz 69*4882a593Smuzhiyun * @bgap_dtemp_mask: mask to temp_sensor_ctrl.dtemp 70*4882a593Smuzhiyun * @bgap_mask_ctrl: BANDGAP_MASK_CTRL register offset 71*4882a593Smuzhiyun * @mask_hot_mask: mask to bandgap_mask_ctrl.mask_hot 72*4882a593Smuzhiyun * @mask_cold_mask: mask to bandgap_mask_ctrl.mask_cold 73*4882a593Smuzhiyun * @mask_counter_delay_mask: mask to bandgap_mask_ctrl.mask_counter_delay 74*4882a593Smuzhiyun * @mask_freeze_mask: mask to bandgap_mask_ctrl.mask_free 75*4882a593Smuzhiyun * @bgap_mode_ctrl: BANDGAP_MODE_CTRL register offset 76*4882a593Smuzhiyun * @mode_ctrl_mask: mask to bandgap_mode_ctrl.mode_ctrl 77*4882a593Smuzhiyun * @bgap_counter: BANDGAP_COUNTER register offset 78*4882a593Smuzhiyun * @counter_mask: mask to bandgap_counter.counter 79*4882a593Smuzhiyun * @bgap_threshold: BANDGAP_THRESHOLD register offset (TALERT thresholds) 80*4882a593Smuzhiyun * @threshold_thot_mask: mask to bandgap_threhold.thot 81*4882a593Smuzhiyun * @threshold_tcold_mask: mask to bandgap_threhold.tcold 82*4882a593Smuzhiyun * @tshut_threshold: TSHUT_THRESHOLD register offset (TSHUT thresholds) 83*4882a593Smuzhiyun * @tshut_hot_mask: mask to tshut_threhold.thot 84*4882a593Smuzhiyun * @tshut_cold_mask: mask to tshut_threhold.thot 85*4882a593Smuzhiyun * @bgap_status: BANDGAP_STATUS register offset 86*4882a593Smuzhiyun * @status_hot_mask: mask to bandgap_status.hot 87*4882a593Smuzhiyun * @status_cold_mask: mask to bandgap_status.cold 88*4882a593Smuzhiyun * @ctrl_dtemp_1: CTRL_DTEMP1 register offset 89*4882a593Smuzhiyun * @ctrl_dtemp_2: CTRL_DTEMP2 register offset 90*4882a593Smuzhiyun * @bgap_efuse: BANDGAP_EFUSE register offset 91*4882a593Smuzhiyun * 92*4882a593Smuzhiyun * The register offsets and bitfields might change across 93*4882a593Smuzhiyun * OMAP and variants versions. Hence this struct serves as a 94*4882a593Smuzhiyun * descriptor map on how to access the registers and the bitfields. 95*4882a593Smuzhiyun * 96*4882a593Smuzhiyun * This descriptor contains registers of all versions of bandgap chips. 97*4882a593Smuzhiyun * Not all versions will use all registers, depending on the available 98*4882a593Smuzhiyun * features. Please read TRMs for descriptive explanation on each bitfield. 99*4882a593Smuzhiyun */ 100*4882a593Smuzhiyun 101*4882a593Smuzhiyun struct temp_sensor_registers { 102*4882a593Smuzhiyun u32 temp_sensor_ctrl; 103*4882a593Smuzhiyun u32 bgap_tempsoff_mask; 104*4882a593Smuzhiyun u32 bgap_soc_mask; 105*4882a593Smuzhiyun u32 bgap_eocz_mask; 106*4882a593Smuzhiyun u32 bgap_dtemp_mask; 107*4882a593Smuzhiyun 108*4882a593Smuzhiyun u32 bgap_mask_ctrl; 109*4882a593Smuzhiyun u32 mask_hot_mask; 110*4882a593Smuzhiyun u32 mask_cold_mask; 111*4882a593Smuzhiyun u32 mask_counter_delay_mask; 112*4882a593Smuzhiyun u32 mask_freeze_mask; 113*4882a593Smuzhiyun 114*4882a593Smuzhiyun u32 bgap_mode_ctrl; 115*4882a593Smuzhiyun u32 mode_ctrl_mask; 116*4882a593Smuzhiyun 117*4882a593Smuzhiyun u32 bgap_counter; 118*4882a593Smuzhiyun u32 counter_mask; 119*4882a593Smuzhiyun 120*4882a593Smuzhiyun u32 bgap_threshold; 121*4882a593Smuzhiyun u32 threshold_thot_mask; 122*4882a593Smuzhiyun u32 threshold_tcold_mask; 123*4882a593Smuzhiyun 124*4882a593Smuzhiyun u32 tshut_threshold; 125*4882a593Smuzhiyun u32 tshut_hot_mask; 126*4882a593Smuzhiyun u32 tshut_cold_mask; 127*4882a593Smuzhiyun 128*4882a593Smuzhiyun u32 bgap_status; 129*4882a593Smuzhiyun u32 status_hot_mask; 130*4882a593Smuzhiyun u32 status_cold_mask; 131*4882a593Smuzhiyun 132*4882a593Smuzhiyun u32 ctrl_dtemp_1; 133*4882a593Smuzhiyun u32 ctrl_dtemp_2; 134*4882a593Smuzhiyun u32 bgap_efuse; 135*4882a593Smuzhiyun }; 136*4882a593Smuzhiyun 137*4882a593Smuzhiyun /** 138*4882a593Smuzhiyun * struct temp_sensor_data - The thresholds and limits for temperature sensors. 139*4882a593Smuzhiyun * @tshut_hot: temperature to trigger a thermal reset (initial value) 140*4882a593Smuzhiyun * @tshut_cold: temp to get the plat out of reset due to thermal (init val) 141*4882a593Smuzhiyun * @t_hot: temperature to trigger a thermal alert (high initial value) 142*4882a593Smuzhiyun * @t_cold: temperature to trigger a thermal alert (low initial value) 143*4882a593Smuzhiyun * @min_freq: sensor minimum clock rate 144*4882a593Smuzhiyun * @max_freq: sensor maximum clock rate 145*4882a593Smuzhiyun * 146*4882a593Smuzhiyun * This data structure will hold the required thresholds and temperature limits 147*4882a593Smuzhiyun * for a specific temperature sensor, like shutdown temperature, alert 148*4882a593Smuzhiyun * temperature, clock / rate used, ADC conversion limits and update intervals 149*4882a593Smuzhiyun */ 150*4882a593Smuzhiyun struct temp_sensor_data { 151*4882a593Smuzhiyun u32 tshut_hot; 152*4882a593Smuzhiyun u32 tshut_cold; 153*4882a593Smuzhiyun u32 t_hot; 154*4882a593Smuzhiyun u32 t_cold; 155*4882a593Smuzhiyun u32 min_freq; 156*4882a593Smuzhiyun u32 max_freq; 157*4882a593Smuzhiyun }; 158*4882a593Smuzhiyun 159*4882a593Smuzhiyun struct ti_bandgap_data; 160*4882a593Smuzhiyun 161*4882a593Smuzhiyun /** 162*4882a593Smuzhiyun * struct temp_sensor_regval - temperature sensor register values and priv data 163*4882a593Smuzhiyun * @bg_mode_ctrl: temp sensor control register value 164*4882a593Smuzhiyun * @bg_ctrl: bandgap ctrl register value 165*4882a593Smuzhiyun * @bg_counter: bandgap counter value 166*4882a593Smuzhiyun * @bg_threshold: bandgap threshold register value 167*4882a593Smuzhiyun * @tshut_threshold: bandgap tshut register value 168*4882a593Smuzhiyun * @data: private data 169*4882a593Smuzhiyun * 170*4882a593Smuzhiyun * Data structure to save and restore bandgap register set context. Only 171*4882a593Smuzhiyun * required registers are shadowed, when needed. 172*4882a593Smuzhiyun */ 173*4882a593Smuzhiyun struct temp_sensor_regval { 174*4882a593Smuzhiyun u32 bg_mode_ctrl; 175*4882a593Smuzhiyun u32 bg_ctrl; 176*4882a593Smuzhiyun u32 bg_counter; 177*4882a593Smuzhiyun u32 bg_threshold; 178*4882a593Smuzhiyun u32 tshut_threshold; 179*4882a593Smuzhiyun void *data; 180*4882a593Smuzhiyun }; 181*4882a593Smuzhiyun 182*4882a593Smuzhiyun /** 183*4882a593Smuzhiyun * struct ti_bandgap - bandgap device structure 184*4882a593Smuzhiyun * @dev: struct device pointer 185*4882a593Smuzhiyun * @base: io memory base address 186*4882a593Smuzhiyun * @conf: struct with bandgap configuration set (# sensors, conv_table, etc) 187*4882a593Smuzhiyun * @regval: temperature sensor register values 188*4882a593Smuzhiyun * @fclock: pointer to functional clock of temperature sensor 189*4882a593Smuzhiyun * @div_clk: pointer to divider clock of temperature sensor fclk 190*4882a593Smuzhiyun * @lock: spinlock for ti_bandgap structure 191*4882a593Smuzhiyun * @irq: MPU IRQ number for thermal alert 192*4882a593Smuzhiyun * @tshut_gpio: GPIO where Tshut signal is routed 193*4882a593Smuzhiyun * @clk_rate: Holds current clock rate 194*4882a593Smuzhiyun * 195*4882a593Smuzhiyun * The bandgap device structure representing the bandgap device instance. 196*4882a593Smuzhiyun * It holds most of the dynamic stuff. Configurations and sensor specific 197*4882a593Smuzhiyun * entries are inside the @conf structure. 198*4882a593Smuzhiyun */ 199*4882a593Smuzhiyun struct ti_bandgap { 200*4882a593Smuzhiyun struct device *dev; 201*4882a593Smuzhiyun void __iomem *base; 202*4882a593Smuzhiyun const struct ti_bandgap_data *conf; 203*4882a593Smuzhiyun struct temp_sensor_regval *regval; 204*4882a593Smuzhiyun struct clk *fclock; 205*4882a593Smuzhiyun struct clk *div_clk; 206*4882a593Smuzhiyun spinlock_t lock; /* shields this struct */ 207*4882a593Smuzhiyun int irq; 208*4882a593Smuzhiyun struct gpio_desc *tshut_gpiod; 209*4882a593Smuzhiyun u32 clk_rate; 210*4882a593Smuzhiyun struct notifier_block nb; 211*4882a593Smuzhiyun unsigned int is_suspended:1; 212*4882a593Smuzhiyun }; 213*4882a593Smuzhiyun 214*4882a593Smuzhiyun /** 215*4882a593Smuzhiyun * struct ti_temp_sensor - bandgap temperature sensor configuration data 216*4882a593Smuzhiyun * @ts_data: pointer to struct with thresholds, limits of temperature sensor 217*4882a593Smuzhiyun * @registers: pointer to the list of register offsets and bitfields 218*4882a593Smuzhiyun * @domain: the name of the domain where the sensor is located 219*4882a593Smuzhiyun * @slope_pcb: sensor gradient slope info for hotspot extrapolation equation 220*4882a593Smuzhiyun * with no external influence 221*4882a593Smuzhiyun * @constant_pcb: sensor gradient const info for hotspot extrapolation equation 222*4882a593Smuzhiyun * with no external influence 223*4882a593Smuzhiyun * @register_cooling: function to describe how this sensor is going to be cooled 224*4882a593Smuzhiyun * @unregister_cooling: function to release cooling data 225*4882a593Smuzhiyun * 226*4882a593Smuzhiyun * Data structure to describe a temperature sensor handled by a bandgap device. 227*4882a593Smuzhiyun * It should provide configuration details on this sensor, such as how to 228*4882a593Smuzhiyun * access the registers affecting this sensor, shadow register buffer, how to 229*4882a593Smuzhiyun * assess the gradient from hotspot, how to cooldown the domain when sensor 230*4882a593Smuzhiyun * reports too hot temperature. 231*4882a593Smuzhiyun */ 232*4882a593Smuzhiyun struct ti_temp_sensor { 233*4882a593Smuzhiyun struct temp_sensor_data *ts_data; 234*4882a593Smuzhiyun struct temp_sensor_registers *registers; 235*4882a593Smuzhiyun char *domain; 236*4882a593Smuzhiyun /* for hotspot extrapolation */ 237*4882a593Smuzhiyun const int slope_pcb; 238*4882a593Smuzhiyun const int constant_pcb; 239*4882a593Smuzhiyun int (*register_cooling)(struct ti_bandgap *bgp, int id); 240*4882a593Smuzhiyun int (*unregister_cooling)(struct ti_bandgap *bgp, int id); 241*4882a593Smuzhiyun }; 242*4882a593Smuzhiyun 243*4882a593Smuzhiyun /** 244*4882a593Smuzhiyun * DOC: ti bandgap feature types 245*4882a593Smuzhiyun * 246*4882a593Smuzhiyun * TI_BANDGAP_FEATURE_TSHUT - used when the thermal shutdown signal output 247*4882a593Smuzhiyun * of a bandgap device instance is routed to the processor. This means 248*4882a593Smuzhiyun * the system must react and perform the shutdown by itself (handle an 249*4882a593Smuzhiyun * IRQ, for instance). 250*4882a593Smuzhiyun * 251*4882a593Smuzhiyun * TI_BANDGAP_FEATURE_TSHUT_CONFIG - used when the bandgap device has control 252*4882a593Smuzhiyun * over the thermal shutdown configuration. This means that the thermal 253*4882a593Smuzhiyun * shutdown thresholds are programmable, for instance. 254*4882a593Smuzhiyun * 255*4882a593Smuzhiyun * TI_BANDGAP_FEATURE_TALERT - used when the bandgap device instance outputs 256*4882a593Smuzhiyun * a signal representing violation of programmable alert thresholds. 257*4882a593Smuzhiyun * 258*4882a593Smuzhiyun * TI_BANDGAP_FEATURE_MODE_CONFIG - used when it is possible to choose which 259*4882a593Smuzhiyun * mode, continuous or one shot, the bandgap device instance will operate. 260*4882a593Smuzhiyun * 261*4882a593Smuzhiyun * TI_BANDGAP_FEATURE_COUNTER - used when the bandgap device instance allows 262*4882a593Smuzhiyun * programming the update interval of its internal state machine. 263*4882a593Smuzhiyun * 264*4882a593Smuzhiyun * TI_BANDGAP_FEATURE_POWER_SWITCH - used when the bandgap device allows 265*4882a593Smuzhiyun * itself to be switched on/off. 266*4882a593Smuzhiyun * 267*4882a593Smuzhiyun * TI_BANDGAP_FEATURE_CLK_CTRL - used when the clocks feeding the bandgap 268*4882a593Smuzhiyun * device are gateable or not. 269*4882a593Smuzhiyun * 270*4882a593Smuzhiyun * TI_BANDGAP_FEATURE_FREEZE_BIT - used when the bandgap device features 271*4882a593Smuzhiyun * a history buffer that its update can be freezed/unfreezed. 272*4882a593Smuzhiyun * 273*4882a593Smuzhiyun * TI_BANDGAP_FEATURE_COUNTER_DELAY - used when the bandgap device features 274*4882a593Smuzhiyun * a delay programming based on distinct values. 275*4882a593Smuzhiyun * 276*4882a593Smuzhiyun * TI_BANDGAP_FEATURE_HISTORY_BUFFER - used when the bandgap device features 277*4882a593Smuzhiyun * a history buffer of temperatures. 278*4882a593Smuzhiyun * 279*4882a593Smuzhiyun * TI_BANDGAP_FEATURE_ERRATA_814 - used to workaorund when the bandgap device 280*4882a593Smuzhiyun * has Errata 814 281*4882a593Smuzhiyun * TI_BANDGAP_FEATURE_UNRELIABLE - used when the sensor readings are too 282*4882a593Smuzhiyun * inaccurate. 283*4882a593Smuzhiyun * TI_BANDGAP_HAS(b, f) - macro to check if a bandgap device is capable of a 284*4882a593Smuzhiyun * specific feature (above) or not. Return non-zero, if yes. 285*4882a593Smuzhiyun */ 286*4882a593Smuzhiyun #define TI_BANDGAP_FEATURE_TSHUT BIT(0) 287*4882a593Smuzhiyun #define TI_BANDGAP_FEATURE_TSHUT_CONFIG BIT(1) 288*4882a593Smuzhiyun #define TI_BANDGAP_FEATURE_TALERT BIT(2) 289*4882a593Smuzhiyun #define TI_BANDGAP_FEATURE_MODE_CONFIG BIT(3) 290*4882a593Smuzhiyun #define TI_BANDGAP_FEATURE_COUNTER BIT(4) 291*4882a593Smuzhiyun #define TI_BANDGAP_FEATURE_POWER_SWITCH BIT(5) 292*4882a593Smuzhiyun #define TI_BANDGAP_FEATURE_CLK_CTRL BIT(6) 293*4882a593Smuzhiyun #define TI_BANDGAP_FEATURE_FREEZE_BIT BIT(7) 294*4882a593Smuzhiyun #define TI_BANDGAP_FEATURE_COUNTER_DELAY BIT(8) 295*4882a593Smuzhiyun #define TI_BANDGAP_FEATURE_HISTORY_BUFFER BIT(9) 296*4882a593Smuzhiyun #define TI_BANDGAP_FEATURE_ERRATA_814 BIT(10) 297*4882a593Smuzhiyun #define TI_BANDGAP_FEATURE_UNRELIABLE BIT(11) 298*4882a593Smuzhiyun #define TI_BANDGAP_HAS(b, f) \ 299*4882a593Smuzhiyun ((b)->conf->features & TI_BANDGAP_FEATURE_ ## f) 300*4882a593Smuzhiyun 301*4882a593Smuzhiyun /** 302*4882a593Smuzhiyun * struct ti_bandgap_data - ti bandgap data configuration structure 303*4882a593Smuzhiyun * @features: a bitwise flag set to describe the device features 304*4882a593Smuzhiyun * @conv_table: Pointer to ADC to temperature conversion table 305*4882a593Smuzhiyun * @adc_start_val: ADC conversion table starting value 306*4882a593Smuzhiyun * @adc_end_val: ADC conversion table ending value 307*4882a593Smuzhiyun * @fclock_name: clock name of the functional clock 308*4882a593Smuzhiyun * @div_ck_name: clock name of the clock divisor 309*4882a593Smuzhiyun * @sensor_count: count of temperature sensor within this bandgap device 310*4882a593Smuzhiyun * @report_temperature: callback to report thermal alert to thermal API 311*4882a593Smuzhiyun * @expose_sensor: callback to export sensor to thermal API 312*4882a593Smuzhiyun * @remove_sensor: callback to destroy sensor from thermal API 313*4882a593Smuzhiyun * @sensors: array of sensors present in this bandgap instance 314*4882a593Smuzhiyun * 315*4882a593Smuzhiyun * This is a data structure which should hold most of the static configuration 316*4882a593Smuzhiyun * of a bandgap device instance. It should describe which features this instance 317*4882a593Smuzhiyun * is capable of, the clock names to feed this device, the amount of sensors and 318*4882a593Smuzhiyun * their configuration representation, and how to export and unexport them to 319*4882a593Smuzhiyun * a thermal API. 320*4882a593Smuzhiyun */ 321*4882a593Smuzhiyun struct ti_bandgap_data { 322*4882a593Smuzhiyun unsigned int features; 323*4882a593Smuzhiyun const int *conv_table; 324*4882a593Smuzhiyun u32 adc_start_val; 325*4882a593Smuzhiyun u32 adc_end_val; 326*4882a593Smuzhiyun char *fclock_name; 327*4882a593Smuzhiyun char *div_ck_name; 328*4882a593Smuzhiyun int sensor_count; 329*4882a593Smuzhiyun int (*report_temperature)(struct ti_bandgap *bgp, int id); 330*4882a593Smuzhiyun int (*expose_sensor)(struct ti_bandgap *bgp, int id, char *domain); 331*4882a593Smuzhiyun int (*remove_sensor)(struct ti_bandgap *bgp, int id); 332*4882a593Smuzhiyun 333*4882a593Smuzhiyun /* this needs to be at the end */ 334*4882a593Smuzhiyun struct ti_temp_sensor sensors[]; 335*4882a593Smuzhiyun }; 336*4882a593Smuzhiyun 337*4882a593Smuzhiyun int ti_bandgap_read_thot(struct ti_bandgap *bgp, int id, int *thot); 338*4882a593Smuzhiyun int ti_bandgap_write_thot(struct ti_bandgap *bgp, int id, int val); 339*4882a593Smuzhiyun int ti_bandgap_read_tcold(struct ti_bandgap *bgp, int id, int *tcold); 340*4882a593Smuzhiyun int ti_bandgap_write_tcold(struct ti_bandgap *bgp, int id, int val); 341*4882a593Smuzhiyun int ti_bandgap_read_update_interval(struct ti_bandgap *bgp, int id, 342*4882a593Smuzhiyun int *interval); 343*4882a593Smuzhiyun int ti_bandgap_write_update_interval(struct ti_bandgap *bgp, int id, 344*4882a593Smuzhiyun u32 interval); 345*4882a593Smuzhiyun int ti_bandgap_read_temperature(struct ti_bandgap *bgp, int id, 346*4882a593Smuzhiyun int *temperature); 347*4882a593Smuzhiyun int ti_bandgap_set_sensor_data(struct ti_bandgap *bgp, int id, void *data); 348*4882a593Smuzhiyun void *ti_bandgap_get_sensor_data(struct ti_bandgap *bgp, int id); 349*4882a593Smuzhiyun int ti_bandgap_get_trend(struct ti_bandgap *bgp, int id, int *trend); 350*4882a593Smuzhiyun 351*4882a593Smuzhiyun #ifdef CONFIG_OMAP3_THERMAL 352*4882a593Smuzhiyun extern const struct ti_bandgap_data omap34xx_data; 353*4882a593Smuzhiyun extern const struct ti_bandgap_data omap36xx_data; 354*4882a593Smuzhiyun #else 355*4882a593Smuzhiyun #define omap34xx_data NULL 356*4882a593Smuzhiyun #define omap36xx_data NULL 357*4882a593Smuzhiyun #endif 358*4882a593Smuzhiyun 359*4882a593Smuzhiyun #ifdef CONFIG_OMAP4_THERMAL 360*4882a593Smuzhiyun extern const struct ti_bandgap_data omap4430_data; 361*4882a593Smuzhiyun extern const struct ti_bandgap_data omap4460_data; 362*4882a593Smuzhiyun extern const struct ti_bandgap_data omap4470_data; 363*4882a593Smuzhiyun #else 364*4882a593Smuzhiyun #define omap4430_data NULL 365*4882a593Smuzhiyun #define omap4460_data NULL 366*4882a593Smuzhiyun #define omap4470_data NULL 367*4882a593Smuzhiyun #endif 368*4882a593Smuzhiyun 369*4882a593Smuzhiyun #ifdef CONFIG_OMAP5_THERMAL 370*4882a593Smuzhiyun extern const struct ti_bandgap_data omap5430_data; 371*4882a593Smuzhiyun #else 372*4882a593Smuzhiyun #define omap5430_data NULL 373*4882a593Smuzhiyun #endif 374*4882a593Smuzhiyun 375*4882a593Smuzhiyun #ifdef CONFIG_DRA752_THERMAL 376*4882a593Smuzhiyun extern const struct ti_bandgap_data dra752_data; 377*4882a593Smuzhiyun #else 378*4882a593Smuzhiyun #define dra752_data NULL 379*4882a593Smuzhiyun #endif 380*4882a593Smuzhiyun #endif 381