Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

thermal: ti-soc-thermal: add OMAP36xx support

Add OMAP36xx support to ti-soc-thermal driver. This
chip is also unreliable. The data provided here is
based on OMAP36xx TRM:
http://www.ti.com/lit/ug/swpu177aa/swpu177aa.pdf

Signed-off-by: Eduardo Valentin <edubezva@gmail.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>

+86
+7
Documentation/devicetree/bindings/thermal/ti_soc_thermal.txt
··· 11 11 Required properties: 12 12 - compatible : Should be: 13 13 - "ti,omap34xx-bandgap" : for OMAP34xx bandgap 14 + - "ti,omap36xx-bandgap" : for OMAP36xx bandgap 14 15 - "ti,omap4430-bandgap" : for OMAP4430 bandgap 15 16 - "ti,omap4460-bandgap" : for OMAP4460 bandgap 16 17 - "ti,omap4470-bandgap" : for OMAP4470 bandgap ··· 31 30 bandgap { 32 31 reg = <0x48002524 0x4>; 33 32 compatible = "ti,omap34xx-bandgap"; 33 + }; 34 + 35 + OMAP36xx: 36 + bandgap { 37 + reg = <0x48002524 0x4>; 38 + compatible = "ti,omap36xx-bandgap"; 34 39 }; 35 40 36 41 OMAP4430:
+73
drivers/thermal/ti-soc-thermal/omap3-thermal-data.c
··· 101 101 }, 102 102 .sensor_count = 1, 103 103 }; 104 + 105 + /* 106 + * OMAP36XX has one instance of thermal sensor for MPU 107 + * need to describe the individual bit fields 108 + */ 109 + static struct temp_sensor_registers 110 + omap36xx_mpu_temp_sensor_registers = { 111 + .temp_sensor_ctrl = 0, 112 + .bgap_soc_mask = BIT(9), 113 + .bgap_eocz_mask = BIT(8), 114 + .bgap_dtemp_mask = 0xFF, 115 + 116 + .bgap_mode_ctrl = 0, 117 + .mode_ctrl_mask = BIT(10), 118 + }; 119 + 120 + /* Thresholds and limits for OMAP36XX MPU temperature sensor */ 121 + static struct temp_sensor_data omap36xx_mpu_temp_sensor_data = { 122 + .min_freq = 32768, 123 + .max_freq = 32768, 124 + .max_temp = 125000, 125 + .min_temp = -40000, 126 + .hyst_val = 5000, 127 + }; 128 + 129 + /* 130 + * Temperature values in milli degree celsius 131 + */ 132 + static const int 133 + omap36xx_adc_to_temp[128] = { 134 + -40000, -40000, -40000, -40000, -40000, -40000, -40000, -40000, 135 + -40000, -40000, -40000, -40000, -40000, -38000, -35000, -34000, 136 + -32000, -30000, -28000, -26000, -24000, -22000, -20000, -18500, 137 + -17000, -15000, -13500, -12000, -10000, -8000, -6500, -5000, -3500, 138 + -1500, 0, 2000, 3500, 5000, 6500, 8500, 10000, 12000, 13500, 139 + 15000, 17000, 19000, 21000, 23000, 25000, 27000, 28500, 30000, 140 + 32000, 33500, 35000, 37000, 38500, 40000, 42000, 43500, 45000, 141 + 47000, 48500, 50000, 52000, 53500, 55000, 57000, 58500, 60000, 142 + 62000, 64000, 66000, 68000, 70000, 71500, 73500, 75000, 77000, 143 + 78500, 80000, 82000, 83500, 85000, 87000, 88500, 90000, 92000, 144 + 93500, 95000, 97000, 98500, 100000, 102000, 103500, 105000, 107000, 145 + 109000, 111000, 113000, 115000, 117000, 118500, 120000, 122000, 146 + 123500, 125000, 125000, 125000, 125000, 125000, 125000, 125000, 147 + 125000, 125000, 125000, 125000, 125000, 125000, 125000, 125000, 148 + 125000, 125000, 125000, 125000, 125000, 125000, 125000 149 + }; 150 + 151 + /* OMAP36XX data */ 152 + const struct ti_bandgap_data omap36xx_data = { 153 + .features = TI_BANDGAP_FEATURE_CLK_CTRL | TI_BANDGAP_FEATURE_UNRELIABLE, 154 + .fclock_name = "ts_fck", 155 + .div_ck_name = "ts_fck", 156 + .conv_table = omap36xx_adc_to_temp, 157 + .adc_start_val = 0, 158 + .adc_end_val = 127, 159 + .expose_sensor = ti_thermal_expose_sensor, 160 + .remove_sensor = ti_thermal_remove_sensor, 161 + 162 + .sensors = { 163 + { 164 + .registers = &omap36xx_mpu_temp_sensor_registers, 165 + .ts_data = &omap36xx_mpu_temp_sensor_data, 166 + .domain = "cpu", 167 + .slope = 0, 168 + .constant = 20000, 169 + .slope_pcb = 0, 170 + .constant_pcb = 20000, 171 + .register_cooling = NULL, 172 + .unregister_cooling = NULL, 173 + }, 174 + }, 175 + .sensor_count = 1, 176 + };
+4
drivers/thermal/ti-soc-thermal/ti-bandgap.c
··· 1588 1588 .compatible = "ti,omap34xx-bandgap", 1589 1589 .data = (void *)&omap34xx_data, 1590 1590 }, 1591 + { 1592 + .compatible = "ti,omap36xx-bandgap", 1593 + .data = (void *)&omap36xx_data, 1594 + }, 1591 1595 #endif 1592 1596 #ifdef CONFIG_OMAP4_THERMAL 1593 1597 {
+2
drivers/thermal/ti-soc-thermal/ti-bandgap.h
··· 395 395 396 396 #ifdef CONFIG_OMAP3_THERMAL 397 397 extern const struct ti_bandgap_data omap34xx_data; 398 + extern const struct ti_bandgap_data omap36xx_data; 398 399 #else 399 400 #define omap34xx_data NULL 401 + #define omap36xx_data NULL 400 402 #endif 401 403 402 404 #ifdef CONFIG_OMAP4_THERMAL