diff options
author | Eduardo Valentin <edubezval@gmail.com> | 2016-02-18 10:43:57 -0500 |
---|---|---|
committer | Eduardo Valentin <edubezval@gmail.com> | 2016-02-18 10:45:37 -0500 |
commit | eb4fc33eb2680750e6dc06bd40bf6a203e7ad312 (patch) | |
tree | 7373a2c82410ba5a0fe5f91444a2aebe92561f34 | |
parent | a92db1c8089e82b7524545d15b6d6ee6cee67965 (diff) |
thermal: small style cleanup in mtk_thermal
Remove all checkpatch.pl --strict errors, checks, and warnings.
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mediatek@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
-rw-r--r-- | drivers/thermal/mtk_thermal.c | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c index 589a138368ee..3d93b1c07cee 100644 --- a/drivers/thermal/mtk_thermal.c +++ b/drivers/thermal/mtk_thermal.c | |||
@@ -78,7 +78,7 @@ | |||
78 | 78 | ||
79 | #define TEMP_MONCTL1_PERIOD_UNIT(x) ((x) & 0x3ff) | 79 | #define TEMP_MONCTL1_PERIOD_UNIT(x) ((x) & 0x3ff) |
80 | 80 | ||
81 | #define TEMP_MONCTL2_FILTER_INTERVAL(x) (((x) & 0x3ff)) << 16 | 81 | #define TEMP_MONCTL2_FILTER_INTERVAL(x) (((x) & 0x3ff) << 16) |
82 | #define TEMP_MONCTL2_SENSOR_INTERVAL(x) ((x) & 0x3ff) | 82 | #define TEMP_MONCTL2_SENSOR_INTERVAL(x) ((x) & 0x3ff) |
83 | 83 | ||
84 | #define TEMP_AHBPOLL_ADC_POLL_INTERVAL(x) (x) | 84 | #define TEMP_AHBPOLL_ADC_POLL_INTERVAL(x) (x) |
@@ -108,15 +108,15 @@ | |||
108 | #define MT8173_NUM_SENSORS_PER_ZONE 4 | 108 | #define MT8173_NUM_SENSORS_PER_ZONE 4 |
109 | 109 | ||
110 | /* Layout of the fuses providing the calibration data */ | 110 | /* Layout of the fuses providing the calibration data */ |
111 | #define MT8173_CALIB_BUF0_VALID (1 << 0) | 111 | #define MT8173_CALIB_BUF0_VALID BIT(0) |
112 | #define MT8173_CALIB_BUF1_ADC_GE(x) (((x) >> 22 ) & 0x3ff) | 112 | #define MT8173_CALIB_BUF1_ADC_GE(x) (((x) >> 22) & 0x3ff) |
113 | #define MT8173_CALIB_BUF0_VTS_TS1(x) (((x) >> 17 ) & 0x1ff) | 113 | #define MT8173_CALIB_BUF0_VTS_TS1(x) (((x) >> 17) & 0x1ff) |
114 | #define MT8173_CALIB_BUF0_VTS_TS2(x) (((x) >> 8 ) & 0x1ff) | 114 | #define MT8173_CALIB_BUF0_VTS_TS2(x) (((x) >> 8) & 0x1ff) |
115 | #define MT8173_CALIB_BUF1_VTS_TS3(x) (((x) >> 0 ) & 0x1ff) | 115 | #define MT8173_CALIB_BUF1_VTS_TS3(x) (((x) >> 0) & 0x1ff) |
116 | #define MT8173_CALIB_BUF2_VTS_TS4(x) (((x) >> 23 ) & 0x1ff) | 116 | #define MT8173_CALIB_BUF2_VTS_TS4(x) (((x) >> 23) & 0x1ff) |
117 | #define MT8173_CALIB_BUF2_VTS_TSABB(x) (((x) >> 14 ) & 0x1ff) | 117 | #define MT8173_CALIB_BUF2_VTS_TSABB(x) (((x) >> 14) & 0x1ff) |
118 | #define MT8173_CALIB_BUF0_DEGC_CALI(x) (((x) >> 1 ) & 0x3f) | 118 | #define MT8173_CALIB_BUF0_DEGC_CALI(x) (((x) >> 1) & 0x3f) |
119 | #define MT8173_CALIB_BUF0_O_SLOPE(x) (((x) >> 26 ) & 0x3f) | 119 | #define MT8173_CALIB_BUF0_O_SLOPE(x) (((x) >> 26) & 0x3f) |
120 | 120 | ||
121 | #define THERMAL_NAME "mtk-thermal" | 121 | #define THERMAL_NAME "mtk-thermal" |
122 | 122 | ||
@@ -136,6 +136,7 @@ struct mtk_thermal { | |||
136 | 136 | ||
137 | struct mtk_thermal_bank banks[MT8173_NUM_ZONES]; | 137 | struct mtk_thermal_bank banks[MT8173_NUM_ZONES]; |
138 | 138 | ||
139 | /* lock: for getting and putting banks */ | ||
139 | struct mutex lock; | 140 | struct mutex lock; |
140 | 141 | ||
141 | /* Calibration values */ | 142 | /* Calibration values */ |
@@ -271,11 +272,9 @@ static void mtk_thermal_put_bank(struct mtk_thermal_bank *bank) | |||
271 | static int mtk_thermal_bank_temperature(struct mtk_thermal_bank *bank) | 272 | static int mtk_thermal_bank_temperature(struct mtk_thermal_bank *bank) |
272 | { | 273 | { |
273 | struct mtk_thermal *mt = bank->mt; | 274 | struct mtk_thermal *mt = bank->mt; |
274 | int temp, i, max; | 275 | int i, temp = INT_MIN, max = INT_MIN; |
275 | u32 raw; | 276 | u32 raw; |
276 | 277 | ||
277 | temp = max = INT_MIN; | ||
278 | |||
279 | for (i = 0; i < bank_data[bank->id].num_sensors; i++) { | 278 | for (i = 0; i < bank_data[bank->id].num_sensors; i++) { |
280 | raw = readl(mt->thermal_base + sensing_points[i].msr); | 279 | raw = readl(mt->thermal_base + sensing_points[i].msr); |
281 | 280 | ||
@@ -322,7 +321,7 @@ static const struct thermal_zone_of_device_ops mtk_thermal_ops = { | |||
322 | }; | 321 | }; |
323 | 322 | ||
324 | static void mtk_thermal_init_bank(struct mtk_thermal *mt, int num, | 323 | static void mtk_thermal_init_bank(struct mtk_thermal *mt, int num, |
325 | u32 apmixed_phys_base, u32 auxadc_phys_base) | 324 | u32 apmixed_phys_base, u32 auxadc_phys_base) |
326 | { | 325 | { |
327 | struct mtk_thermal_bank *bank = &mt->banks[num]; | 326 | struct mtk_thermal_bank *bank = &mt->banks[num]; |
328 | const struct mtk_thermal_bank_cfg *cfg = &bank_data[num]; | 327 | const struct mtk_thermal_bank_cfg *cfg = &bank_data[num]; |
@@ -346,7 +345,7 @@ static void mtk_thermal_init_bank(struct mtk_thermal *mt, int num, | |||
346 | 345 | ||
347 | /* poll is set to 10u */ | 346 | /* poll is set to 10u */ |
348 | writel(TEMP_AHBPOLL_ADC_POLL_INTERVAL(768), | 347 | writel(TEMP_AHBPOLL_ADC_POLL_INTERVAL(768), |
349 | mt->thermal_base + TEMP_AHBPOLL); | 348 | mt->thermal_base + TEMP_AHBPOLL); |
350 | 349 | ||
351 | /* temperature sampling control, 1 sample */ | 350 | /* temperature sampling control, 1 sample */ |
352 | writel(0x0, mt->thermal_base + TEMP_MSRCTL0); | 351 | writel(0x0, mt->thermal_base + TEMP_MSRCTL0); |
@@ -375,49 +374,50 @@ static void mtk_thermal_init_bank(struct mtk_thermal *mt, int num, | |||
375 | 374 | ||
376 | /* AHB address for auxadc mux selection */ | 375 | /* AHB address for auxadc mux selection */ |
377 | writel(auxadc_phys_base + AUXADC_CON1_CLR_V, | 376 | writel(auxadc_phys_base + AUXADC_CON1_CLR_V, |
378 | mt->thermal_base + TEMP_ADCMUXADDR); | 377 | mt->thermal_base + TEMP_ADCMUXADDR); |
379 | 378 | ||
380 | /* AHB address for pnp sensor mux selection */ | 379 | /* AHB address for pnp sensor mux selection */ |
381 | writel(apmixed_phys_base + APMIXED_SYS_TS_CON1, | 380 | writel(apmixed_phys_base + APMIXED_SYS_TS_CON1, |
382 | mt->thermal_base + TEMP_PNPMUXADDR); | 381 | mt->thermal_base + TEMP_PNPMUXADDR); |
383 | 382 | ||
384 | /* AHB value for auxadc enable */ | 383 | /* AHB value for auxadc enable */ |
385 | writel(BIT(MT8173_TEMP_AUXADC_CHANNEL), mt->thermal_base + TEMP_ADCEN); | 384 | writel(BIT(MT8173_TEMP_AUXADC_CHANNEL), mt->thermal_base + TEMP_ADCEN); |
386 | 385 | ||
387 | /* AHB address for auxadc enable (channel 0 immediate mode selected) */ | 386 | /* AHB address for auxadc enable (channel 0 immediate mode selected) */ |
388 | writel(auxadc_phys_base + AUXADC_CON1_SET_V, | 387 | writel(auxadc_phys_base + AUXADC_CON1_SET_V, |
389 | mt->thermal_base + TEMP_ADCENADDR); | 388 | mt->thermal_base + TEMP_ADCENADDR); |
390 | 389 | ||
391 | /* AHB address for auxadc valid bit */ | 390 | /* AHB address for auxadc valid bit */ |
392 | writel(auxadc_phys_base + AUXADC_DATA(MT8173_TEMP_AUXADC_CHANNEL), | 391 | writel(auxadc_phys_base + AUXADC_DATA(MT8173_TEMP_AUXADC_CHANNEL), |
393 | mt->thermal_base + TEMP_ADCVALIDADDR); | 392 | mt->thermal_base + TEMP_ADCVALIDADDR); |
394 | 393 | ||
395 | /* AHB address for auxadc voltage output */ | 394 | /* AHB address for auxadc voltage output */ |
396 | writel(auxadc_phys_base + AUXADC_DATA(MT8173_TEMP_AUXADC_CHANNEL), | 395 | writel(auxadc_phys_base + AUXADC_DATA(MT8173_TEMP_AUXADC_CHANNEL), |
397 | mt->thermal_base + TEMP_ADCVOLTADDR); | 396 | mt->thermal_base + TEMP_ADCVOLTADDR); |
398 | 397 | ||
399 | /* read valid & voltage are at the same register */ | 398 | /* read valid & voltage are at the same register */ |
400 | writel(0x0, mt->thermal_base + TEMP_RDCTRL); | 399 | writel(0x0, mt->thermal_base + TEMP_RDCTRL); |
401 | 400 | ||
402 | /* indicate where the valid bit is */ | 401 | /* indicate where the valid bit is */ |
403 | writel(TEMP_ADCVALIDMASK_VALID_HIGH | TEMP_ADCVALIDMASK_VALID_POS(12), | 402 | writel(TEMP_ADCVALIDMASK_VALID_HIGH | TEMP_ADCVALIDMASK_VALID_POS(12), |
404 | mt->thermal_base + TEMP_ADCVALIDMASK); | 403 | mt->thermal_base + TEMP_ADCVALIDMASK); |
405 | 404 | ||
406 | /* no shift */ | 405 | /* no shift */ |
407 | writel(0x0, mt->thermal_base + TEMP_ADCVOLTAGESHIFT); | 406 | writel(0x0, mt->thermal_base + TEMP_ADCVOLTAGESHIFT); |
408 | 407 | ||
409 | /* enable auxadc mux write transaction */ | 408 | /* enable auxadc mux write transaction */ |
410 | writel(TEMP_ADCWRITECTRL_ADC_MUX_WRITE, | 409 | writel(TEMP_ADCWRITECTRL_ADC_MUX_WRITE, |
411 | mt->thermal_base + TEMP_ADCWRITECTRL); | 410 | mt->thermal_base + TEMP_ADCWRITECTRL); |
412 | 411 | ||
413 | for (i = 0; i < cfg->num_sensors; i++) | 412 | for (i = 0; i < cfg->num_sensors; i++) |
414 | writel(sensor_mux_values[cfg->sensors[i]], | 413 | writel(sensor_mux_values[cfg->sensors[i]], |
415 | mt->thermal_base + sensing_points[i].adcpnp); | 414 | mt->thermal_base + sensing_points[i].adcpnp); |
416 | 415 | ||
417 | writel((1 << cfg->num_sensors) - 1, mt->thermal_base + TEMP_MONCTL0); | 416 | writel((1 << cfg->num_sensors) - 1, mt->thermal_base + TEMP_MONCTL0); |
418 | 417 | ||
419 | writel(TEMP_ADCWRITECTRL_ADC_PNP_WRITE | TEMP_ADCWRITECTRL_ADC_MUX_WRITE, | 418 | writel(TEMP_ADCWRITECTRL_ADC_PNP_WRITE | |
420 | mt->thermal_base + TEMP_ADCWRITECTRL); | 419 | TEMP_ADCWRITECTRL_ADC_MUX_WRITE, |
420 | mt->thermal_base + TEMP_ADCWRITECTRL); | ||
421 | 421 | ||
422 | mtk_thermal_put_bank(bank); | 422 | mtk_thermal_put_bank(bank); |
423 | } | 423 | } |
@@ -434,7 +434,8 @@ static u64 of_get_phys_base(struct device_node *np) | |||
434 | return of_translate_address(np, regaddr_p); | 434 | return of_translate_address(np, regaddr_p); |
435 | } | 435 | } |
436 | 436 | ||
437 | static int mtk_thermal_get_calibration_data(struct device *dev, struct mtk_thermal *mt) | 437 | static int mtk_thermal_get_calibration_data(struct device *dev, |
438 | struct mtk_thermal *mt) | ||
438 | { | 439 | { |
439 | struct nvmem_cell *cell; | 440 | struct nvmem_cell *cell; |
440 | u32 *buf; | 441 | u32 *buf; |
@@ -567,7 +568,8 @@ static int mtk_thermal_probe(struct platform_device *pdev) | |||
567 | } | 568 | } |
568 | 569 | ||
569 | for (i = 0; i < MT8173_NUM_ZONES; i++) | 570 | for (i = 0; i < MT8173_NUM_ZONES; i++) |
570 | mtk_thermal_init_bank(mt, i, apmixed_phys_base, auxadc_phys_base); | 571 | mtk_thermal_init_bank(mt, i, apmixed_phys_base, |
572 | auxadc_phys_base); | ||
571 | 573 | ||
572 | platform_set_drvdata(pdev, mt); | 574 | platform_set_drvdata(pdev, mt); |
573 | 575 | ||