Skip to contentSkip to conversation

Add support for A523 Thermal system

PATCH In review iuncuim 5 participants 18 messages Apr 11, 2025 – Jun 30, 2025

Subsystems (4)
lore
Share & tools
lore

iuncuim

author
#0 lore raw

cover Add support for A523 Thermal system

This patch series adds temperature sensor support for the Allwinner A523 family of processors (same die with H728/A527/T527)

Mikhail Kalashnikov (6):
thermal/drivers/sun8i: add gpadc clock thermal/drivers/sun8i: replace devm_reset_control_get to shared thermal/drivers/sun8i: Add support for A523 THS0/1 controllers
arm64: dts: allwinner: A523: Add SID controller node
arm64: dts: allwinner: A523: Add thermal sensors and zones
dt-bindings: thermal: sun8i: Add A523 THS0/1 controllers

 .../thermal/allwinner,sun8i-a83t-ths.yaml     |   5 +
 .../arm64/boot/dts/allwinner/sun55i-a523.dtsi | 145 +++++++++++++++++
 drivers/thermal/sun8i_thermal.c               | 154 +++++++++++++++++-
 3 files changed, 300 insertions(+), 4 deletions(-)
Signature · 1 line
2.49.0
author
#1 lore raw

PATCH 1/6 thermal/drivers/sun8i: add gpadc clock

From: Mikhail Kalashnikov <[email protected]>

Some processors (e.g. Allwinner A523) require GPADC clocking activation for temperature sensors to work. So let's add support for enabling it.

---
 drivers/thermal/sun8i_thermal.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/thermal/sun8i_thermal.c +15 -3
index 226747906..1f3908a60 100644
@@ -66,8 +66,9 @@ struct tsensor {
 };
 
 struct ths_thermal_chip {
-	bool            has_mod_clk;
-	bool            has_bus_clk_reset;
+	bool		has_gpadc_clk;
+	bool		has_mod_clk;
+	bool		has_bus_clk_reset;
 	bool		needs_sram;
 	int		sensor_num;
 	int		offset;
@@ -89,7 +90,8 @@ struct ths_device {
 	struct regmap_field			*sram_regmap_field;
 	struct reset_control			*reset;
 	struct clk				*bus_clk;
-	struct clk                              *mod_clk;
+	struct clk				*mod_clk;
+	struct clk				*gpadc_clk;
 	struct tsensor				sensor[MAX_SENSOR_NUM];
 };
 
@@ -417,6 +419,16 @@ static int sun8i_ths_resource_init(struct ths_device *tmdev)
 	if (ret)
 		return ret;
 
+	if (tmdev->chip->has_gpadc_clk) {
+		tmdev->gpadc_clk = devm_clk_get_enabled(&pdev->dev, "gpadc");
+		if (IS_ERR(tmdev->gpadc_clk))
+			return PTR_ERR(tmdev->gpadc_clk);
+	}
+
+	ret = clk_prepare_enable(tmdev->gpadc_clk);
+	if (ret)
+		return ret;
+
 	if (tmdev->chip->needs_sram) {
 		struct regmap *regmap;
 
Signature · 1 line
2.49.0
#2 lore raw

Re: [PATCH 1/6] thermal/drivers/sun8i: add gpadc clock

Quoted 37 lines · Mikhail Kalashnikov

From: Mikhail Kalashnikov <[email protected]>

Some processors (e.g. Allwinner A523) require GPADC clocking activation for temperature sensors to work. So let's add support for enabling it.

---
 drivers/thermal/sun8i_thermal.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/thermal/sun8i_thermal.c +5 -3
index 226747906..1f3908a60 100644
@@ -66,8 +66,9 @@ struct tsensor {
 };
 
 struct ths_thermal_chip {
-	bool            has_mod_clk;
-	bool            has_bus_clk_reset;
+	bool		has_gpadc_clk;
+	bool		has_mod_clk;
+	bool		has_bus_clk_reset;
 	bool		needs_sram;
 	int		sensor_num;
 	int		offset;
@@ -89,7 +90,8 @@ struct ths_device {
 	struct regmap_field			*sram_regmap_field;
 	struct reset_control			*reset;
 	struct clk				*bus_clk;
-	struct clk                              *mod_clk;
+	struct clk				*mod_clk;
+	struct clk				*gpadc_clk;
 	struct tsensor				sensor[MAX_SENSOR_NUM];
 };
 

drivers/thermal/sun8i_thermal.c static int sun8i_ths_resource_init(struct ths_device *tmdev) · line 425

Quoted 7 lines
drivers/thermal/sun8i_thermal.c +4 -0
@@ -417,6 +419,16 @@ static int sun8i_ths_resource_init(struct ths_device *tmdev)
 	if (ret)
 		return ret;
 
+	if (tmdev->chip->has_gpadc_clk) {
+		tmdev->gpadc_clk = devm_clk_get_enabled(&pdev->dev, "gpadc");
+		if (IS_ERR(tmdev->gpadc_clk))
+			return PTR_ERR(tmdev->gpadc_clk);
			return dev_err_probe();

drivers/thermal/sun8i_thermal.c static int sun8i_ths_resource_init(struct ths_device *tmdev) · line 431

Quoted 6 lines
drivers/thermal/sun8i_thermal.c +6 -0
+	}
+
+	ret = clk_prepare_enable(tmdev->gpadc_clk);
+	if (ret)
+		return ret;
+

Why calling clk_prepare_enable() ? devm_clk_get_enabled() did the job no ?

Quoted 6 lines
drivers/thermal/sun8i_thermal.c +0 -0
 	if (tmdev->chip->needs_sram) {
 		struct regmap *regmap;
 
Signature · 1 line
2.49.0
Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
author
#3 lore raw

PATCH 2/6 thermal/drivers/sun8i: replace devm_reset_control_get to shared

In reply to iuncuim

From: Mikhail Kalashnikov <[email protected]>

The A523 processor has two temperature controllers, but they share a common reset line. We need to use devm_reset_control_get_shared() instead of devm_reset_control_get()

---
 drivers/thermal/sun8i_thermal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/sun8i_thermal.c +1 -1
index 1f3908a60..dc4055c9c 100644
@@ -391,7 +391,7 @@ static int sun8i_ths_resource_init(struct ths_device *tmdev)
 		return PTR_ERR(tmdev->regmap);
 
 	if (tmdev->chip->has_bus_clk_reset) {
-		tmdev->reset = devm_reset_control_get(dev, NULL);
+		tmdev->reset = devm_reset_control_get_shared(dev, NULL);
 		if (IS_ERR(tmdev->reset))
 			return PTR_ERR(tmdev->reset);
 
Signature · 1 line
2.49.0
#4 lore raw

Re: [PATCH 2/6] thermal/drivers/sun8i: replace devm_reset_control_get to shared

Quoted 17 lines · iuncuim

From: Mikhail Kalashnikov <[email protected]>

The A523 processor has two temperature controllers, but they share a common reset line. We need to use devm_reset_control_get_shared() instead of devm_reset_control_get()

---
 drivers/thermal/sun8i_thermal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/sun8i_thermal.c +0 -0
index 1f3908a60..dc4055c9c 100644

drivers/thermal/sun8i_thermal.c static int sun8i_ths_resource_init(struct ths_device *tmdev) · line 394

Quoted 5 lines
drivers/thermal/sun8i_thermal.c +1 -1
@@ -391,7 +391,7 @@ static int sun8i_ths_resource_init(struct ths_device *tmdev)
                return PTR_ERR(tmdev->regmap);
 
        if (tmdev->chip->has_bus_clk_reset) {
-               tmdev->reset = devm_reset_control_get(dev, NULL);
+               tmdev->reset = devm_reset_control_get_shared(dev, NULL);

You could just use devm_reset_control_get_shared_deasserted() and then drop the reset_control_deassert() and devm_add_action_or_reset() stuff below this hunk. This simplifies the driver a bit.

Quoted 6 lines
drivers/thermal/sun8i_thermal.c +0 -1
                if (IS_ERR(tmdev->reset))
                        return PTR_ERR(tmdev->reset);
 
--

2.49.0

author
#5 lore raw

PATCH 3/6 thermal/drivers/sun8i: Add support for A523 THS0/1 controllers

In reply to iuncuim

From: Mikhail Kalashnikov <[email protected]>

The A523 processor has two temperature controllers, THS0 and THS1. THS0 has only one temperature sensor, which is located in the DRAM.

THS1 does have 3 sensors:
ths1_0 - "big" cores
ths1_1 - "little" cores
ths1_2 - gpu

The datasheet mentions a fourth sensor in the NPU, but lacks any registers for operation other than calibration registers. The vendor code reads the value from ths1_2, but uses separate calibration data, so we get two different values from real one.

---
 drivers/thermal/sun8i_thermal.c | 134 ++++++++++++++++++++++++++++++++
 1 file changed, 134 insertions(+)
drivers/thermal/sun8i_thermal.c +134 -0
index dc4055c9c..919b05a96 100644
@@ -116,6 +116,15 @@ static int sun50i_h5_calc_temp(struct ths_device *tmdev,
 		return -1590 * reg / 10 + 276000;
 }
 
+static int sun55i_a523_calc_temp(struct ths_device *tmdev,
+					int id, int reg)
+{
+	if (reg >= 0x7c8)
+		return tmdev->chip->scale * (tmdev->chip->offset - reg);
+	else
+		return 65 * (2825 - reg);
+}
+
 static int sun8i_ths_get_temp(struct thermal_zone_device *tz, int *temp)
 {
 	struct tsensor *s = thermal_zone_device_priv(tz);
@@ -208,6 +217,100 @@ static irqreturn_t sun8i_irq_thread(int irq, void *data)
 	return IRQ_HANDLED;
 }
 
+
+/*
+ * The A523 nvmem calibration values. The ths1_3 is not used as it
+ * doesn't have its own sensor and doesn't have any internal switch.
+ * Instead, the value from the ths1_2 sensor is used, which gives the
+ * illusion of an independent sensor for NPU and GPU when using
+ * different calibration values.
+ *
+ * efuse layout 0x38-0x3F (caldata[0..3]):
+ *     caldata[0]      caldata[1]      caldata[2]      caldata[3]
+ * 0               16      24      32  36          48          60 64
+ * +---------------+---------------+---------------+---------------+
+ * |               |       |   temp    |  ths1_0   |  ths1_1   |   +
+ * +---------------+---------------+---------------+---------------+
+ *
+ * efuse layout 0x40-0x43 (caldata[4..5]) - not in use
+ *
+ * efuse layout 0x44-0x4B (caldata[6..9]):
+ *     caldata[6]      caldata[7]      caldata[8]      caldata[9]
+ * 0           12  16      24      32  36          48             64
+ * +---------------+---------------+---------------+---------------+
+ * |  ths1_2   |  ths1_3   |  ths0_0   |           |               +
+ * +---------------+---------------+---------------+---------------+
+ */
+static int sun55i_a523_ths_calibrate(struct ths_device *tmdev,
+				   u16 *caldata, int callen)
+{
+	struct device *dev = tmdev->dev;
+	int i, ft_temp;
+
+	if (!caldata[0])
+		return -EINVAL;
+
+	ft_temp = (((caldata[2] << 8) | (caldata[1] >> 8)) & FT_TEMP_MASK) * 100;
+
+	for (i = 0; i < tmdev->chip->sensor_num; i++) {
+		int sensor_reg, sensor_temp, cdata, offset;
+		/*
+		 * Chips ths0 and ths1 have common parameters for value
+		 * calibration. To separate them we can use the number of
+		 * temperature sensors on each chip.
+		 * For ths0 this value is 1.
+		 */
+		if (tmdev->chip->sensor_num == 1) {
+			sensor_reg = ((caldata[7] >> 8) | (caldata[8] << 8)) & TEMP_CALIB_MASK;
+		} else {
+			switch (i) {
+			case 0:
+				sensor_reg = (caldata[2] >> 4) & TEMP_CALIB_MASK;
+				break;
+			case 1:
+				sensor_reg = caldata[3] & TEMP_CALIB_MASK;
+				break;
+			case 2:
+				sensor_reg = caldata[6] & TEMP_CALIB_MASK;
+				break;
+			default:
+				sensor_reg = 0;
+				break;
+			}
+		}
+
+		sensor_temp = tmdev->chip->calc_temp(tmdev, i, sensor_reg);
+
+		/*
+		 * Calibration data is CALIBRATE_DEFAULT - (calculated
+		 * temperature from sensor reading at factory temperature
+		 * minus actual factory temperature) * X (scale from
+		 * temperature to register values)
+		 */
+		cdata = CALIBRATE_DEFAULT -
+			((sensor_temp - ft_temp) / tmdev->chip->scale);
+
+		if (cdata & ~TEMP_CALIB_MASK) {
+			/*
+			 * Calibration value more than 12-bit, but calibration
+			 * register is 12-bit. In this case, ths hardware can
+			 * still work without calibration, although the data
+			 * won't be so accurate.
+			 */
+			dev_warn(dev, "sensor%d is not calibrated.\n", i);
+			continue;
+		}
+
+		offset = (i % 2) * 16;
+		regmap_update_bits(tmdev->regmap,
+				   SUN50I_H6_THS_TEMP_CALIB + (i / 2 * 4),
+				   TEMP_CALIB_MASK << offset,
+				   cdata << offset);
+	}
+
+	return 0;
+}
+
 static int sun8i_h3_ths_calibrate(struct ths_device *tmdev,
 				  u16 *caldata, int callen)
 {
@@ -721,6 +824,35 @@ static const struct ths_thermal_chip sun50i_h616_ths = {
 	.calc_temp = sun8i_ths_calc_temp,
 };
 
+/* The A523 has a shared reset line for both chips */
+static const struct ths_thermal_chip sun55i_a523_ths0 = {
+	.sensor_num = 1,
+	.has_bus_clk_reset = true,
+	.has_gpadc_clk = true,
+	.ft_deviation = 5000,
+	.offset = 2736,
+	.scale = 74,
+	.temp_data_base = SUN50I_H6_THS_TEMP_DATA,
+	.calibrate = sun55i_a523_ths_calibrate,
+	.init = sun50i_h6_thermal_init,
+	.irq_ack = sun50i_h6_irq_ack,
+	.calc_temp = sun55i_a523_calc_temp,
+};
+
+static const struct ths_thermal_chip sun55i_a523_ths1 = {
+	.sensor_num = 3,
+	.has_bus_clk_reset = true,
+	.has_gpadc_clk = true,
+	.ft_deviation = 5000,
+	.offset = 2736,
+	.scale = 74,
+	.temp_data_base = SUN50I_H6_THS_TEMP_DATA,
+	.calibrate = sun55i_a523_ths_calibrate,
+	.init = sun50i_h6_thermal_init,
+	.irq_ack = sun50i_h6_irq_ack,
+	.calc_temp = sun55i_a523_calc_temp,
+};
+
 static const struct of_device_id of_ths_match[] = {
 	{ .compatible = "allwinner,sun8i-a83t-ths", .data = &sun8i_a83t_ths },
 	{ .compatible = "allwinner,sun8i-h3-ths", .data = &sun8i_h3_ths },
@@ -731,6 +863,8 @@ static const struct of_device_id of_ths_match[] = {
 	{ .compatible = "allwinner,sun50i-h6-ths", .data = &sun50i_h6_ths },
 	{ .compatible = "allwinner,sun20i-d1-ths", .data = &sun20i_d1_ths },
 	{ .compatible = "allwinner,sun50i-h616-ths", .data = &sun50i_h616_ths },
+	{ .compatible = "allwinner,sun55i-a523-ths0", .data = &sun55i_a523_ths0 },
+	{ .compatible = "allwinner,sun55i-a523-ths1", .data = &sun55i_a523_ths1 },
 	{ /* sentinel */ },
 };
 MODULE_DEVICE_TABLE(of, of_ths_match);
Signature · 1 line
2.49.0
#6 lore raw

Re: [PATCH 3/6] thermal/drivers/sun8i: Add support for A523 THS0/1 controllers

Quoted 26 lines · Mikhail Kalashnikov

From: Mikhail Kalashnikov <[email protected]>

The A523 processor has two temperature controllers, THS0 and THS1. THS0 has only one temperature sensor, which is located in the DRAM.

THS1 does have 3 sensors:
ths1_0 - "big" cores
ths1_1 - "little" cores
ths1_2 - gpu

The datasheet mentions a fourth sensor in the NPU, but lacks any registers for operation other than calibration registers. The vendor code reads the value from ths1_2, but uses separate calibration data, so we get two different values from real one.

---
 drivers/thermal/sun8i_thermal.c | 134 ++++++++++++++++++++++++++++++++
 1 file changed, 134 insertions(+)
drivers/thermal/sun8i_thermal.c +0 -0
index dc4055c9c..919b05a96 100644
@@ -116,6 +116,15 @@ static int sun50i_h5_calc_temp(struct ths_device *tmdev,
 		return -1590 * reg / 10 + 276000;

drivers/thermal/sun8i_thermal.c static int sun50i_h5_calc_temp(struct ths_device *tmdev, · line 126

Quoted 10 lines
drivers/thermal/sun8i_thermal.c +8 -0
 }
 
+static int sun55i_a523_calc_temp(struct ths_device *tmdev,
+					int id, int reg)
+{
+	if (reg >= 0x7c8)
+		return tmdev->chip->scale * (tmdev->chip->offset - reg);
+	else
+		return 65 * (2825 - reg);
+}

Please use macro instead of litterals

Quoted 153 lines
drivers/thermal/sun8i_thermal.c +126 -0
+
 static int sun8i_ths_get_temp(struct thermal_zone_device *tz, int *temp)
 {
 	struct tsensor *s = thermal_zone_device_priv(tz);
@@ -208,6 +217,100 @@ static irqreturn_t sun8i_irq_thread(int irq, void *data)
 	return IRQ_HANDLED;
 }
 
+
+/*
+ * The A523 nvmem calibration values. The ths1_3 is not used as it
+ * doesn't have its own sensor and doesn't have any internal switch.
+ * Instead, the value from the ths1_2 sensor is used, which gives the
+ * illusion of an independent sensor for NPU and GPU when using
+ * different calibration values.
+ *
+ * efuse layout 0x38-0x3F (caldata[0..3]):
+ *     caldata[0]      caldata[1]      caldata[2]      caldata[3]
+ * 0               16      24      32  36          48          60 64
+ * +---------------+---------------+---------------+---------------+
+ * |               |       |   temp    |  ths1_0   |  ths1_1   |   +
+ * +---------------+---------------+---------------+---------------+
+ *
+ * efuse layout 0x40-0x43 (caldata[4..5]) - not in use
+ *
+ * efuse layout 0x44-0x4B (caldata[6..9]):
+ *     caldata[6]      caldata[7]      caldata[8]      caldata[9]
+ * 0           12  16      24      32  36          48             64
+ * +---------------+---------------+---------------+---------------+
+ * |  ths1_2   |  ths1_3   |  ths0_0   |           |               +
+ * +---------------+---------------+---------------+---------------+
+ */
+static int sun55i_a523_ths_calibrate(struct ths_device *tmdev,
+				   u16 *caldata, int callen)
+{
+	struct device *dev = tmdev->dev;
+	int i, ft_temp;
+
+	if (!caldata[0])
+		return -EINVAL;
+
+	ft_temp = (((caldata[2] << 8) | (caldata[1] >> 8)) & FT_TEMP_MASK) * 100;
+
+	for (i = 0; i < tmdev->chip->sensor_num; i++) {
+		int sensor_reg, sensor_temp, cdata, offset;
+		/*
+		 * Chips ths0 and ths1 have common parameters for value
+		 * calibration. To separate them we can use the number of
+		 * temperature sensors on each chip.
+		 * For ths0 this value is 1.
+		 */
+		if (tmdev->chip->sensor_num == 1) {
+			sensor_reg = ((caldata[7] >> 8) | (caldata[8] << 8)) & TEMP_CALIB_MASK;
+		} else {
+			switch (i) {
+			case 0:
+				sensor_reg = (caldata[2] >> 4) & TEMP_CALIB_MASK;
+				break;
+			case 1:
+				sensor_reg = caldata[3] & TEMP_CALIB_MASK;
+				break;
+			case 2:
+				sensor_reg = caldata[6] & TEMP_CALIB_MASK;
+				break;
+			default:
+				sensor_reg = 0;
+				break;
+			}
+		}
+
+		sensor_temp = tmdev->chip->calc_temp(tmdev, i, sensor_reg);
+
+		/*
+		 * Calibration data is CALIBRATE_DEFAULT - (calculated
+		 * temperature from sensor reading at factory temperature
+		 * minus actual factory temperature) * X (scale from
+		 * temperature to register values)
+		 */
+		cdata = CALIBRATE_DEFAULT -
+			((sensor_temp - ft_temp) / tmdev->chip->scale);
+
+		if (cdata & ~TEMP_CALIB_MASK) {
+			/*
+			 * Calibration value more than 12-bit, but calibration
+			 * register is 12-bit. In this case, ths hardware can
+			 * still work without calibration, although the data
+			 * won't be so accurate.
+			 */
+			dev_warn(dev, "sensor%d is not calibrated.\n", i);
+			continue;
+		}
+
+		offset = (i % 2) * 16;
+		regmap_update_bits(tmdev->regmap,
+				   SUN50I_H6_THS_TEMP_CALIB + (i / 2 * 4),
+				   TEMP_CALIB_MASK << offset,
+				   cdata << offset);
+	}
+
+	return 0;
+}
+
 static int sun8i_h3_ths_calibrate(struct ths_device *tmdev,
 				  u16 *caldata, int callen)
 {
@@ -721,6 +824,35 @@ static const struct ths_thermal_chip sun50i_h616_ths = {
 	.calc_temp = sun8i_ths_calc_temp,
 };
 
+/* The A523 has a shared reset line for both chips */
+static const struct ths_thermal_chip sun55i_a523_ths0 = {
+	.sensor_num = 1,
+	.has_bus_clk_reset = true,
+	.has_gpadc_clk = true,
+	.ft_deviation = 5000,
+	.offset = 2736,
+	.scale = 74,
+	.temp_data_base = SUN50I_H6_THS_TEMP_DATA,
+	.calibrate = sun55i_a523_ths_calibrate,
+	.init = sun50i_h6_thermal_init,
+	.irq_ack = sun50i_h6_irq_ack,
+	.calc_temp = sun55i_a523_calc_temp,
+};
+
+static const struct ths_thermal_chip sun55i_a523_ths1 = {
+	.sensor_num = 3,
+	.has_bus_clk_reset = true,
+	.has_gpadc_clk = true,
+	.ft_deviation = 5000,
+	.offset = 2736,
+	.scale = 74,
+	.temp_data_base = SUN50I_H6_THS_TEMP_DATA,
+	.calibrate = sun55i_a523_ths_calibrate,
+	.init = sun50i_h6_thermal_init,
+	.irq_ack = sun50i_h6_irq_ack,
+	.calc_temp = sun55i_a523_calc_temp,
+};
+
 static const struct of_device_id of_ths_match[] = {
 	{ .compatible = "allwinner,sun8i-a83t-ths", .data = &sun8i_a83t_ths },
 	{ .compatible = "allwinner,sun8i-h3-ths", .data = &sun8i_h3_ths },
@@ -731,6 +863,8 @@ static const struct of_device_id of_ths_match[] = {
 	{ .compatible = "allwinner,sun50i-h6-ths", .data = &sun50i_h6_ths },
 	{ .compatible = "allwinner,sun20i-d1-ths", .data = &sun20i_d1_ths },
 	{ .compatible = "allwinner,sun50i-h616-ths", .data = &sun50i_h616_ths },
+	{ .compatible = "allwinner,sun55i-a523-ths0", .data = &sun55i_a523_ths0 },
+	{ .compatible = "allwinner,sun55i-a523-ths1", .data = &sun55i_a523_ths1 },
 	{ /* sentinel */ },
 };
 MODULE_DEVICE_TABLE(of, of_ths_match);
Signature · 1 line
2.49.0
Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
author
#7 lore raw

PATCH 4/6 arm64: dts: allwinner: A523: Add SID controller node

In reply to iuncuim

From: Mikhail Kalashnikov <[email protected]>

The SID controller should be compatible with A64 and others SoC with 0x200 offset.

---
 arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi +7 -0
index ee485899b..d626612bb 100644
@@ -171,6 +171,13 @@ ccu: clock-controller@2001000 {
 			#reset-cells = <1>;
 		};
 
+		sid: efuse@3006000 {
+			compatible = "allwinner,sun50i-a523-sid", "allwinner,sun50i-a64-sid";
+			reg = <0x03006000 0x1000>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+		};
+
 		mmc0: mmc@4020000 {
 			compatible = "allwinner,sun55i-a523-mmc",
 				     "allwinner,sun20i-d1-mmc";
Signature · 1 line
2.49.0
Reviewed-by on v1 4/6
#8 lore raw

Re: [PATCH 4/6] arm64: dts: allwinner: A523: Add SID controller node

Quoted 7 lines · iuncuim

From: Mikhail Kalashnikov <[email protected]>

The SID controller should be compatible with A64 and others SoC with 0x200 offset.

But this also needs a matching update to the binding.

Quoted 25 lines
---
 arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi +7 -1
index ee485899b..d626612bb 100644
@@ -171,6 +171,13 @@ ccu: clock-controller@2001000 {
                        #reset-cells = <1>;
                };
 
+               sid: efuse@3006000 {
+                       compatible = "allwinner,sun50i-a523-sid", "allwinner,sun50i-a64-sid";
+                       reg = <0x03006000 0x1000>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+               };
+
                mmc0: mmc@4020000 {
                        compatible = "allwinner,sun55i-a523-mmc",
                                     "allwinner,sun20i-d1-mmc";
--

2.49.0

author
#9 lore raw

PATCH 5/6 arm64: dts: allwinner: A523: Add thermal sensors and zones

In reply to iuncuim

From: Mikhail Kalashnikov <[email protected]>

The A523 processor has two temperature controllers, THS0 and THS1. THS0 has only one temperature sensor, which is located in the DRAM.

THS1 does have 3 sensors:
ths1_0 - "big" cores
ths1_1 - "little" cores
ths1_2 - gpu

Add the thermal sensor configuration and the thermal zones

---
 .../arm64/boot/dts/allwinner/sun55i-a523.dtsi | 138 ++++++++++++++++++
 1 file changed, 138 insertions(+)
arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi +138 -0
index d626612bb..4f36032b2 100644
@@ -7,6 +7,7 @@
 #include <dt-bindings/clock/sun55i-a523-r-ccu.h>
 #include <dt-bindings/reset/sun55i-a523-ccu.h>
 #include <dt-bindings/reset/sun55i-a523-r-ccu.h>
+#include <dt-bindings/thermal/thermal.h>
 
 / {
 	interrupt-parent = <&gic>;
@@ -22,6 +23,7 @@ cpu0: cpu@0 {
 			device_type = "cpu";
 			reg = <0x000>;
 			enable-method = "psci";
+			#cooling-cells = <2>;
 		};
 
 		cpu1: cpu@100 {
@@ -29,6 +31,7 @@ cpu1: cpu@100 {
 			device_type = "cpu";
 			reg = <0x100>;
 			enable-method = "psci";
+			#cooling-cells = <2>;
 		};
 
 		cpu2: cpu@200 {
@@ -36,6 +39,7 @@ cpu2: cpu@200 {
 			device_type = "cpu";
 			reg = <0x200>;
 			enable-method = "psci";
+			#cooling-cells = <2>;
 		};
 
 		cpu3: cpu@300 {
@@ -43,6 +47,7 @@ cpu3: cpu@300 {
 			device_type = "cpu";
 			reg = <0x300>;
 			enable-method = "psci";
+			#cooling-cells = <2>;
 		};
 
 		cpu4: cpu@400 {
@@ -50,6 +55,7 @@ cpu4: cpu@400 {
 			device_type = "cpu";
 			reg = <0x400>;
 			enable-method = "psci";
+			#cooling-cells = <2>;
 		};
 
 		cpu5: cpu@500 {
@@ -57,6 +63,7 @@ cpu5: cpu@500 {
 			device_type = "cpu";
 			reg = <0x500>;
 			enable-method = "psci";
+			#cooling-cells = <2>;
 		};
 
 		cpu6: cpu@600 {
@@ -64,6 +71,7 @@ cpu6: cpu@600 {
 			device_type = "cpu";
 			reg = <0x600>;
 			enable-method = "psci";
+			#cooling-cells = <2>;
 		};
 
 		cpu7: cpu@700 {
@@ -71,6 +79,7 @@ cpu7: cpu@700 {
 			device_type = "cpu";
 			reg = <0x700>;
 			enable-method = "psci";
+			#cooling-cells = <2>;
 		};
 	};
 
@@ -171,11 +180,39 @@ ccu: clock-controller@2001000 {
 			#reset-cells = <1>;
 		};
 
+		ths1: thermal-sensor@2009400 {
+			compatible = "allwinner,sun55i-a523-ths1";
+			reg = <0x02009400 0x400>;
+			interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_THS>, <&ccu CLK_GPADC1>;
+			clock-names = "bus", "gpadc";
+			resets = <&ccu RST_BUS_THS>;
+			nvmem-cells = <&ths_calibration>;
+			nvmem-cell-names = "calibration";
+			#thermal-sensor-cells = <1>;
+		};
+
+		ths0: thermal-sensor@200a000 {
+			compatible = "allwinner,sun55i-a523-ths0";
+			reg = <0x0200a000 0x400>;
+			interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_THS>, <&ccu CLK_GPADC0>;
+			clock-names = "bus", "gpadc";
+			resets = <&ccu RST_BUS_THS>;
+			nvmem-cells = <&ths_calibration>;
+			nvmem-cell-names = "calibration";
+			#thermal-sensor-cells = <0>;
+		};
+
 		sid: efuse@3006000 {
 			compatible = "allwinner,sun50i-a523-sid", "allwinner,sun50i-a64-sid";
 			reg = <0x03006000 0x1000>;
 			#address-cells = <1>;
 			#size-cells = <1>;
+
+			ths_calibration: thermal-sensor-calibration@38 {
+				reg = <0x38 0x14>;
+			};
 		};
 
 		mmc0: mmc@4020000 {
@@ -602,4 +639,105 @@ rtc: rtc@7090000 {
 			#clock-cells = <1>;
 		};
 	};
+
+	thermal-zones {
+		cpu0_thermal: cpu0-thermal {
+			polling-delay-passive = <500>;
+			polling-delay = <1000>;
+			thermal-sensors = <&ths1 1>;
+			sustainable-power = <1200>;
+
+			trips {
+				cpu0_threshold: cpu-trip-0 {
+					temperature = <70000>;
+					type = "passive";
+					hysteresis = <0>;
+				};
+				cpu0_target: cpu-trip-1 {
+					temperature = <90000>;
+					type = "passive";
+					hysteresis = <0>;
+				};
+				cpu0_critical: cpu-trip-2 {
+					temperature = <110000>;
+					type = "critical";
+					hysteresis = <0>;
+				};
+			};
+
+			cooling-maps {
+				map0 {
+					trip = <&cpu0_target>;
+					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+			};
+		};
+
+		cpu4_thermal: cpu4-thermal {
+			polling-delay-passive = <500>;
+			polling-delay = <1000>;
+			thermal-sensors = <&ths1 0>;
+			sustainable-power = <1600>;
+
+			trips {
+				cpu4_threshold: cpu-trip-0 {
+					temperature = <70000>;
+					type = "passive";
+					hysteresis = <0>;
+				};
+				cpu4_target: cpu-trip-1 {
+					temperature = <90000>;
+					type = "passive";
+					hysteresis = <0>;
+				};
+				cpu4_critical: cpu-trip-2 {
+					temperature = <110000>;
+					type = "critical";
+					hysteresis = <0>;
+				};
+			};
+
+			cooling-maps {
+				map0 {
+					trip = <&cpu4_target>;
+					cooling-device = <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+			};
+		};
+
+		gpu-thermal {
+			polling-delay-passive = <500>;
+			polling-delay = <1000>;
+			thermal-sensors = <&ths1 2>;
+			sustainable-power = <2400>;
+
+			trips {
+				gpu_temp_critical: gpu-trip-0 {
+					temperature = <110000>;
+					type = "critical";
+					hysteresis = <0>;
+				};
+			};
+		};
+
+		ddr-thermal {
+			polling-delay-passive = <0>;
+			polling-delay = <0>;
+			thermal-sensors = <&ths0>;
+
+			trips {
+				ddr_temp_critical: ddr-trip-0 {
+					temperature = <110000>;
+					type = "critical";
+					hysteresis = <0>;
+				};
+			};
+		};
+	};
 };
Signature · 1 line
2.49.0
#10 lore raw

Re: [PATCH 5/6] arm64: dts: allwinner: A523: Add thermal sensors and zones

Quoted 120 lines · iuncuim

From: Mikhail Kalashnikov <[email protected]>

The A523 processor has two temperature controllers, THS0 and THS1. THS0 has only one temperature sensor, which is located in the DRAM.

THS1 does have 3 sensors:
ths1_0 - "big" cores
ths1_1 - "little" cores
ths1_2 - gpu

Add the thermal sensor configuration and the thermal zones

---
 .../arm64/boot/dts/allwinner/sun55i-a523.dtsi | 138 ++++++++++++++++++
 1 file changed, 138 insertions(+)
arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi +31 -0
index d626612bb..4f36032b2 100644
@@ -7,6 +7,7 @@
 #include <dt-bindings/clock/sun55i-a523-r-ccu.h>
 #include <dt-bindings/reset/sun55i-a523-ccu.h>
 #include <dt-bindings/reset/sun55i-a523-r-ccu.h>
+#include <dt-bindings/thermal/thermal.h>
 
 / {
        interrupt-parent = <&gic>;
@@ -22,6 +23,7 @@ cpu0: cpu@0 {
                        device_type = "cpu";
                        reg = <0x000>;
                        enable-method = "psci";
+                       #cooling-cells = <2>;
                };
 
                cpu1: cpu@100 {
@@ -29,6 +31,7 @@ cpu1: cpu@100 {
                        device_type = "cpu";
                        reg = <0x100>;
                        enable-method = "psci";
+                       #cooling-cells = <2>;
                };
 
                cpu2: cpu@200 {
@@ -36,6 +39,7 @@ cpu2: cpu@200 {
                        device_type = "cpu";
                        reg = <0x200>;
                        enable-method = "psci";
+                       #cooling-cells = <2>;
                };
 
                cpu3: cpu@300 {
@@ -43,6 +47,7 @@ cpu3: cpu@300 {
                        device_type = "cpu";
                        reg = <0x300>;
                        enable-method = "psci";
+                       #cooling-cells = <2>;
                };
 
                cpu4: cpu@400 {
@@ -50,6 +55,7 @@ cpu4: cpu@400 {
                        device_type = "cpu";
                        reg = <0x400>;
                        enable-method = "psci";
+                       #cooling-cells = <2>;
                };
 
                cpu5: cpu@500 {
@@ -57,6 +63,7 @@ cpu5: cpu@500 {
                        device_type = "cpu";
                        reg = <0x500>;
                        enable-method = "psci";
+                       #cooling-cells = <2>;
                };
 
                cpu6: cpu@600 {
@@ -64,6 +71,7 @@ cpu6: cpu@600 {
                        device_type = "cpu";
                        reg = <0x600>;
                        enable-method = "psci";
+                       #cooling-cells = <2>;
                };
 
                cpu7: cpu@700 {
@@ -71,6 +79,7 @@ cpu7: cpu@700 {
                        device_type = "cpu";
                        reg = <0x700>;
                        enable-method = "psci";
+                       #cooling-cells = <2>;
                };
        };
 
@@ -171,11 +180,39 @@ ccu: clock-controller@2001000 {
                        #reset-cells = <1>;
                };
 
+               ths1: thermal-sensor@2009400 {
+                       compatible = "allwinner,sun55i-a523-ths1";
+                       reg = <0x02009400 0x400>;
+                       interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&ccu CLK_BUS_THS>, <&ccu CLK_GPADC1>;
+                       clock-names = "bus", "gpadc";
+                       resets = <&ccu RST_BUS_THS>;
+                       nvmem-cells = <&ths_calibration>;
+                       nvmem-cell-names = "calibration";
+                       #thermal-sensor-cells = <1>;
+               };
+
+               ths0: thermal-sensor@200a000 {
+                       compatible = "allwinner,sun55i-a523-ths0";
+                       reg = <0x0200a000 0x400>;
+                       interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&ccu CLK_BUS_THS>, <&ccu CLK_GPADC0>;
+                       clock-names = "bus", "gpadc";
+                       resets = <&ccu RST_BUS_THS>;
+                       nvmem-cells = <&ths_calibration>;
+                       nvmem-cell-names = "calibration";
+                       #thermal-sensor-cells = <0>;

arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi ccu: clock-controller@2001000 { · line 214

Quoted 10 lines
arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi +5 -0
+               };
+
                sid: efuse@3006000 {
                        compatible = "allwinner,sun50i-a523-sid", "allwinner,sun50i-a64-sid";
                        reg = <0x03006000 0x1000>;
                        #address-cells = <1>;
                        #size-cells = <1>;
+
+                       ths_calibration: thermal-sensor-calibration@38 {
+                               reg = <0x38 0x14>;

Including unrelated bits is probably not correct. Instead I think it should be two cells. The thermal driver then has to stitch them together or something.

Quoted 5 lines
arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi +1 -0
+                       };
                };
 
                mmc0: mmc@4020000 {

arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi rtc: rtc@7090000 { · line 648

Quoted 10 lines
arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi +7 -0
@@ -602,4 +639,105 @@ rtc: rtc@7090000 {
                        #clock-cells = <1>;
                };
        };
+
+       thermal-zones {
+               cpu0_thermal: cpu0-thermal {
+                       polling-delay-passive = <500>;
+                       polling-delay = <1000>;
+                       thermal-sensors = <&ths1 1>;
+                       sustainable-power = <1200>;

Please describe in the commit log how the sustainable power values were derived or sourced.

Quoted 62 lines
arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi +62 -0
+
+                       trips {
+                               cpu0_threshold: cpu-trip-0 {
+                                       temperature = <70000>;
+                                       type = "passive";
+                                       hysteresis = <0>;
+                               };
+                               cpu0_target: cpu-trip-1 {
+                                       temperature = <90000>;
+                                       type = "passive";
+                                       hysteresis = <0>;
+                               };
+                               cpu0_critical: cpu-trip-2 {
+                                       temperature = <110000>;
+                                       type = "critical";
+                                       hysteresis = <0>;
+                               };
+                       };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&cpu0_target>;
+                                       cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
+               };
+
+               cpu4_thermal: cpu4-thermal {
+                       polling-delay-passive = <500>;
+                       polling-delay = <1000>;
+                       thermal-sensors = <&ths1 0>;
+                       sustainable-power = <1600>;
+
+                       trips {
+                               cpu4_threshold: cpu-trip-0 {
+                                       temperature = <70000>;
+                                       type = "passive";
+                                       hysteresis = <0>;
+                               };
+                               cpu4_target: cpu-trip-1 {
+                                       temperature = <90000>;
+                                       type = "passive";
+                                       hysteresis = <0>;
+                               };
+                               cpu4_critical: cpu-trip-2 {
+                                       temperature = <110000>;
+                                       type = "critical";
+                                       hysteresis = <0>;
+                               };
+                       };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&cpu4_target>;
+                                       cooling-device = <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                                        <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };

arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi rtc: rtc@7090000 { · line 720

Quoted 10 lines
arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi +10 -0
+                       };
+               };
+
+               gpu-thermal {
+                       polling-delay-passive = <500>;
+                       polling-delay = <1000>;
+                       thermal-sensors = <&ths1 2>;
+                       sustainable-power = <2400>;
+
+                       trips {

We could have passive trip points here as well so thermal throttling of the GPU could work.

ChenYu

Quoted 26 lines
arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi +22 -1
+                               gpu_temp_critical: gpu-trip-0 {
+                                       temperature = <110000>;
+                                       type = "critical";
+                                       hysteresis = <0>;
+                               };
+                       };
+               };
+
+               ddr-thermal {
+                       polling-delay-passive = <0>;
+                       polling-delay = <0>;
+                       thermal-sensors = <&ths0>;
+
+                       trips {
+                               ddr_temp_critical: ddr-trip-0 {
+                                       temperature = <110000>;
+                                       type = "critical";
+                                       hysteresis = <0>;
+                               };
+                       };
+               };
+       };
 };
--

2.49.0

author
#11 lore raw

PATCH 6/6 dt-bindings: thermal: sun8i: Add A523 THS0/1 controllers

In reply to iuncuim

From: Mikhail Kalashnikov <[email protected]>

Add dt-bindings description of the thermal sensors in the A523 processor.

---
 .../bindings/thermal/allwinner,sun8i-a83t-ths.yaml           | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml +5 -0
index 3e61689f6..70ac395ef 100644
@@ -24,17 +24,21 @@ properties:
       - allwinner,sun50i-h5-ths
       - allwinner,sun50i-h6-ths
       - allwinner,sun50i-h616-ths
+      - allwinner,sun55i-a523-ths0
+      - allwinner,sun55i-a523-ths1
 
   clocks:
     minItems: 1
     items:
       - description: Bus Clock
+      - description: GPADC Clock
       - description: Module Clock
 
   clock-names:
     minItems: 1
     items:
       - const: bus
+      - const: gpadc
       - const: mod
 
   reg:
@@ -107,6 +111,7 @@ allOf:
             enum:
               - allwinner,sun8i-h3-ths
               - allwinner,sun20i-d1-ths
+              - allwinner,sun55i-a523-ths0
 
     then:
       properties:
Signature · 1 line
2.49.0
#12 lore raw

Re: [PATCH 6/6] dt-bindings: thermal: sun8i: Add A523 THS0/1 controllers

Quoted 9 lines · iuncuim

From: Mikhail Kalashnikov <[email protected]>

Add dt-bindings description of the thermal sensors in the A523 processor.

---
 .../bindings/thermal/allwinner,sun8i-a83t-ths.yaml           | 5 +++++
 1 file changed, 5 insertions(+)

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.example.dtb: thermal-sensor@1c25000 (allwinner,sun8i-h3-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

#13 lore raw

Re: [PATCH 6/6] dt-bindings: thermal: sun8i: Add A523 THS0/1 controllers

Quoted 10 lines · Rob Herring (Arm)
Quoted 9 lines · iuncuim

From: Mikhail Kalashnikov <[email protected]>

Add dt-bindings description of the thermal sensors in the A523 processor.

---
  .../bindings/thermal/allwinner,sun8i-a83t-ths.yaml           | 5 +++++
  1 file changed, 5 insertions(+)
Quoted 7 lines

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.example.dtb: thermal-sensor@1c25000 (allwinner,sun8i-h3-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#

Thanks for the reply, I didn't know about this tool, I will use it in v2.

Quoted 7 lines

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

Yes, I forgot to point out that the patches are based on 6.15-rc1 using dts patches from that series that didn't make it into the latest rc:
https://lore.kernel.org/linux-sunxi/[email protected]/T/#t
I'll add that information to the cover letter.

Quoted 11 lines

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

maintainer
#14 lore raw

Re: [PATCH 6/6] dt-bindings: thermal: sun8i: Add A523 THS0/1 controllers

In reply to iuncuim
Quoted 3 lines · iuncuim

From: Mikhail Kalashnikov <[email protected]>

Add dt-bindings description of the thermal sensors in the A523 processor.

That's obvious from the diff. What's not is how is the h/w different from prior versions? For example, why is there another clock?

Quoted 19 lines
---
 .../bindings/thermal/allwinner,sun8i-a83t-ths.yaml           | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml +2 -0
index 3e61689f6..70ac395ef 100644
@@ -24,17 +24,21 @@ properties:
       - allwinner,sun50i-h5-ths
       - allwinner,sun50i-h6-ths
       - allwinner,sun50i-h616-ths
+      - allwinner,sun55i-a523-ths0
+      - allwinner,sun55i-a523-ths1
 
   clocks:
     minItems: 1

Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml properties: · line 41

Quoted 10 lines
Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml +2 -0
     items:
       - description: Bus Clock
+      - description: GPADC Clock
       - description: Module Clock
 
   clock-names:
     minItems: 1
     items:
       - const: bus
+      - const: gpadc

You cannot add new entries in the middle. They must go on the end and you then need to restrict the existing users to 2 clocks. And for the new users, how many clocks are required? 1, 2, or 3?

Quoted 14 lines
Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml +1 -0
       - const: mod
 
   reg:
@@ -107,6 +111,7 @@ allOf:
             enum:
               - allwinner,sun8i-h3-ths
               - allwinner,sun20i-d1-ths
+              - allwinner,sun55i-a523-ths0
 
     then:
       properties:
Signature · 1 line
2.49.0
#15 lore raw
In reply to iuncuim
Quoted 11 lines · iuncuim

This patch series adds temperature sensor support for the Allwinner A523 family of processors (same die with H728/A527/T527)

Mikhail Kalashnikov (6):
thermal/drivers/sun8i: add gpadc clock thermal/drivers/sun8i: replace devm_reset_control_get to shared thermal/drivers/sun8i: Add support for A523 THS0/1 controllers
arm64: dts: allwinner: A523: Add SID controller node
arm64: dts: allwinner: A523: Add thermal sensors and zones
dt-bindings: thermal: sun8i: Add A523 THS0/1 controllers

Quoted 10 lines
 .../thermal/allwinner,sun8i-a83t-ths.yaml     |   5 +
 .../arm64/boot/dts/allwinner/sun55i-a523.dtsi | 145 +++++++++++++++++
 drivers/thermal/sun8i_thermal.c               | 154 +++++++++++++++++-
 3 files changed, 300 insertions(+), 4 deletions(-)

--
2.49.0

My bot found new DTB warnings on the .dts files added or changed in this series.

Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings are fixed by another series. Ultimately, it is up to the platform maintainer whether these warnings are acceptable or not. No need to reply unless the platform maintainer has comments.

If you already ran DT checks and didn't see these error(s), then make sure dt-schema is up to date:

  pip3 install dtschema --upgrade

This patch series was applied (using b4) to base:
Base: attempting to guess base-commit...
Base: tags/next-20250411 (exact match)

If this is not the correct base, please add 'base-commit' tag (or use b4 which does this automatically)

New warnings running 'make CHECK_DTBS=y for arch/arm64/boot/dts/allwinner/' for [email protected]:

arch/arm64/boot/dts/allwinner/sun50i-h5-libretech-all-h3-cc.dtb: thermal-sensor@1c25000 (allwinner,sun50i-h5-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun50i-h5-libretech-all-h3-it.dtb: thermal-sensor@1c25000 (allwinner,sun50i-h5-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dtb: thermal-sensor@1c25000 (allwinner,sun50i-h5-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dtb: thermal-sensor@1c25000 (allwinner,sun50i-a64-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dtb: thermal-sensor@1c25000 (allwinner,sun50i-h5-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino-emmc.dtb: thermal-sensor@1c25000 (allwinner,sun50i-a64-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dtb: thermal-sensor@1c25000 (allwinner,sun50i-a64-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun50i-h5-emlid-neutis-n5-devboard.dtb: thermal-sensor@1c25000 (allwinner,sun50i-h5-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun55i-a527-radxa-a5e.dtb: efuse@3006000 (allwinner,sun50i-a523-sid): compatible: 'oneOf' conditional failed, one must be fixed:
['allwinner,sun50i-a523-sid', 'allwinner,sun50i-a64-sid'] is too long
'allwinner,sun4i-a10-sid' was expected
'allwinner,sun7i-a20-sid' was expected
'allwinner,sun8i-a83t-sid' was expected
'allwinner,sun8i-h3-sid' was expected
'allwinner,sun20i-d1-sid' was expected
'allwinner,sun50i-a64-sid' was expected
'allwinner,sun50i-a523-sid' is not one of ['allwinner,sun50i-a100-sid', 'allwinner,sun50i-h616-sid']
'allwinner,sun50i-h5-sid' was expected
'allwinner,sun50i-h6-sid' was expected
from schema $id: http://devicetree.org/schemas/nvmem/allwinner,sun4i-a10-sid.yaml#
arch/arm64/boot/dts/allwinner/sun55i-a527-radxa-a5e.dtb: efuse@3006000 (allwinner,sun50i-a523-sid): Unevaluated properties are not allowed ('compatible' was unexpected)
from schema $id: http://devicetree.org/schemas/nvmem/allwinner,sun4i-a10-sid.yaml#
arch/arm64/boot/dts/allwinner/sun55i-a527-radxa-a5e.dtb: /soc/efuse@3006000: failed to match any schema with compatible: ['allwinner,sun50i-a523-sid', 'allwinner,sun50i-a64-sid'] arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.2.dtb: thermal-sensor@1c25000 (allwinner,sun50i-a64-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dtb: thermal-sensor@1c25000 (allwinner,sun50i-a64-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun50i-a64-pinetab-early-adopter.dtb: thermal-sensor@1c25000 (allwinner,sun50i-a64-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dtb: thermal-sensor@1c25000 (allwinner,sun50i-a64-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo-plus2.dtb: thermal-sensor@1c25000 (allwinner,sun50i-h5-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun50i-h5-bananapi-m2-plus-v1.2.dtb: thermal-sensor@1c25000 (allwinner,sun50i-h5-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-lts.dtb: thermal-sensor@1c25000 (allwinner,sun50i-a64-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun50i-a64-amarula-relic.dtb: thermal-sensor@1c25000 (allwinner,sun50i-a64-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun50i-h5-bananapi-m2-plus.dtb: thermal-sensor@1c25000 (allwinner,sun50i-h5-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dtb: thermal-sensor@1c25000 (allwinner,sun50i-a64-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus.dtb: thermal-sensor@1c25000 (allwinner,sun50i-h5-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun50i-a64-oceanic-5205-5inmfd.dtb: thermal-sensor@1c25000 (allwinner,sun50i-a64-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dtb: thermal-sensor@1c25000 (allwinner,sun50i-a64-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun55i-h728-x96qpro+.dtb: efuse@3006000 (allwinner,sun50i-a523-sid): compatible: 'oneOf' conditional failed, one must be fixed:
['allwinner,sun50i-a523-sid', 'allwinner,sun50i-a64-sid'] is too long
'allwinner,sun4i-a10-sid' was expected
'allwinner,sun7i-a20-sid' was expected
'allwinner,sun8i-a83t-sid' was expected
'allwinner,sun8i-h3-sid' was expected
'allwinner,sun20i-d1-sid' was expected
'allwinner,sun50i-a64-sid' was expected
'allwinner,sun50i-a523-sid' is not one of ['allwinner,sun50i-a100-sid', 'allwinner,sun50i-h616-sid']
'allwinner,sun50i-h5-sid' was expected
'allwinner,sun50i-h6-sid' was expected
from schema $id: http://devicetree.org/schemas/nvmem/allwinner,sun4i-a10-sid.yaml#
arch/arm64/boot/dts/allwinner/sun55i-h728-x96qpro+.dtb: efuse@3006000 (allwinner,sun50i-a523-sid): Unevaluated properties are not allowed ('compatible' was unexpected)
from schema $id: http://devicetree.org/schemas/nvmem/allwinner,sun4i-a10-sid.yaml#
arch/arm64/boot/dts/allwinner/sun55i-h728-x96qpro+.dtb: /soc/efuse@3006000: failed to match any schema with compatible: ['allwinner,sun50i-a523-sid', 'allwinner,sun50i-a64-sid'] arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dtb: thermal-sensor@1c25000 (allwinner,sun50i-a64-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dtb: thermal-sensor@1c25000 (allwinner,sun50i-a64-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dtb: thermal-sensor@1c25000 (allwinner,sun50i-a64-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun50i-a64-pinetab.dtb: thermal-sensor@1c25000 (allwinner,sun50i-a64-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-prime.dtb: thermal-sensor@1c25000 (allwinner,sun50i-h5-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun50i-a64-nanopi-a64.dtb: thermal-sensor@1c25000 (allwinner,sun50i-a64-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun50i-h5-libretech-all-h5-cc.dtb: thermal-sensor@1c25000 (allwinner,sun50i-h5-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.0.dtb: thermal-sensor@1c25000 (allwinner,sun50i-a64-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun55i-t527-avaota-a1.dtb: efuse@3006000 (allwinner,sun50i-a523-sid): compatible: 'oneOf' conditional failed, one must be fixed:
['allwinner,sun50i-a523-sid', 'allwinner,sun50i-a64-sid'] is too long
'allwinner,sun4i-a10-sid' was expected
'allwinner,sun7i-a20-sid' was expected
'allwinner,sun8i-a83t-sid' was expected
'allwinner,sun8i-h3-sid' was expected
'allwinner,sun20i-d1-sid' was expected
'allwinner,sun50i-a64-sid' was expected
'allwinner,sun50i-a523-sid' is not one of ['allwinner,sun50i-a100-sid', 'allwinner,sun50i-h616-sid']
'allwinner,sun50i-h5-sid' was expected
'allwinner,sun50i-h6-sid' was expected
from schema $id: http://devicetree.org/schemas/nvmem/allwinner,sun4i-a10-sid.yaml#
arch/arm64/boot/dts/allwinner/sun55i-t527-avaota-a1.dtb: efuse@3006000 (allwinner,sun50i-a523-sid): Unevaluated properties are not allowed ('compatible' was unexpected)
from schema $id: http://devicetree.org/schemas/nvmem/allwinner,sun4i-a10-sid.yaml#
arch/arm64/boot/dts/allwinner/sun55i-t527-avaota-a1.dtb: /soc/efuse@3006000: failed to match any schema with compatible: ['allwinner,sun50i-a523-sid', 'allwinner,sun50i-a64-sid'] arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s-h5.dtb: thermal-sensor@1c25000 (allwinner,sun50i-h5-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun50i-h64-remix-mini-pc.dtb: thermal-sensor@1c25000 (allwinner,sun50i-a64-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo2.dtb: thermal-sensor@1c25000 (allwinner,sun50i-h5-ths): clock-names:1: 'gpadc' was expected
from schema $id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#

#16 lore raw
In reply to iuncuim
Quoted 2 lines · Mikhail Kalashnikov

This patch series adds temperature sensor support for the Allwinner A523 family of processors (same die with H728/A527/T527)

Based on 6.15-rc1 with dts patches from

https://lore.kernel.org/linux-sunxi/[email protected]/T/#t

Quoted 13 lines

Mikhail Kalashnikov (6):
thermal/drivers/sun8i: add gpadc clock thermal/drivers/sun8i: replace devm_reset_control_get to shared thermal/drivers/sun8i: Add support for A523 THS0/1 controllers
arm64: dts: allwinner: A523: Add SID controller node
arm64: dts: allwinner: A523: Add thermal sensors and zones
dt-bindings: thermal: sun8i: Add A523 THS0/1 controllers

  .../thermal/allwinner,sun8i-a83t-ths.yaml     |   5 +
  .../arm64/boot/dts/allwinner/sun55i-a523.dtsi | 145 +++++++++++++++++
  drivers/thermal/sun8i_thermal.c               | 154 +++++++++++++++++-
  3 files changed, 300 insertions(+), 4 deletions(-)
#17 lore raw

On Sat, 12 Apr 2025 03:53:08 +0300
Mikhail Kalashnikov <[email protected]> wrote:

Hi,

Quoted 7 lines · Mikhail Kalashnikov
Quoted 2 lines

This patch series adds temperature sensor support for the Allwinner A523 family of processors (same die with H728/A527/T527)

Based on 6.15-rc1 with dts patches from

https://lore.kernel.org/linux-sunxi/[email protected]/T/#t

Chen-Yu merged those patches already, to the sunxi repo on kernel.org, under the dt-for-6.16 branch, so you can reference that instead, and also base any new patches on that.

Cheers,
Andre

Quoted 15 lines
Quoted 14 lines

Mikhail Kalashnikov (6):
thermal/drivers/sun8i: add gpadc clock thermal/drivers/sun8i: replace devm_reset_control_get to shared thermal/drivers/sun8i: Add support for A523 THS0/1 controllers
arm64: dts: allwinner: A523: Add SID controller node
arm64: dts: allwinner: A523: Add thermal sensors and zones
dt-bindings: thermal: sun8i: Add A523 THS0/1 controllers

  .../thermal/allwinner,sun8i-a83t-ths.yaml     |   5 +
  .../arm64/boot/dts/allwinner/sun55i-a523.dtsi | 145 +++++++++++++++++
  drivers/thermal/sun8i_thermal.c               | 154 +++++++++++++++++-
  3 files changed, 300 insertions(+), 4 deletions(-)