public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] thermal/drivers/rcar_gen3: improve Gen4 handling
@ 2025-09-09  8:46 Wolfram Sang
  2025-09-09  8:46 ` [RFC PATCH 1/2] thermal/drivers/rcar_gen3: fix mapping SoCs to generic Gen4 entry Wolfram Sang
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Wolfram Sang @ 2025-09-09  8:46 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: Niklas Söderlund, Marek Vasut, Wolfram Sang, Daniel Lezcano,
	Geert Uytterhoeven, linux-pm, Lukasz Luba, Magnus Damm,
	Rafael J. Wysocki, Zhang Rui

Here are some patches to discuss the findings we had yesterday during a
collaborative effort. Details are in the patches. Let's discuss!

Wolfram Sang (2):
  thermal/drivers/rcar_gen3: fix mapping SoCs to generic Gen4 entry
  thermal/drivers/rcar_gen3: use approved default values

 drivers/thermal/renesas/rcar_gen3_thermal.c | 24 ++++++++++-----------
 1 file changed, 12 insertions(+), 12 deletions(-)

-- 
2.47.2


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

* [RFC PATCH 1/2] thermal/drivers/rcar_gen3: fix mapping SoCs to generic Gen4 entry
  2025-09-09  8:46 [RFC PATCH 0/2] thermal/drivers/rcar_gen3: improve Gen4 handling Wolfram Sang
@ 2025-09-09  8:46 ` Wolfram Sang
  2025-09-09 14:46   ` Niklas Söderlund
  2025-09-09  8:46 ` [RFC PATCH 2/2] thermal/drivers/rcar_gen3: use approved default values Wolfram Sang
  2025-09-09 12:01 ` [RFC PATCH 0/2] thermal/drivers/rcar_gen3: improve Gen4 handling Geert Uytterhoeven
  2 siblings, 1 reply; 6+ messages in thread
From: Wolfram Sang @ 2025-09-09  8:46 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: Niklas Söderlund, Marek Vasut, Wolfram Sang,
	Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Geert Uytterhoeven, Magnus Damm, linux-pm

S4 was added first so it was assumed to be the blueprint for R-Car Gen4.
It turned out now, that S4 is a special mix between Gen3 and Gen4. V4H
and V4M are the similar ones as confirmed by HW engineers.

So, rename the S4 entry to be specific instead of generic. Rename the
V4H entry to be the new generic one, so V4M will use it as well now.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/thermal/renesas/rcar_gen3_thermal.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/thermal/renesas/rcar_gen3_thermal.c b/drivers/thermal/renesas/rcar_gen3_thermal.c
index 01858e72f4e0..07b53d4f2683 100644
--- a/drivers/thermal/renesas/rcar_gen3_thermal.c
+++ b/drivers/thermal/renesas/rcar_gen3_thermal.c
@@ -371,7 +371,7 @@ static const struct rcar_gen3_thermal_fuse_default rcar_gen3_thermal_fuse_defaul
 	},
 };
 
-static const struct rcar_gen3_thermal_fuse_default rcar_gen3_thermal_fuse_default_info_v4h = {
+static const struct rcar_gen3_thermal_fuse_default rcar_gen3_thermal_fuse_default_info_gen4 = {
 	.ptat = { 3274, 2164, 985 },
 	.thcodes = { /* All four THS units share the same trimming */
 		{ 3218, 2617, 1980 },
@@ -397,7 +397,7 @@ static const struct rcar_thermal_info rcar_gen3_thermal_info = {
 	.fuse_defaults = &rcar_gen3_thermal_fuse_default_info_gen3,
 };
 
-static const struct rcar_thermal_info rcar_gen4_thermal_info = {
+static const struct rcar_thermal_info rcar_s4_thermal_info = {
 	.scale = 167,
 	.adj_below = -41,
 	.adj_above = 126,
@@ -405,12 +405,12 @@ static const struct rcar_thermal_info rcar_gen4_thermal_info = {
 	.fuse_defaults = &rcar_gen3_thermal_fuse_default_info_gen3,
 };
 
-static const struct rcar_thermal_info rcar_v4h_thermal_info = {
+static const struct rcar_thermal_info rcar_gen4_thermal_info = {
 	.scale = 167,
 	.adj_below = -41,
 	.adj_above = 126,
 	.fuses = &rcar_gen3_thermal_fuse_info_gen4,
-	.fuse_defaults = &rcar_gen3_thermal_fuse_default_info_v4h,
+	.fuse_defaults = &rcar_gen3_thermal_fuse_default_info_gen4,
 };
 
 static const struct of_device_id rcar_gen3_thermal_dt_ids[] = {
@@ -452,11 +452,11 @@ static const struct of_device_id rcar_gen3_thermal_dt_ids[] = {
 	},
 	{
 		.compatible = "renesas,r8a779f0-thermal",
-		.data = &rcar_gen4_thermal_info,
+		.data = &rcar_s4_thermal_info,
 	},
 	{
 		.compatible = "renesas,r8a779g0-thermal",
-		.data = &rcar_v4h_thermal_info,
+		.data = &rcar_gen4_thermal_info,
 	},
 	{
 		.compatible = "renesas,r8a779h0-thermal",
-- 
2.47.2


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

* [RFC PATCH 2/2] thermal/drivers/rcar_gen3: use approved default values
  2025-09-09  8:46 [RFC PATCH 0/2] thermal/drivers/rcar_gen3: improve Gen4 handling Wolfram Sang
  2025-09-09  8:46 ` [RFC PATCH 1/2] thermal/drivers/rcar_gen3: fix mapping SoCs to generic Gen4 entry Wolfram Sang
@ 2025-09-09  8:46 ` Wolfram Sang
  2025-09-09 14:51   ` Niklas Söderlund
  2025-09-09 12:01 ` [RFC PATCH 0/2] thermal/drivers/rcar_gen3: improve Gen4 handling Geert Uytterhoeven
  2 siblings, 1 reply; 6+ messages in thread
From: Wolfram Sang @ 2025-09-09  8:46 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: Niklas Söderlund, Marek Vasut, Wolfram Sang,
	Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Geert Uytterhoeven, Magnus Damm, linux-pm

The current default values for R-Car Gen4 are from a V4H Rev3.0 SoC.
They seem incomplete because of the same values for all THS instances.
Also, the bits to flag valid fuses were not set. So, better use the
values from the Rev2.2 SoC which have the valid flags set.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/thermal/renesas/rcar_gen3_thermal.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/thermal/renesas/rcar_gen3_thermal.c b/drivers/thermal/renesas/rcar_gen3_thermal.c
index 07b53d4f2683..b7026ab733d4 100644
--- a/drivers/thermal/renesas/rcar_gen3_thermal.c
+++ b/drivers/thermal/renesas/rcar_gen3_thermal.c
@@ -372,12 +372,12 @@ static const struct rcar_gen3_thermal_fuse_default rcar_gen3_thermal_fuse_defaul
 };
 
 static const struct rcar_gen3_thermal_fuse_default rcar_gen3_thermal_fuse_default_info_gen4 = {
-	.ptat = { 3274, 2164, 985 },
-	.thcodes = { /* All four THS units share the same trimming */
-		{ 3218, 2617, 1980 },
-		{ 3218, 2617, 1980 },
-		{ 3218, 2617, 1980 },
-		{ 3218, 2617, 1980 },
+	.ptat = { 3146, 2076, 928 },
+	.thcodes = {
+		{ 3092, 2505, 1881 },
+		{ 2181, 2609, 2001 },
+		{ 3175, 2587, 1962 },
+		{ 3163, 2592, 1986 },
 	}
 };
 
-- 
2.47.2


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

* Re: [RFC PATCH 0/2] thermal/drivers/rcar_gen3: improve Gen4 handling
  2025-09-09  8:46 [RFC PATCH 0/2] thermal/drivers/rcar_gen3: improve Gen4 handling Wolfram Sang
  2025-09-09  8:46 ` [RFC PATCH 1/2] thermal/drivers/rcar_gen3: fix mapping SoCs to generic Gen4 entry Wolfram Sang
  2025-09-09  8:46 ` [RFC PATCH 2/2] thermal/drivers/rcar_gen3: use approved default values Wolfram Sang
@ 2025-09-09 12:01 ` Geert Uytterhoeven
  2 siblings, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2025-09-09 12:01 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-renesas-soc, Niklas Söderlund, Marek Vasut,
	Daniel Lezcano, Geert Uytterhoeven, linux-pm, Lukasz Luba,
	Magnus Damm, Rafael J. Wysocki, Zhang Rui

Hi Wolfram,

On Tue, 9 Sept 2025 at 10:46, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> Here are some patches to discuss the findings we had yesterday during a
> collaborative effort. Details are in the patches. Let's discuss!

Thanks for your series!

Results from the two unfused R-Car Gen4 boards I have:

root@white-hawk:~# grep . /sys/class/thermal/thermal_zone?/temp
/sys/class/thermal/thermal_zone0/temp:43100
/sys/class/thermal/thermal_zone1/temp:27400
/sys/class/thermal/thermal_zone2/temp:33300
/sys/class/thermal/thermal_zone3/temp:28000

root@gray-hawk-single:~# grep . /sys/class/thermal/thermal_zone?/temp
/sys/class/thermal/thermal_zone0/temp:46300
/sys/class/thermal/thermal_zone1/temp:29500

Tested-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] 6+ messages in thread

* Re: [RFC PATCH 1/2] thermal/drivers/rcar_gen3: fix mapping SoCs to generic Gen4 entry
  2025-09-09  8:46 ` [RFC PATCH 1/2] thermal/drivers/rcar_gen3: fix mapping SoCs to generic Gen4 entry Wolfram Sang
@ 2025-09-09 14:46   ` Niklas Söderlund
  0 siblings, 0 replies; 6+ messages in thread
From: Niklas Söderlund @ 2025-09-09 14:46 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-renesas-soc, Marek Vasut, Rafael J. Wysocki, Daniel Lezcano,
	Zhang Rui, Lukasz Luba, Geert Uytterhoeven, Magnus Damm, linux-pm

Hi Wolfram,

Thanks for your work.

On 2025-09-09 10:46:19 +0200, Wolfram Sang wrote:
> S4 was added first so it was assumed to be the blueprint for R-Car Gen4.
> It turned out now, that S4 is a special mix between Gen3 and Gen4. V4H
> and V4M are the similar ones as confirmed by HW engineers.
> 
> So, rename the S4 entry to be specific instead of generic. Rename the
> V4H entry to be the new generic one, so V4M will use it as well now.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Good catch,

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

> ---
>  drivers/thermal/renesas/rcar_gen3_thermal.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/thermal/renesas/rcar_gen3_thermal.c b/drivers/thermal/renesas/rcar_gen3_thermal.c
> index 01858e72f4e0..07b53d4f2683 100644
> --- a/drivers/thermal/renesas/rcar_gen3_thermal.c
> +++ b/drivers/thermal/renesas/rcar_gen3_thermal.c
> @@ -371,7 +371,7 @@ static const struct rcar_gen3_thermal_fuse_default rcar_gen3_thermal_fuse_defaul
>  	},
>  };
>  
> -static const struct rcar_gen3_thermal_fuse_default rcar_gen3_thermal_fuse_default_info_v4h = {
> +static const struct rcar_gen3_thermal_fuse_default rcar_gen3_thermal_fuse_default_info_gen4 = {
>  	.ptat = { 3274, 2164, 985 },
>  	.thcodes = { /* All four THS units share the same trimming */
>  		{ 3218, 2617, 1980 },
> @@ -397,7 +397,7 @@ static const struct rcar_thermal_info rcar_gen3_thermal_info = {
>  	.fuse_defaults = &rcar_gen3_thermal_fuse_default_info_gen3,
>  };
>  
> -static const struct rcar_thermal_info rcar_gen4_thermal_info = {
> +static const struct rcar_thermal_info rcar_s4_thermal_info = {
>  	.scale = 167,
>  	.adj_below = -41,
>  	.adj_above = 126,
> @@ -405,12 +405,12 @@ static const struct rcar_thermal_info rcar_gen4_thermal_info = {
>  	.fuse_defaults = &rcar_gen3_thermal_fuse_default_info_gen3,
>  };
>  
> -static const struct rcar_thermal_info rcar_v4h_thermal_info = {
> +static const struct rcar_thermal_info rcar_gen4_thermal_info = {
>  	.scale = 167,
>  	.adj_below = -41,
>  	.adj_above = 126,
>  	.fuses = &rcar_gen3_thermal_fuse_info_gen4,
> -	.fuse_defaults = &rcar_gen3_thermal_fuse_default_info_v4h,
> +	.fuse_defaults = &rcar_gen3_thermal_fuse_default_info_gen4,
>  };
>  
>  static const struct of_device_id rcar_gen3_thermal_dt_ids[] = {
> @@ -452,11 +452,11 @@ static const struct of_device_id rcar_gen3_thermal_dt_ids[] = {
>  	},
>  	{
>  		.compatible = "renesas,r8a779f0-thermal",
> -		.data = &rcar_gen4_thermal_info,
> +		.data = &rcar_s4_thermal_info,
>  	},
>  	{
>  		.compatible = "renesas,r8a779g0-thermal",
> -		.data = &rcar_v4h_thermal_info,
> +		.data = &rcar_gen4_thermal_info,
>  	},
>  	{
>  		.compatible = "renesas,r8a779h0-thermal",
> -- 
> 2.47.2
> 

-- 
Kind Regards,
Niklas Söderlund

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

* Re: [RFC PATCH 2/2] thermal/drivers/rcar_gen3: use approved default values
  2025-09-09  8:46 ` [RFC PATCH 2/2] thermal/drivers/rcar_gen3: use approved default values Wolfram Sang
@ 2025-09-09 14:51   ` Niklas Söderlund
  0 siblings, 0 replies; 6+ messages in thread
From: Niklas Söderlund @ 2025-09-09 14:51 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-renesas-soc, Marek Vasut, Rafael J. Wysocki, Daniel Lezcano,
	Zhang Rui, Lukasz Luba, Geert Uytterhoeven, Magnus Damm, linux-pm

Hi Wolfram,

Thanks for your work.

On 2025-09-09 10:46:20 +0200, Wolfram Sang wrote:
> The current default values for R-Car Gen4 are from a V4H Rev3.0 SoC.
> They seem incomplete because of the same values for all THS instances.
> Also, the bits to flag valid fuses were not set. So, better use the
> values from the Rev2.2 SoC which have the valid flags set.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  drivers/thermal/renesas/rcar_gen3_thermal.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/thermal/renesas/rcar_gen3_thermal.c b/drivers/thermal/renesas/rcar_gen3_thermal.c
> index 07b53d4f2683..b7026ab733d4 100644
> --- a/drivers/thermal/renesas/rcar_gen3_thermal.c
> +++ b/drivers/thermal/renesas/rcar_gen3_thermal.c
> @@ -372,12 +372,12 @@ static const struct rcar_gen3_thermal_fuse_default rcar_gen3_thermal_fuse_defaul
>  };
>  
>  static const struct rcar_gen3_thermal_fuse_default rcar_gen3_thermal_fuse_default_info_gen4 = {
> -	.ptat = { 3274, 2164, 985 },
> -	.thcodes = { /* All four THS units share the same trimming */
> -		{ 3218, 2617, 1980 },
> -		{ 3218, 2617, 1980 },
> -		{ 3218, 2617, 1980 },
> -		{ 3218, 2617, 1980 },
> +	.ptat = { 3146, 2076, 928 },
> +	.thcodes = {
> +		{ 3092, 2505, 1881 },
> +		{ 2181, 2609, 2001 },

If these values come from the board I think they do, s/2181/3181/ ?

> +		{ 3175, 2587, 1962 },
> +		{ 3163, 2592, 1986 },
>  	}
>  };
>  
> -- 
> 2.47.2
> 

-- 
Kind Regards,
Niklas Söderlund

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

end of thread, other threads:[~2025-09-09 14:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-09  8:46 [RFC PATCH 0/2] thermal/drivers/rcar_gen3: improve Gen4 handling Wolfram Sang
2025-09-09  8:46 ` [RFC PATCH 1/2] thermal/drivers/rcar_gen3: fix mapping SoCs to generic Gen4 entry Wolfram Sang
2025-09-09 14:46   ` Niklas Söderlund
2025-09-09  8:46 ` [RFC PATCH 2/2] thermal/drivers/rcar_gen3: use approved default values Wolfram Sang
2025-09-09 14:51   ` Niklas Söderlund
2025-09-09 12:01 ` [RFC PATCH 0/2] thermal/drivers/rcar_gen3: improve Gen4 handling Geert Uytterhoeven

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