diff options
author | Caesar Wang <wxt@rock-chips.com> | 2016-06-22 06:13:56 -0400 |
---|---|---|
committer | Zhang Rui <rui.zhang@intel.com> | 2016-09-27 02:02:16 -0400 |
commit | 466678790650a9dff6f107ca09a2f5e6480799e9 (patch) | |
tree | e7d233be963d44ff7f37f26e6056c89327eafbf5 /drivers/thermal | |
parent | 148485023f2bff19732366789f2badb1cc3ac95b (diff) |
thermal: rockchip: fixes the period time for tsadc
We should increase the period cycles to save power since the rk3399 has
the high frequency for tsadc clock.
Fixes commit b0d70338bca22cb14
("thermal: rockchip: Support the RK3399 SoCs in thermal driver")
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: linux-pm@vger.kernel.org
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r-- | drivers/thermal/rockchip_thermal.c | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c index 8175cdb2f362..2d5ba97ade08 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c | |||
@@ -211,8 +211,11 @@ struct rockchip_thermal_data { | |||
211 | 211 | ||
212 | #define TSADCV2_HIGHT_INT_DEBOUNCE_COUNT 4 | 212 | #define TSADCV2_HIGHT_INT_DEBOUNCE_COUNT 4 |
213 | #define TSADCV2_HIGHT_TSHUT_DEBOUNCE_COUNT 4 | 213 | #define TSADCV2_HIGHT_TSHUT_DEBOUNCE_COUNT 4 |
214 | #define TSADCV2_AUTO_PERIOD_TIME 250 /* msec */ | 214 | #define TSADCV2_AUTO_PERIOD_TIME 250 /* 250ms */ |
215 | #define TSADCV2_AUTO_PERIOD_HT_TIME 50 /* msec */ | 215 | #define TSADCV2_AUTO_PERIOD_HT_TIME 50 /* 50ms */ |
216 | #define TSADCV3_AUTO_PERIOD_TIME 187500 /* 250ms */ | ||
217 | #define TSADCV3_AUTO_PERIOD_HT_TIME 37500 /* 50ms */ | ||
218 | |||
216 | #define TSADCV2_USER_INTER_PD_SOC 0x340 /* 13 clocks */ | 219 | #define TSADCV2_USER_INTER_PD_SOC 0x340 /* 13 clocks */ |
217 | 220 | ||
218 | #define GRF_SARADC_TESTBIT 0x0e644 | 221 | #define GRF_SARADC_TESTBIT 0x0e644 |
@@ -547,6 +550,16 @@ static void rk_tsadcv3_initialize(struct regmap *grf, void __iomem *regs, | |||
547 | /* Set interleave value to workround ic time sync issue */ | 550 | /* Set interleave value to workround ic time sync issue */ |
548 | writel_relaxed(TSADCV2_USER_INTER_PD_SOC, regs + | 551 | writel_relaxed(TSADCV2_USER_INTER_PD_SOC, regs + |
549 | TSADCV2_USER_CON); | 552 | TSADCV2_USER_CON); |
553 | |||
554 | writel_relaxed(TSADCV2_AUTO_PERIOD_TIME, | ||
555 | regs + TSADCV2_AUTO_PERIOD); | ||
556 | writel_relaxed(TSADCV2_HIGHT_INT_DEBOUNCE_COUNT, | ||
557 | regs + TSADCV2_HIGHT_INT_DEBOUNCE); | ||
558 | writel_relaxed(TSADCV2_AUTO_PERIOD_HT_TIME, | ||
559 | regs + TSADCV2_AUTO_PERIOD_HT); | ||
560 | writel_relaxed(TSADCV2_HIGHT_TSHUT_DEBOUNCE_COUNT, | ||
561 | regs + TSADCV2_HIGHT_TSHUT_DEBOUNCE); | ||
562 | |||
550 | } else { | 563 | } else { |
551 | regmap_write(grf, GRF_TSADC_TESTBIT_L, GRF_TSADC_TSEN_PD_ON); | 564 | regmap_write(grf, GRF_TSADC_TESTBIT_L, GRF_TSADC_TSEN_PD_ON); |
552 | mdelay(10); | 565 | mdelay(10); |
@@ -555,6 +568,15 @@ static void rk_tsadcv3_initialize(struct regmap *grf, void __iomem *regs, | |||
555 | regmap_write(grf, GRF_SARADC_TESTBIT, GRF_SARADC_TESTBIT_ON); | 568 | regmap_write(grf, GRF_SARADC_TESTBIT, GRF_SARADC_TESTBIT_ON); |
556 | regmap_write(grf, GRF_TSADC_TESTBIT_H, GRF_TSADC_TESTBIT_H_ON); | 569 | regmap_write(grf, GRF_TSADC_TESTBIT_H, GRF_TSADC_TESTBIT_H_ON); |
557 | usleep_range(90, 200); /* The spec note says at least 90 us */ | 570 | usleep_range(90, 200); /* The spec note says at least 90 us */ |
571 | |||
572 | writel_relaxed(TSADCV3_AUTO_PERIOD_TIME, | ||
573 | regs + TSADCV2_AUTO_PERIOD); | ||
574 | writel_relaxed(TSADCV2_HIGHT_INT_DEBOUNCE_COUNT, | ||
575 | regs + TSADCV2_HIGHT_INT_DEBOUNCE); | ||
576 | writel_relaxed(TSADCV3_AUTO_PERIOD_HT_TIME, | ||
577 | regs + TSADCV2_AUTO_PERIOD_HT); | ||
578 | writel_relaxed(TSADCV2_HIGHT_TSHUT_DEBOUNCE_COUNT, | ||
579 | regs + TSADCV2_HIGHT_TSHUT_DEBOUNCE); | ||
558 | } | 580 | } |
559 | 581 | ||
560 | if (tshut_polarity == TSHUT_HIGH_ACTIVE) | 582 | if (tshut_polarity == TSHUT_HIGH_ACTIVE) |
@@ -563,14 +585,6 @@ static void rk_tsadcv3_initialize(struct regmap *grf, void __iomem *regs, | |||
563 | else | 585 | else |
564 | writel_relaxed(0U & ~TSADCV2_AUTO_TSHUT_POLARITY_HIGH, | 586 | writel_relaxed(0U & ~TSADCV2_AUTO_TSHUT_POLARITY_HIGH, |
565 | regs + TSADCV2_AUTO_CON); | 587 | regs + TSADCV2_AUTO_CON); |
566 | |||
567 | writel_relaxed(TSADCV2_AUTO_PERIOD_TIME, regs + TSADCV2_AUTO_PERIOD); | ||
568 | writel_relaxed(TSADCV2_HIGHT_INT_DEBOUNCE_COUNT, | ||
569 | regs + TSADCV2_HIGHT_INT_DEBOUNCE); | ||
570 | writel_relaxed(TSADCV2_AUTO_PERIOD_HT_TIME, | ||
571 | regs + TSADCV2_AUTO_PERIOD_HT); | ||
572 | writel_relaxed(TSADCV2_HIGHT_TSHUT_DEBOUNCE_COUNT, | ||
573 | regs + TSADCV2_HIGHT_TSHUT_DEBOUNCE); | ||
574 | } | 588 | } |
575 | 589 | ||
576 | static void rk_tsadcv2_irq_ack(void __iomem *regs) | 590 | static void rk_tsadcv2_irq_ack(void __iomem *regs) |