Skip to contentSkip to conversation

thermal: Support Amlogic C3 thermal

PATCH In review Xianwei Zhao 3 participants 6 messages Jul 22, 2025 – Sep 4, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover thermal: Support Amlogic C3 thermal

Add Amlogic C3 thermal compatible string, private_data of driver and device node.

---
Changes in v2:
- Modify the binding file according to Rob's suggestion.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Xianwei Zhao (3):
dt-bindings: thermal: amlogic: Add compatible string for C3
thermal: amlogic: Support C3 thermal controller driver
arm64: dts: amlogic: c3: Add tempsensor controller node

 .../devicetree/bindings/thermal/amlogic,thermal.yaml          |  4 +++-
 arch/arm64/boot/dts/amlogic/amlogic-c3.dtsi                   | 11 +++++++++++
 drivers/thermal/amlogic_thermal.c                             | 10 ++++++++++
 3 files changed, 24 insertions(+), 1 deletion(-)

---
base-commit: 58abdca0eb653c1a2e755ba9ba406ee475d87636
change-id: 20250718-c3-thermal-cfdf0a2bbf52

Best regards,

Signature · 1 line
Xianwei Zhao <[email protected]>
#1 lore raw

PATCH v2 1/3 dt-bindings: thermal: amlogic: Add compatible string for C3

Add the compatible properties for Amlogic C3 SoC family. C3 family supports only one thermal node - CPU thermal sensor.

---
 Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml +3 -1
index 70b273271754..27ddb67c7743 100644
@@ -16,12 +16,14 @@ $ref: thermal-sensor.yaml#
 properties:
   compatible:
     oneOf:
+      - enum:
+          - amlogic,a1-cpu-thermal
+          - amlogic,c3-cpu-thermal
       - items:
           - enum:
               - amlogic,g12a-cpu-thermal
               - amlogic,g12a-ddr-thermal
           - const: amlogic,g12a-thermal
-      - const: amlogic,a1-cpu-thermal
 
   reg:
     maxItems: 1
Signature · 1 line
2.37.1
maintainer Acked-by on v2 1/3
#2 lore raw

Re: [PATCH v2 1/3] dt-bindings: thermal: amlogic: Add compatible string for C3

Quoted 10 lines · Xianwei Zhao

Add the compatible properties for Amlogic C3 SoC family. C3 family supports only one thermal node - CPU thermal sensor.

---
 Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
#3 lore raw

PATCH v2 2/3 thermal: amlogic: Support C3 thermal controller driver

In reply to Xianwei Zhao

Add the thermal controller driver for the C3 SoC family.

The main difference compared to other Amlogic chips lies in the offset of the sec_ao base (referred to as u_efuse_off), which is handled differently. Everything else remains consistent.

---
 drivers/thermal/amlogic_thermal.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/thermal/amlogic_thermal.c +10 -0
index 5448d772db12..d1b08119c818 100644
@@ -226,6 +226,12 @@ static const struct amlogic_thermal_data amlogic_thermal_a1_cpu_param = {
 	.regmap_config = &amlogic_thermal_regmap_config_g12a,
 };
 
+static const struct amlogic_thermal_data amlogic_thermal_c3_cpu_param = {
+	.u_efuse_off = 0x108,
+	.calibration_parameters = &amlogic_thermal_g12a,
+	.regmap_config = &amlogic_thermal_regmap_config_g12a,
+};
+
 static const struct of_device_id of_amlogic_thermal_match[] = {
 	{
 		.compatible = "amlogic,g12a-ddr-thermal",
@@ -239,6 +245,10 @@ static const struct of_device_id of_amlogic_thermal_match[] = {
 		.compatible = "amlogic,a1-cpu-thermal",
 		.data = &amlogic_thermal_a1_cpu_param,
 	},
+	{
+		.compatible = "amlogic,c3-cpu-thermal",
+		.data = &amlogic_thermal_c3_cpu_param,
+	},
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, of_amlogic_thermal_match);
Signature · 1 line
2.37.1
#4 lore raw

PATCH v2 3/3 arm64: dts: amlogic: c3: Add tempsensor controller node

In reply to Xianwei Zhao

Add the Tempsensor controller node for C3 SoC family.

---
 arch/arm64/boot/dts/amlogic/amlogic-c3.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm64/boot/dts/amlogic/amlogic-c3.dtsi +11 -0
index cb9ea3ca6ee0..c853390eca6c 100644
@@ -727,6 +727,17 @@ clkc_pll: clock-controller@8000 {
 					      "fix";
 			};
 
+			temperature-sensor@20000 {
+				compatible = "amlogic,c3-cpu-thermal";
+				reg = <0x0 0x20000 0x0 0x50>;
+				interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>;
+				clocks = <&clkc_periphs CLKID_TS>;
+				assigned-clocks = <&clkc_periphs CLKID_TS>;
+				assigned-clock-rates = <500000>;
+				amlogic,ao-secure = <&sec_ao>;
+				#thermal-sensor-cells = <0>;
+			};
+
 			eth_phy: mdio-multiplexer@28000 {
 				compatible = "amlogic,g12a-mdio-mux";
 				reg = <0x0 0x28000 0x0 0xa4>;
Signature · 1 line
2.37.1
maintainer
#5 lore raw
In reply to Xianwei Zhao

Hi,

Quoted 19 lines · On 22/07/2025 13:26, Xianwei Zhao via B4 Relay wrote:

Add Amlogic C3 thermal compatible string, private_data of driver and device node.

---
Changes in v2:
- Modify the binding file according to Rob's suggestion.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Xianwei Zhao (3):
dt-bindings: thermal: amlogic: Add compatible string for C3
thermal: amlogic: Support C3 thermal controller driver
arm64: dts: amlogic: c3: Add tempsensor controller node

  .../devicetree/bindings/thermal/amlogic,thermal.yaml          |  4 +++-
  arch/arm64/boot/dts/amlogic/amlogic-c3.dtsi                   | 11 +++++++++++
  drivers/thermal/amlogic_thermal.c                             | 10 ++++++++++
  3 files changed, 24 insertions(+), 1 deletion(-)
Quoted 5 lines

---
base-commit: 58abdca0eb653c1a2e755ba9ba406ee475d87636
change-id: 20250718-c3-thermal-cfdf0a2bbf52

Best regards,

Patches 1 & 2 are reviewed and ready to be merged. I'll take patch 3 for next cycle.

Thanks,
Neil