Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH] thermal/drivers/rz2gl: Fix OTP Calibration Register values
@ 2022-04-28  9:33 Biju Das
  2022-05-02 15:43 ` Geert Uytterhoeven
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Biju Das @ 2022-04-28  9:33 UTC (permalink / raw)
  To: Rafael J. Wysocki, Daniel Lezcano, Amit Kucheria, Zhang Rui
  Cc: Biju Das, linux-pm, Geert Uytterhoeven, Chris Paterson, Biju Das,
	Prabhakar Mahadev Lad, linux-renesas-soc

As per the latest RZ/G2L Hardware User's Manual (Rev.1.10 Apr, 2022),
the bit 31 of TSU OTP Calibration Register(OTPTSUTRIM) indicates
whether bit [11:0] of OTPTSUTRIM is valid or invalid.

This patch updates the code to reflect this change.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/thermal/rzg2l_thermal.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/thermal/rzg2l_thermal.c b/drivers/thermal/rzg2l_thermal.c
index 7a9cdc1f37ca..be07e04c6926 100644
--- a/drivers/thermal/rzg2l_thermal.c
+++ b/drivers/thermal/rzg2l_thermal.c
@@ -32,6 +32,8 @@
 #define TSU_SS		0x10
 
 #define OTPTSUTRIM_REG(n)	(0x18 + ((n) * 0x4))
+#define OTPTSUTRIM_EN_MASK	BIT(31)
+#define OTPTSUTRIM_MASK		GENMASK(11, 0)
 
 /* Sensor Mode Register(TSU_SM) */
 #define TSU_SM_EN_TS		BIT(0)
@@ -183,11 +185,15 @@ static int rzg2l_thermal_probe(struct platform_device *pdev)
 	pm_runtime_get_sync(dev);
 
 	priv->calib0 = rzg2l_thermal_read(priv, OTPTSUTRIM_REG(0));
-	if (!priv->calib0)
+	if (priv->calib0 & OTPTSUTRIM_EN_MASK)
+		priv->calib0 &= OTPTSUTRIM_MASK;
+	else
 		priv->calib0 = SW_CALIB0_VAL;
 
 	priv->calib1 = rzg2l_thermal_read(priv, OTPTSUTRIM_REG(1));
-	if (!priv->calib1)
+	if (priv->calib1 & OTPTSUTRIM_EN_MASK)
+		priv->calib1 &= OTPTSUTRIM_MASK;
+	else
 		priv->calib1 = SW_CALIB1_VAL;
 
 	platform_set_drvdata(pdev, priv);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] thermal/drivers/rz2gl: Fix OTP Calibration Register values
  2022-04-28  9:33 [PATCH] thermal/drivers/rz2gl: Fix OTP Calibration Register values Biju Das
@ 2022-05-02 15:43 ` Geert Uytterhoeven
  2022-05-09 10:01 ` Daniel Lezcano
  2022-05-19 12:44 ` [thermal: thermal/next] " thermal-bot for Biju Das
  2 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2022-05-02 15:43 UTC (permalink / raw)
  To: Biju Das
  Cc: Rafael J. Wysocki, Daniel Lezcano, Amit Kucheria, Zhang Rui,
	Linux PM list, Chris Paterson, Biju Das, Prabhakar Mahadev Lad,
	Linux-Renesas

On Thu, Apr 28, 2022 at 11:33 AM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> As per the latest RZ/G2L Hardware User's Manual (Rev.1.10 Apr, 2022),
> the bit 31 of TSU OTP Calibration Register(OTPTSUTRIM) indicates
> whether bit [11:0] of OTPTSUTRIM is valid or invalid.
>
> This patch updates the code to reflect this change.
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] thermal/drivers/rz2gl: Fix OTP Calibration Register values
  2022-04-28  9:33 [PATCH] thermal/drivers/rz2gl: Fix OTP Calibration Register values Biju Das
  2022-05-02 15:43 ` Geert Uytterhoeven
@ 2022-05-09 10:01 ` Daniel Lezcano
  2022-05-19 12:44 ` [thermal: thermal/next] " thermal-bot for Biju Das
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel Lezcano @ 2022-05-09 10:01 UTC (permalink / raw)
  To: Biju Das, Rafael J. Wysocki, Amit Kucheria, Zhang Rui
  Cc: linux-pm, Geert Uytterhoeven, Chris Paterson, Biju Das,
	Prabhakar Mahadev Lad, linux-renesas-soc

On 28/04/2022 11:33, Biju Das wrote:
> As per the latest RZ/G2L Hardware User's Manual (Rev.1.10 Apr, 2022),
> the bit 31 of TSU OTP Calibration Register(OTPTSUTRIM) indicates
> whether bit [11:0] of OTPTSUTRIM is valid or invalid.
> 
> This patch updates the code to reflect this change.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---

Applied, thanks


-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [thermal: thermal/next] thermal/drivers/rz2gl: Fix OTP Calibration Register values
  2022-04-28  9:33 [PATCH] thermal/drivers/rz2gl: Fix OTP Calibration Register values Biju Das
  2022-05-02 15:43 ` Geert Uytterhoeven
  2022-05-09 10:01 ` Daniel Lezcano
@ 2022-05-19 12:44 ` thermal-bot for Biju Das
  2 siblings, 0 replies; 4+ messages in thread
From: thermal-bot for Biju Das @ 2022-05-19 12:44 UTC (permalink / raw)
  To: linux-pm; +Cc: Biju Das, Geert Uytterhoeven, Daniel Lezcano, rui.zhang, amitk

The following commit has been merged into the thermal/next branch of thermal:

Commit-ID:     2d37f5c90bdc659b329dac7cf6d165a4bbf34cb6
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//2d37f5c90bdc659b329dac7cf6d165a4bbf34cb6
Author:        Biju Das <biju.das.jz@bp.renesas.com>
AuthorDate:    Thu, 28 Apr 2022 10:33:46 +01:00
Committer:     Daniel Lezcano <daniel.lezcano@linaro.org>
CommitterDate: Thu, 19 May 2022 12:11:52 +02:00

thermal/drivers/rz2gl: Fix OTP Calibration Register values

As per the latest RZ/G2L Hardware User's Manual (Rev.1.10 Apr, 2022),
the bit 31 of TSU OTP Calibration Register(OTPTSUTRIM) indicates
whether bit [11:0] of OTPTSUTRIM is valid or invalid.

This patch updates the code to reflect this change.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20220428093346.7552-1-biju.das.jz@bp.renesas.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/thermal/rzg2l_thermal.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/thermal/rzg2l_thermal.c b/drivers/thermal/rzg2l_thermal.c
index 7a9cdc1..be07e04 100644
--- a/drivers/thermal/rzg2l_thermal.c
+++ b/drivers/thermal/rzg2l_thermal.c
@@ -32,6 +32,8 @@
 #define TSU_SS		0x10
 
 #define OTPTSUTRIM_REG(n)	(0x18 + ((n) * 0x4))
+#define OTPTSUTRIM_EN_MASK	BIT(31)
+#define OTPTSUTRIM_MASK		GENMASK(11, 0)
 
 /* Sensor Mode Register(TSU_SM) */
 #define TSU_SM_EN_TS		BIT(0)
@@ -183,11 +185,15 @@ static int rzg2l_thermal_probe(struct platform_device *pdev)
 	pm_runtime_get_sync(dev);
 
 	priv->calib0 = rzg2l_thermal_read(priv, OTPTSUTRIM_REG(0));
-	if (!priv->calib0)
+	if (priv->calib0 & OTPTSUTRIM_EN_MASK)
+		priv->calib0 &= OTPTSUTRIM_MASK;
+	else
 		priv->calib0 = SW_CALIB0_VAL;
 
 	priv->calib1 = rzg2l_thermal_read(priv, OTPTSUTRIM_REG(1));
-	if (!priv->calib1)
+	if (priv->calib1 & OTPTSUTRIM_EN_MASK)
+		priv->calib1 &= OTPTSUTRIM_MASK;
+	else
 		priv->calib1 = SW_CALIB1_VAL;
 
 	platform_set_drvdata(pdev, priv);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-19 12:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-28  9:33 [PATCH] thermal/drivers/rz2gl: Fix OTP Calibration Register values Biju Das
2022-05-02 15:43 ` Geert Uytterhoeven
2022-05-09 10:01 ` Daniel Lezcano
2022-05-19 12:44 ` [thermal: thermal/next] " thermal-bot for Biju Das

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox