* [PATCH 0/6] Add support for A523 Thermal system
@ 2025-04-11 0:38 iuncuim
2025-04-11 0:38 ` [PATCH 1/6] thermal/drivers/sun8i: add gpadc clock iuncuim
` (7 more replies)
0 siblings, 8 replies; 18+ messages in thread
From: iuncuim @ 2025-04-11 0:38 UTC (permalink / raw)
To: Vasily Khoruzhick, Yangtao Li, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Andre Przywara
Cc: Rafael J . Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
linux-pm, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel,
Piotr Oniszczuk
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(-)
--
2.49.0
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 1/6] thermal/drivers/sun8i: add gpadc clock
2025-04-11 0:38 [PATCH 0/6] Add support for A523 Thermal system iuncuim
@ 2025-04-11 0:38 ` iuncuim
2025-04-18 8:37 ` Daniel Lezcano
2025-04-11 0:38 ` [PATCH 2/6] thermal/drivers/sun8i: replace devm_reset_control_get to shared iuncuim
` (6 subsequent siblings)
7 siblings, 1 reply; 18+ messages in thread
From: iuncuim @ 2025-04-11 0:38 UTC (permalink / raw)
To: Vasily Khoruzhick, Yangtao Li, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Andre Przywara
Cc: Rafael J . Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
linux-pm, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel,
Piotr Oniszczuk
From: Mikhail Kalashnikov <iuncuim@gmail.com>
Some processors (e.g. Allwinner A523) require GPADC clocking activation for
temperature sensors to work. So let's add support for enabling it.
Signed-off-by: Mikhail Kalashnikov <iuncuim@gmail.com>
---
drivers/thermal/sun8i_thermal.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c
index 226747906..1f3908a60 100644
--- a/drivers/thermal/sun8i_thermal.c
+++ b/drivers/thermal/sun8i_thermal.c
@@ -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;
--
2.49.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 2/6] thermal/drivers/sun8i: replace devm_reset_control_get to shared
2025-04-11 0:38 [PATCH 0/6] Add support for A523 Thermal system iuncuim
2025-04-11 0:38 ` [PATCH 1/6] thermal/drivers/sun8i: add gpadc clock iuncuim
@ 2025-04-11 0:38 ` iuncuim
2025-06-30 4:53 ` Chen-Yu Tsai
2025-04-11 0:38 ` [PATCH 3/6] thermal/drivers/sun8i: Add support for A523 THS0/1 controllers iuncuim
` (5 subsequent siblings)
7 siblings, 1 reply; 18+ messages in thread
From: iuncuim @ 2025-04-11 0:38 UTC (permalink / raw)
To: Vasily Khoruzhick, Yangtao Li, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Andre Przywara
Cc: Rafael J . Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
linux-pm, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel,
Piotr Oniszczuk
From: Mikhail Kalashnikov <iuncuim@gmail.com>
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()
Signed-off-by: Mikhail Kalashnikov <iuncuim@gmail.com>
---
drivers/thermal/sun8i_thermal.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c
index 1f3908a60..dc4055c9c 100644
--- a/drivers/thermal/sun8i_thermal.c
+++ b/drivers/thermal/sun8i_thermal.c
@@ -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);
--
2.49.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 3/6] thermal/drivers/sun8i: Add support for A523 THS0/1 controllers
2025-04-11 0:38 [PATCH 0/6] Add support for A523 Thermal system iuncuim
2025-04-11 0:38 ` [PATCH 1/6] thermal/drivers/sun8i: add gpadc clock iuncuim
2025-04-11 0:38 ` [PATCH 2/6] thermal/drivers/sun8i: replace devm_reset_control_get to shared iuncuim
@ 2025-04-11 0:38 ` iuncuim
2025-04-18 8:41 ` Daniel Lezcano
2025-04-11 0:38 ` [PATCH 4/6] arm64: dts: allwinner: A523: Add SID controller node iuncuim
` (4 subsequent siblings)
7 siblings, 1 reply; 18+ messages in thread
From: iuncuim @ 2025-04-11 0:38 UTC (permalink / raw)
To: Vasily Khoruzhick, Yangtao Li, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Andre Przywara
Cc: Rafael J . Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
linux-pm, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel,
Piotr Oniszczuk
From: Mikhail Kalashnikov <iuncuim@gmail.com>
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.
Signed-off-by: Mikhail Kalashnikov <iuncuim@gmail.com>
---
drivers/thermal/sun8i_thermal.c | 134 ++++++++++++++++++++++++++++++++
1 file changed, 134 insertions(+)
diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c
index dc4055c9c..919b05a96 100644
--- a/drivers/thermal/sun8i_thermal.c
+++ b/drivers/thermal/sun8i_thermal.c
@@ -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);
--
2.49.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 4/6] arm64: dts: allwinner: A523: Add SID controller node
2025-04-11 0:38 [PATCH 0/6] Add support for A523 Thermal system iuncuim
` (2 preceding siblings ...)
2025-04-11 0:38 ` [PATCH 3/6] thermal/drivers/sun8i: Add support for A523 THS0/1 controllers iuncuim
@ 2025-04-11 0:38 ` iuncuim
2025-06-30 4:32 ` Chen-Yu Tsai
2025-04-11 0:38 ` [PATCH 5/6] arm64: dts: allwinner: A523: Add thermal sensors and zones iuncuim
` (3 subsequent siblings)
7 siblings, 1 reply; 18+ messages in thread
From: iuncuim @ 2025-04-11 0:38 UTC (permalink / raw)
To: Vasily Khoruzhick, Yangtao Li, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Andre Przywara
Cc: Rafael J . Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
linux-pm, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel,
Piotr Oniszczuk
From: Mikhail Kalashnikov <iuncuim@gmail.com>
The SID controller should be compatible with A64 and others SoC with 0x200
offset.
Signed-off-by: Mikhail Kalashnikov <iuncuim@gmail.com>
---
arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi
index ee485899b..d626612bb 100644
--- a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi
@@ -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
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 5/6] arm64: dts: allwinner: A523: Add thermal sensors and zones
2025-04-11 0:38 [PATCH 0/6] Add support for A523 Thermal system iuncuim
` (3 preceding siblings ...)
2025-04-11 0:38 ` [PATCH 4/6] arm64: dts: allwinner: A523: Add SID controller node iuncuim
@ 2025-04-11 0:38 ` iuncuim
2025-06-30 4:45 ` Chen-Yu Tsai
2025-04-11 0:38 ` [PATCH 6/6] dt-bindings: thermal: sun8i: Add A523 THS0/1 controllers iuncuim
` (2 subsequent siblings)
7 siblings, 1 reply; 18+ messages in thread
From: iuncuim @ 2025-04-11 0:38 UTC (permalink / raw)
To: Vasily Khoruzhick, Yangtao Li, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Andre Przywara
Cc: Rafael J . Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
linux-pm, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel,
Piotr Oniszczuk
From: Mikhail Kalashnikov <iuncuim@gmail.com>
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
Signed-off-by: Mikhail Kalashnikov <iuncuim@gmail.com>
---
.../arm64/boot/dts/allwinner/sun55i-a523.dtsi | 138 ++++++++++++++++++
1 file changed, 138 insertions(+)
diff --git a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi
index d626612bb..4f36032b2 100644
--- a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi
@@ -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>;
+ };
+ };
+ };
+ };
};
--
2.49.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 6/6] dt-bindings: thermal: sun8i: Add A523 THS0/1 controllers
2025-04-11 0:38 [PATCH 0/6] Add support for A523 Thermal system iuncuim
` (4 preceding siblings ...)
2025-04-11 0:38 ` [PATCH 5/6] arm64: dts: allwinner: A523: Add thermal sensors and zones iuncuim
@ 2025-04-11 0:38 ` iuncuim
2025-04-11 1:21 ` Rob Herring (Arm)
2025-04-11 13:43 ` Rob Herring
2025-04-11 13:11 ` [PATCH 0/6] Add support for A523 Thermal system Rob Herring (Arm)
2025-04-12 0:53 ` Mikhail Kalashnikov
7 siblings, 2 replies; 18+ messages in thread
From: iuncuim @ 2025-04-11 0:38 UTC (permalink / raw)
To: Vasily Khoruzhick, Yangtao Li, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Andre Przywara
Cc: Rafael J . Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
linux-pm, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel,
Piotr Oniszczuk
From: Mikhail Kalashnikov <iuncuim@gmail.com>
Add dt-bindings description of the thermal sensors in the A523 processor.
Signed-off-by: Mikhail Kalashnikov <iuncuim@gmail.com>
---
.../bindings/thermal/allwinner,sun8i-a83t-ths.yaml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml b/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml
index 3e61689f6..70ac395ef 100644
--- a/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml
+++ b/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml
@@ -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:
--
2.49.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 6/6] dt-bindings: thermal: sun8i: Add A523 THS0/1 controllers
2025-04-11 0:38 ` [PATCH 6/6] dt-bindings: thermal: sun8i: Add A523 THS0/1 controllers iuncuim
@ 2025-04-11 1:21 ` Rob Herring (Arm)
2025-04-12 0:50 ` Mikhail Kalashnikov
2025-04-11 13:43 ` Rob Herring
1 sibling, 1 reply; 18+ messages in thread
From: Rob Herring (Arm) @ 2025-04-11 1:21 UTC (permalink / raw)
To: iuncuim
Cc: Chen-Yu Tsai, Samuel Holland, linux-arm-kernel,
Krzysztof Kozlowski, devicetree, Andre Przywara, Philipp Zabel,
Zhang Rui, Lukasz Luba, Yangtao Li, Jernej Skrabec, linux-kernel,
linux-sunxi, Conor Dooley, Vasily Khoruzhick, Daniel Lezcano,
linux-pm, Piotr Oniszczuk, Rafael J . Wysocki
On Fri, 11 Apr 2025 08:38:26 +0800, iuncuim wrote:
> From: Mikhail Kalashnikov <iuncuim@gmail.com>
>
> Add dt-bindings description of the thermal sensors in the A523 processor.
>
> Signed-off-by: Mikhail Kalashnikov <iuncuim@gmail.com>
> ---
> .../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/20250411003827.782544-7-iuncuim@gmail.com
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.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 0/6] Add support for A523 Thermal system
2025-04-11 0:38 [PATCH 0/6] Add support for A523 Thermal system iuncuim
` (5 preceding siblings ...)
2025-04-11 0:38 ` [PATCH 6/6] dt-bindings: thermal: sun8i: Add A523 THS0/1 controllers iuncuim
@ 2025-04-11 13:11 ` Rob Herring (Arm)
2025-04-12 0:53 ` Mikhail Kalashnikov
7 siblings, 0 replies; 18+ messages in thread
From: Rob Herring (Arm) @ 2025-04-11 13:11 UTC (permalink / raw)
To: iuncuim
Cc: Krzysztof Kozlowski, Vasily Khoruzhick, Lukasz Luba,
Andre Przywara, Conor Dooley, Rafael J . Wysocki,
linux-arm-kernel, linux-pm, Zhang Rui, linux-kernel,
Jernej Skrabec, devicetree, Piotr Oniszczuk, Daniel Lezcano,
Yangtao Li, Samuel Holland, Chen-Yu Tsai, linux-sunxi,
Philipp Zabel
On Fri, 11 Apr 2025 08:38:20 +0800, iuncuim wrote:
> 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(-)
>
> --
> 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 20250411003827.782544-1-iuncuim@gmail.com:
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#
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 6/6] dt-bindings: thermal: sun8i: Add A523 THS0/1 controllers
2025-04-11 0:38 ` [PATCH 6/6] dt-bindings: thermal: sun8i: Add A523 THS0/1 controllers iuncuim
2025-04-11 1:21 ` Rob Herring (Arm)
@ 2025-04-11 13:43 ` Rob Herring
1 sibling, 0 replies; 18+ messages in thread
From: Rob Herring @ 2025-04-11 13:43 UTC (permalink / raw)
To: iuncuim
Cc: Vasily Khoruzhick, Yangtao Li, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Andre Przywara, Rafael J . Wysocki,
Daniel Lezcano, Zhang Rui, Lukasz Luba, Krzysztof Kozlowski,
Conor Dooley, Philipp Zabel, linux-pm, devicetree,
linux-arm-kernel, linux-sunxi, linux-kernel, Piotr Oniszczuk
On Fri, Apr 11, 2025 at 08:38:26AM +0800, iuncuim wrote:
> From: Mikhail Kalashnikov <iuncuim@gmail.com>
>
> 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?
>
> Signed-off-by: Mikhail Kalashnikov <iuncuim@gmail.com>
> ---
> .../bindings/thermal/allwinner,sun8i-a83t-ths.yaml | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml b/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml
> index 3e61689f6..70ac395ef 100644
> --- a/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml
> +++ b/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml
> @@ -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
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?
> - const: mod
>
> reg:
> @@ -107,6 +111,7 @@ allOf:
> enum:
> - allwinner,sun8i-h3-ths
> - allwinner,sun20i-d1-ths
> + - allwinner,sun55i-a523-ths0
>
> then:
> properties:
> --
> 2.49.0
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 6/6] dt-bindings: thermal: sun8i: Add A523 THS0/1 controllers
2025-04-11 1:21 ` Rob Herring (Arm)
@ 2025-04-12 0:50 ` Mikhail Kalashnikov
0 siblings, 0 replies; 18+ messages in thread
From: Mikhail Kalashnikov @ 2025-04-12 0:50 UTC (permalink / raw)
To: Rob Herring (Arm)
Cc: Chen-Yu Tsai, Samuel Holland, linux-arm-kernel,
Krzysztof Kozlowski, devicetree, Andre Przywara, Philipp Zabel,
Zhang Rui, Lukasz Luba, Yangtao Li, Jernej Skrabec, linux-kernel,
linux-sunxi, Conor Dooley, Vasily Khoruzhick, Daniel Lezcano,
linux-pm, Piotr Oniszczuk, Rafael J . Wysocki
On 4/11/25 04:21, Rob Herring (Arm) wrote:
> On Fri, 11 Apr 2025 08:38:26 +0800, iuncuim wrote:
>> From: Mikhail Kalashnikov <iuncuim@gmail.com>
>>
>> Add dt-bindings description of the thermal sensors in the A523 processor.
>>
>> Signed-off-by: Mikhail Kalashnikov <iuncuim@gmail.com>
>> ---
>> .../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#
Thanks for the reply, I didn't know about this tool, I will use it in v2.
>
> doc reference errors (make refcheckdocs):
>
> See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20250411003827.782544-7-iuncuim@gmail.com
>
> 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/20250307005712.16828-1-andre.przywara@arm.com/T/#t
I'll add that information to the cover letter.
>
> 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.
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 0/6] Add support for A523 Thermal system
2025-04-11 0:38 [PATCH 0/6] Add support for A523 Thermal system iuncuim
` (6 preceding siblings ...)
2025-04-11 13:11 ` [PATCH 0/6] Add support for A523 Thermal system Rob Herring (Arm)
@ 2025-04-12 0:53 ` Mikhail Kalashnikov
2025-04-13 22:11 ` Andre Przywara
7 siblings, 1 reply; 18+ messages in thread
From: Mikhail Kalashnikov @ 2025-04-12 0:53 UTC (permalink / raw)
To: Vasily Khoruzhick, Yangtao Li, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Andre Przywara
Cc: Rafael J . Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
linux-pm, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel,
Piotr Oniszczuk
On 4/11/25 03:38, Mikhail Kalashnikov wrote:
> 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/20250307005712.16828-1-andre.przywara@arm.com/T/#t
> 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(-)
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 0/6] Add support for A523 Thermal system
2025-04-12 0:53 ` Mikhail Kalashnikov
@ 2025-04-13 22:11 ` Andre Przywara
0 siblings, 0 replies; 18+ messages in thread
From: Andre Przywara @ 2025-04-13 22:11 UTC (permalink / raw)
To: Mikhail Kalashnikov
Cc: Vasily Khoruzhick, Yangtao Li, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Rafael J . Wysocki, Daniel Lezcano, Zhang Rui,
Lukasz Luba, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Philipp Zabel, linux-pm, devicetree, linux-arm-kernel,
linux-sunxi, linux-kernel, Piotr Oniszczuk
On Sat, 12 Apr 2025 03:53:08 +0300
Mikhail Kalashnikov <iuncuim@gmail.com> wrote:
Hi,
> On 4/11/25 03:38, Mikhail Kalashnikov wrote:
> > 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/20250307005712.16828-1-andre.przywara@arm.com/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
>
> > 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(-)
> >
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/6] thermal/drivers/sun8i: add gpadc clock
2025-04-11 0:38 ` [PATCH 1/6] thermal/drivers/sun8i: add gpadc clock iuncuim
@ 2025-04-18 8:37 ` Daniel Lezcano
0 siblings, 0 replies; 18+ messages in thread
From: Daniel Lezcano @ 2025-04-18 8:37 UTC (permalink / raw)
To: iuncuim
Cc: Vasily Khoruzhick, Yangtao Li, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Andre Przywara, Rafael J . Wysocki, Zhang Rui,
Lukasz Luba, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Philipp Zabel, linux-pm, devicetree, linux-arm-kernel,
linux-sunxi, linux-kernel, Piotr Oniszczuk
On Fri, Apr 11, 2025 at 08:38:21AM +0800, Mikhail Kalashnikov wrote:
> From: Mikhail Kalashnikov <iuncuim@gmail.com>
>
> Some processors (e.g. Allwinner A523) require GPADC clocking activation for
> temperature sensors to work. So let's add support for enabling it.
>
> Signed-off-by: Mikhail Kalashnikov <iuncuim@gmail.com>
> ---
> drivers/thermal/sun8i_thermal.c | 18 +++++++++++++++---
> 1 file changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c
> index 226747906..1f3908a60 100644
> --- a/drivers/thermal/sun8i_thermal.c
> +++ b/drivers/thermal/sun8i_thermal.c
> @@ -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);
return dev_err_probe();
> + }
> +
> + ret = clk_prepare_enable(tmdev->gpadc_clk);
> + if (ret)
> + return ret;
> +
Why calling clk_prepare_enable() ? devm_clk_get_enabled() did the job no ?
> if (tmdev->chip->needs_sram) {
> struct regmap *regmap;
>
> --
> 2.49.0
>
--
<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
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/6] thermal/drivers/sun8i: Add support for A523 THS0/1 controllers
2025-04-11 0:38 ` [PATCH 3/6] thermal/drivers/sun8i: Add support for A523 THS0/1 controllers iuncuim
@ 2025-04-18 8:41 ` Daniel Lezcano
0 siblings, 0 replies; 18+ messages in thread
From: Daniel Lezcano @ 2025-04-18 8:41 UTC (permalink / raw)
To: iuncuim
Cc: Vasily Khoruzhick, Yangtao Li, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Andre Przywara, Rafael J . Wysocki, Zhang Rui,
Lukasz Luba, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Philipp Zabel, linux-pm, devicetree, linux-arm-kernel,
linux-sunxi, linux-kernel, Piotr Oniszczuk
On Fri, Apr 11, 2025 at 08:38:23AM +0800, Mikhail Kalashnikov wrote:
> From: Mikhail Kalashnikov <iuncuim@gmail.com>
>
> 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.
>
> Signed-off-by: Mikhail Kalashnikov <iuncuim@gmail.com>
> ---
> drivers/thermal/sun8i_thermal.c | 134 ++++++++++++++++++++++++++++++++
> 1 file changed, 134 insertions(+)
>
> diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c
> index dc4055c9c..919b05a96 100644
> --- a/drivers/thermal/sun8i_thermal.c
> +++ b/drivers/thermal/sun8i_thermal.c
> @@ -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);
> +}
Please use macro instead of litterals
> +
> 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);
> --
> 2.49.0
>
--
<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
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 4/6] arm64: dts: allwinner: A523: Add SID controller node
2025-04-11 0:38 ` [PATCH 4/6] arm64: dts: allwinner: A523: Add SID controller node iuncuim
@ 2025-06-30 4:32 ` Chen-Yu Tsai
0 siblings, 0 replies; 18+ messages in thread
From: Chen-Yu Tsai @ 2025-06-30 4:32 UTC (permalink / raw)
To: iuncuim
Cc: Vasily Khoruzhick, Yangtao Li, Jernej Skrabec, Samuel Holland,
Andre Przywara, Rafael J . Wysocki, Daniel Lezcano, Zhang Rui,
Lukasz Luba, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Philipp Zabel, linux-pm, devicetree, linux-arm-kernel,
linux-sunxi, linux-kernel, Piotr Oniszczuk
On Fri, Apr 11, 2025 at 8:40 AM iuncuim <iuncuim@gmail.com> wrote:
>
> From: Mikhail Kalashnikov <iuncuim@gmail.com>
>
> The SID controller should be compatible with A64 and others SoC with 0x200
> offset.
>
> Signed-off-by: Mikhail Kalashnikov <iuncuim@gmail.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
But this also needs a matching update to the binding.
> ---
> arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi
> index ee485899b..d626612bb 100644
> --- a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi
> +++ b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi
> @@ -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
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 5/6] arm64: dts: allwinner: A523: Add thermal sensors and zones
2025-04-11 0:38 ` [PATCH 5/6] arm64: dts: allwinner: A523: Add thermal sensors and zones iuncuim
@ 2025-06-30 4:45 ` Chen-Yu Tsai
0 siblings, 0 replies; 18+ messages in thread
From: Chen-Yu Tsai @ 2025-06-30 4:45 UTC (permalink / raw)
To: iuncuim
Cc: Vasily Khoruzhick, Yangtao Li, Jernej Skrabec, Samuel Holland,
Andre Przywara, Rafael J . Wysocki, Daniel Lezcano, Zhang Rui,
Lukasz Luba, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Philipp Zabel, linux-pm, devicetree, linux-arm-kernel,
linux-sunxi, linux-kernel, Piotr Oniszczuk
On Fri, Apr 11, 2025 at 8:40 AM iuncuim <iuncuim@gmail.com> wrote:
>
> From: Mikhail Kalashnikov <iuncuim@gmail.com>
>
> 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
>
> Signed-off-by: Mikhail Kalashnikov <iuncuim@gmail.com>
> ---
> .../arm64/boot/dts/allwinner/sun55i-a523.dtsi | 138 ++++++++++++++++++
> 1 file changed, 138 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi
> index d626612bb..4f36032b2 100644
> --- a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi
> +++ b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi
> @@ -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>;
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.
> + };
> };
>
> 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>;
Please describe in the commit log how the sustainable power values were
derived or sourced.
> +
> + 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 {
We could have passive trip points here as well so thermal throttling of
the GPU could work.
ChenYu
> + 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
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 2/6] thermal/drivers/sun8i: replace devm_reset_control_get to shared
2025-04-11 0:38 ` [PATCH 2/6] thermal/drivers/sun8i: replace devm_reset_control_get to shared iuncuim
@ 2025-06-30 4:53 ` Chen-Yu Tsai
0 siblings, 0 replies; 18+ messages in thread
From: Chen-Yu Tsai @ 2025-06-30 4:53 UTC (permalink / raw)
To: iuncuim
Cc: Vasily Khoruzhick, Yangtao Li, Jernej Skrabec, Samuel Holland,
Andre Przywara, Rafael J . Wysocki, Daniel Lezcano, Zhang Rui,
Lukasz Luba, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Philipp Zabel, linux-pm, devicetree, linux-arm-kernel,
linux-sunxi, linux-kernel, Piotr Oniszczuk
On Fri, Apr 11, 2025 at 8:39 AM iuncuim <iuncuim@gmail.com> wrote:
>
> From: Mikhail Kalashnikov <iuncuim@gmail.com>
>
> 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()
>
> Signed-off-by: Mikhail Kalashnikov <iuncuim@gmail.com>
> ---
> drivers/thermal/sun8i_thermal.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c
> index 1f3908a60..dc4055c9c 100644
> --- a/drivers/thermal/sun8i_thermal.c
> +++ b/drivers/thermal/sun8i_thermal.c
> @@ -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.
> if (IS_ERR(tmdev->reset))
> return PTR_ERR(tmdev->reset);
>
> --
> 2.49.0
>
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2025-06-30 4:54 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-11 0:38 [PATCH 0/6] Add support for A523 Thermal system iuncuim
2025-04-11 0:38 ` [PATCH 1/6] thermal/drivers/sun8i: add gpadc clock iuncuim
2025-04-18 8:37 ` Daniel Lezcano
2025-04-11 0:38 ` [PATCH 2/6] thermal/drivers/sun8i: replace devm_reset_control_get to shared iuncuim
2025-06-30 4:53 ` Chen-Yu Tsai
2025-04-11 0:38 ` [PATCH 3/6] thermal/drivers/sun8i: Add support for A523 THS0/1 controllers iuncuim
2025-04-18 8:41 ` Daniel Lezcano
2025-04-11 0:38 ` [PATCH 4/6] arm64: dts: allwinner: A523: Add SID controller node iuncuim
2025-06-30 4:32 ` Chen-Yu Tsai
2025-04-11 0:38 ` [PATCH 5/6] arm64: dts: allwinner: A523: Add thermal sensors and zones iuncuim
2025-06-30 4:45 ` Chen-Yu Tsai
2025-04-11 0:38 ` [PATCH 6/6] dt-bindings: thermal: sun8i: Add A523 THS0/1 controllers iuncuim
2025-04-11 1:21 ` Rob Herring (Arm)
2025-04-12 0:50 ` Mikhail Kalashnikov
2025-04-11 13:43 ` Rob Herring
2025-04-11 13:11 ` [PATCH 0/6] Add support for A523 Thermal system Rob Herring (Arm)
2025-04-12 0:53 ` Mikhail Kalashnikov
2025-04-13 22:11 ` Andre Przywara
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).