diff options
author | Caesar Wang <wxt@rock-chips.com> | 2015-12-03 03:48:43 -0500 |
---|---|---|
committer | Eduardo Valentin <edubezval@gmail.com> | 2016-01-06 21:06:38 -0500 |
commit | b0d70338bca22cb14367042a9d5cead116e7f2d9 (patch) | |
tree | 5dd4a8bb61b1f5a5249dcc1b59fae192401512b6 /drivers/thermal/rockchip_thermal.c | |
parent | 7b02a5e782fa151a610c455ac06e5a998e9cb3f3 (diff) |
thermal: rockchip: Support the RK3399 SoCs in thermal driver
The RK3399 SoCs have two Temperature Sensors, channel 0 is for CPU.
channel 1 is for GPU.
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Diffstat (limited to 'drivers/thermal/rockchip_thermal.c')
-rw-r--r-- | drivers/thermal/rockchip_thermal.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c index e118e42c0326..b58e3fb9b311 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c | |||
@@ -292,6 +292,44 @@ static const struct tsadc_table v3_code_table[] = { | |||
292 | {TSADCV3_DATA_MASK, 125000}, | 292 | {TSADCV3_DATA_MASK, 125000}, |
293 | }; | 293 | }; |
294 | 294 | ||
295 | static const struct tsadc_table v4_code_table[] = { | ||
296 | {TSADCV3_DATA_MASK, -40000}, | ||
297 | {431, -40000}, | ||
298 | {426, -35000}, | ||
299 | {421, -30000}, | ||
300 | {415, -25000}, | ||
301 | {410, -20000}, | ||
302 | {405, -15000}, | ||
303 | {399, -10000}, | ||
304 | {394, -5000}, | ||
305 | {389, 0}, | ||
306 | {383, 5000}, | ||
307 | {378, 10000}, | ||
308 | {373, 15000}, | ||
309 | {367, 20000}, | ||
310 | {362, 25000}, | ||
311 | {357, 30000}, | ||
312 | {351, 35000}, | ||
313 | {346, 40000}, | ||
314 | {340, 45000}, | ||
315 | {335, 50000}, | ||
316 | {330, 55000}, | ||
317 | {324, 60000}, | ||
318 | {319, 65000}, | ||
319 | {313, 70000}, | ||
320 | {308, 75000}, | ||
321 | {302, 80000}, | ||
322 | {297, 85000}, | ||
323 | {291, 90000}, | ||
324 | {286, 95000}, | ||
325 | {281, 100000}, | ||
326 | {275, 105000}, | ||
327 | {270, 110000}, | ||
328 | {264, 115000}, | ||
329 | {259, 120000}, | ||
330 | {253, 125000}, | ||
331 | }; | ||
332 | |||
295 | static u32 rk_tsadcv2_temp_to_code(struct chip_tsadc_table table, | 333 | static u32 rk_tsadcv2_temp_to_code(struct chip_tsadc_table table, |
296 | int temp) | 334 | int temp) |
297 | { | 335 | { |
@@ -555,6 +593,30 @@ static const struct rockchip_tsadc_chip rk3368_tsadc_data = { | |||
555 | }, | 593 | }, |
556 | }; | 594 | }; |
557 | 595 | ||
596 | static const struct rockchip_tsadc_chip rk3399_tsadc_data = { | ||
597 | .chn_id[SENSOR_CPU] = 0, /* cpu sensor is channel 0 */ | ||
598 | .chn_id[SENSOR_GPU] = 1, /* gpu sensor is channel 1 */ | ||
599 | .chn_num = 2, /* two channels for tsadc */ | ||
600 | |||
601 | .tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */ | ||
602 | .tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */ | ||
603 | .tshut_temp = 95000, | ||
604 | |||
605 | .initialize = rk_tsadcv2_initialize, | ||
606 | .irq_ack = rk_tsadcv1_irq_ack, | ||
607 | .control = rk_tsadcv2_control, | ||
608 | .get_temp = rk_tsadcv2_get_temp, | ||
609 | .set_tshut_temp = rk_tsadcv2_tshut_temp, | ||
610 | .set_tshut_mode = rk_tsadcv2_tshut_mode, | ||
611 | |||
612 | .table = { | ||
613 | .id = v4_code_table, | ||
614 | .length = ARRAY_SIZE(v4_code_table), | ||
615 | .data_mask = TSADCV3_DATA_MASK, | ||
616 | .mode = ADC_DECREMENT, | ||
617 | }, | ||
618 | }; | ||
619 | |||
558 | static const struct of_device_id of_rockchip_thermal_match[] = { | 620 | static const struct of_device_id of_rockchip_thermal_match[] = { |
559 | { | 621 | { |
560 | .compatible = "rockchip,rk3228-tsadc", | 622 | .compatible = "rockchip,rk3228-tsadc", |
@@ -568,6 +630,10 @@ static const struct of_device_id of_rockchip_thermal_match[] = { | |||
568 | .compatible = "rockchip,rk3368-tsadc", | 630 | .compatible = "rockchip,rk3368-tsadc", |
569 | .data = (void *)&rk3368_tsadc_data, | 631 | .data = (void *)&rk3368_tsadc_data, |
570 | }, | 632 | }, |
633 | { | ||
634 | .compatible = "rockchip,rk3399-tsadc", | ||
635 | .data = (void *)&rk3399_tsadc_data, | ||
636 | }, | ||
571 | { /* end */ }, | 637 | { /* end */ }, |
572 | }; | 638 | }; |
573 | MODULE_DEVICE_TABLE(of, of_rockchip_thermal_match); | 639 | MODULE_DEVICE_TABLE(of, of_rockchip_thermal_match); |