linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] thermal: rcar_gen3_thermal: Fix coefficient calculations
@ 2021-06-05  8:52 Niklas Söderlund
  2021-06-07  1:27 ` Yoshihiro Shimoda
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Niklas Söderlund @ 2021-06-05  8:52 UTC (permalink / raw)
  To: Daniel Lezcano, linux-pm
  Cc: linux-renesas-soc, Niklas Söderlund, Yoshihiro Shimoda

The fixed value of 157 used in the calculations are only correct for
M3-W, on other Gen3 SoC it should be 167. The constant can be derived
correctly from the static TJ_3 constant and the SoC specific TJ_1 value.
Update the calculation be correct on all Gen3 SoCs.

Reported-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
 drivers/thermal/rcar_gen3_thermal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c
index e1e412348076b2ff..1a60adb1d30a011d 100644
--- a/drivers/thermal/rcar_gen3_thermal.c
+++ b/drivers/thermal/rcar_gen3_thermal.c
@@ -143,7 +143,7 @@ static void rcar_gen3_thermal_calc_coefs(struct rcar_gen3_thermal_tsc *tsc,
 	 * Division is not scaled in BSP and if scaled it might overflow
 	 * the dividend (4095 * 4095 << 14 > INT_MAX) so keep it unscaled
 	 */
-	tsc->tj_t = (FIXPT_INT((ptat[1] - ptat[2]) * 157)
+	tsc->tj_t = (FIXPT_INT((ptat[1] - ptat[2]) * (ths_tj_1 - TJ_3))
 		     / (ptat[0] - ptat[2])) + FIXPT_INT(TJ_3);
 
 	tsc->coef.a1 = FIXPT_DIV(FIXPT_INT(thcode[1] - thcode[2]),
-- 
2.31.1


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

* RE: [PATCH] thermal: rcar_gen3_thermal: Fix coefficient calculations
  2021-06-05  8:52 [PATCH] thermal: rcar_gen3_thermal: Fix coefficient calculations Niklas Söderlund
@ 2021-06-07  1:27 ` Yoshihiro Shimoda
  2021-06-07  9:05 ` Geert Uytterhoeven
  2021-06-21  9:46 ` [thermal: thermal/next] thermal/drivers/rcar_gen3_thermal: " thermal-bot for Niklas Söderlund
  2 siblings, 0 replies; 4+ messages in thread
From: Yoshihiro Shimoda @ 2021-06-07  1:27 UTC (permalink / raw)
  To: Niklas Söderlund, Daniel Lezcano, linux-pm; +Cc: linux-renesas-soc

Hi Niklas-san,

Thank you for the patch!

> From: Niklas Söderlund, Sent: Saturday, June 5, 2021 5:52 PM
> 
> The fixed value of 157 used in the calculations are only correct for
> M3-W, on other Gen3 SoC it should be 167. The constant can be derived
> correctly from the static TJ_3 constant and the SoC specific TJ_1 value.
> Update the calculation be correct on all Gen3 SoCs.
> 
> Reported-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

I think adding Fixes tag like below is useful for backporting to LTS.

Fixes: 4eb39f79ef44 ("thermal: rcar_gen3_thermal: Update value of Tj_1")

> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

After adding the Fixes tag,

Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Best regards,
Yoshihiro Shimoda


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

* Re: [PATCH] thermal: rcar_gen3_thermal: Fix coefficient calculations
  2021-06-05  8:52 [PATCH] thermal: rcar_gen3_thermal: Fix coefficient calculations Niklas Söderlund
  2021-06-07  1:27 ` Yoshihiro Shimoda
@ 2021-06-07  9:05 ` Geert Uytterhoeven
  2021-06-21  9:46 ` [thermal: thermal/next] thermal/drivers/rcar_gen3_thermal: " thermal-bot for Niklas Söderlund
  2 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2021-06-07  9:05 UTC (permalink / raw)
  To: Niklas Söderlund
  Cc: Daniel Lezcano, Linux PM list, Linux-Renesas, Yoshihiro Shimoda

On Sat, Jun 5, 2021 at 10:53 AM Niklas Söderlund
<niklas.soderlund+renesas@ragnatech.se> wrote:
> The fixed value of 157 used in the calculations are only correct for
> M3-W, on other Gen3 SoC it should be 167. The constant can be derived
> correctly from the static TJ_3 constant and the SoC specific TJ_1 value.
> Update the calculation be correct on all Gen3 SoCs.
>
> Reported-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

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

* [thermal: thermal/next] thermal/drivers/rcar_gen3_thermal: Fix coefficient calculations
  2021-06-05  8:52 [PATCH] thermal: rcar_gen3_thermal: Fix coefficient calculations Niklas Söderlund
  2021-06-07  1:27 ` Yoshihiro Shimoda
  2021-06-07  9:05 ` Geert Uytterhoeven
@ 2021-06-21  9:46 ` thermal-bot for Niklas Söderlund
  2 siblings, 0 replies; 4+ messages in thread
From: thermal-bot for Niklas Söderlund @ 2021-06-21  9:46 UTC (permalink / raw)
  To: linux-pm
  Cc: Yoshihiro Shimoda, niklas.soderlund+renesas, Geert Uytterhoeven,
	Daniel Lezcano, rui.zhang, amitk

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

Commit-ID:     8946187ab57ffd02088e50256c73dd31f49db06d
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//8946187ab57ffd02088e50256c73dd31f49db06d
Author:        Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
AuthorDate:    Sat, 05 Jun 2021 10:52:11 +02:00
Committer:     Daniel Lezcano <daniel.lezcano@linaro.org>
CommitterDate: Mon, 14 Jun 2021 19:02:55 +02:00

thermal/drivers/rcar_gen3_thermal: Fix coefficient calculations

The fixed value of 157 used in the calculations are only correct for
M3-W, on other Gen3 SoC it should be 167. The constant can be derived
correctly from the static TJ_3 constant and the SoC specific TJ_1 value.
Update the calculation be correct on all Gen3 SoCs.

Fixes: 4eb39f79ef44 ("thermal: rcar_gen3_thermal: Update value of Tj_1")
Reported-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20210605085211.564909-1-niklas.soderlund+renesas@ragnatech.se
---
 drivers/thermal/rcar_gen3_thermal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c
index e1e4123..1a60adb 100644
--- a/drivers/thermal/rcar_gen3_thermal.c
+++ b/drivers/thermal/rcar_gen3_thermal.c
@@ -143,7 +143,7 @@ static void rcar_gen3_thermal_calc_coefs(struct rcar_gen3_thermal_tsc *tsc,
 	 * Division is not scaled in BSP and if scaled it might overflow
 	 * the dividend (4095 * 4095 << 14 > INT_MAX) so keep it unscaled
 	 */
-	tsc->tj_t = (FIXPT_INT((ptat[1] - ptat[2]) * 157)
+	tsc->tj_t = (FIXPT_INT((ptat[1] - ptat[2]) * (ths_tj_1 - TJ_3))
 		     / (ptat[0] - ptat[2])) + FIXPT_INT(TJ_3);
 
 	tsc->coef.a1 = FIXPT_DIV(FIXPT_INT(thcode[1] - thcode[2]),

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

end of thread, other threads:[~2021-06-21  9:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-05  8:52 [PATCH] thermal: rcar_gen3_thermal: Fix coefficient calculations Niklas Söderlund
2021-06-07  1:27 ` Yoshihiro Shimoda
2021-06-07  9:05 ` Geert Uytterhoeven
2021-06-21  9:46 ` [thermal: thermal/next] thermal/drivers/rcar_gen3_thermal: " thermal-bot for Niklas Söderlund

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).