Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH 0/3] Add Renesas RZ/G3L TSU support
@ 2026-09-11 13:16 Biju Das
  2026-09-11 13:16 ` [PATCH 1/3] dt-bindings: thermal: r9a08g045-tsu: Document RZ/G3L TSU Biju Das
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Biju Das @ 2026-09-11 13:16 UTC (permalink / raw)
  To: Claudiu Beznea, Rafael J. Wysocki, Daniel Lezcano, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
	Magnus Damm
  Cc: Biju Das, Zhang Rui, Lukasz Luba, linux-pm, devicetree,
	linux-renesas-soc, Chris Paterson, Biju Das,
	Prabhakar Mahadev Lad

The TSU IP found on the RZ/G3L SoC is similar to the RZ/G3S, but it has
different calibration constants. Moreover, the TSU is connected to ADC1 on
the RZ/G3L, whereas it is connected to ADC0 on the RZ/G3S.

Biju Das (3):
  dt-bindings: thermal: r9a08g045-tsu: Document RZ/G3L TSU
  thermal/drivers/renesas/rzg3s: Convert calibration defaults to per-SoC
    match data
  thermal/drivers/renesas/rzg3s: Add RZ/G3L TSU support

 .../thermal/renesas,r9a08g045-tsu.yaml        |  4 +-
 drivers/thermal/renesas/rzg3s_thermal.c       | 38 ++++++++++++++-----
 2 files changed, 32 insertions(+), 10 deletions(-)

-- 
2.43.0


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

* [PATCH 1/3] dt-bindings: thermal: r9a08g045-tsu: Document RZ/G3L TSU
  2026-09-11 13:16 [PATCH 0/3] Add Renesas RZ/G3L TSU support Biju Das
@ 2026-09-11 13:16 ` Biju Das
  2026-09-21 17:48   ` Rob Herring (Arm)
  2026-09-11 13:16 ` [PATCH 2/3] thermal/drivers/renesas/rzg3s: Convert calibration defaults to per-SoC match data Biju Das
  2026-09-11 13:16 ` [PATCH 3/3] thermal/drivers/renesas/rzg3s: Add RZ/G3L TSU support Biju Das
  2 siblings, 1 reply; 5+ messages in thread
From: Biju Das @ 2026-09-11 13:16 UTC (permalink / raw)
  To: Claudiu Beznea, Rafael J. Wysocki, Daniel Lezcano, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
	Magnus Damm
  Cc: Biju Das, Zhang Rui, Lukasz Luba, linux-pm, devicetree,
	linux-renesas-soc, Chris Paterson, Biju Das,
	Prabhakar Mahadev Lad

Add the renesas,r9a08g046-tsu compatible string for the RZ/G3L TSU,
which is similar to the RZ/G3S TSU but uses different calibration
constants. TSU is connected to a dedicated ADC IP (a.k.a ADC1) on
RZ/G3L.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 .../devicetree/bindings/thermal/renesas,r9a08g045-tsu.yaml    | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/thermal/renesas,r9a08g045-tsu.yaml b/Documentation/devicetree/bindings/thermal/renesas,r9a08g045-tsu.yaml
index 573e2b9d3752..20fc1a8000e3 100644
--- a/Documentation/devicetree/bindings/thermal/renesas,r9a08g045-tsu.yaml
+++ b/Documentation/devicetree/bindings/thermal/renesas,r9a08g045-tsu.yaml
@@ -17,7 +17,9 @@ $ref: thermal-sensor.yaml#
 
 properties:
   compatible:
-    const: renesas,r9a08g045-tsu
+    enum:
+      - renesas,r9a08g045-tsu
+      - renesas,r9a08g046-tsu
 
   reg:
     maxItems: 1
-- 
2.43.0


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

* [PATCH 2/3] thermal/drivers/renesas/rzg3s: Convert calibration defaults to per-SoC match data
  2026-09-11 13:16 [PATCH 0/3] Add Renesas RZ/G3L TSU support Biju Das
  2026-09-11 13:16 ` [PATCH 1/3] dt-bindings: thermal: r9a08g045-tsu: Document RZ/G3L TSU Biju Das
@ 2026-09-11 13:16 ` Biju Das
  2026-09-11 13:16 ` [PATCH 3/3] thermal/drivers/renesas/rzg3s: Add RZ/G3L TSU support Biju Das
  2 siblings, 0 replies; 5+ messages in thread
From: Biju Das @ 2026-09-11 13:16 UTC (permalink / raw)
  To: Claudiu Beznea, Rafael J. Wysocki, Daniel Lezcano,
	Geert Uytterhoeven, Magnus Damm
  Cc: Biju Das, Zhang Rui, Lukasz Luba, linux-pm, linux-renesas-soc,
	Chris Paterson, Biju Das, Prabhakar Mahadev Lad

Move the default (software) calibration values SW_CALIB0_VAL and
SW_CALIB1_VAL, used when FUSE values are missing, into a new
struct rzg3s_thermal_info retrieved via of_device_get_match_data().

This allows different SoCs sharing this driver to provide their own
default calibration constants, which is needed as RZ/G3L uses
different values than RZ/G3S.

No functional change intended for RZ/G3S.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/thermal/renesas/rzg3s_thermal.c | 32 ++++++++++++++++++-------
 1 file changed, 23 insertions(+), 9 deletions(-)

diff --git a/drivers/thermal/renesas/rzg3s_thermal.c b/drivers/thermal/renesas/rzg3s_thermal.c
index 7ced8f76a0ec..146b73a1b751 100644
--- a/drivers/thermal/renesas/rzg3s_thermal.c
+++ b/drivers/thermal/renesas/rzg3s_thermal.c
@@ -12,6 +12,7 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
+#include <linux/property.h>
 #include <linux/reset.h>
 #include <linux/thermal.h>
 #include <linux/units.h>
@@ -27,10 +28,6 @@
 
 #define TSU_READ_STEPS		8
 
-/* Default calibration values, if FUSE values are missing. */
-#define SW_CALIB0_VAL		1297
-#define SW_CALIB1_VAL		751
-
 #define MCELSIUS(temp)		((temp) * MILLIDEGREE_PER_DEGREE)
 
 /**
@@ -55,6 +52,16 @@ struct rzg3s_thermal_priv {
 	u16 calib1;
 };
 
+/**
+ * struct rzg3s_thermal_info - RZ/G3S thermal information
+ * @calib0: calibration value if FUSE value is missing
+ * @calib1: calibration value if FUSE value is missing
+ */
+struct rzg3s_thermal_info {
+	u16 calib0;
+	u16 calib1;
+};
+
 static int rzg3s_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
 {
 	struct rzg3s_thermal_priv *priv = thermal_zone_device_priv(tz);
@@ -149,7 +156,8 @@ static const struct thermal_zone_device_ops rzg3s_tz_of_ops = {
 	.change_mode = rzg3s_thermal_change_mode,
 };
 
-static int rzg3s_thermal_read_calib(struct rzg3s_thermal_priv *priv)
+static int rzg3s_thermal_read_calib(struct rzg3s_thermal_priv *priv,
+				    const struct rzg3s_thermal_info *info)
 {
 	struct device *dev = priv->dev;
 	u32 val;
@@ -163,13 +171,13 @@ static int rzg3s_thermal_read_calib(struct rzg3s_thermal_priv *priv)
 	if (val & OTPTSUTRIM_EN_MASK)
 		priv->calib0 = FIELD_GET(OTPTSUTRIM_MASK, val);
 	else
-		priv->calib0 = SW_CALIB0_VAL;
+		priv->calib0 = info->calib0;
 
 	val = readl(priv->base + OTPTSUTRIM_REG(1));
 	if (val & OTPTSUTRIM_EN_MASK)
 		priv->calib1 = FIELD_GET(OTPTSUTRIM_MASK, val);
 	else
-		priv->calib1 = SW_CALIB1_VAL;
+		priv->calib1 = info->calib1;
 
 	pm_runtime_put_autosuspend(dev);
 
@@ -178,6 +186,7 @@ static int rzg3s_thermal_read_calib(struct rzg3s_thermal_priv *priv)
 
 static int rzg3s_thermal_probe(struct platform_device *pdev)
 {
+	const struct rzg3s_thermal_info *info = device_get_match_data(&pdev->dev);
 	struct rzg3s_thermal_priv *priv;
 	struct device *dev = &pdev->dev;
 	int ret;
@@ -208,7 +217,7 @@ static int rzg3s_thermal_probe(struct platform_device *pdev)
 	if (ret)
 		return dev_err_probe(dev, ret, "Failed to enable runtime PM!\n");
 
-	ret = rzg3s_thermal_read_calib(priv);
+	ret = rzg3s_thermal_read_calib(priv, info);
 	if (ret)
 		return dev_err_probe(dev, ret, "Failed to read calibration data!\n");
 
@@ -251,8 +260,13 @@ static const struct dev_pm_ops rzg3s_thermal_pm_ops = {
 	SYSTEM_SLEEP_PM_OPS(rzg3s_thermal_suspend, rzg3s_thermal_resume)
 };
 
+static const struct rzg3s_thermal_info rzg3s_info = {
+	.calib0 = 1297,
+	.calib1 = 751,
+};
+
 static const struct of_device_id rzg3s_thermal_dt_ids[] = {
-	{ .compatible = "renesas,r9a08g045-tsu" },
+	{ .compatible = "renesas,r9a08g045-tsu", .data = &rzg3s_info },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, rzg3s_thermal_dt_ids);
-- 
2.43.0


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

* [PATCH 3/3] thermal/drivers/renesas/rzg3s: Add RZ/G3L TSU support
  2026-09-11 13:16 [PATCH 0/3] Add Renesas RZ/G3L TSU support Biju Das
  2026-09-11 13:16 ` [PATCH 1/3] dt-bindings: thermal: r9a08g045-tsu: Document RZ/G3L TSU Biju Das
  2026-09-11 13:16 ` [PATCH 2/3] thermal/drivers/renesas/rzg3s: Convert calibration defaults to per-SoC match data Biju Das
@ 2026-09-11 13:16 ` Biju Das
  2 siblings, 0 replies; 5+ messages in thread
From: Biju Das @ 2026-09-11 13:16 UTC (permalink / raw)
  To: Claudiu Beznea, Rafael J. Wysocki, Daniel Lezcano,
	Geert Uytterhoeven, Magnus Damm
  Cc: Biju Das, Zhang Rui, Lukasz Luba, linux-pm, linux-renesas-soc,
	Chris Paterson, Biju Das, Prabhakar Mahadev Lad

Add the renesas,r9a08g046-tsu compatible string and its default
(software) calibration constants for RZ/G3L, used when FUSE
calibration values are missing.

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

diff --git a/drivers/thermal/renesas/rzg3s_thermal.c b/drivers/thermal/renesas/rzg3s_thermal.c
index 146b73a1b751..a8716da7fcd2 100644
--- a/drivers/thermal/renesas/rzg3s_thermal.c
+++ b/drivers/thermal/renesas/rzg3s_thermal.c
@@ -265,8 +265,14 @@ static const struct rzg3s_thermal_info rzg3s_info = {
 	.calib1 = 751,
 };
 
+static const struct rzg3s_thermal_info rzg3l_info = {
+	.calib0 = 1322,
+	.calib1 = 772,
+};
+
 static const struct of_device_id rzg3s_thermal_dt_ids[] = {
 	{ .compatible = "renesas,r9a08g045-tsu", .data = &rzg3s_info },
+	{ .compatible = "renesas,r9a08g046-tsu", .data = &rzg3l_info },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, rzg3s_thermal_dt_ids);
-- 
2.43.0


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

* Re: [PATCH 1/3] dt-bindings: thermal: r9a08g045-tsu: Document RZ/G3L TSU
  2026-09-11 13:16 ` [PATCH 1/3] dt-bindings: thermal: r9a08g045-tsu: Document RZ/G3L TSU Biju Das
@ 2026-09-21 17:48   ` Rob Herring (Arm)
  0 siblings, 0 replies; 5+ messages in thread
From: Rob Herring (Arm) @ 2026-09-21 17:48 UTC (permalink / raw)
  To: Biju Das
  Cc: Lukasz Luba, Conor Dooley, Biju Das, Daniel Lezcano, Zhang Rui,
	Claudiu Beznea, Geert Uytterhoeven, devicetree,
	Krzysztof Kozlowski, Chris Paterson, linux-renesas-soc,
	Rafael J. Wysocki, linux-pm, Magnus Damm, Prabhakar Mahadev Lad


On Fri, 11 Sep 2026 14:16:22 +0100, Biju Das wrote:
> Add the renesas,r9a08g046-tsu compatible string for the RZ/G3L TSU,
> which is similar to the RZ/G3S TSU but uses different calibration
> constants. TSU is connected to a dedicated ADC IP (a.k.a ADC1) on
> RZ/G3L.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
>  .../devicetree/bindings/thermal/renesas,r9a08g045-tsu.yaml    | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 

Acked-by: Rob Herring (Arm) <robh@kernel.org>


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

end of thread, other threads:[~2026-09-21 17:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-11 13:16 [PATCH 0/3] Add Renesas RZ/G3L TSU support Biju Das
2026-09-11 13:16 ` [PATCH 1/3] dt-bindings: thermal: r9a08g045-tsu: Document RZ/G3L TSU Biju Das
2026-09-21 17:48   ` Rob Herring (Arm)
2026-09-11 13:16 ` [PATCH 2/3] thermal/drivers/renesas/rzg3s: Convert calibration defaults to per-SoC match data Biju Das
2026-09-11 13:16 ` [PATCH 3/3] thermal/drivers/renesas/rzg3s: Add RZ/G3L TSU support Biju Das

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