aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/thermal/samsung/exynos_tmu_data.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/thermal/samsung/exynos_tmu_data.c')
-rw-r--r--drivers/thermal/samsung/exynos_tmu_data.c239
1 files changed, 8 insertions, 231 deletions
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c b/drivers/thermal/samsung/exynos_tmu_data.c
index 1724f6cdaef8..b23910069f68 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -22,24 +22,6 @@
22 22
23#include "exynos_thermal_common.h" 23#include "exynos_thermal_common.h"
24#include "exynos_tmu.h" 24#include "exynos_tmu.h"
25#include "exynos_tmu_data.h"
26
27#if defined(CONFIG_CPU_EXYNOS4210)
28static const struct exynos_tmu_registers exynos4210_tmu_registers = {
29 .triminfo_data = EXYNOS_TMU_REG_TRIMINFO,
30 .tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
31 .tmu_status = EXYNOS_TMU_REG_STATUS,
32 .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP,
33 .threshold_temp = EXYNOS4210_TMU_REG_THRESHOLD_TEMP,
34 .threshold_th0 = EXYNOS4210_TMU_REG_TRIG_LEVEL0,
35 .tmu_inten = EXYNOS_TMU_REG_INTEN,
36 .inten_rise0_shift = EXYNOS_TMU_INTEN_RISE0_SHIFT,
37 .inten_rise1_shift = EXYNOS_TMU_INTEN_RISE1_SHIFT,
38 .inten_rise2_shift = EXYNOS_TMU_INTEN_RISE2_SHIFT,
39 .inten_rise3_shift = EXYNOS_TMU_INTEN_RISE3_SHIFT,
40 .tmu_intstat = EXYNOS_TMU_REG_INTSTAT,
41 .tmu_intclear = EXYNOS_TMU_REG_INTCLEAR,
42};
43 25
44struct exynos_tmu_init_data const exynos4210_default_tmu_data = { 26struct exynos_tmu_init_data const exynos4210_default_tmu_data = {
45 .tmu_data = { 27 .tmu_data = {
@@ -75,40 +57,10 @@ struct exynos_tmu_init_data const exynos4210_default_tmu_data = {
75 }, 57 },
76 .freq_tab_count = 2, 58 .freq_tab_count = 2,
77 .type = SOC_ARCH_EXYNOS4210, 59 .type = SOC_ARCH_EXYNOS4210,
78 .registers = &exynos4210_tmu_registers,
79 .features = TMU_SUPPORT_READY_STATUS,
80 }, 60 },
81 }, 61 },
82 .tmu_count = 1, 62 .tmu_count = 1,
83}; 63};
84#endif
85
86#if defined(CONFIG_SOC_EXYNOS3250)
87static const struct exynos_tmu_registers exynos3250_tmu_registers = {
88 .triminfo_data = EXYNOS_TMU_REG_TRIMINFO,
89 .triminfo_ctrl[0] = EXYNOS_TMU_TRIMINFO_CON1,
90 .triminfo_ctrl[1] = EXYNOS_TMU_TRIMINFO_CON2,
91 .triminfo_ctrl_count = 2,
92 .tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
93 .test_mux_addr_shift = EXYNOS4412_MUX_ADDR_SHIFT,
94 .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
95 .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK,
96 .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,
97 .tmu_status = EXYNOS_TMU_REG_STATUS,
98 .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP,
99 .threshold_th0 = EXYNOS_THD_TEMP_RISE,
100 .threshold_th1 = EXYNOS_THD_TEMP_FALL,
101 .tmu_inten = EXYNOS_TMU_REG_INTEN,
102 .inten_rise0_shift = EXYNOS_TMU_INTEN_RISE0_SHIFT,
103 .inten_rise1_shift = EXYNOS_TMU_INTEN_RISE1_SHIFT,
104 .inten_rise2_shift = EXYNOS_TMU_INTEN_RISE2_SHIFT,
105 .inten_fall0_shift = EXYNOS_TMU_INTEN_FALL0_SHIFT,
106 .tmu_intstat = EXYNOS_TMU_REG_INTSTAT,
107 .tmu_intclear = EXYNOS_TMU_REG_INTCLEAR,
108 .emul_con = EXYNOS_EMUL_CON,
109 .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT,
110 .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT,
111};
112 64
113#define EXYNOS3250_TMU_DATA \ 65#define EXYNOS3250_TMU_DATA \
114 .threshold_falling = 10, \ 66 .threshold_falling = 10, \
@@ -144,54 +96,17 @@ static const struct exynos_tmu_registers exynos3250_tmu_registers = {
144 .freq_clip_max = 400 * 1000, \ 96 .freq_clip_max = 400 * 1000, \
145 .temp_level = 95, \ 97 .temp_level = 95, \
146 }, \ 98 }, \
147 .freq_tab_count = 2, \ 99 .freq_tab_count = 2
148 .triminfo_reload[0] = EXYNOS_TRIMINFO_RELOAD_ENABLE, \
149 .triminfo_reload[1] = EXYNOS_TRIMINFO_RELOAD_ENABLE, \
150 .registers = &exynos3250_tmu_registers, \
151 .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \
152 TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \
153 TMU_SUPPORT_EMUL_TIME)
154#endif
155 100
156#if defined(CONFIG_SOC_EXYNOS3250)
157struct exynos_tmu_init_data const exynos3250_default_tmu_data = { 101struct exynos_tmu_init_data const exynos3250_default_tmu_data = {
158 .tmu_data = { 102 .tmu_data = {
159 { 103 {
160 EXYNOS3250_TMU_DATA, 104 EXYNOS3250_TMU_DATA,
161 .type = SOC_ARCH_EXYNOS3250, 105 .type = SOC_ARCH_EXYNOS3250,
162 .test_mux = EXYNOS4412_MUX_ADDR_VALUE,
163 }, 106 },
164 }, 107 },
165 .tmu_count = 1, 108 .tmu_count = 1,
166}; 109};
167#endif
168
169#if defined(CONFIG_SOC_EXYNOS4412) || defined(CONFIG_SOC_EXYNOS5250)
170static const struct exynos_tmu_registers exynos4412_tmu_registers = {
171 .triminfo_data = EXYNOS_TMU_REG_TRIMINFO,
172 .triminfo_ctrl[0] = EXYNOS_TMU_TRIMINFO_CON2,
173 .triminfo_ctrl_count = 1,
174 .tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
175 .test_mux_addr_shift = EXYNOS4412_MUX_ADDR_SHIFT,
176 .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
177 .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK,
178 .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,
179 .tmu_status = EXYNOS_TMU_REG_STATUS,
180 .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP,
181 .threshold_th0 = EXYNOS_THD_TEMP_RISE,
182 .threshold_th1 = EXYNOS_THD_TEMP_FALL,
183 .tmu_inten = EXYNOS_TMU_REG_INTEN,
184 .inten_rise0_shift = EXYNOS_TMU_INTEN_RISE0_SHIFT,
185 .inten_rise1_shift = EXYNOS_TMU_INTEN_RISE1_SHIFT,
186 .inten_rise2_shift = EXYNOS_TMU_INTEN_RISE2_SHIFT,
187 .inten_rise3_shift = EXYNOS_TMU_INTEN_RISE3_SHIFT,
188 .inten_fall0_shift = EXYNOS_TMU_INTEN_FALL0_SHIFT,
189 .tmu_intstat = EXYNOS_TMU_REG_INTSTAT,
190 .tmu_intclear = EXYNOS_TMU_REG_INTCLEAR,
191 .emul_con = EXYNOS_EMUL_CON,
192 .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT,
193 .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT,
194};
195 110
196#define EXYNOS4412_TMU_DATA \ 111#define EXYNOS4412_TMU_DATA \
197 .threshold_falling = 10, \ 112 .threshold_falling = 10, \
@@ -227,28 +142,18 @@ static const struct exynos_tmu_registers exynos4412_tmu_registers = {
227 .freq_clip_max = 400 * 1000, \ 142 .freq_clip_max = 400 * 1000, \
228 .temp_level = 95, \ 143 .temp_level = 95, \
229 }, \ 144 }, \
230 .freq_tab_count = 2, \ 145 .freq_tab_count = 2
231 .triminfo_reload[0] = EXYNOS_TRIMINFO_RELOAD_ENABLE, \
232 .registers = &exynos4412_tmu_registers, \
233 .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \
234 TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \
235 TMU_SUPPORT_EMUL_TIME)
236#endif
237 146
238#if defined(CONFIG_SOC_EXYNOS4412)
239struct exynos_tmu_init_data const exynos4412_default_tmu_data = { 147struct exynos_tmu_init_data const exynos4412_default_tmu_data = {
240 .tmu_data = { 148 .tmu_data = {
241 { 149 {
242 EXYNOS4412_TMU_DATA, 150 EXYNOS4412_TMU_DATA,
243 .type = SOC_ARCH_EXYNOS4412, 151 .type = SOC_ARCH_EXYNOS4412,
244 .test_mux = EXYNOS4412_MUX_ADDR_VALUE,
245 }, 152 },
246 }, 153 },
247 .tmu_count = 1, 154 .tmu_count = 1,
248}; 155};
249#endif
250 156
251#if defined(CONFIG_SOC_EXYNOS5250)
252struct exynos_tmu_init_data const exynos5250_default_tmu_data = { 157struct exynos_tmu_init_data const exynos5250_default_tmu_data = {
253 .tmu_data = { 158 .tmu_data = {
254 { 159 {
@@ -258,31 +163,6 @@ struct exynos_tmu_init_data const exynos5250_default_tmu_data = {
258 }, 163 },
259 .tmu_count = 1, 164 .tmu_count = 1,
260}; 165};
261#endif
262
263#if defined(CONFIG_SOC_EXYNOS5260)
264static const struct exynos_tmu_registers exynos5260_tmu_registers = {
265 .triminfo_data = EXYNOS_TMU_REG_TRIMINFO,
266 .tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
267 .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
268 .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK,
269 .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,
270 .tmu_status = EXYNOS_TMU_REG_STATUS,
271 .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP,
272 .threshold_th0 = EXYNOS_THD_TEMP_RISE,
273 .threshold_th1 = EXYNOS_THD_TEMP_FALL,
274 .tmu_inten = EXYNOS5260_TMU_REG_INTEN,
275 .inten_rise0_shift = EXYNOS_TMU_INTEN_RISE0_SHIFT,
276 .inten_rise1_shift = EXYNOS_TMU_INTEN_RISE1_SHIFT,
277 .inten_rise2_shift = EXYNOS_TMU_INTEN_RISE2_SHIFT,
278 .inten_rise3_shift = EXYNOS_TMU_INTEN_RISE3_SHIFT,
279 .inten_fall0_shift = EXYNOS_TMU_INTEN_FALL0_SHIFT,
280 .tmu_intstat = EXYNOS5260_TMU_REG_INTSTAT,
281 .tmu_intclear = EXYNOS5260_TMU_REG_INTCLEAR,
282 .emul_con = EXYNOS5260_EMUL_CON,
283 .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT,
284 .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT,
285};
286 166
287#define __EXYNOS5260_TMU_DATA \ 167#define __EXYNOS5260_TMU_DATA \
288 .threshold_falling = 10, \ 168 .threshold_falling = 10, \
@@ -319,13 +199,10 @@ static const struct exynos_tmu_registers exynos5260_tmu_registers = {
319 .temp_level = 103, \ 199 .temp_level = 103, \
320 }, \ 200 }, \
321 .freq_tab_count = 2, \ 201 .freq_tab_count = 2, \
322 .registers = &exynos5260_tmu_registers, \
323 202
324#define EXYNOS5260_TMU_DATA \ 203#define EXYNOS5260_TMU_DATA \
325 __EXYNOS5260_TMU_DATA \ 204 __EXYNOS5260_TMU_DATA \
326 .type = SOC_ARCH_EXYNOS5260, \ 205 .type = SOC_ARCH_EXYNOS5260
327 .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_FALLING_TRIP | \
328 TMU_SUPPORT_READY_STATUS | TMU_SUPPORT_EMUL_TIME)
329 206
330struct exynos_tmu_init_data const exynos5260_default_tmu_data = { 207struct exynos_tmu_init_data const exynos5260_default_tmu_data = {
331 .tmu_data = { 208 .tmu_data = {
@@ -337,82 +214,14 @@ struct exynos_tmu_init_data const exynos5260_default_tmu_data = {
337 }, 214 },
338 .tmu_count = 5, 215 .tmu_count = 5,
339}; 216};
340#endif
341
342#if defined(CONFIG_SOC_EXYNOS5420)
343static const struct exynos_tmu_registers exynos5420_tmu_registers = {
344 .triminfo_data = EXYNOS_TMU_REG_TRIMINFO,
345 .tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
346 .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
347 .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK,
348 .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,
349 .tmu_status = EXYNOS_TMU_REG_STATUS,
350 .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP,
351 .threshold_th0 = EXYNOS_THD_TEMP_RISE,
352 .threshold_th1 = EXYNOS_THD_TEMP_FALL,
353 .tmu_inten = EXYNOS_TMU_REG_INTEN,
354 .inten_rise0_shift = EXYNOS_TMU_INTEN_RISE0_SHIFT,
355 .inten_rise1_shift = EXYNOS_TMU_INTEN_RISE1_SHIFT,
356 .inten_rise2_shift = EXYNOS_TMU_INTEN_RISE2_SHIFT,
357 /* INTEN_RISE3 Not availble in exynos5420 */
358 .inten_rise3_shift = EXYNOS_TMU_INTEN_RISE3_SHIFT,
359 .inten_fall0_shift = EXYNOS_TMU_INTEN_FALL0_SHIFT,
360 .tmu_intstat = EXYNOS_TMU_REG_INTSTAT,
361 .tmu_intclear = EXYNOS_TMU_REG_INTCLEAR,
362 .emul_con = EXYNOS_EMUL_CON,
363 .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT,
364 .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT,
365};
366
367#define __EXYNOS5420_TMU_DATA \
368 .threshold_falling = 10, \
369 .trigger_levels[0] = 85, \
370 .trigger_levels[1] = 103, \
371 .trigger_levels[2] = 110, \
372 .trigger_levels[3] = 120, \
373 .trigger_enable[0] = true, \
374 .trigger_enable[1] = true, \
375 .trigger_enable[2] = true, \
376 .trigger_enable[3] = false, \
377 .trigger_type[0] = THROTTLE_ACTIVE, \
378 .trigger_type[1] = THROTTLE_ACTIVE, \
379 .trigger_type[2] = SW_TRIP, \
380 .trigger_type[3] = HW_TRIP, \
381 .max_trigger_level = 4, \
382 .non_hw_trigger_levels = 3, \
383 .gain = 8, \
384 .reference_voltage = 16, \
385 .noise_cancel_mode = 4, \
386 .cal_type = TYPE_ONE_POINT_TRIMMING, \
387 .efuse_value = 55, \
388 .min_efuse_value = 40, \
389 .max_efuse_value = 100, \
390 .first_point_trim = 25, \
391 .second_point_trim = 85, \
392 .default_temp_offset = 50, \
393 .freq_tab[0] = { \
394 .freq_clip_max = 800 * 1000, \
395 .temp_level = 85, \
396 }, \
397 .freq_tab[1] = { \
398 .freq_clip_max = 200 * 1000, \
399 .temp_level = 103, \
400 }, \
401 .freq_tab_count = 2, \
402 .registers = &exynos5420_tmu_registers, \
403 217
404#define EXYNOS5420_TMU_DATA \ 218#define EXYNOS5420_TMU_DATA \
405 __EXYNOS5420_TMU_DATA \ 219 __EXYNOS5260_TMU_DATA \
406 .type = SOC_ARCH_EXYNOS5250, \ 220 .type = SOC_ARCH_EXYNOS5420
407 .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_FALLING_TRIP | \
408 TMU_SUPPORT_READY_STATUS | TMU_SUPPORT_EMUL_TIME)
409 221
410#define EXYNOS5420_TMU_DATA_SHARED \ 222#define EXYNOS5420_TMU_DATA_SHARED \
411 __EXYNOS5420_TMU_DATA \ 223 __EXYNOS5260_TMU_DATA \
412 .type = SOC_ARCH_EXYNOS5420_TRIMINFO, \ 224 .type = SOC_ARCH_EXYNOS5420_TRIMINFO
413 .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_FALLING_TRIP | \
414 TMU_SUPPORT_READY_STATUS | TMU_SUPPORT_EMUL_TIME | \
415 TMU_SUPPORT_ADDRESS_MULTIPLE)
416 225
417struct exynos_tmu_init_data const exynos5420_default_tmu_data = { 226struct exynos_tmu_init_data const exynos5420_default_tmu_data = {
418 .tmu_data = { 227 .tmu_data = {
@@ -424,34 +233,6 @@ struct exynos_tmu_init_data const exynos5420_default_tmu_data = {
424 }, 233 },
425 .tmu_count = 5, 234 .tmu_count = 5,
426}; 235};
427#endif
428
429#if defined(CONFIG_SOC_EXYNOS5440)
430static const struct exynos_tmu_registers exynos5440_tmu_registers = {
431 .triminfo_data = EXYNOS5440_TMU_S0_7_TRIM,
432 .tmu_ctrl = EXYNOS5440_TMU_S0_7_CTRL,
433 .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
434 .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK,
435 .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,
436 .tmu_status = EXYNOS5440_TMU_S0_7_STATUS,
437 .tmu_cur_temp = EXYNOS5440_TMU_S0_7_TEMP,
438 .threshold_th0 = EXYNOS5440_TMU_S0_7_TH0,
439 .threshold_th1 = EXYNOS5440_TMU_S0_7_TH1,
440 .threshold_th2 = EXYNOS5440_TMU_S0_7_TH2,
441 .threshold_th3_l0_shift = EXYNOS5440_TMU_TH_RISE4_SHIFT,
442 .tmu_inten = EXYNOS5440_TMU_S0_7_IRQEN,
443 .inten_rise0_shift = EXYNOS5440_TMU_INTEN_RISE0_SHIFT,
444 .inten_rise1_shift = EXYNOS5440_TMU_INTEN_RISE1_SHIFT,
445 .inten_rise2_shift = EXYNOS5440_TMU_INTEN_RISE2_SHIFT,
446 .inten_rise3_shift = EXYNOS5440_TMU_INTEN_RISE3_SHIFT,
447 .inten_fall0_shift = EXYNOS5440_TMU_INTEN_FALL0_SHIFT,
448 .tmu_intstat = EXYNOS5440_TMU_S0_7_IRQ,
449 .tmu_intclear = EXYNOS5440_TMU_S0_7_IRQ,
450 .tmu_irqstatus = EXYNOS5440_TMU_IRQ_STATUS,
451 .emul_con = EXYNOS5440_TMU_S0_7_DEBUG,
452 .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT,
453 .tmu_pmin = EXYNOS5440_TMU_PMIN,
454};
455 236
456#define EXYNOS5440_TMU_DATA \ 237#define EXYNOS5440_TMU_DATA \
457 .trigger_levels[0] = 100, \ 238 .trigger_levels[0] = 100, \
@@ -471,10 +252,7 @@ static const struct exynos_tmu_registers exynos5440_tmu_registers = {
471 .first_point_trim = 25, \ 252 .first_point_trim = 25, \
472 .second_point_trim = 70, \ 253 .second_point_trim = 70, \
473 .default_temp_offset = 25, \ 254 .default_temp_offset = 25, \
474 .type = SOC_ARCH_EXYNOS5440, \ 255 .type = SOC_ARCH_EXYNOS5440
475 .registers = &exynos5440_tmu_registers, \
476 .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_FALLING_TRIP | \
477 TMU_SUPPORT_MULTI_INST | TMU_SUPPORT_ADDRESS_MULTIPLE),
478 256
479struct exynos_tmu_init_data const exynos5440_default_tmu_data = { 257struct exynos_tmu_init_data const exynos5440_default_tmu_data = {
480 .tmu_data = { 258 .tmu_data = {
@@ -484,4 +262,3 @@ struct exynos_tmu_init_data const exynos5440_default_tmu_data = {
484 }, 262 },
485 .tmu_count = 3, 263 .tmu_count = 3,
486}; 264};
487#endif