devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] thermal: rockchip: shut up GRF warning
@ 2025-08-20 17:40 Sebastian Reichel
  2025-08-20 17:40 ` [PATCH v2 1/3] thermal: rockchip: unify struct rockchip_tsadc_chip format Sebastian Reichel
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Sebastian Reichel @ 2025-08-20 17:40 UTC (permalink / raw)
  To: Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Heiko Stuebner, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: Robin Murphy, Diederik de Haas, linux-pm, linux-arm-kernel,
	linux-rockchip, linux-kernel, devicetree, kernel,
	Sebastian Reichel

Changes in v2:
- Link to v1: https://lore.kernel.org/r/20250818-thermal-rockchip-grf-warning-v1-1-134152c97097@kernel.org
- Add patch droping extra newlines in older chip info structures (Heiko)
- Add patch updating DT bindings to make GRF either mandatory or unallowed (Heiko, Robin)
- Update previous patch to only differntiate between mandatory and no GRF (Heiko, Robin)
- Update struct documentation (kernel test robot)
- Do not collect Tested-by from Diederik, as too much changed in this version

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
Sebastian Reichel (3):
      thermal: rockchip: unify struct rockchip_tsadc_chip format
      thermal: rockchip: shut up GRF warning
      dt-bindings: thermal: rockchip: tighten grf requirements

 .../bindings/thermal/rockchip-thermal.yaml         | 15 +++++++
 drivers/thermal/rockchip_thermal.c                 | 50 ++++++++--------------
 2 files changed, 33 insertions(+), 32 deletions(-)
---
base-commit: c17b750b3ad9f45f2b6f7e6f7f4679844244f0b9
change-id: 20250818-thermal-rockchip-grf-warning-05f7f56286a2

Best regards,
-- 
Sebastian Reichel <sre@kernel.org>


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

* [PATCH v2 1/3] thermal: rockchip: unify struct rockchip_tsadc_chip format
  2025-08-20 17:40 [PATCH v2 0/3] thermal: rockchip: shut up GRF warning Sebastian Reichel
@ 2025-08-20 17:40 ` Sebastian Reichel
  2025-08-20 20:11   ` Heiko Stübner
  2025-08-22  3:11   ` Dragan Simic
  2025-08-20 17:40 ` [PATCH v2 2/3] thermal: rockchip: shut up GRF warning Sebastian Reichel
  2025-08-20 17:40 ` [PATCH v2 3/3] dt-bindings: thermal: rockchip: tighten grf requirements Sebastian Reichel
  2 siblings, 2 replies; 11+ messages in thread
From: Sebastian Reichel @ 2025-08-20 17:40 UTC (permalink / raw)
  To: Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Heiko Stuebner, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: Robin Murphy, Diederik de Haas, linux-pm, linux-arm-kernel,
	linux-rockchip, linux-kernel, devicetree, kernel,
	Sebastian Reichel

Unify all chip descriptions to the version without any empty
lines.

Suggested-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
 drivers/thermal/rockchip_thermal.c | 27 ---------------------------
 1 file changed, 27 deletions(-)

diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
index 3beff9b6fac3abe8948b56132b618ff1bed57217..7b18a705dfade6fa7318b28c2b57544a4446c1cc 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -1098,10 +1098,8 @@ static const struct rockchip_tsadc_chip px30_tsadc_data = {
 	/* cpu, gpu */
 	.chn_offset = 0,
 	.chn_num = 2, /* 2 channels for tsadc */
-
 	.tshut_mode = TSHUT_MODE_CRU, /* default TSHUT via CRU */
 	.tshut_temp = 95000,
-
 	.initialize = rk_tsadcv4_initialize,
 	.irq_ack = rk_tsadcv3_irq_ack,
 	.control = rk_tsadcv3_control,
@@ -1109,7 +1107,6 @@ static const struct rockchip_tsadc_chip px30_tsadc_data = {
 	.set_alarm_temp = rk_tsadcv2_alarm_temp,
 	.set_tshut_temp = rk_tsadcv2_tshut_temp,
 	.set_tshut_mode = rk_tsadcv2_tshut_mode,
-
 	.table = {
 		.id = rk3328_code_table,
 		.length = ARRAY_SIZE(rk3328_code_table),
@@ -1122,11 +1119,9 @@ static const struct rockchip_tsadc_chip rv1108_tsadc_data = {
 	/* cpu */
 	.chn_offset = 0,
 	.chn_num = 1, /* one channel for tsadc */
-
 	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
 	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
 	.tshut_temp = 95000,
-
 	.initialize = rk_tsadcv2_initialize,
 	.irq_ack = rk_tsadcv3_irq_ack,
 	.control = rk_tsadcv3_control,
@@ -1134,7 +1129,6 @@ static const struct rockchip_tsadc_chip rv1108_tsadc_data = {
 	.set_alarm_temp = rk_tsadcv2_alarm_temp,
 	.set_tshut_temp = rk_tsadcv2_tshut_temp,
 	.set_tshut_mode = rk_tsadcv2_tshut_mode,
-
 	.table = {
 		.id = rv1108_table,
 		.length = ARRAY_SIZE(rv1108_table),
@@ -1147,11 +1141,9 @@ static const struct rockchip_tsadc_chip rk3228_tsadc_data = {
 	/* cpu */
 	.chn_offset = 0,
 	.chn_num = 1, /* one channel for tsadc */
-
 	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
 	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
 	.tshut_temp = 95000,
-
 	.initialize = rk_tsadcv2_initialize,
 	.irq_ack = rk_tsadcv3_irq_ack,
 	.control = rk_tsadcv3_control,
@@ -1159,7 +1151,6 @@ static const struct rockchip_tsadc_chip rk3228_tsadc_data = {
 	.set_alarm_temp = rk_tsadcv2_alarm_temp,
 	.set_tshut_temp = rk_tsadcv2_tshut_temp,
 	.set_tshut_mode = rk_tsadcv2_tshut_mode,
-
 	.table = {
 		.id = rk3228_code_table,
 		.length = ARRAY_SIZE(rk3228_code_table),
@@ -1172,11 +1163,9 @@ static const struct rockchip_tsadc_chip rk3288_tsadc_data = {
 	/* cpu, gpu */
 	.chn_offset = 1,
 	.chn_num = 2, /* two channels for tsadc */
-
 	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
 	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
 	.tshut_temp = 95000,
-
 	.initialize = rk_tsadcv2_initialize,
 	.irq_ack = rk_tsadcv2_irq_ack,
 	.control = rk_tsadcv2_control,
@@ -1184,7 +1173,6 @@ static const struct rockchip_tsadc_chip rk3288_tsadc_data = {
 	.set_alarm_temp = rk_tsadcv2_alarm_temp,
 	.set_tshut_temp = rk_tsadcv2_tshut_temp,
 	.set_tshut_mode = rk_tsadcv2_tshut_mode,
-
 	.table = {
 		.id = rk3288_code_table,
 		.length = ARRAY_SIZE(rk3288_code_table),
@@ -1197,10 +1185,8 @@ static const struct rockchip_tsadc_chip rk3328_tsadc_data = {
 	/* cpu */
 	.chn_offset = 0,
 	.chn_num = 1, /* one channels for tsadc */
-
 	.tshut_mode = TSHUT_MODE_CRU, /* default TSHUT via CRU */
 	.tshut_temp = 95000,
-
 	.initialize = rk_tsadcv2_initialize,
 	.irq_ack = rk_tsadcv3_irq_ack,
 	.control = rk_tsadcv3_control,
@@ -1208,7 +1194,6 @@ static const struct rockchip_tsadc_chip rk3328_tsadc_data = {
 	.set_alarm_temp = rk_tsadcv2_alarm_temp,
 	.set_tshut_temp = rk_tsadcv2_tshut_temp,
 	.set_tshut_mode = rk_tsadcv2_tshut_mode,
-
 	.table = {
 		.id = rk3328_code_table,
 		.length = ARRAY_SIZE(rk3328_code_table),
@@ -1221,11 +1206,9 @@ static const struct rockchip_tsadc_chip rk3366_tsadc_data = {
 	/* cpu, gpu */
 	.chn_offset = 0,
 	.chn_num = 2, /* two channels for tsadc */
-
 	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
 	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
 	.tshut_temp = 95000,
-
 	.initialize = rk_tsadcv3_initialize,
 	.irq_ack = rk_tsadcv3_irq_ack,
 	.control = rk_tsadcv3_control,
@@ -1233,7 +1216,6 @@ static const struct rockchip_tsadc_chip rk3366_tsadc_data = {
 	.set_alarm_temp = rk_tsadcv2_alarm_temp,
 	.set_tshut_temp = rk_tsadcv2_tshut_temp,
 	.set_tshut_mode = rk_tsadcv2_tshut_mode,
-
 	.table = {
 		.id = rk3228_code_table,
 		.length = ARRAY_SIZE(rk3228_code_table),
@@ -1246,11 +1228,9 @@ static const struct rockchip_tsadc_chip rk3368_tsadc_data = {
 	/* cpu, gpu */
 	.chn_offset = 0,
 	.chn_num = 2, /* two channels for tsadc */
-
 	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
 	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
 	.tshut_temp = 95000,
-
 	.initialize = rk_tsadcv2_initialize,
 	.irq_ack = rk_tsadcv2_irq_ack,
 	.control = rk_tsadcv2_control,
@@ -1258,7 +1238,6 @@ static const struct rockchip_tsadc_chip rk3368_tsadc_data = {
 	.set_alarm_temp = rk_tsadcv2_alarm_temp,
 	.set_tshut_temp = rk_tsadcv2_tshut_temp,
 	.set_tshut_mode = rk_tsadcv2_tshut_mode,
-
 	.table = {
 		.id = rk3368_code_table,
 		.length = ARRAY_SIZE(rk3368_code_table),
@@ -1271,11 +1250,9 @@ static const struct rockchip_tsadc_chip rk3399_tsadc_data = {
 	/* cpu, gpu */
 	.chn_offset = 0,
 	.chn_num = 2, /* two channels for tsadc */
-
 	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
 	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
 	.tshut_temp = 95000,
-
 	.initialize = rk_tsadcv3_initialize,
 	.irq_ack = rk_tsadcv3_irq_ack,
 	.control = rk_tsadcv3_control,
@@ -1283,7 +1260,6 @@ static const struct rockchip_tsadc_chip rk3399_tsadc_data = {
 	.set_alarm_temp = rk_tsadcv2_alarm_temp,
 	.set_tshut_temp = rk_tsadcv2_tshut_temp,
 	.set_tshut_mode = rk_tsadcv2_tshut_mode,
-
 	.table = {
 		.id = rk3399_code_table,
 		.length = ARRAY_SIZE(rk3399_code_table),
@@ -1296,11 +1272,9 @@ static const struct rockchip_tsadc_chip rk3568_tsadc_data = {
 	/* cpu, gpu */
 	.chn_offset = 0,
 	.chn_num = 2, /* two channels for tsadc */
-
 	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
 	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
 	.tshut_temp = 95000,
-
 	.initialize = rk_tsadcv7_initialize,
 	.irq_ack = rk_tsadcv3_irq_ack,
 	.control = rk_tsadcv3_control,
@@ -1308,7 +1282,6 @@ static const struct rockchip_tsadc_chip rk3568_tsadc_data = {
 	.set_alarm_temp = rk_tsadcv2_alarm_temp,
 	.set_tshut_temp = rk_tsadcv2_tshut_temp,
 	.set_tshut_mode = rk_tsadcv2_tshut_mode,
-
 	.table = {
 		.id = rk3568_code_table,
 		.length = ARRAY_SIZE(rk3568_code_table),

-- 
2.50.1


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

* [PATCH v2 2/3] thermal: rockchip: shut up GRF warning
  2025-08-20 17:40 [PATCH v2 0/3] thermal: rockchip: shut up GRF warning Sebastian Reichel
  2025-08-20 17:40 ` [PATCH v2 1/3] thermal: rockchip: unify struct rockchip_tsadc_chip format Sebastian Reichel
@ 2025-08-20 17:40 ` Sebastian Reichel
  2025-08-20 20:14   ` Heiko Stübner
                     ` (2 more replies)
  2025-08-20 17:40 ` [PATCH v2 3/3] dt-bindings: thermal: rockchip: tighten grf requirements Sebastian Reichel
  2 siblings, 3 replies; 11+ messages in thread
From: Sebastian Reichel @ 2025-08-20 17:40 UTC (permalink / raw)
  To: Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Heiko Stuebner, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: Robin Murphy, Diederik de Haas, linux-pm, linux-arm-kernel,
	linux-rockchip, linux-kernel, devicetree, kernel,
	Sebastian Reichel

Most of the recent Rockchip devices do not have a GRF associated
with the tsadc IP. Let's avoid printing a warning on those devices.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
 drivers/thermal/rockchip_thermal.c | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
index 7b18a705dfade6fa7318b28c2b57544a4446c1cc..c49ddf70f86e7beaf0190b1b3e93f5e6b2f72b2c 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -74,6 +74,7 @@ struct chip_tsadc_table {
  * @tshut_temp: the hardware-controlled shutdown temperature value, with no trim
  * @tshut_mode: the hardware-controlled shutdown mode (0:CRU 1:GPIO)
  * @tshut_polarity: the hardware-controlled active polarity (0:LOW 1:HIGH)
+ * @grf_required: true, if a GRF is required for proper functionality
  * @initialize: SoC special initialize tsadc controller method
  * @irq_ack: clear the interrupt
  * @control: enable/disable method for the tsadc controller
@@ -97,6 +98,9 @@ struct rockchip_tsadc_chip {
 	enum tshut_mode tshut_mode;
 	enum tshut_polarity tshut_polarity;
 
+	/* GRF availability */
+	bool grf_required;
+
 	/* Chip-wide methods */
 	void (*initialize)(struct regmap *grf,
 			   void __iomem *reg, enum tshut_polarity p);
@@ -1098,6 +1102,7 @@ static const struct rockchip_tsadc_chip px30_tsadc_data = {
 	/* cpu, gpu */
 	.chn_offset = 0,
 	.chn_num = 2, /* 2 channels for tsadc */
+	.grf_required = true,
 	.tshut_mode = TSHUT_MODE_CRU, /* default TSHUT via CRU */
 	.tshut_temp = 95000,
 	.initialize = rk_tsadcv4_initialize,
@@ -1119,6 +1124,7 @@ static const struct rockchip_tsadc_chip rv1108_tsadc_data = {
 	/* cpu */
 	.chn_offset = 0,
 	.chn_num = 1, /* one channel for tsadc */
+	.grf_required = false,
 	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
 	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
 	.tshut_temp = 95000,
@@ -1141,6 +1147,7 @@ static const struct rockchip_tsadc_chip rk3228_tsadc_data = {
 	/* cpu */
 	.chn_offset = 0,
 	.chn_num = 1, /* one channel for tsadc */
+	.grf_required = false,
 	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
 	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
 	.tshut_temp = 95000,
@@ -1163,6 +1170,7 @@ static const struct rockchip_tsadc_chip rk3288_tsadc_data = {
 	/* cpu, gpu */
 	.chn_offset = 1,
 	.chn_num = 2, /* two channels for tsadc */
+	.grf_required = false,
 	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
 	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
 	.tshut_temp = 95000,
@@ -1185,6 +1193,7 @@ static const struct rockchip_tsadc_chip rk3328_tsadc_data = {
 	/* cpu */
 	.chn_offset = 0,
 	.chn_num = 1, /* one channels for tsadc */
+	.grf_required = false,
 	.tshut_mode = TSHUT_MODE_CRU, /* default TSHUT via CRU */
 	.tshut_temp = 95000,
 	.initialize = rk_tsadcv2_initialize,
@@ -1206,6 +1215,7 @@ static const struct rockchip_tsadc_chip rk3366_tsadc_data = {
 	/* cpu, gpu */
 	.chn_offset = 0,
 	.chn_num = 2, /* two channels for tsadc */
+	.grf_required = true,
 	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
 	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
 	.tshut_temp = 95000,
@@ -1228,6 +1238,7 @@ static const struct rockchip_tsadc_chip rk3368_tsadc_data = {
 	/* cpu, gpu */
 	.chn_offset = 0,
 	.chn_num = 2, /* two channels for tsadc */
+	.grf_required = false,
 	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
 	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
 	.tshut_temp = 95000,
@@ -1250,6 +1261,7 @@ static const struct rockchip_tsadc_chip rk3399_tsadc_data = {
 	/* cpu, gpu */
 	.chn_offset = 0,
 	.chn_num = 2, /* two channels for tsadc */
+	.grf_required = true,
 	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
 	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
 	.tshut_temp = 95000,
@@ -1272,6 +1284,7 @@ static const struct rockchip_tsadc_chip rk3568_tsadc_data = {
 	/* cpu, gpu */
 	.chn_offset = 0,
 	.chn_num = 2, /* two channels for tsadc */
+	.grf_required = true,
 	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
 	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
 	.tshut_temp = 95000,
@@ -1294,6 +1307,7 @@ static const struct rockchip_tsadc_chip rk3576_tsadc_data = {
 	/* top, big_core, little_core, ddr, npu, gpu */
 	.chn_offset = 0,
 	.chn_num = 6, /* six channels for tsadc */
+	.grf_required = false,
 	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
 	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
 	.tshut_temp = 95000,
@@ -1318,6 +1332,7 @@ static const struct rockchip_tsadc_chip rk3588_tsadc_data = {
 	/* top, big_core0, big_core1, little_core, center, gpu, npu */
 	.chn_offset = 0,
 	.chn_num = 7, /* seven channels for tsadc */
+	.grf_required = false,
 	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
 	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
 	.tshut_temp = 95000,
@@ -1594,12 +1609,10 @@ static int rockchip_configure_from_dt(struct device *dev,
 		return -EINVAL;
 	}
 
-	/* The tsadc wont to handle the error in here since some SoCs didn't
-	 * need this property.
-	 */
 	thermal->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf");
-	if (IS_ERR(thermal->grf))
-		dev_warn(dev, "Missing rockchip,grf property\n");
+	if (IS_ERR(thermal->grf) && thermal->chip->grf_required)
+		return dev_err_probe(dev, PTR_ERR(thermal->grf),
+				     "Missing rockchip,grf property\n");
 
 	rockchip_get_trim_configuration(dev, np, thermal);
 

-- 
2.50.1


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

* [PATCH v2 3/3] dt-bindings: thermal: rockchip: tighten grf requirements
  2025-08-20 17:40 [PATCH v2 0/3] thermal: rockchip: shut up GRF warning Sebastian Reichel
  2025-08-20 17:40 ` [PATCH v2 1/3] thermal: rockchip: unify struct rockchip_tsadc_chip format Sebastian Reichel
  2025-08-20 17:40 ` [PATCH v2 2/3] thermal: rockchip: shut up GRF warning Sebastian Reichel
@ 2025-08-20 17:40 ` Sebastian Reichel
  2025-08-20 19:48   ` Conor Dooley
  2025-08-22  3:20   ` Dragan Simic
  2 siblings, 2 replies; 11+ messages in thread
From: Sebastian Reichel @ 2025-08-20 17:40 UTC (permalink / raw)
  To: Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Heiko Stuebner, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: Robin Murphy, Diederik de Haas, linux-pm, linux-arm-kernel,
	linux-rockchip, linux-kernel, devicetree, kernel,
	Sebastian Reichel

Instead of having an optional rockchip,grf property, forbid using it on
platforms without registers in a GRF being needed for thermal monitoring
and make it mandatory on the platforms actually needing it.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
 .../devicetree/bindings/thermal/rockchip-thermal.yaml     | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/Documentation/devicetree/bindings/thermal/rockchip-thermal.yaml b/Documentation/devicetree/bindings/thermal/rockchip-thermal.yaml
index 573f447cc26ed7100638277598b0e745d436fd01..9fa5c4c49d76e3a689f31797875124e7fb30d3df 100644
--- a/Documentation/devicetree/bindings/thermal/rockchip-thermal.yaml
+++ b/Documentation/devicetree/bindings/thermal/rockchip-thermal.yaml
@@ -119,6 +119,21 @@ required:
   - resets
 
 allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - rockchip,px30-tsadc
+              - rockchip,rk3366-tsadc
+              - rockchip,rk3399-tsadc
+              - rockchip,rk3568-tsadc
+    then:
+      required:
+        - rockchip,grf
+    else:
+      properties:
+        rockchip,grf: false
   - if:
       not:
         properties:

-- 
2.50.1


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

* Re: [PATCH v2 3/3] dt-bindings: thermal: rockchip: tighten grf requirements
  2025-08-20 17:40 ` [PATCH v2 3/3] dt-bindings: thermal: rockchip: tighten grf requirements Sebastian Reichel
@ 2025-08-20 19:48   ` Conor Dooley
  2025-08-22  3:20   ` Dragan Simic
  1 sibling, 0 replies; 11+ messages in thread
From: Conor Dooley @ 2025-08-20 19:48 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Heiko Stuebner, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Robin Murphy, Diederik de Haas, linux-pm, linux-arm-kernel,
	linux-rockchip, linux-kernel, devicetree, kernel

[-- Attachment #1: Type: text/plain, Size: 1614 bytes --]

On Wed, Aug 20, 2025 at 07:40:49PM +0200, Sebastian Reichel wrote:
> Instead of having an optional rockchip,grf property, forbid using it on
> platforms without registers in a GRF being needed for thermal monitoring
> and make it mandatory on the platforms actually needing it.

I am assuming that "needing it" means that it was actually mandatory but
the binding was just missing the required required entry. If so
Acked-by: Conor Dooley <conor.dooley@microchip.com>

> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> ---
>  .../devicetree/bindings/thermal/rockchip-thermal.yaml     | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/thermal/rockchip-thermal.yaml b/Documentation/devicetree/bindings/thermal/rockchip-thermal.yaml
> index 573f447cc26ed7100638277598b0e745d436fd01..9fa5c4c49d76e3a689f31797875124e7fb30d3df 100644
> --- a/Documentation/devicetree/bindings/thermal/rockchip-thermal.yaml
> +++ b/Documentation/devicetree/bindings/thermal/rockchip-thermal.yaml
> @@ -119,6 +119,21 @@ required:
>    - resets
>  
>  allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - rockchip,px30-tsadc
> +              - rockchip,rk3366-tsadc
> +              - rockchip,rk3399-tsadc
> +              - rockchip,rk3568-tsadc
> +    then:
> +      required:
> +        - rockchip,grf
> +    else:
> +      properties:
> +        rockchip,grf: false
>    - if:
>        not:
>          properties:
> 
> -- 
> 2.50.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH v2 1/3] thermal: rockchip: unify struct rockchip_tsadc_chip format
  2025-08-20 17:40 ` [PATCH v2 1/3] thermal: rockchip: unify struct rockchip_tsadc_chip format Sebastian Reichel
@ 2025-08-20 20:11   ` Heiko Stübner
  2025-08-22  3:11   ` Dragan Simic
  1 sibling, 0 replies; 11+ messages in thread
From: Heiko Stübner @ 2025-08-20 20:11 UTC (permalink / raw)
  To: Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Sebastian Reichel
  Cc: Robin Murphy, Diederik de Haas, linux-pm, linux-arm-kernel,
	linux-rockchip, linux-kernel, devicetree, kernel,
	Sebastian Reichel

Am Mittwoch, 20. August 2025, 19:40:47 Mitteleuropäische Sommerzeit schrieb Sebastian Reichel:
> Unify all chip descriptions to the version without any empty
> lines.
> 
> Suggested-by: Heiko Stuebner <heiko@sntech.de>
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

Reviewed-by: Heiko Stuebner <heiko@sntech.de>




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

* Re: [PATCH v2 2/3] thermal: rockchip: shut up GRF warning
  2025-08-20 17:40 ` [PATCH v2 2/3] thermal: rockchip: shut up GRF warning Sebastian Reichel
@ 2025-08-20 20:14   ` Heiko Stübner
  2025-08-21 12:41   ` Diederik de Haas
  2025-08-22  3:15   ` Dragan Simic
  2 siblings, 0 replies; 11+ messages in thread
From: Heiko Stübner @ 2025-08-20 20:14 UTC (permalink / raw)
  To: Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Sebastian Reichel
  Cc: Robin Murphy, Diederik de Haas, linux-pm, linux-arm-kernel,
	linux-rockchip, linux-kernel, devicetree, kernel,
	Sebastian Reichel

Am Mittwoch, 20. August 2025, 19:40:48 Mitteleuropäische Sommerzeit schrieb Sebastian Reichel:
> Most of the recent Rockchip devices do not have a GRF associated
> with the tsadc IP. Let's avoid printing a warning on those devices.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

As we talked about in v1, the variants now having grf_required set,
had it set in their devicetree nodes all the time - the grf handle
was added _with_ the tsadc node.

So this does not cause any regression and just makes the
warning go away for platforms that do not use any GRF registers.


Reviewed-by: Heiko Stuebner <heiko@sntech.de>


> ---
>  drivers/thermal/rockchip_thermal.c | 23 ++++++++++++++++++-----
>  1 file changed, 18 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
> index 7b18a705dfade6fa7318b28c2b57544a4446c1cc..c49ddf70f86e7beaf0190b1b3e93f5e6b2f72b2c 100644
> --- a/drivers/thermal/rockchip_thermal.c
> +++ b/drivers/thermal/rockchip_thermal.c
> @@ -74,6 +74,7 @@ struct chip_tsadc_table {
>   * @tshut_temp: the hardware-controlled shutdown temperature value, with no trim
>   * @tshut_mode: the hardware-controlled shutdown mode (0:CRU 1:GPIO)
>   * @tshut_polarity: the hardware-controlled active polarity (0:LOW 1:HIGH)
> + * @grf_required: true, if a GRF is required for proper functionality
>   * @initialize: SoC special initialize tsadc controller method
>   * @irq_ack: clear the interrupt
>   * @control: enable/disable method for the tsadc controller
> @@ -97,6 +98,9 @@ struct rockchip_tsadc_chip {
>  	enum tshut_mode tshut_mode;
>  	enum tshut_polarity tshut_polarity;
>  
> +	/* GRF availability */
> +	bool grf_required;
> +
>  	/* Chip-wide methods */
>  	void (*initialize)(struct regmap *grf,
>  			   void __iomem *reg, enum tshut_polarity p);
> @@ -1098,6 +1102,7 @@ static const struct rockchip_tsadc_chip px30_tsadc_data = {
>  	/* cpu, gpu */
>  	.chn_offset = 0,
>  	.chn_num = 2, /* 2 channels for tsadc */
> +	.grf_required = true,
>  	.tshut_mode = TSHUT_MODE_CRU, /* default TSHUT via CRU */
>  	.tshut_temp = 95000,
>  	.initialize = rk_tsadcv4_initialize,
> @@ -1119,6 +1124,7 @@ static const struct rockchip_tsadc_chip rv1108_tsadc_data = {
>  	/* cpu */
>  	.chn_offset = 0,
>  	.chn_num = 1, /* one channel for tsadc */
> +	.grf_required = false,
>  	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
>  	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
>  	.tshut_temp = 95000,
> @@ -1141,6 +1147,7 @@ static const struct rockchip_tsadc_chip rk3228_tsadc_data = {
>  	/* cpu */
>  	.chn_offset = 0,
>  	.chn_num = 1, /* one channel for tsadc */
> +	.grf_required = false,
>  	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
>  	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
>  	.tshut_temp = 95000,
> @@ -1163,6 +1170,7 @@ static const struct rockchip_tsadc_chip rk3288_tsadc_data = {
>  	/* cpu, gpu */
>  	.chn_offset = 1,
>  	.chn_num = 2, /* two channels for tsadc */
> +	.grf_required = false,
>  	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
>  	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
>  	.tshut_temp = 95000,
> @@ -1185,6 +1193,7 @@ static const struct rockchip_tsadc_chip rk3328_tsadc_data = {
>  	/* cpu */
>  	.chn_offset = 0,
>  	.chn_num = 1, /* one channels for tsadc */
> +	.grf_required = false,
>  	.tshut_mode = TSHUT_MODE_CRU, /* default TSHUT via CRU */
>  	.tshut_temp = 95000,
>  	.initialize = rk_tsadcv2_initialize,
> @@ -1206,6 +1215,7 @@ static const struct rockchip_tsadc_chip rk3366_tsadc_data = {
>  	/* cpu, gpu */
>  	.chn_offset = 0,
>  	.chn_num = 2, /* two channels for tsadc */
> +	.grf_required = true,
>  	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
>  	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
>  	.tshut_temp = 95000,
> @@ -1228,6 +1238,7 @@ static const struct rockchip_tsadc_chip rk3368_tsadc_data = {
>  	/* cpu, gpu */
>  	.chn_offset = 0,
>  	.chn_num = 2, /* two channels for tsadc */
> +	.grf_required = false,
>  	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
>  	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
>  	.tshut_temp = 95000,
> @@ -1250,6 +1261,7 @@ static const struct rockchip_tsadc_chip rk3399_tsadc_data = {
>  	/* cpu, gpu */
>  	.chn_offset = 0,
>  	.chn_num = 2, /* two channels for tsadc */
> +	.grf_required = true,
>  	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
>  	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
>  	.tshut_temp = 95000,
> @@ -1272,6 +1284,7 @@ static const struct rockchip_tsadc_chip rk3568_tsadc_data = {
>  	/* cpu, gpu */
>  	.chn_offset = 0,
>  	.chn_num = 2, /* two channels for tsadc */
> +	.grf_required = true,
>  	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
>  	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
>  	.tshut_temp = 95000,
> @@ -1294,6 +1307,7 @@ static const struct rockchip_tsadc_chip rk3576_tsadc_data = {
>  	/* top, big_core, little_core, ddr, npu, gpu */
>  	.chn_offset = 0,
>  	.chn_num = 6, /* six channels for tsadc */
> +	.grf_required = false,
>  	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
>  	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
>  	.tshut_temp = 95000,
> @@ -1318,6 +1332,7 @@ static const struct rockchip_tsadc_chip rk3588_tsadc_data = {
>  	/* top, big_core0, big_core1, little_core, center, gpu, npu */
>  	.chn_offset = 0,
>  	.chn_num = 7, /* seven channels for tsadc */
> +	.grf_required = false,
>  	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
>  	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
>  	.tshut_temp = 95000,
> @@ -1594,12 +1609,10 @@ static int rockchip_configure_from_dt(struct device *dev,
>  		return -EINVAL;
>  	}
>  
> -	/* The tsadc wont to handle the error in here since some SoCs didn't
> -	 * need this property.
> -	 */
>  	thermal->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf");
> -	if (IS_ERR(thermal->grf))
> -		dev_warn(dev, "Missing rockchip,grf property\n");
> +	if (IS_ERR(thermal->grf) && thermal->chip->grf_required)
> +		return dev_err_probe(dev, PTR_ERR(thermal->grf),
> +				     "Missing rockchip,grf property\n");
>  
>  	rockchip_get_trim_configuration(dev, np, thermal);
>  
> 
> 





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

* Re: [PATCH v2 2/3] thermal: rockchip: shut up GRF warning
  2025-08-20 17:40 ` [PATCH v2 2/3] thermal: rockchip: shut up GRF warning Sebastian Reichel
  2025-08-20 20:14   ` Heiko Stübner
@ 2025-08-21 12:41   ` Diederik de Haas
  2025-08-22  3:15   ` Dragan Simic
  2 siblings, 0 replies; 11+ messages in thread
From: Diederik de Haas @ 2025-08-21 12:41 UTC (permalink / raw)
  To: Sebastian Reichel, Rafael J. Wysocki, Daniel Lezcano, Zhang Rui,
	Lukasz Luba, Heiko Stuebner, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley
  Cc: Robin Murphy, linux-pm, linux-arm-kernel, linux-rockchip,
	linux-kernel, devicetree, kernel

[-- Attachment #1: Type: text/plain, Size: 827 bytes --]

On Wed Aug 20, 2025 at 7:40 PM CEST, Sebastian Reichel wrote:
> Most of the recent Rockchip devices do not have a GRF associated
> with the tsadc IP. Let's avoid printing a warning on those devices.

Retested with v2 of this patch (set) and there were still no regressions
on Rock64 (rk3328), RockPro64 (rk3399) and Quartz64-B (rk3566).
I skipped testing my NanoPi R5S (rk3568) this time.

And on Rock 5B (rk3588) I (still) no longer see this warning:

  rockchip-thermal fec00000.tsadc: Missing rockchip,grf property

So also with v2:

Tested-by: Diederik de Haas <didi.debian@cknow.org>

Cheers,
  Diederik

> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> ---
>  drivers/thermal/rockchip_thermal.c | 23 ++++++++++++++++++-----
>  1 file changed, 18 insertions(+), 5 deletions(-)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH v2 1/3] thermal: rockchip: unify struct rockchip_tsadc_chip format
  2025-08-20 17:40 ` [PATCH v2 1/3] thermal: rockchip: unify struct rockchip_tsadc_chip format Sebastian Reichel
  2025-08-20 20:11   ` Heiko Stübner
@ 2025-08-22  3:11   ` Dragan Simic
  1 sibling, 0 replies; 11+ messages in thread
From: Dragan Simic @ 2025-08-22  3:11 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Heiko Stuebner, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Robin Murphy, Diederik de Haas, linux-pm, linux-arm-kernel,
	linux-rockchip, linux-kernel, devicetree, kernel

Hello Sebastian,

On 2025-08-20 19:40, Sebastian Reichel wrote:
> Unify all chip descriptions to the version without any empty
> lines.
> 
> Suggested-by: Heiko Stuebner <heiko@sntech.de>
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> ---
>  drivers/thermal/rockchip_thermal.c | 27 ---------------------------
>  1 file changed, 27 deletions(-)

Thanks for the patch, it's perfectly reasonable and obviously correct.
Please feel free to include

Reviewed-by: Dragan Simic <dsimic@manjaro.org>

> diff --git a/drivers/thermal/rockchip_thermal.c
> b/drivers/thermal/rockchip_thermal.c
> index
> 3beff9b6fac3abe8948b56132b618ff1bed57217..7b18a705dfade6fa7318b28c2b57544a4446c1cc
> 100644
> --- a/drivers/thermal/rockchip_thermal.c
> +++ b/drivers/thermal/rockchip_thermal.c
> @@ -1098,10 +1098,8 @@ static const struct rockchip_tsadc_chip
> px30_tsadc_data = {
>  	/* cpu, gpu */
>  	.chn_offset = 0,
>  	.chn_num = 2, /* 2 channels for tsadc */
> -
>  	.tshut_mode = TSHUT_MODE_CRU, /* default TSHUT via CRU */
>  	.tshut_temp = 95000,
> -
>  	.initialize = rk_tsadcv4_initialize,
>  	.irq_ack = rk_tsadcv3_irq_ack,
>  	.control = rk_tsadcv3_control,
> @@ -1109,7 +1107,6 @@ static const struct rockchip_tsadc_chip
> px30_tsadc_data = {
>  	.set_alarm_temp = rk_tsadcv2_alarm_temp,
>  	.set_tshut_temp = rk_tsadcv2_tshut_temp,
>  	.set_tshut_mode = rk_tsadcv2_tshut_mode,
> -
>  	.table = {
>  		.id = rk3328_code_table,
>  		.length = ARRAY_SIZE(rk3328_code_table),
> @@ -1122,11 +1119,9 @@ static const struct rockchip_tsadc_chip
> rv1108_tsadc_data = {
>  	/* cpu */
>  	.chn_offset = 0,
>  	.chn_num = 1, /* one channel for tsadc */
> -
>  	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
>  	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
>  	.tshut_temp = 95000,
> -
>  	.initialize = rk_tsadcv2_initialize,
>  	.irq_ack = rk_tsadcv3_irq_ack,
>  	.control = rk_tsadcv3_control,
> @@ -1134,7 +1129,6 @@ static const struct rockchip_tsadc_chip
> rv1108_tsadc_data = {
>  	.set_alarm_temp = rk_tsadcv2_alarm_temp,
>  	.set_tshut_temp = rk_tsadcv2_tshut_temp,
>  	.set_tshut_mode = rk_tsadcv2_tshut_mode,
> -
>  	.table = {
>  		.id = rv1108_table,
>  		.length = ARRAY_SIZE(rv1108_table),
> @@ -1147,11 +1141,9 @@ static const struct rockchip_tsadc_chip
> rk3228_tsadc_data = {
>  	/* cpu */
>  	.chn_offset = 0,
>  	.chn_num = 1, /* one channel for tsadc */
> -
>  	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
>  	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
>  	.tshut_temp = 95000,
> -
>  	.initialize = rk_tsadcv2_initialize,
>  	.irq_ack = rk_tsadcv3_irq_ack,
>  	.control = rk_tsadcv3_control,
> @@ -1159,7 +1151,6 @@ static const struct rockchip_tsadc_chip
> rk3228_tsadc_data = {
>  	.set_alarm_temp = rk_tsadcv2_alarm_temp,
>  	.set_tshut_temp = rk_tsadcv2_tshut_temp,
>  	.set_tshut_mode = rk_tsadcv2_tshut_mode,
> -
>  	.table = {
>  		.id = rk3228_code_table,
>  		.length = ARRAY_SIZE(rk3228_code_table),
> @@ -1172,11 +1163,9 @@ static const struct rockchip_tsadc_chip
> rk3288_tsadc_data = {
>  	/* cpu, gpu */
>  	.chn_offset = 1,
>  	.chn_num = 2, /* two channels for tsadc */
> -
>  	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
>  	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
>  	.tshut_temp = 95000,
> -
>  	.initialize = rk_tsadcv2_initialize,
>  	.irq_ack = rk_tsadcv2_irq_ack,
>  	.control = rk_tsadcv2_control,
> @@ -1184,7 +1173,6 @@ static const struct rockchip_tsadc_chip
> rk3288_tsadc_data = {
>  	.set_alarm_temp = rk_tsadcv2_alarm_temp,
>  	.set_tshut_temp = rk_tsadcv2_tshut_temp,
>  	.set_tshut_mode = rk_tsadcv2_tshut_mode,
> -
>  	.table = {
>  		.id = rk3288_code_table,
>  		.length = ARRAY_SIZE(rk3288_code_table),
> @@ -1197,10 +1185,8 @@ static const struct rockchip_tsadc_chip
> rk3328_tsadc_data = {
>  	/* cpu */
>  	.chn_offset = 0,
>  	.chn_num = 1, /* one channels for tsadc */
> -
>  	.tshut_mode = TSHUT_MODE_CRU, /* default TSHUT via CRU */
>  	.tshut_temp = 95000,
> -
>  	.initialize = rk_tsadcv2_initialize,
>  	.irq_ack = rk_tsadcv3_irq_ack,
>  	.control = rk_tsadcv3_control,
> @@ -1208,7 +1194,6 @@ static const struct rockchip_tsadc_chip
> rk3328_tsadc_data = {
>  	.set_alarm_temp = rk_tsadcv2_alarm_temp,
>  	.set_tshut_temp = rk_tsadcv2_tshut_temp,
>  	.set_tshut_mode = rk_tsadcv2_tshut_mode,
> -
>  	.table = {
>  		.id = rk3328_code_table,
>  		.length = ARRAY_SIZE(rk3328_code_table),
> @@ -1221,11 +1206,9 @@ static const struct rockchip_tsadc_chip
> rk3366_tsadc_data = {
>  	/* cpu, gpu */
>  	.chn_offset = 0,
>  	.chn_num = 2, /* two channels for tsadc */
> -
>  	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
>  	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
>  	.tshut_temp = 95000,
> -
>  	.initialize = rk_tsadcv3_initialize,
>  	.irq_ack = rk_tsadcv3_irq_ack,
>  	.control = rk_tsadcv3_control,
> @@ -1233,7 +1216,6 @@ static const struct rockchip_tsadc_chip
> rk3366_tsadc_data = {
>  	.set_alarm_temp = rk_tsadcv2_alarm_temp,
>  	.set_tshut_temp = rk_tsadcv2_tshut_temp,
>  	.set_tshut_mode = rk_tsadcv2_tshut_mode,
> -
>  	.table = {
>  		.id = rk3228_code_table,
>  		.length = ARRAY_SIZE(rk3228_code_table),
> @@ -1246,11 +1228,9 @@ static const struct rockchip_tsadc_chip
> rk3368_tsadc_data = {
>  	/* cpu, gpu */
>  	.chn_offset = 0,
>  	.chn_num = 2, /* two channels for tsadc */
> -
>  	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
>  	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
>  	.tshut_temp = 95000,
> -
>  	.initialize = rk_tsadcv2_initialize,
>  	.irq_ack = rk_tsadcv2_irq_ack,
>  	.control = rk_tsadcv2_control,
> @@ -1258,7 +1238,6 @@ static const struct rockchip_tsadc_chip
> rk3368_tsadc_data = {
>  	.set_alarm_temp = rk_tsadcv2_alarm_temp,
>  	.set_tshut_temp = rk_tsadcv2_tshut_temp,
>  	.set_tshut_mode = rk_tsadcv2_tshut_mode,
> -
>  	.table = {
>  		.id = rk3368_code_table,
>  		.length = ARRAY_SIZE(rk3368_code_table),
> @@ -1271,11 +1250,9 @@ static const struct rockchip_tsadc_chip
> rk3399_tsadc_data = {
>  	/* cpu, gpu */
>  	.chn_offset = 0,
>  	.chn_num = 2, /* two channels for tsadc */
> -
>  	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
>  	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
>  	.tshut_temp = 95000,
> -
>  	.initialize = rk_tsadcv3_initialize,
>  	.irq_ack = rk_tsadcv3_irq_ack,
>  	.control = rk_tsadcv3_control,
> @@ -1283,7 +1260,6 @@ static const struct rockchip_tsadc_chip
> rk3399_tsadc_data = {
>  	.set_alarm_temp = rk_tsadcv2_alarm_temp,
>  	.set_tshut_temp = rk_tsadcv2_tshut_temp,
>  	.set_tshut_mode = rk_tsadcv2_tshut_mode,
> -
>  	.table = {
>  		.id = rk3399_code_table,
>  		.length = ARRAY_SIZE(rk3399_code_table),
> @@ -1296,11 +1272,9 @@ static const struct rockchip_tsadc_chip
> rk3568_tsadc_data = {
>  	/* cpu, gpu */
>  	.chn_offset = 0,
>  	.chn_num = 2, /* two channels for tsadc */
> -
>  	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
>  	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
>  	.tshut_temp = 95000,
> -
>  	.initialize = rk_tsadcv7_initialize,
>  	.irq_ack = rk_tsadcv3_irq_ack,
>  	.control = rk_tsadcv3_control,
> @@ -1308,7 +1282,6 @@ static const struct rockchip_tsadc_chip
> rk3568_tsadc_data = {
>  	.set_alarm_temp = rk_tsadcv2_alarm_temp,
>  	.set_tshut_temp = rk_tsadcv2_tshut_temp,
>  	.set_tshut_mode = rk_tsadcv2_tshut_mode,
> -
>  	.table = {
>  		.id = rk3568_code_table,
>  		.length = ARRAY_SIZE(rk3568_code_table),

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

* Re: [PATCH v2 2/3] thermal: rockchip: shut up GRF warning
  2025-08-20 17:40 ` [PATCH v2 2/3] thermal: rockchip: shut up GRF warning Sebastian Reichel
  2025-08-20 20:14   ` Heiko Stübner
  2025-08-21 12:41   ` Diederik de Haas
@ 2025-08-22  3:15   ` Dragan Simic
  2 siblings, 0 replies; 11+ messages in thread
From: Dragan Simic @ 2025-08-22  3:15 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Heiko Stuebner, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Robin Murphy, Diederik de Haas, linux-pm, linux-arm-kernel,
	linux-rockchip, linux-kernel, devicetree, kernel

Hello Sebastian,

On 2025-08-20 19:40, Sebastian Reichel wrote:
> Most of the recent Rockchip devices do not have a GRF associated
> with the tsadc IP. Let's avoid printing a warning on those devices.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> ---
>  drivers/thermal/rockchip_thermal.c | 23 ++++++++++++++++++-----
>  1 file changed, 18 insertions(+), 5 deletions(-)

Thanks for the patch!  It's looking good to me, and it's virtually
identical to my rather old patch that I implemented a while ago, but
never submitted to the mailing list(s).

Please feel free to include

Reviewed-by: Dragan Simic <dsimic@manjaro.org>

> diff --git a/drivers/thermal/rockchip_thermal.c
> b/drivers/thermal/rockchip_thermal.c
> index
> 7b18a705dfade6fa7318b28c2b57544a4446c1cc..c49ddf70f86e7beaf0190b1b3e93f5e6b2f72b2c
> 100644
> --- a/drivers/thermal/rockchip_thermal.c
> +++ b/drivers/thermal/rockchip_thermal.c
> @@ -74,6 +74,7 @@ struct chip_tsadc_table {
>   * @tshut_temp: the hardware-controlled shutdown temperature value,
> with no trim
>   * @tshut_mode: the hardware-controlled shutdown mode (0:CRU 1:GPIO)
>   * @tshut_polarity: the hardware-controlled active polarity (0:LOW 
> 1:HIGH)
> + * @grf_required: true, if a GRF is required for proper functionality
>   * @initialize: SoC special initialize tsadc controller method
>   * @irq_ack: clear the interrupt
>   * @control: enable/disable method for the tsadc controller
> @@ -97,6 +98,9 @@ struct rockchip_tsadc_chip {
>  	enum tshut_mode tshut_mode;
>  	enum tshut_polarity tshut_polarity;
> 
> +	/* GRF availability */
> +	bool grf_required;
> +
>  	/* Chip-wide methods */
>  	void (*initialize)(struct regmap *grf,
>  			   void __iomem *reg, enum tshut_polarity p);
> @@ -1098,6 +1102,7 @@ static const struct rockchip_tsadc_chip
> px30_tsadc_data = {
>  	/* cpu, gpu */
>  	.chn_offset = 0,
>  	.chn_num = 2, /* 2 channels for tsadc */
> +	.grf_required = true,
>  	.tshut_mode = TSHUT_MODE_CRU, /* default TSHUT via CRU */
>  	.tshut_temp = 95000,
>  	.initialize = rk_tsadcv4_initialize,
> @@ -1119,6 +1124,7 @@ static const struct rockchip_tsadc_chip
> rv1108_tsadc_data = {
>  	/* cpu */
>  	.chn_offset = 0,
>  	.chn_num = 1, /* one channel for tsadc */
> +	.grf_required = false,
>  	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
>  	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
>  	.tshut_temp = 95000,
> @@ -1141,6 +1147,7 @@ static const struct rockchip_tsadc_chip
> rk3228_tsadc_data = {
>  	/* cpu */
>  	.chn_offset = 0,
>  	.chn_num = 1, /* one channel for tsadc */
> +	.grf_required = false,
>  	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
>  	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
>  	.tshut_temp = 95000,
> @@ -1163,6 +1170,7 @@ static const struct rockchip_tsadc_chip
> rk3288_tsadc_data = {
>  	/* cpu, gpu */
>  	.chn_offset = 1,
>  	.chn_num = 2, /* two channels for tsadc */
> +	.grf_required = false,
>  	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
>  	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
>  	.tshut_temp = 95000,
> @@ -1185,6 +1193,7 @@ static const struct rockchip_tsadc_chip
> rk3328_tsadc_data = {
>  	/* cpu */
>  	.chn_offset = 0,
>  	.chn_num = 1, /* one channels for tsadc */
> +	.grf_required = false,
>  	.tshut_mode = TSHUT_MODE_CRU, /* default TSHUT via CRU */
>  	.tshut_temp = 95000,
>  	.initialize = rk_tsadcv2_initialize,
> @@ -1206,6 +1215,7 @@ static const struct rockchip_tsadc_chip
> rk3366_tsadc_data = {
>  	/* cpu, gpu */
>  	.chn_offset = 0,
>  	.chn_num = 2, /* two channels for tsadc */
> +	.grf_required = true,
>  	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
>  	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
>  	.tshut_temp = 95000,
> @@ -1228,6 +1238,7 @@ static const struct rockchip_tsadc_chip
> rk3368_tsadc_data = {
>  	/* cpu, gpu */
>  	.chn_offset = 0,
>  	.chn_num = 2, /* two channels for tsadc */
> +	.grf_required = false,
>  	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
>  	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
>  	.tshut_temp = 95000,
> @@ -1250,6 +1261,7 @@ static const struct rockchip_tsadc_chip
> rk3399_tsadc_data = {
>  	/* cpu, gpu */
>  	.chn_offset = 0,
>  	.chn_num = 2, /* two channels for tsadc */
> +	.grf_required = true,
>  	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
>  	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
>  	.tshut_temp = 95000,
> @@ -1272,6 +1284,7 @@ static const struct rockchip_tsadc_chip
> rk3568_tsadc_data = {
>  	/* cpu, gpu */
>  	.chn_offset = 0,
>  	.chn_num = 2, /* two channels for tsadc */
> +	.grf_required = true,
>  	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
>  	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
>  	.tshut_temp = 95000,
> @@ -1294,6 +1307,7 @@ static const struct rockchip_tsadc_chip
> rk3576_tsadc_data = {
>  	/* top, big_core, little_core, ddr, npu, gpu */
>  	.chn_offset = 0,
>  	.chn_num = 6, /* six channels for tsadc */
> +	.grf_required = false,
>  	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
>  	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
>  	.tshut_temp = 95000,
> @@ -1318,6 +1332,7 @@ static const struct rockchip_tsadc_chip
> rk3588_tsadc_data = {
>  	/* top, big_core0, big_core1, little_core, center, gpu, npu */
>  	.chn_offset = 0,
>  	.chn_num = 7, /* seven channels for tsadc */
> +	.grf_required = false,
>  	.tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC */
>  	.tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
>  	.tshut_temp = 95000,
> @@ -1594,12 +1609,10 @@ static int rockchip_configure_from_dt(struct
> device *dev,
>  		return -EINVAL;
>  	}
> 
> -	/* The tsadc wont to handle the error in here since some SoCs didn't
> -	 * need this property.
> -	 */
>  	thermal->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf");
> -	if (IS_ERR(thermal->grf))
> -		dev_warn(dev, "Missing rockchip,grf property\n");
> +	if (IS_ERR(thermal->grf) && thermal->chip->grf_required)
> +		return dev_err_probe(dev, PTR_ERR(thermal->grf),
> +				     "Missing rockchip,grf property\n");
> 
>  	rockchip_get_trim_configuration(dev, np, thermal);

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

* Re: [PATCH v2 3/3] dt-bindings: thermal: rockchip: tighten grf requirements
  2025-08-20 17:40 ` [PATCH v2 3/3] dt-bindings: thermal: rockchip: tighten grf requirements Sebastian Reichel
  2025-08-20 19:48   ` Conor Dooley
@ 2025-08-22  3:20   ` Dragan Simic
  1 sibling, 0 replies; 11+ messages in thread
From: Dragan Simic @ 2025-08-22  3:20 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Heiko Stuebner, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Robin Murphy, Diederik de Haas, linux-pm, linux-arm-kernel,
	linux-rockchip, linux-kernel, devicetree, kernel

Hello Sebastian,

On 2025-08-20 19:40, Sebastian Reichel wrote:
> Instead of having an optional rockchip,grf property, forbid using it on
> platforms without registers in a GRF being needed for thermal 
> monitoring
> and make it mandatory on the platforms actually needing it.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> ---
>  .../devicetree/bindings/thermal/rockchip-thermal.yaml     | 15 
> +++++++++++++++
>  1 file changed, 15 insertions(+)

Thanks for the patch!  It matches what's already presented in your
patch 2/3, so it's looking good to me. Please feel free to include

Reviewed-by: Dragan Simic <dsimic@manjaro.org>

> diff --git
> a/Documentation/devicetree/bindings/thermal/rockchip-thermal.yaml
> b/Documentation/devicetree/bindings/thermal/rockchip-thermal.yaml
> index
> 573f447cc26ed7100638277598b0e745d436fd01..9fa5c4c49d76e3a689f31797875124e7fb30d3df
> 100644
> --- a/Documentation/devicetree/bindings/thermal/rockchip-thermal.yaml
> +++ b/Documentation/devicetree/bindings/thermal/rockchip-thermal.yaml
> @@ -119,6 +119,21 @@ required:
>    - resets
> 
>  allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - rockchip,px30-tsadc
> +              - rockchip,rk3366-tsadc
> +              - rockchip,rk3399-tsadc
> +              - rockchip,rk3568-tsadc
> +    then:
> +      required:
> +        - rockchip,grf
> +    else:
> +      properties:
> +        rockchip,grf: false
>    - if:
>        not:
>          properties:

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

end of thread, other threads:[~2025-08-22  3:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-20 17:40 [PATCH v2 0/3] thermal: rockchip: shut up GRF warning Sebastian Reichel
2025-08-20 17:40 ` [PATCH v2 1/3] thermal: rockchip: unify struct rockchip_tsadc_chip format Sebastian Reichel
2025-08-20 20:11   ` Heiko Stübner
2025-08-22  3:11   ` Dragan Simic
2025-08-20 17:40 ` [PATCH v2 2/3] thermal: rockchip: shut up GRF warning Sebastian Reichel
2025-08-20 20:14   ` Heiko Stübner
2025-08-21 12:41   ` Diederik de Haas
2025-08-22  3:15   ` Dragan Simic
2025-08-20 17:40 ` [PATCH v2 3/3] dt-bindings: thermal: rockchip: tighten grf requirements Sebastian Reichel
2025-08-20 19:48   ` Conor Dooley
2025-08-22  3:20   ` Dragan Simic

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).