mtk_thermal.c 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2015 MediaTek Inc.
  4. * Author: Hanyi Wu <[email protected]>
  5. * Sascha Hauer <[email protected]>
  6. * Dawei Chien <[email protected]>
  7. * Louis Yu <[email protected]>
  8. */
  9. #include <linux/clk.h>
  10. #include <linux/delay.h>
  11. #include <linux/interrupt.h>
  12. #include <linux/kernel.h>
  13. #include <linux/module.h>
  14. #include <linux/nvmem-consumer.h>
  15. #include <linux/of.h>
  16. #include <linux/of_address.h>
  17. #include <linux/of_device.h>
  18. #include <linux/platform_device.h>
  19. #include <linux/slab.h>
  20. #include <linux/io.h>
  21. #include <linux/thermal.h>
  22. #include <linux/reset.h>
  23. #include <linux/types.h>
  24. #include "thermal_hwmon.h"
  25. /* AUXADC Registers */
  26. #define AUXADC_CON1_SET_V 0x008
  27. #define AUXADC_CON1_CLR_V 0x00c
  28. #define AUXADC_CON2_V 0x010
  29. #define AUXADC_DATA(channel) (0x14 + (channel) * 4)
  30. #define APMIXED_SYS_TS_CON1 0x604
  31. /* Thermal Controller Registers */
  32. #define TEMP_MONCTL0 0x000
  33. #define TEMP_MONCTL1 0x004
  34. #define TEMP_MONCTL2 0x008
  35. #define TEMP_MONIDET0 0x014
  36. #define TEMP_MONIDET1 0x018
  37. #define TEMP_MSRCTL0 0x038
  38. #define TEMP_MSRCTL1 0x03c
  39. #define TEMP_AHBPOLL 0x040
  40. #define TEMP_AHBTO 0x044
  41. #define TEMP_ADCPNP0 0x048
  42. #define TEMP_ADCPNP1 0x04c
  43. #define TEMP_ADCPNP2 0x050
  44. #define TEMP_ADCPNP3 0x0b4
  45. #define TEMP_ADCMUX 0x054
  46. #define TEMP_ADCEN 0x060
  47. #define TEMP_PNPMUXADDR 0x064
  48. #define TEMP_ADCMUXADDR 0x068
  49. #define TEMP_ADCENADDR 0x074
  50. #define TEMP_ADCVALIDADDR 0x078
  51. #define TEMP_ADCVOLTADDR 0x07c
  52. #define TEMP_RDCTRL 0x080
  53. #define TEMP_ADCVALIDMASK 0x084
  54. #define TEMP_ADCVOLTAGESHIFT 0x088
  55. #define TEMP_ADCWRITECTRL 0x08c
  56. #define TEMP_MSR0 0x090
  57. #define TEMP_MSR1 0x094
  58. #define TEMP_MSR2 0x098
  59. #define TEMP_MSR3 0x0B8
  60. #define TEMP_SPARE0 0x0f0
  61. #define TEMP_ADCPNP0_1 0x148
  62. #define TEMP_ADCPNP1_1 0x14c
  63. #define TEMP_ADCPNP2_1 0x150
  64. #define TEMP_MSR0_1 0x190
  65. #define TEMP_MSR1_1 0x194
  66. #define TEMP_MSR2_1 0x198
  67. #define TEMP_ADCPNP3_1 0x1b4
  68. #define TEMP_MSR3_1 0x1B8
  69. #define PTPCORESEL 0x400
  70. #define TEMP_MONCTL1_PERIOD_UNIT(x) ((x) & 0x3ff)
  71. #define TEMP_MONCTL2_FILTER_INTERVAL(x) (((x) & 0x3ff) << 16)
  72. #define TEMP_MONCTL2_SENSOR_INTERVAL(x) ((x) & 0x3ff)
  73. #define TEMP_AHBPOLL_ADC_POLL_INTERVAL(x) (x)
  74. #define TEMP_ADCWRITECTRL_ADC_PNP_WRITE BIT(0)
  75. #define TEMP_ADCWRITECTRL_ADC_MUX_WRITE BIT(1)
  76. #define TEMP_ADCVALIDMASK_VALID_HIGH BIT(5)
  77. #define TEMP_ADCVALIDMASK_VALID_POS(bit) (bit)
  78. /* MT8173 thermal sensors */
  79. #define MT8173_TS1 0
  80. #define MT8173_TS2 1
  81. #define MT8173_TS3 2
  82. #define MT8173_TS4 3
  83. #define MT8173_TSABB 4
  84. /* AUXADC channel 11 is used for the temperature sensors */
  85. #define MT8173_TEMP_AUXADC_CHANNEL 11
  86. /* The total number of temperature sensors in the MT8173 */
  87. #define MT8173_NUM_SENSORS 5
  88. /* The number of banks in the MT8173 */
  89. #define MT8173_NUM_ZONES 4
  90. /* The number of sensing points per bank */
  91. #define MT8173_NUM_SENSORS_PER_ZONE 4
  92. /* The number of controller in the MT8173 */
  93. #define MT8173_NUM_CONTROLLER 1
  94. /* The calibration coefficient of sensor */
  95. #define MT8173_CALIBRATION 165
  96. /*
  97. * Layout of the fuses providing the calibration data
  98. * These macros could be used for MT8183, MT8173, MT2701, and MT2712.
  99. * MT8183 has 6 sensors and needs 6 VTS calibration data.
  100. * MT8173 has 5 sensors and needs 5 VTS calibration data.
  101. * MT2701 has 3 sensors and needs 3 VTS calibration data.
  102. * MT2712 has 4 sensors and needs 4 VTS calibration data.
  103. */
  104. #define CALIB_BUF0_VALID_V1 BIT(0)
  105. #define CALIB_BUF1_ADC_GE_V1(x) (((x) >> 22) & 0x3ff)
  106. #define CALIB_BUF0_VTS_TS1_V1(x) (((x) >> 17) & 0x1ff)
  107. #define CALIB_BUF0_VTS_TS2_V1(x) (((x) >> 8) & 0x1ff)
  108. #define CALIB_BUF1_VTS_TS3_V1(x) (((x) >> 0) & 0x1ff)
  109. #define CALIB_BUF2_VTS_TS4_V1(x) (((x) >> 23) & 0x1ff)
  110. #define CALIB_BUF2_VTS_TS5_V1(x) (((x) >> 5) & 0x1ff)
  111. #define CALIB_BUF2_VTS_TSABB_V1(x) (((x) >> 14) & 0x1ff)
  112. #define CALIB_BUF0_DEGC_CALI_V1(x) (((x) >> 1) & 0x3f)
  113. #define CALIB_BUF0_O_SLOPE_V1(x) (((x) >> 26) & 0x3f)
  114. #define CALIB_BUF0_O_SLOPE_SIGN_V1(x) (((x) >> 7) & 0x1)
  115. #define CALIB_BUF1_ID_V1(x) (((x) >> 9) & 0x1)
  116. /*
  117. * Layout of the fuses providing the calibration data
  118. * These macros could be used for MT7622.
  119. */
  120. #define CALIB_BUF0_ADC_OE_V2(x) (((x) >> 22) & 0x3ff)
  121. #define CALIB_BUF0_ADC_GE_V2(x) (((x) >> 12) & 0x3ff)
  122. #define CALIB_BUF0_DEGC_CALI_V2(x) (((x) >> 6) & 0x3f)
  123. #define CALIB_BUF0_O_SLOPE_V2(x) (((x) >> 0) & 0x3f)
  124. #define CALIB_BUF1_VTS_TS1_V2(x) (((x) >> 23) & 0x1ff)
  125. #define CALIB_BUF1_VTS_TS2_V2(x) (((x) >> 14) & 0x1ff)
  126. #define CALIB_BUF1_VTS_TSABB_V2(x) (((x) >> 5) & 0x1ff)
  127. #define CALIB_BUF1_VALID_V2(x) (((x) >> 4) & 0x1)
  128. #define CALIB_BUF1_O_SLOPE_SIGN_V2(x) (((x) >> 3) & 0x1)
  129. enum {
  130. VTS1,
  131. VTS2,
  132. VTS3,
  133. VTS4,
  134. VTS5,
  135. VTSABB,
  136. MAX_NUM_VTS,
  137. };
  138. enum mtk_thermal_version {
  139. MTK_THERMAL_V1 = 1,
  140. MTK_THERMAL_V2,
  141. };
  142. /* MT2701 thermal sensors */
  143. #define MT2701_TS1 0
  144. #define MT2701_TS2 1
  145. #define MT2701_TSABB 2
  146. /* AUXADC channel 11 is used for the temperature sensors */
  147. #define MT2701_TEMP_AUXADC_CHANNEL 11
  148. /* The total number of temperature sensors in the MT2701 */
  149. #define MT2701_NUM_SENSORS 3
  150. /* The number of sensing points per bank */
  151. #define MT2701_NUM_SENSORS_PER_ZONE 3
  152. /* The number of controller in the MT2701 */
  153. #define MT2701_NUM_CONTROLLER 1
  154. /* The calibration coefficient of sensor */
  155. #define MT2701_CALIBRATION 165
  156. /* MT2712 thermal sensors */
  157. #define MT2712_TS1 0
  158. #define MT2712_TS2 1
  159. #define MT2712_TS3 2
  160. #define MT2712_TS4 3
  161. /* AUXADC channel 11 is used for the temperature sensors */
  162. #define MT2712_TEMP_AUXADC_CHANNEL 11
  163. /* The total number of temperature sensors in the MT2712 */
  164. #define MT2712_NUM_SENSORS 4
  165. /* The number of sensing points per bank */
  166. #define MT2712_NUM_SENSORS_PER_ZONE 4
  167. /* The number of controller in the MT2712 */
  168. #define MT2712_NUM_CONTROLLER 1
  169. /* The calibration coefficient of sensor */
  170. #define MT2712_CALIBRATION 165
  171. #define MT7622_TEMP_AUXADC_CHANNEL 11
  172. #define MT7622_NUM_SENSORS 1
  173. #define MT7622_NUM_ZONES 1
  174. #define MT7622_NUM_SENSORS_PER_ZONE 1
  175. #define MT7622_TS1 0
  176. #define MT7622_NUM_CONTROLLER 1
  177. /* The maximum number of banks */
  178. #define MAX_NUM_ZONES 8
  179. /* The calibration coefficient of sensor */
  180. #define MT7622_CALIBRATION 165
  181. /* MT8183 thermal sensors */
  182. #define MT8183_TS1 0
  183. #define MT8183_TS2 1
  184. #define MT8183_TS3 2
  185. #define MT8183_TS4 3
  186. #define MT8183_TS5 4
  187. #define MT8183_TSABB 5
  188. /* AUXADC channel is used for the temperature sensors */
  189. #define MT8183_TEMP_AUXADC_CHANNEL 11
  190. /* The total number of temperature sensors in the MT8183 */
  191. #define MT8183_NUM_SENSORS 6
  192. /* The number of banks in the MT8183 */
  193. #define MT8183_NUM_ZONES 1
  194. /* The number of sensing points per bank */
  195. #define MT8183_NUM_SENSORS_PER_ZONE 6
  196. /* The number of controller in the MT8183 */
  197. #define MT8183_NUM_CONTROLLER 2
  198. /* The calibration coefficient of sensor */
  199. #define MT8183_CALIBRATION 153
  200. struct mtk_thermal;
  201. struct thermal_bank_cfg {
  202. unsigned int num_sensors;
  203. const int *sensors;
  204. };
  205. struct mtk_thermal_bank {
  206. struct mtk_thermal *mt;
  207. int id;
  208. };
  209. struct mtk_thermal_data {
  210. s32 num_banks;
  211. s32 num_sensors;
  212. s32 auxadc_channel;
  213. const int *vts_index;
  214. const int *sensor_mux_values;
  215. const int *msr;
  216. const int *adcpnp;
  217. const int cali_val;
  218. const int num_controller;
  219. const int *controller_offset;
  220. bool need_switch_bank;
  221. struct thermal_bank_cfg bank_data[MAX_NUM_ZONES];
  222. enum mtk_thermal_version version;
  223. };
  224. struct mtk_thermal {
  225. struct device *dev;
  226. void __iomem *thermal_base;
  227. struct clk *clk_peri_therm;
  228. struct clk *clk_auxadc;
  229. /* lock: for getting and putting banks */
  230. struct mutex lock;
  231. /* Calibration values */
  232. s32 adc_ge;
  233. s32 adc_oe;
  234. s32 degc_cali;
  235. s32 o_slope;
  236. s32 o_slope_sign;
  237. s32 vts[MAX_NUM_VTS];
  238. const struct mtk_thermal_data *conf;
  239. struct mtk_thermal_bank banks[MAX_NUM_ZONES];
  240. };
  241. /* MT8183 thermal sensor data */
  242. static const int mt8183_bank_data[MT8183_NUM_SENSORS] = {
  243. MT8183_TS1, MT8183_TS2, MT8183_TS3, MT8183_TS4, MT8183_TS5, MT8183_TSABB
  244. };
  245. static const int mt8183_msr[MT8183_NUM_SENSORS_PER_ZONE] = {
  246. TEMP_MSR0_1, TEMP_MSR1_1, TEMP_MSR2_1, TEMP_MSR1, TEMP_MSR0, TEMP_MSR3_1
  247. };
  248. static const int mt8183_adcpnp[MT8183_NUM_SENSORS_PER_ZONE] = {
  249. TEMP_ADCPNP0_1, TEMP_ADCPNP1_1, TEMP_ADCPNP2_1,
  250. TEMP_ADCPNP1, TEMP_ADCPNP0, TEMP_ADCPNP3_1
  251. };
  252. static const int mt8183_mux_values[MT8183_NUM_SENSORS] = { 0, 1, 2, 3, 4, 0 };
  253. static const int mt8183_tc_offset[MT8183_NUM_CONTROLLER] = {0x0, 0x100};
  254. static const int mt8183_vts_index[MT8183_NUM_SENSORS] = {
  255. VTS1, VTS2, VTS3, VTS4, VTS5, VTSABB
  256. };
  257. /* MT8173 thermal sensor data */
  258. static const int mt8173_bank_data[MT8173_NUM_ZONES][3] = {
  259. { MT8173_TS2, MT8173_TS3 },
  260. { MT8173_TS2, MT8173_TS4 },
  261. { MT8173_TS1, MT8173_TS2, MT8173_TSABB },
  262. { MT8173_TS2 },
  263. };
  264. static const int mt8173_msr[MT8173_NUM_SENSORS_PER_ZONE] = {
  265. TEMP_MSR0, TEMP_MSR1, TEMP_MSR2, TEMP_MSR3
  266. };
  267. static const int mt8173_adcpnp[MT8173_NUM_SENSORS_PER_ZONE] = {
  268. TEMP_ADCPNP0, TEMP_ADCPNP1, TEMP_ADCPNP2, TEMP_ADCPNP3
  269. };
  270. static const int mt8173_mux_values[MT8173_NUM_SENSORS] = { 0, 1, 2, 3, 16 };
  271. static const int mt8173_tc_offset[MT8173_NUM_CONTROLLER] = { 0x0, };
  272. static const int mt8173_vts_index[MT8173_NUM_SENSORS] = {
  273. VTS1, VTS2, VTS3, VTS4, VTSABB
  274. };
  275. /* MT2701 thermal sensor data */
  276. static const int mt2701_bank_data[MT2701_NUM_SENSORS] = {
  277. MT2701_TS1, MT2701_TS2, MT2701_TSABB
  278. };
  279. static const int mt2701_msr[MT2701_NUM_SENSORS_PER_ZONE] = {
  280. TEMP_MSR0, TEMP_MSR1, TEMP_MSR2
  281. };
  282. static const int mt2701_adcpnp[MT2701_NUM_SENSORS_PER_ZONE] = {
  283. TEMP_ADCPNP0, TEMP_ADCPNP1, TEMP_ADCPNP2
  284. };
  285. static const int mt2701_mux_values[MT2701_NUM_SENSORS] = { 0, 1, 16 };
  286. static const int mt2701_tc_offset[MT2701_NUM_CONTROLLER] = { 0x0, };
  287. static const int mt2701_vts_index[MT2701_NUM_SENSORS] = {
  288. VTS1, VTS2, VTS3
  289. };
  290. /* MT2712 thermal sensor data */
  291. static const int mt2712_bank_data[MT2712_NUM_SENSORS] = {
  292. MT2712_TS1, MT2712_TS2, MT2712_TS3, MT2712_TS4
  293. };
  294. static const int mt2712_msr[MT2712_NUM_SENSORS_PER_ZONE] = {
  295. TEMP_MSR0, TEMP_MSR1, TEMP_MSR2, TEMP_MSR3
  296. };
  297. static const int mt2712_adcpnp[MT2712_NUM_SENSORS_PER_ZONE] = {
  298. TEMP_ADCPNP0, TEMP_ADCPNP1, TEMP_ADCPNP2, TEMP_ADCPNP3
  299. };
  300. static const int mt2712_mux_values[MT2712_NUM_SENSORS] = { 0, 1, 2, 3 };
  301. static const int mt2712_tc_offset[MT2712_NUM_CONTROLLER] = { 0x0, };
  302. static const int mt2712_vts_index[MT2712_NUM_SENSORS] = {
  303. VTS1, VTS2, VTS3, VTS4
  304. };
  305. /* MT7622 thermal sensor data */
  306. static const int mt7622_bank_data[MT7622_NUM_SENSORS] = { MT7622_TS1, };
  307. static const int mt7622_msr[MT7622_NUM_SENSORS_PER_ZONE] = { TEMP_MSR0, };
  308. static const int mt7622_adcpnp[MT7622_NUM_SENSORS_PER_ZONE] = { TEMP_ADCPNP0, };
  309. static const int mt7622_mux_values[MT7622_NUM_SENSORS] = { 0, };
  310. static const int mt7622_vts_index[MT7622_NUM_SENSORS] = { VTS1 };
  311. static const int mt7622_tc_offset[MT7622_NUM_CONTROLLER] = { 0x0, };
  312. /*
  313. * The MT8173 thermal controller has four banks. Each bank can read up to
  314. * four temperature sensors simultaneously. The MT8173 has a total of 5
  315. * temperature sensors. We use each bank to measure a certain area of the
  316. * SoC. Since TS2 is located centrally in the SoC it is influenced by multiple
  317. * areas, hence is used in different banks.
  318. *
  319. * The thermal core only gets the maximum temperature of all banks, so
  320. * the bank concept wouldn't be necessary here. However, the SVS (Smart
  321. * Voltage Scaling) unit makes its decisions based on the same bank
  322. * data, and this indeed needs the temperatures of the individual banks
  323. * for making better decisions.
  324. */
  325. static const struct mtk_thermal_data mt8173_thermal_data = {
  326. .auxadc_channel = MT8173_TEMP_AUXADC_CHANNEL,
  327. .num_banks = MT8173_NUM_ZONES,
  328. .num_sensors = MT8173_NUM_SENSORS,
  329. .vts_index = mt8173_vts_index,
  330. .cali_val = MT8173_CALIBRATION,
  331. .num_controller = MT8173_NUM_CONTROLLER,
  332. .controller_offset = mt8173_tc_offset,
  333. .need_switch_bank = true,
  334. .bank_data = {
  335. {
  336. .num_sensors = 2,
  337. .sensors = mt8173_bank_data[0],
  338. }, {
  339. .num_sensors = 2,
  340. .sensors = mt8173_bank_data[1],
  341. }, {
  342. .num_sensors = 3,
  343. .sensors = mt8173_bank_data[2],
  344. }, {
  345. .num_sensors = 1,
  346. .sensors = mt8173_bank_data[3],
  347. },
  348. },
  349. .msr = mt8173_msr,
  350. .adcpnp = mt8173_adcpnp,
  351. .sensor_mux_values = mt8173_mux_values,
  352. .version = MTK_THERMAL_V1,
  353. };
  354. /*
  355. * The MT2701 thermal controller has one bank, which can read up to
  356. * three temperature sensors simultaneously. The MT2701 has a total of 3
  357. * temperature sensors.
  358. *
  359. * The thermal core only gets the maximum temperature of this one bank,
  360. * so the bank concept wouldn't be necessary here. However, the SVS (Smart
  361. * Voltage Scaling) unit makes its decisions based on the same bank
  362. * data.
  363. */
  364. static const struct mtk_thermal_data mt2701_thermal_data = {
  365. .auxadc_channel = MT2701_TEMP_AUXADC_CHANNEL,
  366. .num_banks = 1,
  367. .num_sensors = MT2701_NUM_SENSORS,
  368. .vts_index = mt2701_vts_index,
  369. .cali_val = MT2701_CALIBRATION,
  370. .num_controller = MT2701_NUM_CONTROLLER,
  371. .controller_offset = mt2701_tc_offset,
  372. .need_switch_bank = true,
  373. .bank_data = {
  374. {
  375. .num_sensors = 3,
  376. .sensors = mt2701_bank_data,
  377. },
  378. },
  379. .msr = mt2701_msr,
  380. .adcpnp = mt2701_adcpnp,
  381. .sensor_mux_values = mt2701_mux_values,
  382. .version = MTK_THERMAL_V1,
  383. };
  384. /*
  385. * The MT2712 thermal controller has one bank, which can read up to
  386. * four temperature sensors simultaneously. The MT2712 has a total of 4
  387. * temperature sensors.
  388. *
  389. * The thermal core only gets the maximum temperature of this one bank,
  390. * so the bank concept wouldn't be necessary here. However, the SVS (Smart
  391. * Voltage Scaling) unit makes its decisions based on the same bank
  392. * data.
  393. */
  394. static const struct mtk_thermal_data mt2712_thermal_data = {
  395. .auxadc_channel = MT2712_TEMP_AUXADC_CHANNEL,
  396. .num_banks = 1,
  397. .num_sensors = MT2712_NUM_SENSORS,
  398. .vts_index = mt2712_vts_index,
  399. .cali_val = MT2712_CALIBRATION,
  400. .num_controller = MT2712_NUM_CONTROLLER,
  401. .controller_offset = mt2712_tc_offset,
  402. .need_switch_bank = true,
  403. .bank_data = {
  404. {
  405. .num_sensors = 4,
  406. .sensors = mt2712_bank_data,
  407. },
  408. },
  409. .msr = mt2712_msr,
  410. .adcpnp = mt2712_adcpnp,
  411. .sensor_mux_values = mt2712_mux_values,
  412. .version = MTK_THERMAL_V1,
  413. };
  414. /*
  415. * MT7622 have only one sensing point which uses AUXADC Channel 11 for raw data
  416. * access.
  417. */
  418. static const struct mtk_thermal_data mt7622_thermal_data = {
  419. .auxadc_channel = MT7622_TEMP_AUXADC_CHANNEL,
  420. .num_banks = MT7622_NUM_ZONES,
  421. .num_sensors = MT7622_NUM_SENSORS,
  422. .vts_index = mt7622_vts_index,
  423. .cali_val = MT7622_CALIBRATION,
  424. .num_controller = MT7622_NUM_CONTROLLER,
  425. .controller_offset = mt7622_tc_offset,
  426. .need_switch_bank = true,
  427. .bank_data = {
  428. {
  429. .num_sensors = 1,
  430. .sensors = mt7622_bank_data,
  431. },
  432. },
  433. .msr = mt7622_msr,
  434. .adcpnp = mt7622_adcpnp,
  435. .sensor_mux_values = mt7622_mux_values,
  436. .version = MTK_THERMAL_V2,
  437. };
  438. /*
  439. * The MT8183 thermal controller has one bank for the current SW framework.
  440. * The MT8183 has a total of 6 temperature sensors.
  441. * There are two thermal controller to control the six sensor.
  442. * The first one bind 2 sensor, and the other bind 4 sensors.
  443. * The thermal core only gets the maximum temperature of all sensor, so
  444. * the bank concept wouldn't be necessary here. However, the SVS (Smart
  445. * Voltage Scaling) unit makes its decisions based on the same bank
  446. * data, and this indeed needs the temperatures of the individual banks
  447. * for making better decisions.
  448. */
  449. static const struct mtk_thermal_data mt8183_thermal_data = {
  450. .auxadc_channel = MT8183_TEMP_AUXADC_CHANNEL,
  451. .num_banks = MT8183_NUM_ZONES,
  452. .num_sensors = MT8183_NUM_SENSORS,
  453. .vts_index = mt8183_vts_index,
  454. .cali_val = MT8183_CALIBRATION,
  455. .num_controller = MT8183_NUM_CONTROLLER,
  456. .controller_offset = mt8183_tc_offset,
  457. .need_switch_bank = false,
  458. .bank_data = {
  459. {
  460. .num_sensors = 6,
  461. .sensors = mt8183_bank_data,
  462. },
  463. },
  464. .msr = mt8183_msr,
  465. .adcpnp = mt8183_adcpnp,
  466. .sensor_mux_values = mt8183_mux_values,
  467. .version = MTK_THERMAL_V1,
  468. };
  469. /**
  470. * raw_to_mcelsius - convert a raw ADC value to mcelsius
  471. * @mt: The thermal controller
  472. * @sensno: sensor number
  473. * @raw: raw ADC value
  474. *
  475. * This converts the raw ADC value to mcelsius using the SoC specific
  476. * calibration constants
  477. */
  478. static int raw_to_mcelsius_v1(struct mtk_thermal *mt, int sensno, s32 raw)
  479. {
  480. s32 tmp;
  481. raw &= 0xfff;
  482. tmp = 203450520 << 3;
  483. tmp /= mt->conf->cali_val + mt->o_slope;
  484. tmp /= 10000 + mt->adc_ge;
  485. tmp *= raw - mt->vts[sensno] - 3350;
  486. tmp >>= 3;
  487. return mt->degc_cali * 500 - tmp;
  488. }
  489. static int raw_to_mcelsius_v2(struct mtk_thermal *mt, int sensno, s32 raw)
  490. {
  491. s32 format_1;
  492. s32 format_2;
  493. s32 g_oe;
  494. s32 g_gain;
  495. s32 g_x_roomt;
  496. s32 tmp;
  497. if (raw == 0)
  498. return 0;
  499. raw &= 0xfff;
  500. g_gain = 10000 + (((mt->adc_ge - 512) * 10000) >> 12);
  501. g_oe = mt->adc_oe - 512;
  502. format_1 = mt->vts[VTS2] + 3105 - g_oe;
  503. format_2 = (mt->degc_cali * 10) >> 1;
  504. g_x_roomt = (((format_1 * 10000) >> 12) * 10000) / g_gain;
  505. tmp = (((((raw - g_oe) * 10000) >> 12) * 10000) / g_gain) - g_x_roomt;
  506. tmp = tmp * 10 * 100 / 11;
  507. if (mt->o_slope_sign == 0)
  508. tmp = tmp / (165 - mt->o_slope);
  509. else
  510. tmp = tmp / (165 + mt->o_slope);
  511. return (format_2 - tmp) * 100;
  512. }
  513. /**
  514. * mtk_thermal_get_bank - get bank
  515. * @bank: The bank
  516. *
  517. * The bank registers are banked, we have to select a bank in the
  518. * PTPCORESEL register to access it.
  519. */
  520. static void mtk_thermal_get_bank(struct mtk_thermal_bank *bank)
  521. {
  522. struct mtk_thermal *mt = bank->mt;
  523. u32 val;
  524. if (mt->conf->need_switch_bank) {
  525. mutex_lock(&mt->lock);
  526. val = readl(mt->thermal_base + PTPCORESEL);
  527. val &= ~0xf;
  528. val |= bank->id;
  529. writel(val, mt->thermal_base + PTPCORESEL);
  530. }
  531. }
  532. /**
  533. * mtk_thermal_put_bank - release bank
  534. * @bank: The bank
  535. *
  536. * release a bank previously taken with mtk_thermal_get_bank,
  537. */
  538. static void mtk_thermal_put_bank(struct mtk_thermal_bank *bank)
  539. {
  540. struct mtk_thermal *mt = bank->mt;
  541. if (mt->conf->need_switch_bank)
  542. mutex_unlock(&mt->lock);
  543. }
  544. /**
  545. * mtk_thermal_bank_temperature - get the temperature of a bank
  546. * @bank: The bank
  547. *
  548. * The temperature of a bank is considered the maximum temperature of
  549. * the sensors associated to the bank.
  550. */
  551. static int mtk_thermal_bank_temperature(struct mtk_thermal_bank *bank)
  552. {
  553. struct mtk_thermal *mt = bank->mt;
  554. const struct mtk_thermal_data *conf = mt->conf;
  555. int i, temp = INT_MIN, max = INT_MIN;
  556. u32 raw;
  557. for (i = 0; i < conf->bank_data[bank->id].num_sensors; i++) {
  558. raw = readl(mt->thermal_base + conf->msr[i]);
  559. if (mt->conf->version == MTK_THERMAL_V1) {
  560. temp = raw_to_mcelsius_v1(
  561. mt, conf->bank_data[bank->id].sensors[i], raw);
  562. } else {
  563. temp = raw_to_mcelsius_v2(
  564. mt, conf->bank_data[bank->id].sensors[i], raw);
  565. }
  566. /*
  567. * The first read of a sensor often contains very high bogus
  568. * temperature value. Filter these out so that the system does
  569. * not immediately shut down.
  570. */
  571. if (temp > 200000)
  572. temp = 0;
  573. if (temp > max)
  574. max = temp;
  575. }
  576. return max;
  577. }
  578. static int mtk_read_temp(struct thermal_zone_device *tz, int *temperature)
  579. {
  580. struct mtk_thermal *mt = tz->devdata;
  581. int i;
  582. int tempmax = INT_MIN;
  583. for (i = 0; i < mt->conf->num_banks; i++) {
  584. struct mtk_thermal_bank *bank = &mt->banks[i];
  585. mtk_thermal_get_bank(bank);
  586. tempmax = max(tempmax, mtk_thermal_bank_temperature(bank));
  587. mtk_thermal_put_bank(bank);
  588. }
  589. *temperature = tempmax;
  590. return 0;
  591. }
  592. static const struct thermal_zone_device_ops mtk_thermal_ops = {
  593. .get_temp = mtk_read_temp,
  594. };
  595. static void mtk_thermal_init_bank(struct mtk_thermal *mt, int num,
  596. u32 apmixed_phys_base, u32 auxadc_phys_base,
  597. int ctrl_id)
  598. {
  599. struct mtk_thermal_bank *bank = &mt->banks[num];
  600. const struct mtk_thermal_data *conf = mt->conf;
  601. int i;
  602. int offset = mt->conf->controller_offset[ctrl_id];
  603. void __iomem *controller_base = mt->thermal_base + offset;
  604. bank->id = num;
  605. bank->mt = mt;
  606. mtk_thermal_get_bank(bank);
  607. /* bus clock 66M counting unit is 12 * 15.15ns * 256 = 46.540us */
  608. writel(TEMP_MONCTL1_PERIOD_UNIT(12), controller_base + TEMP_MONCTL1);
  609. /*
  610. * filt interval is 1 * 46.540us = 46.54us,
  611. * sen interval is 429 * 46.540us = 19.96ms
  612. */
  613. writel(TEMP_MONCTL2_FILTER_INTERVAL(1) |
  614. TEMP_MONCTL2_SENSOR_INTERVAL(429),
  615. controller_base + TEMP_MONCTL2);
  616. /* poll is set to 10u */
  617. writel(TEMP_AHBPOLL_ADC_POLL_INTERVAL(768),
  618. controller_base + TEMP_AHBPOLL);
  619. /* temperature sampling control, 1 sample */
  620. writel(0x0, controller_base + TEMP_MSRCTL0);
  621. /* exceed this polling time, IRQ would be inserted */
  622. writel(0xffffffff, controller_base + TEMP_AHBTO);
  623. /* number of interrupts per event, 1 is enough */
  624. writel(0x0, controller_base + TEMP_MONIDET0);
  625. writel(0x0, controller_base + TEMP_MONIDET1);
  626. /*
  627. * The MT8173 thermal controller does not have its own ADC. Instead it
  628. * uses AHB bus accesses to control the AUXADC. To do this the thermal
  629. * controller has to be programmed with the physical addresses of the
  630. * AUXADC registers and with the various bit positions in the AUXADC.
  631. * Also the thermal controller controls a mux in the APMIXEDSYS register
  632. * space.
  633. */
  634. /*
  635. * this value will be stored to TEMP_PNPMUXADDR (TEMP_SPARE0)
  636. * automatically by hw
  637. */
  638. writel(BIT(conf->auxadc_channel), controller_base + TEMP_ADCMUX);
  639. /* AHB address for auxadc mux selection */
  640. writel(auxadc_phys_base + AUXADC_CON1_CLR_V,
  641. controller_base + TEMP_ADCMUXADDR);
  642. if (mt->conf->version == MTK_THERMAL_V1) {
  643. /* AHB address for pnp sensor mux selection */
  644. writel(apmixed_phys_base + APMIXED_SYS_TS_CON1,
  645. controller_base + TEMP_PNPMUXADDR);
  646. }
  647. /* AHB value for auxadc enable */
  648. writel(BIT(conf->auxadc_channel), controller_base + TEMP_ADCEN);
  649. /* AHB address for auxadc enable (channel 0 immediate mode selected) */
  650. writel(auxadc_phys_base + AUXADC_CON1_SET_V,
  651. controller_base + TEMP_ADCENADDR);
  652. /* AHB address for auxadc valid bit */
  653. writel(auxadc_phys_base + AUXADC_DATA(conf->auxadc_channel),
  654. controller_base + TEMP_ADCVALIDADDR);
  655. /* AHB address for auxadc voltage output */
  656. writel(auxadc_phys_base + AUXADC_DATA(conf->auxadc_channel),
  657. controller_base + TEMP_ADCVOLTADDR);
  658. /* read valid & voltage are at the same register */
  659. writel(0x0, controller_base + TEMP_RDCTRL);
  660. /* indicate where the valid bit is */
  661. writel(TEMP_ADCVALIDMASK_VALID_HIGH | TEMP_ADCVALIDMASK_VALID_POS(12),
  662. controller_base + TEMP_ADCVALIDMASK);
  663. /* no shift */
  664. writel(0x0, controller_base + TEMP_ADCVOLTAGESHIFT);
  665. /* enable auxadc mux write transaction */
  666. writel(TEMP_ADCWRITECTRL_ADC_MUX_WRITE,
  667. controller_base + TEMP_ADCWRITECTRL);
  668. for (i = 0; i < conf->bank_data[num].num_sensors; i++)
  669. writel(conf->sensor_mux_values[conf->bank_data[num].sensors[i]],
  670. mt->thermal_base + conf->adcpnp[i]);
  671. writel((1 << conf->bank_data[num].num_sensors) - 1,
  672. controller_base + TEMP_MONCTL0);
  673. writel(TEMP_ADCWRITECTRL_ADC_PNP_WRITE |
  674. TEMP_ADCWRITECTRL_ADC_MUX_WRITE,
  675. controller_base + TEMP_ADCWRITECTRL);
  676. mtk_thermal_put_bank(bank);
  677. }
  678. static u64 of_get_phys_base(struct device_node *np)
  679. {
  680. u64 size64;
  681. const __be32 *regaddr_p;
  682. regaddr_p = of_get_address(np, 0, &size64, NULL);
  683. if (!regaddr_p)
  684. return OF_BAD_ADDR;
  685. return of_translate_address(np, regaddr_p);
  686. }
  687. static int mtk_thermal_extract_efuse_v1(struct mtk_thermal *mt, u32 *buf)
  688. {
  689. int i;
  690. if (!(buf[0] & CALIB_BUF0_VALID_V1))
  691. return -EINVAL;
  692. mt->adc_ge = CALIB_BUF1_ADC_GE_V1(buf[1]);
  693. for (i = 0; i < mt->conf->num_sensors; i++) {
  694. switch (mt->conf->vts_index[i]) {
  695. case VTS1:
  696. mt->vts[VTS1] = CALIB_BUF0_VTS_TS1_V1(buf[0]);
  697. break;
  698. case VTS2:
  699. mt->vts[VTS2] = CALIB_BUF0_VTS_TS2_V1(buf[0]);
  700. break;
  701. case VTS3:
  702. mt->vts[VTS3] = CALIB_BUF1_VTS_TS3_V1(buf[1]);
  703. break;
  704. case VTS4:
  705. mt->vts[VTS4] = CALIB_BUF2_VTS_TS4_V1(buf[2]);
  706. break;
  707. case VTS5:
  708. mt->vts[VTS5] = CALIB_BUF2_VTS_TS5_V1(buf[2]);
  709. break;
  710. case VTSABB:
  711. mt->vts[VTSABB] =
  712. CALIB_BUF2_VTS_TSABB_V1(buf[2]);
  713. break;
  714. default:
  715. break;
  716. }
  717. }
  718. mt->degc_cali = CALIB_BUF0_DEGC_CALI_V1(buf[0]);
  719. if (CALIB_BUF1_ID_V1(buf[1]) &
  720. CALIB_BUF0_O_SLOPE_SIGN_V1(buf[0]))
  721. mt->o_slope = -CALIB_BUF0_O_SLOPE_V1(buf[0]);
  722. else
  723. mt->o_slope = CALIB_BUF0_O_SLOPE_V1(buf[0]);
  724. return 0;
  725. }
  726. static int mtk_thermal_extract_efuse_v2(struct mtk_thermal *mt, u32 *buf)
  727. {
  728. if (!CALIB_BUF1_VALID_V2(buf[1]))
  729. return -EINVAL;
  730. mt->adc_oe = CALIB_BUF0_ADC_OE_V2(buf[0]);
  731. mt->adc_ge = CALIB_BUF0_ADC_GE_V2(buf[0]);
  732. mt->degc_cali = CALIB_BUF0_DEGC_CALI_V2(buf[0]);
  733. mt->o_slope = CALIB_BUF0_O_SLOPE_V2(buf[0]);
  734. mt->vts[VTS1] = CALIB_BUF1_VTS_TS1_V2(buf[1]);
  735. mt->vts[VTS2] = CALIB_BUF1_VTS_TS2_V2(buf[1]);
  736. mt->vts[VTSABB] = CALIB_BUF1_VTS_TSABB_V2(buf[1]);
  737. mt->o_slope_sign = CALIB_BUF1_O_SLOPE_SIGN_V2(buf[1]);
  738. return 0;
  739. }
  740. static int mtk_thermal_get_calibration_data(struct device *dev,
  741. struct mtk_thermal *mt)
  742. {
  743. struct nvmem_cell *cell;
  744. u32 *buf;
  745. size_t len;
  746. int i, ret = 0;
  747. /* Start with default values */
  748. mt->adc_ge = 512;
  749. for (i = 0; i < mt->conf->num_sensors; i++)
  750. mt->vts[i] = 260;
  751. mt->degc_cali = 40;
  752. mt->o_slope = 0;
  753. cell = nvmem_cell_get(dev, "calibration-data");
  754. if (IS_ERR(cell)) {
  755. if (PTR_ERR(cell) == -EPROBE_DEFER)
  756. return PTR_ERR(cell);
  757. return 0;
  758. }
  759. buf = (u32 *)nvmem_cell_read(cell, &len);
  760. nvmem_cell_put(cell);
  761. if (IS_ERR(buf))
  762. return PTR_ERR(buf);
  763. if (len < 3 * sizeof(u32)) {
  764. dev_warn(dev, "invalid calibration data\n");
  765. ret = -EINVAL;
  766. goto out;
  767. }
  768. if (mt->conf->version == MTK_THERMAL_V1)
  769. ret = mtk_thermal_extract_efuse_v1(mt, buf);
  770. else
  771. ret = mtk_thermal_extract_efuse_v2(mt, buf);
  772. if (ret) {
  773. dev_info(dev, "Device not calibrated, using default calibration values\n");
  774. ret = 0;
  775. }
  776. out:
  777. kfree(buf);
  778. return ret;
  779. }
  780. static const struct of_device_id mtk_thermal_of_match[] = {
  781. {
  782. .compatible = "mediatek,mt8173-thermal",
  783. .data = (void *)&mt8173_thermal_data,
  784. },
  785. {
  786. .compatible = "mediatek,mt2701-thermal",
  787. .data = (void *)&mt2701_thermal_data,
  788. },
  789. {
  790. .compatible = "mediatek,mt2712-thermal",
  791. .data = (void *)&mt2712_thermal_data,
  792. },
  793. {
  794. .compatible = "mediatek,mt7622-thermal",
  795. .data = (void *)&mt7622_thermal_data,
  796. },
  797. {
  798. .compatible = "mediatek,mt8183-thermal",
  799. .data = (void *)&mt8183_thermal_data,
  800. }, {
  801. },
  802. };
  803. MODULE_DEVICE_TABLE(of, mtk_thermal_of_match);
  804. static void mtk_thermal_turn_on_buffer(void __iomem *apmixed_base)
  805. {
  806. int tmp;
  807. tmp = readl(apmixed_base + APMIXED_SYS_TS_CON1);
  808. tmp &= ~(0x37);
  809. tmp |= 0x1;
  810. writel(tmp, apmixed_base + APMIXED_SYS_TS_CON1);
  811. udelay(200);
  812. }
  813. static void mtk_thermal_release_periodic_ts(struct mtk_thermal *mt,
  814. void __iomem *auxadc_base)
  815. {
  816. int tmp;
  817. writel(0x800, auxadc_base + AUXADC_CON1_SET_V);
  818. writel(0x1, mt->thermal_base + TEMP_MONCTL0);
  819. tmp = readl(mt->thermal_base + TEMP_MSRCTL1);
  820. writel((tmp & (~0x10e)), mt->thermal_base + TEMP_MSRCTL1);
  821. }
  822. static int mtk_thermal_probe(struct platform_device *pdev)
  823. {
  824. int ret, i, ctrl_id;
  825. struct device_node *auxadc, *apmixedsys, *np = pdev->dev.of_node;
  826. struct mtk_thermal *mt;
  827. struct resource *res;
  828. u64 auxadc_phys_base, apmixed_phys_base;
  829. struct thermal_zone_device *tzdev;
  830. void __iomem *apmixed_base, *auxadc_base;
  831. mt = devm_kzalloc(&pdev->dev, sizeof(*mt), GFP_KERNEL);
  832. if (!mt)
  833. return -ENOMEM;
  834. mt->conf = of_device_get_match_data(&pdev->dev);
  835. mt->clk_peri_therm = devm_clk_get(&pdev->dev, "therm");
  836. if (IS_ERR(mt->clk_peri_therm))
  837. return PTR_ERR(mt->clk_peri_therm);
  838. mt->clk_auxadc = devm_clk_get(&pdev->dev, "auxadc");
  839. if (IS_ERR(mt->clk_auxadc))
  840. return PTR_ERR(mt->clk_auxadc);
  841. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  842. mt->thermal_base = devm_ioremap_resource(&pdev->dev, res);
  843. if (IS_ERR(mt->thermal_base))
  844. return PTR_ERR(mt->thermal_base);
  845. ret = mtk_thermal_get_calibration_data(&pdev->dev, mt);
  846. if (ret)
  847. return ret;
  848. mutex_init(&mt->lock);
  849. mt->dev = &pdev->dev;
  850. auxadc = of_parse_phandle(np, "mediatek,auxadc", 0);
  851. if (!auxadc) {
  852. dev_err(&pdev->dev, "missing auxadc node\n");
  853. return -ENODEV;
  854. }
  855. auxadc_base = of_iomap(auxadc, 0);
  856. auxadc_phys_base = of_get_phys_base(auxadc);
  857. of_node_put(auxadc);
  858. if (auxadc_phys_base == OF_BAD_ADDR) {
  859. dev_err(&pdev->dev, "Can't get auxadc phys address\n");
  860. return -EINVAL;
  861. }
  862. apmixedsys = of_parse_phandle(np, "mediatek,apmixedsys", 0);
  863. if (!apmixedsys) {
  864. dev_err(&pdev->dev, "missing apmixedsys node\n");
  865. return -ENODEV;
  866. }
  867. apmixed_base = of_iomap(apmixedsys, 0);
  868. apmixed_phys_base = of_get_phys_base(apmixedsys);
  869. of_node_put(apmixedsys);
  870. if (apmixed_phys_base == OF_BAD_ADDR) {
  871. dev_err(&pdev->dev, "Can't get auxadc phys address\n");
  872. return -EINVAL;
  873. }
  874. ret = device_reset_optional(&pdev->dev);
  875. if (ret)
  876. return ret;
  877. ret = clk_prepare_enable(mt->clk_auxadc);
  878. if (ret) {
  879. dev_err(&pdev->dev, "Can't enable auxadc clk: %d\n", ret);
  880. return ret;
  881. }
  882. ret = clk_prepare_enable(mt->clk_peri_therm);
  883. if (ret) {
  884. dev_err(&pdev->dev, "Can't enable peri clk: %d\n", ret);
  885. goto err_disable_clk_auxadc;
  886. }
  887. if (mt->conf->version == MTK_THERMAL_V2) {
  888. mtk_thermal_turn_on_buffer(apmixed_base);
  889. mtk_thermal_release_periodic_ts(mt, auxadc_base);
  890. }
  891. for (ctrl_id = 0; ctrl_id < mt->conf->num_controller ; ctrl_id++)
  892. for (i = 0; i < mt->conf->num_banks; i++)
  893. mtk_thermal_init_bank(mt, i, apmixed_phys_base,
  894. auxadc_phys_base, ctrl_id);
  895. platform_set_drvdata(pdev, mt);
  896. tzdev = devm_thermal_of_zone_register(&pdev->dev, 0, mt,
  897. &mtk_thermal_ops);
  898. if (IS_ERR(tzdev)) {
  899. ret = PTR_ERR(tzdev);
  900. goto err_disable_clk_peri_therm;
  901. }
  902. ret = devm_thermal_add_hwmon_sysfs(tzdev);
  903. if (ret)
  904. dev_warn(&pdev->dev, "error in thermal_add_hwmon_sysfs");
  905. return 0;
  906. err_disable_clk_peri_therm:
  907. clk_disable_unprepare(mt->clk_peri_therm);
  908. err_disable_clk_auxadc:
  909. clk_disable_unprepare(mt->clk_auxadc);
  910. return ret;
  911. }
  912. static int mtk_thermal_remove(struct platform_device *pdev)
  913. {
  914. struct mtk_thermal *mt = platform_get_drvdata(pdev);
  915. clk_disable_unprepare(mt->clk_peri_therm);
  916. clk_disable_unprepare(mt->clk_auxadc);
  917. return 0;
  918. }
  919. static struct platform_driver mtk_thermal_driver = {
  920. .probe = mtk_thermal_probe,
  921. .remove = mtk_thermal_remove,
  922. .driver = {
  923. .name = "mtk-thermal",
  924. .of_match_table = mtk_thermal_of_match,
  925. },
  926. };
  927. module_platform_driver(mtk_thermal_driver);
  928. MODULE_AUTHOR("Michael Kao <[email protected]>");
  929. MODULE_AUTHOR("Louis Yu <[email protected]>");
  930. MODULE_AUTHOR("Dawei Chien <[email protected]>");
  931. MODULE_AUTHOR("Sascha Hauer <[email protected]>");
  932. MODULE_AUTHOR("Hanyi Wu <[email protected]>");
  933. MODULE_DESCRIPTION("Mediatek thermal driver");
  934. MODULE_LICENSE("GPL v2");