exynos_tmu_data.c 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. /*
  2. * exynos_tmu_data.c - Samsung EXYNOS tmu data file
  3. *
  4. * Copyright (C) 2013 Samsung Electronics
  5. * Amit Daniel Kachhap <amit.daniel@samsung.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. *
  21. */
  22. #include "exynos_thermal_common.h"
  23. #include "exynos_tmu.h"
  24. #include "exynos_tmu_data.h"
  25. #if defined(CONFIG_CPU_EXYNOS4210)
  26. static const struct exynos_tmu_registers exynos4210_tmu_registers = {
  27. .triminfo_data = EXYNOS_TMU_REG_TRIMINFO,
  28. .triminfo_25_shift = EXYNOS_TRIMINFO_25_SHIFT,
  29. .triminfo_85_shift = EXYNOS_TRIMINFO_85_SHIFT,
  30. .tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
  31. .buf_vref_sel_shift = EXYNOS_TMU_REF_VOLTAGE_SHIFT,
  32. .buf_vref_sel_mask = EXYNOS_TMU_REF_VOLTAGE_MASK,
  33. .buf_slope_sel_shift = EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT,
  34. .buf_slope_sel_mask = EXYNOS_TMU_BUF_SLOPE_SEL_MASK,
  35. .core_en_shift = EXYNOS_TMU_CORE_EN_SHIFT,
  36. .tmu_status = EXYNOS_TMU_REG_STATUS,
  37. .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP,
  38. .threshold_temp = EXYNOS4210_TMU_REG_THRESHOLD_TEMP,
  39. .threshold_th0 = EXYNOS4210_TMU_REG_TRIG_LEVEL0,
  40. .tmu_inten = EXYNOS_TMU_REG_INTEN,
  41. .inten_rise_mask = EXYNOS4210_TMU_TRIG_LEVEL_MASK,
  42. .inten_rise0_shift = EXYNOS_TMU_INTEN_RISE0_SHIFT,
  43. .inten_rise1_shift = EXYNOS_TMU_INTEN_RISE1_SHIFT,
  44. .inten_rise2_shift = EXYNOS_TMU_INTEN_RISE2_SHIFT,
  45. .inten_rise3_shift = EXYNOS_TMU_INTEN_RISE3_SHIFT,
  46. .tmu_intstat = EXYNOS_TMU_REG_INTSTAT,
  47. .tmu_intclear = EXYNOS_TMU_REG_INTCLEAR,
  48. };
  49. struct exynos_tmu_init_data const exynos4210_default_tmu_data = {
  50. .tmu_data = {
  51. {
  52. .threshold = 80,
  53. .trigger_levels[0] = 5,
  54. .trigger_levels[1] = 20,
  55. .trigger_levels[2] = 30,
  56. .trigger_enable[0] = true,
  57. .trigger_enable[1] = true,
  58. .trigger_enable[2] = true,
  59. .trigger_enable[3] = false,
  60. .trigger_type[0] = THROTTLE_ACTIVE,
  61. .trigger_type[1] = THROTTLE_ACTIVE,
  62. .trigger_type[2] = SW_TRIP,
  63. .max_trigger_level = 4,
  64. .gain = 15,
  65. .reference_voltage = 7,
  66. .cal_type = TYPE_ONE_POINT_TRIMMING,
  67. .min_efuse_value = 40,
  68. .max_efuse_value = 100,
  69. .first_point_trim = 25,
  70. .second_point_trim = 85,
  71. .default_temp_offset = 50,
  72. .freq_tab[0] = {
  73. .freq_clip_max = 800 * 1000,
  74. .temp_level = 85,
  75. },
  76. .freq_tab[1] = {
  77. .freq_clip_max = 200 * 1000,
  78. .temp_level = 100,
  79. },
  80. .freq_tab_count = 2,
  81. .type = SOC_ARCH_EXYNOS4210,
  82. .registers = &exynos4210_tmu_registers,
  83. .features = TMU_SUPPORT_READY_STATUS,
  84. },
  85. },
  86. .tmu_count = 1,
  87. };
  88. #endif
  89. #if defined(CONFIG_SOC_EXYNOS5250) || defined(CONFIG_SOC_EXYNOS4412)
  90. static const struct exynos_tmu_registers exynos5250_tmu_registers = {
  91. .triminfo_data = EXYNOS_TMU_REG_TRIMINFO,
  92. .triminfo_25_shift = EXYNOS_TRIMINFO_25_SHIFT,
  93. .triminfo_85_shift = EXYNOS_TRIMINFO_85_SHIFT,
  94. .triminfo_ctrl = EXYNOS_TMU_TRIMINFO_CON,
  95. .triminfo_reload_shift = EXYNOS_TRIMINFO_RELOAD_SHIFT,
  96. .tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
  97. .buf_vref_sel_shift = EXYNOS_TMU_REF_VOLTAGE_SHIFT,
  98. .buf_vref_sel_mask = EXYNOS_TMU_REF_VOLTAGE_MASK,
  99. .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
  100. .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK,
  101. .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,
  102. .buf_slope_sel_shift = EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT,
  103. .buf_slope_sel_mask = EXYNOS_TMU_BUF_SLOPE_SEL_MASK,
  104. .core_en_shift = EXYNOS_TMU_CORE_EN_SHIFT,
  105. .tmu_status = EXYNOS_TMU_REG_STATUS,
  106. .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP,
  107. .threshold_th0 = EXYNOS_THD_TEMP_RISE,
  108. .threshold_th1 = EXYNOS_THD_TEMP_FALL,
  109. .tmu_inten = EXYNOS_TMU_REG_INTEN,
  110. .inten_rise_mask = EXYNOS_TMU_RISE_INT_MASK,
  111. .inten_rise_shift = EXYNOS_TMU_RISE_INT_SHIFT,
  112. .inten_fall_mask = EXYNOS_TMU_FALL_INT_MASK,
  113. .inten_fall_shift = EXYNOS_TMU_FALL_INT_SHIFT,
  114. .inten_rise0_shift = EXYNOS_TMU_INTEN_RISE0_SHIFT,
  115. .inten_rise1_shift = EXYNOS_TMU_INTEN_RISE1_SHIFT,
  116. .inten_rise2_shift = EXYNOS_TMU_INTEN_RISE2_SHIFT,
  117. .inten_rise3_shift = EXYNOS_TMU_INTEN_RISE3_SHIFT,
  118. .inten_fall0_shift = EXYNOS_TMU_INTEN_FALL0_SHIFT,
  119. .tmu_intstat = EXYNOS_TMU_REG_INTSTAT,
  120. .tmu_intclear = EXYNOS_TMU_REG_INTCLEAR,
  121. .emul_con = EXYNOS_EMUL_CON,
  122. .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT,
  123. .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT,
  124. .emul_time_mask = EXYNOS_EMUL_TIME_MASK,
  125. };
  126. #define EXYNOS5250_TMU_DATA \
  127. .threshold_falling = 10, \
  128. .trigger_levels[0] = 85, \
  129. .trigger_levels[1] = 103, \
  130. .trigger_levels[2] = 110, \
  131. .trigger_levels[3] = 120, \
  132. .trigger_enable[0] = true, \
  133. .trigger_enable[1] = true, \
  134. .trigger_enable[2] = true, \
  135. .trigger_enable[3] = false, \
  136. .trigger_type[0] = THROTTLE_ACTIVE, \
  137. .trigger_type[1] = THROTTLE_ACTIVE, \
  138. .trigger_type[2] = SW_TRIP, \
  139. .trigger_type[3] = HW_TRIP, \
  140. .max_trigger_level = 4, \
  141. .gain = 8, \
  142. .reference_voltage = 16, \
  143. .noise_cancel_mode = 4, \
  144. .cal_type = TYPE_ONE_POINT_TRIMMING, \
  145. .efuse_value = 55, \
  146. .min_efuse_value = 40, \
  147. .max_efuse_value = 100, \
  148. .first_point_trim = 25, \
  149. .second_point_trim = 85, \
  150. .default_temp_offset = 50, \
  151. .freq_tab[0] = { \
  152. .freq_clip_max = 800 * 1000, \
  153. .temp_level = 85, \
  154. }, \
  155. .freq_tab[1] = { \
  156. .freq_clip_max = 200 * 1000, \
  157. .temp_level = 103, \
  158. }, \
  159. .freq_tab_count = 2, \
  160. .type = SOC_ARCH_EXYNOS, \
  161. .registers = &exynos5250_tmu_registers, \
  162. .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \
  163. TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \
  164. TMU_SUPPORT_EMUL_TIME)
  165. struct exynos_tmu_init_data const exynos5250_default_tmu_data = {
  166. .tmu_data = {
  167. { EXYNOS5250_TMU_DATA },
  168. },
  169. .tmu_count = 1,
  170. };
  171. #endif
  172. #if defined(CONFIG_SOC_EXYNOS5440)
  173. static const struct exynos_tmu_registers exynos5440_tmu_registers = {
  174. .triminfo_data = EXYNOS5440_TMU_S0_7_TRIM,
  175. .triminfo_25_shift = EXYNOS_TRIMINFO_25_SHIFT,
  176. .triminfo_85_shift = EXYNOS_TRIMINFO_85_SHIFT,
  177. .tmu_ctrl = EXYNOS5440_TMU_S0_7_CTRL,
  178. .buf_vref_sel_shift = EXYNOS_TMU_REF_VOLTAGE_SHIFT,
  179. .buf_vref_sel_mask = EXYNOS_TMU_REF_VOLTAGE_MASK,
  180. .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
  181. .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK,
  182. .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,
  183. .buf_slope_sel_shift = EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT,
  184. .buf_slope_sel_mask = EXYNOS_TMU_BUF_SLOPE_SEL_MASK,
  185. .calib_mode_shift = EXYNOS_TMU_CALIB_MODE_SHIFT,
  186. .calib_mode_mask = EXYNOS_TMU_CALIB_MODE_MASK,
  187. .core_en_shift = EXYNOS_TMU_CORE_EN_SHIFT,
  188. .tmu_status = EXYNOS5440_TMU_S0_7_STATUS,
  189. .tmu_cur_temp = EXYNOS5440_TMU_S0_7_TEMP,
  190. .threshold_th0 = EXYNOS5440_TMU_S0_7_TH0,
  191. .threshold_th1 = EXYNOS5440_TMU_S0_7_TH1,
  192. .threshold_th2 = EXYNOS5440_TMU_S0_7_TH2,
  193. .threshold_th3_l0_shift = EXYNOS5440_TMU_TH_RISE4_SHIFT,
  194. .tmu_inten = EXYNOS5440_TMU_S0_7_IRQEN,
  195. .inten_rise_mask = EXYNOS5440_TMU_RISE_INT_MASK,
  196. .inten_rise_shift = EXYNOS5440_TMU_RISE_INT_SHIFT,
  197. .inten_fall_mask = EXYNOS5440_TMU_FALL_INT_MASK,
  198. .inten_fall_shift = EXYNOS5440_TMU_FALL_INT_SHIFT,
  199. .inten_rise0_shift = EXYNOS5440_TMU_INTEN_RISE0_SHIFT,
  200. .inten_rise1_shift = EXYNOS5440_TMU_INTEN_RISE1_SHIFT,
  201. .inten_rise2_shift = EXYNOS5440_TMU_INTEN_RISE2_SHIFT,
  202. .inten_rise3_shift = EXYNOS5440_TMU_INTEN_RISE3_SHIFT,
  203. .inten_fall0_shift = EXYNOS5440_TMU_INTEN_FALL0_SHIFT,
  204. .tmu_intstat = EXYNOS5440_TMU_S0_7_IRQ,
  205. .tmu_intclear = EXYNOS5440_TMU_S0_7_IRQ,
  206. .tmu_irqstatus = EXYNOS5440_TMU_IRQ_STATUS,
  207. .emul_con = EXYNOS5440_TMU_S0_7_DEBUG,
  208. .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT,
  209. .tmu_pmin = EXYNOS5440_TMU_PMIN,
  210. };
  211. #define EXYNOS5440_TMU_DATA \
  212. .trigger_levels[0] = 100, \
  213. .trigger_levels[4] = 105, \
  214. .trigger_enable[0] = 1, \
  215. .trigger_type[0] = SW_TRIP, \
  216. .trigger_type[4] = HW_TRIP, \
  217. .max_trigger_level = 5, \
  218. .gain = 5, \
  219. .reference_voltage = 16, \
  220. .noise_cancel_mode = 4, \
  221. .cal_type = TYPE_ONE_POINT_TRIMMING, \
  222. .cal_mode = 0, \
  223. .efuse_value = 0x5b2d, \
  224. .min_efuse_value = 16, \
  225. .max_efuse_value = 76, \
  226. .first_point_trim = 25, \
  227. .second_point_trim = 70, \
  228. .default_temp_offset = 25, \
  229. .type = SOC_ARCH_EXYNOS5440, \
  230. .registers = &exynos5440_tmu_registers, \
  231. .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_FALLING_TRIP | \
  232. TMU_SUPPORT_MULTI_INST | TMU_SUPPORT_SHARED_MEMORY),
  233. struct exynos_tmu_init_data const exynos5440_default_tmu_data = {
  234. .tmu_data = {
  235. { EXYNOS5440_TMU_DATA } ,
  236. { EXYNOS5440_TMU_DATA } ,
  237. { EXYNOS5440_TMU_DATA } ,
  238. },
  239. .tmu_count = 3,
  240. };
  241. #endif