Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1451298 > unrolled thread

[PATCH 1/2] thermal: rockchip: enhance the tsadc's bandgap feature for rk3399

Started byCaesar Wang <wxt@rock-chips.com>
First post2016-07-27 16:20 +0200
Last post2016-07-29 00:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/2] thermal: rockchip: enhance the tsadc's bandgap feature for rk3399 Caesar Wang <wxt@rock-chips.com> - 2016-07-27 16:20 +0200
    Re: [PATCH 1/2] thermal: rockchip: enhance the tsadc's bandgap  feature for rk3399 Stephen Barber <smbarber@chromium.org> - 2016-07-29 00:00 +0200

#1451298 — [PATCH 1/2] thermal: rockchip: enhance the tsadc's bandgap feature for rk3399

FromCaesar Wang <wxt@rock-chips.com>
Date2016-07-27 16:20 +0200
Subject[PATCH 1/2] thermal: rockchip: enhance the tsadc's bandgap feature for rk3399
Message-ID<rZxQJ-ug-9@gated-at.bofh.it>
From: Rocky Hao <rocky.hao@rock-chips.com>

Due to the voltage ripple, the sensing data of the tsadc is not accurate.
And in this patch, the bandgap feature is enhanced to remove the voltage
ripple, and then the tsadc can sense the temperature more precisely.

Obsolete codes are removed as well.

Signed-off-by: Rocky Hao <rocky.hao@rock-chips.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: linux-pm@vger.kernel.org
---

 drivers/thermal/rockchip_thermal.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
index db5ecc5..a90423d 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -222,10 +222,10 @@ struct rockchip_thermal_data {
 #define GRF_TSADC_TESTBIT_L			0x0e648
 #define GRF_TSADC_TESTBIT_H			0x0e64c
 
-#define GRF_TSADC_TSEN_PD_ON			(0x30003 << 0)
-#define GRF_TSADC_TSEN_PD_OFF			(0x30000 << 0)
 #define GRF_SARADC_TESTBIT_ON			(0x10001 << 2)
 #define GRF_TSADC_TESTBIT_H_ON			(0x10001 << 2)
+#define GRF_TSADC_VCM_EN_L			(0x10001 << 7)
+#define GRF_TSADC_VCM_EN_H			(0x10001 << 7)
 
 /**
  * struct tsadc_table - code to temperature conversion table
@@ -567,9 +567,10 @@ static void rk_tsadcv3_initialize(struct regmap *grf, void __iomem *regs,
 			       regs + TSADCV2_HIGHT_TSHUT_DEBOUNCE);
 
 	} else {
-		regmap_write(grf, GRF_TSADC_TESTBIT_L, GRF_TSADC_TSEN_PD_ON);
-		mdelay(10);
-		regmap_write(grf, GRF_TSADC_TESTBIT_L, GRF_TSADC_TSEN_PD_OFF);
+		/* Enable the voltage common mode feature */
+		regmap_write(grf, GRF_TSADC_TESTBIT_L, GRF_TSADC_VCM_EN_L);
+		regmap_write(grf, GRF_TSADC_TESTBIT_H, GRF_TSADC_VCM_EN_H);
+
 		usleep_range(15, 100); /* The spec note says at least 15 us */
 		regmap_write(grf, GRF_SARADC_TESTBIT, GRF_SARADC_TESTBIT_ON);
 		regmap_write(grf, GRF_TSADC_TESTBIT_H, GRF_TSADC_TESTBIT_H_ON);
-- 
1.9.1

[toc] | [next] | [standalone]


#1452136 — Re: [PATCH 1/2] thermal: rockchip: enhance the tsadc's bandgap feature for rk3399

FromStephen Barber <smbarber@chromium.org>
Date2016-07-29 00:00 +0200
SubjectRe: [PATCH 1/2] thermal: rockchip: enhance the tsadc's bandgap feature for rk3399
Message-ID<s01vs-3Eo-3@gated-at.bofh.it>
In reply to#1451298
On Wed, Jul 27, 2016 at 7:10 AM, Caesar Wang <wxt@rock-chips.com> wrote:
> From: Rocky Hao <rocky.hao@rock-chips.com>
>
> Due to the voltage ripple, the sensing data of the tsadc is not accurate.
> And in this patch, the bandgap feature is enhanced to remove the voltage
> ripple, and then the tsadc can sense the temperature more precisely.
>
> Obsolete codes are removed as well.
>
> Signed-off-by: Rocky Hao <rocky.hao@rock-chips.com>
> Signed-off-by: Caesar Wang <wxt@rock-chips.com>
> Cc: Eduardo Valentin <edubezval@gmail.com>
> Cc: Zhang Rui <rui.zhang@intel.com>
> Cc: Heiko Stuebner <heiko@sntech.de>
> Cc: linux-pm@vger.kernel.org
> ---
>
>  drivers/thermal/rockchip_thermal.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
> index db5ecc5..a90423d 100644
> --- a/drivers/thermal/rockchip_thermal.c
> +++ b/drivers/thermal/rockchip_thermal.c
> @@ -222,10 +222,10 @@ struct rockchip_thermal_data {
>  #define GRF_TSADC_TESTBIT_L                    0x0e648
>  #define GRF_TSADC_TESTBIT_H                    0x0e64c
>
> -#define GRF_TSADC_TSEN_PD_ON                   (0x30003 << 0)
> -#define GRF_TSADC_TSEN_PD_OFF                  (0x30000 << 0)
>  #define GRF_SARADC_TESTBIT_ON                  (0x10001 << 2)
>  #define GRF_TSADC_TESTBIT_H_ON                 (0x10001 << 2)
> +#define GRF_TSADC_VCM_EN_L                     (0x10001 << 7)
> +#define GRF_TSADC_VCM_EN_H                     (0x10001 << 7)
>
>  /**
>   * struct tsadc_table - code to temperature conversion table
> @@ -567,9 +567,10 @@ static void rk_tsadcv3_initialize(struct regmap *grf, void __iomem *regs,
>                                regs + TSADCV2_HIGHT_TSHUT_DEBOUNCE);
>
>         } else {
> -               regmap_write(grf, GRF_TSADC_TESTBIT_L, GRF_TSADC_TSEN_PD_ON);
> -               mdelay(10);
> -               regmap_write(grf, GRF_TSADC_TESTBIT_L, GRF_TSADC_TSEN_PD_OFF);
> +               /* Enable the voltage common mode feature */
> +               regmap_write(grf, GRF_TSADC_TESTBIT_L, GRF_TSADC_VCM_EN_L);
> +               regmap_write(grf, GRF_TSADC_TESTBIT_H, GRF_TSADC_VCM_EN_H);
> +
>                 usleep_range(15, 100); /* The spec note says at least 15 us */
>                 regmap_write(grf, GRF_SARADC_TESTBIT, GRF_SARADC_TESTBIT_ON);
>                 regmap_write(grf, GRF_TSADC_TESTBIT_H, GRF_TSADC_TESTBIT_H_ON);
> --
> 1.9.1
>

Tested-by: Stephen Barber <smbarber@chromium.org>

Steve

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web