Skip to content

Commit 2d37f5c

Browse files
bijudasdlezcano
authored andcommitted
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>
1 parent e126ce0 commit 2d37f5c

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

drivers/thermal/rzg2l_thermal.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
#define TSU_SS 0x10
3333

3434
#define OTPTSUTRIM_REG(n) (0x18 + ((n) * 0x4))
35+
#define OTPTSUTRIM_EN_MASK BIT(31)
36+
#define OTPTSUTRIM_MASK GENMASK(11, 0)
3537

3638
/* Sensor Mode Register(TSU_SM) */
3739
#define TSU_SM_EN_TS BIT(0)
@@ -183,11 +185,15 @@ static int rzg2l_thermal_probe(struct platform_device *pdev)
183185
pm_runtime_get_sync(dev);
184186

185187
priv->calib0 = rzg2l_thermal_read(priv, OTPTSUTRIM_REG(0));
186-
if (!priv->calib0)
188+
if (priv->calib0 & OTPTSUTRIM_EN_MASK)
189+
priv->calib0 &= OTPTSUTRIM_MASK;
190+
else
187191
priv->calib0 = SW_CALIB0_VAL;
188192

189193
priv->calib1 = rzg2l_thermal_read(priv, OTPTSUTRIM_REG(1));
190-
if (!priv->calib1)
194+
if (priv->calib1 & OTPTSUTRIM_EN_MASK)
195+
priv->calib1 &= OTPTSUTRIM_MASK;
196+
else
191197
priv->calib1 = SW_CALIB1_VAL;
192198

193199
platform_set_drvdata(pdev, priv);

0 commit comments

Comments
 (0)