Skip to contentSkip to conversation

Add support of New Amlogic temperature sensor for G12 SoCs

PATCH Superseded Guillaume La Roque 5 participants 15 messages Aug 6, 2019 – Aug 21, 2019

Subsystems (4)

v3 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Guillaume La Roque

author maintainer
#0 lore raw

v3 cover Add support of New Amlogic temperature sensor for G12 SoCs

This patchs series add support of New Amlogic temperature sensor and minimal thermal zone for SEI510 and ODROID-N2 boards.

First implementation was doing on IIO[1] but after comments i move on thermal framework. Formulas and calibration values come from amlogic.

Changes since v2:
- fix yaml documention
- remove unneeded status variable for temperature-sensor node
- rework driver after Martin review
- add some information in commit message

Changes since v1:
- fix enum vs const in documentation
- fix error with thermal-sensor-cells value set to 1 instead of 0
- add some dependencies needed to add cooling-maps

Dependencies :
- patch 3,4 & 5: depends on Neil's patch and series :
- missing dwc2 phy-names[2]
- patchsets to add DVFS on G12a[3] which have deps on [4] and [5]

[1] https://lore.kernel.org/linux-amlogic/[email protected]/
[2] https://lore.kernel.org/linux-amlogic/[email protected]/
[3] https://lore.kernel.org/linux-amlogic/[email protected]/
[4] https://lore.kernel.org/linux-amlogic/[email protected]/
[5] https://lore.kernel.org/linux-amlogic/[email protected]/

Guillaume La Roque (6):
dt-bindings: thermal: Add DT bindings documentation for Amlogic
Thermal
thermal: amlogic: Add thermal driver to support G12 SoCs
arm64: dts: amlogic: g12: add temperature sensor
arm64: dts: meson: sei510: Add minimal thermal zone
arm64: dts: amlogic: odroid-n2: add minimal thermal zone
MAINTAINERS: add entry for Amlogic Thermal driver

 .../bindings/thermal/amlogic,thermal.yaml     |  54 +++
 MAINTAINERS                                   |   9 +
 .../boot/dts/amlogic/meson-g12-common.dtsi    |  20 ++
 .../boot/dts/amlogic/meson-g12a-sei510.dts    |  56 +++
 .../boot/dts/amlogic/meson-g12b-odroid-n2.dts |  60 ++++
 drivers/thermal/Kconfig                       |  11 +
 drivers/thermal/Makefile                      |   1 +
 drivers/thermal/amlogic_thermal.c             | 336 ++++++++++++++++++
 8 files changed, 547 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml
 create mode 100644 drivers/thermal/amlogic_thermal.c
Signature · 1 line
2.17.1
author maintainer
#1 lore raw

PATCH v3 1/6 dt-bindings: thermal: Add DT bindings documentation for Amlogic Thermal

Adding the devicetree binding documentation for the Amlogic temperature sensor found in the Amlogic Meson G12 SoCs.
the G12A and G12B SoCs are supported.

---
 .../bindings/thermal/amlogic,thermal.yaml     | 54 +++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml
Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml new file +54 -0
new file mode 100644
index 000000000000..d25e59113398
@@ -0,0 +1,54 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/thermal/amlogic,thermal.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Amlogic Thermal
+
+maintainers:
+  - Guillaume La Roque <[email protected]>
+
+description: Binding for Amlogic Thermal Driver
+
+properties:
+  compatible:
+      items:
+        - enum:
+            - amlogic,g12-cpu-thermal
+            - amlogic,g12-ddr-thermal
+        - const: amlogic,g12-thermal
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  amlogic,ao-secure:
+    description: phandle to the ao-secure syscon
+    $ref: '/schemas/types.yaml#/definitions/phandle'
+
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - amlogic,ao-secure
+
+examples:
+  - |
+        cpu_temp: temperature-sensor@ff634800 {
+                compatible = "amlogic,g12-cpu-thermal",
+                             "amlogic,g12-thermal";
+                reg = <0xff634800 0x50>;
+                interrupts = <0x0 0x24 0x0>;
+                clocks = <&clk 164>;
+                #thermal-sensor-cells = <0>;
+                amlogic,ao-secure = <&sec_AO>;
+        };
+...
Signature · 1 line
2.17.1
maintainer Reviewed-by on v3 1/6
#2 lore raw

Re: [PATCH v3 1/6] dt-bindings: thermal: Add DT bindings documentation for Amlogic Thermal

Quoted 18 lines · Guillaume La Roque

Adding the devicetree binding documentation for the Amlogic temperature sensor found in the Amlogic Meson G12 SoCs.
the G12A and G12B SoCs are supported.

---
 .../bindings/thermal/amlogic,thermal.yaml     | 54 +++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml
Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml new file +2 -0
new file mode 100644
index 000000000000..d25e59113398
@@ -0,0 +1,54 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2

Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml line 12

Quoted 10 lines
Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml new file +10 -0
+---
+$id: http://devicetree.org/schemas/thermal/amlogic,thermal.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Amlogic Thermal
+
+maintainers:
+  - Guillaume La Roque <[email protected]>
+
+description: Binding for Amlogic Thermal Driver

Bindings are for h/w blocks, not drivers.

Other than that nit,

author maintainer
#3 lore raw

PATCH v3 2/6 thermal: amlogic: Add thermal driver to support G12 SoCs

In reply to Guillaume La Roque

Amlogic G12A and G12B SoCs integrate two thermal sensors with the same design.
One is located close to the DDR controller and the other one is located close to the PLLs (between the CPU and GPU).

The calibration data for each of the thermal sensors instance is stored in a different location within the AO region.

Implement reading the temperature from each thermal sensor.

The IP block has more functionality, which may be added to this driver in the future:
- chip reset when the temperature exceeds a configurable threshold
- up to four interrupts when the temperature has risen above a configurable threshold
- up to four interrupts when the temperature has fallen below a configurable threshold

---
 drivers/thermal/Kconfig           |  11 +
 drivers/thermal/Makefile          |   1 +
 drivers/thermal/amlogic_thermal.c | 336 ++++++++++++++++++++++++++++++
 3 files changed, 348 insertions(+)
 create mode 100644 drivers/thermal/amlogic_thermal.c
drivers/thermal/Kconfig +11 -0
index 9966364a6deb..0f31bb4bc372 100644
@@ -348,6 +348,17 @@ config MTK_THERMAL
 	  Enable this option if you want to have support for thermal management
 	  controller present in Mediatek SoCs
 
+config AMLOGIC_THERMAL
+	tristate "Amlogic Thermal Support"
+	default ARCH_MESON
+	depends on OF && ARCH_MESON
+	help
+	  If you say yes here you get support for Amlogic Thermal
+	  for G12 SoC Family.
+
+	  This driver can also be built as a module. If so, the module will
+	  be called amlogic_thermal.
+
 menu "Intel thermal drivers"
 depends on X86 || X86_INTEL_QUARK || COMPILE_TEST
 source "drivers/thermal/intel/Kconfig"
drivers/thermal/Makefile +1 -0
index 74a37c7f847a..baeb70bf0568 100644
@@ -54,3 +54,4 @@ obj-$(CONFIG_MTK_THERMAL)	+= mtk_thermal.o
 obj-$(CONFIG_GENERIC_ADC_THERMAL)	+= thermal-generic-adc.o
 obj-$(CONFIG_ZX2967_THERMAL)	+= zx2967_thermal.o
 obj-$(CONFIG_UNIPHIER_THERMAL)	+= uniphier_thermal.o
+obj-$(CONFIG_AMLOGIC_THERMAL)     += amlogic_thermal.o
drivers/thermal/amlogic_thermal.c new file +336 -0

336 lines not on this page · raw message

Signature · 1 line
2.17.1
#4 lore raw

Re: [PATCH v3 2/6] thermal: amlogic: Add thermal driver to support G12 SoCs

Hi Guillaume,

[...]

drivers/thermal/amlogic_thermal.c line 101

Quoted 9 lines
drivers/thermal/amlogic_thermal.c new file +9 -0
+struct amlogic_thermal {
+       struct platform_device *pdev;
+       const struct amlogic_thermal_data *data;
+       struct regmap *regmap;
+       struct regmap *sec_ao_map;
+       struct clk *clk;
+       struct thermal_zone_device *tzd;
+       u32 trim_info;
+       void __iomem *base;

nit-pick: this is only used in _probe() so you could make it a local variable there

[...]

drivers/thermal/amlogic_thermal.c line 231

Quoted 9 lines
drivers/thermal/amlogic_thermal.c new file +9 -0
+static const struct of_device_id of_amlogic_thermal_match[] = {
+       {
+               .compatible = "amlogic,g12-ddr-thermal",
+               .data = &amlogic_thermal_g12_ddr_param,
+       },
+       {
+               .compatible = "amlogic,g12-cpu-thermal",
+               .data = &amlogic_thermal_g12_cpu_param,
+       },

I assume you are using "g12" to indicate that it's valid for both, G12A and G12B?
meson-g12-common.dtsi currently does not use any other "amlogic,g12-*" compatible string (there are some meson-axg-*, meson-gx-* and meson-g12a-* ones, but no g12-*)
I would like to hear Kevin's and Neil's opinion on this one whether we should introduce that "amlogic,g12-*" prefix or stick to "amlogic,g12a-*"

[...]

drivers/thermal/amlogic_thermal.c line 293

Quoted 3 lines
drivers/thermal/amlogic_thermal.c new file +3 -0
+       ret = amlogic_thermal_enable(pdata);
+       if (ret)
+               clk_disable_unprepare(pdata->clk);

amlogic_thermal_enable only returns an error-code if clk_prepare_enable() fails in that case the clock is neither prepared nor enabled so we must not call clk_disable_unprepare

apart from that it looks good to me (as someone who doesn't know the thermal framework)

Martin

author maintainer
#5 lore raw

PATCH v3 3/6 arm64: dts: amlogic: g12: add temperature sensor

In reply to Guillaume La Roque

Add cpu and ddr temperature sensors for G12 Socs

---
 .../boot/dts/amlogic/meson-g12-common.dtsi    | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +20 -0
index 06e186ca41e3..a06298538614 100644
@@ -1353,6 +1353,26 @@
 				};
 			};
 
+			cpu_temp: temperature-sensor@34800 {
+				compatible = "amlogic,g12-cpu-thermal",
+					     "amlogic,g12-thermal";
+				reg = <0x0 0x34800 0x0 0x50>;
+				interrupts = <GIC_SPI 35 IRQ_TYPE_EDGE_RISING>;
+				clocks = <&clkc CLKID_TS>;
+				#thermal-sensor-cells = <0>;
+				amlogic,ao-secure = <&sec_AO>;
+			};
+
+			ddr_temp: temperature-sensor@34c00 {
+				compatible = "amlogic,g12-ddr-thermal",
+					     "amlogic,g12-thermal";
+				reg = <0x0 0x34c00 0x0 0x50>;
+				interrupts = <GIC_SPI 36 IRQ_TYPE_EDGE_RISING>;
+				clocks = <&clkc CLKID_TS>;
+				#thermal-sensor-cells = <0>;
+				amlogic,ao-secure = <&sec_AO>;
+			};
+
 			usb2_phy0: phy@36000 {
 				compatible = "amlogic,g12a-usb2-phy";
 				reg = <0x0 0x36000 0x0 0x2000>;
Signature · 1 line
2.17.1
author maintainer
#6 lore raw

PATCH v3 4/6 arm64: dts: meson: sei510: Add minimal thermal zone

In reply to Guillaume La Roque

Add minimal thermal zone for two temperature sensor One is located close to the DDR and the other one is located close to the PLLs (between the CPU and GPU)

---
 .../boot/dts/amlogic/meson-g12a-sei510.dts    | 56 +++++++++++++++++++
 1 file changed, 56 insertions(+)
arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts +56 -0
index 979449968a5f..2c16a2cba0a3 100644
@@ -10,6 +10,7 @@
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/gpio/meson-g12a-gpio.h>
 #include <dt-bindings/sound/meson-g12a-tohdmitx.h>
+#include <dt-bindings/thermal/thermal.h>
 
 / {
 	compatible = "seirobotics,sei510", "amlogic,g12a";
@@ -33,6 +34,53 @@
 		ethernet0 = &ethmac;
 	};
 
+	thermal-zones {
+		cpu-thermal {
+			polling-delay = <1000>;
+			polling-delay-passive = <100>;
+			thermal-sensors = <&cpu_temp>;
+
+			trips {
+				cpu_critical: cpu-critical {
+					temperature = <110000>; /* millicelsius */
+					hysteresis = <2000>; /* millicelsius */
+					type = "critical";
+				};
+			};
+
+			cooling-maps {
+				map {
+					trip = <&cpu_critical>;
+					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>;
+				};
+			};
+		};
+
+		ddr-thermal {
+			polling-delay = <1000>;
+			polling-delay-passive = <100>;
+			thermal-sensors = <&ddr_temp>;
+
+			trips {
+				ddr_critical: ddr-critical {
+					temperature = <110000>; /* millicelsius */
+					hysteresis = <2000>; /* millicelsius */
+					type = "critical";
+				};
+			};
+
+			cooling-maps {
+				map {
+					trip = <&ddr_critical>;
+					cooling-device = <&mali THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+			};
+		};
+	};
+
 	mono_dac: audio-codec-0 {
 		compatible = "maxim,max98357a";
 		#sound-dai-cells = <0>;
@@ -321,6 +369,7 @@
 	operating-points-v2 = <&cpu_opp_table>;
 	clocks = <&clkc CLKID_CPU_CLK>;
 	clock-latency = <50000>;
+	#cooling-cells = <2>;
 };
 
 &cpu1 {
@@ -328,6 +377,7 @@
 	operating-points-v2 = <&cpu_opp_table>;
 	clocks = <&clkc CLKID_CPU_CLK>;
 	clock-latency = <50000>;
+	#cooling-cells = <2>;
 };
 
 &cpu2 {
@@ -335,6 +385,7 @@
 	operating-points-v2 = <&cpu_opp_table>;
 	clocks = <&clkc CLKID_CPU_CLK>;
 	clock-latency = <50000>;
+	#cooling-cells = <2>;
 };
 
 &cpu3 {
@@ -342,6 +393,7 @@
 	operating-points-v2 = <&cpu_opp_table>;
 	clocks = <&clkc CLKID_CPU_CLK>;
 	clock-latency = <50000>;
+	#cooling-cells = <2>;
 };
 
 &cvbs_vdac_port {
@@ -368,6 +420,10 @@
 	status = "okay";
 };
 
+&mali {
+	#cooling-cells = <2>;
+};
+
 &hdmi_tx {
 	status = "okay";
 	pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
Signature · 1 line
2.17.1
reviewer Acked-by on v3 4/6
#7 lore raw

Re: [PATCH v3 4/6] arm64: dts: meson: sei510: Add minimal thermal zone

Quoted 6 lines · Guillaume La Roque

Add minimal thermal zone for two temperature sensor One is located close to the DDR and the other one is located close to the PLLs (between the CPU and GPU)

I'm not familiar with the thermal subsystem but this looks sane so:

author maintainer
#8 lore raw

PATCH v3 5/6 arm64: dts: amlogic: odroid-n2: add minimal thermal zone

In reply to Guillaume La Roque

Add minimal thermal zone for two temperature sensor One is located close to the DDR and the other one is located close to the PLLs (between the CPU and GPU)

---
 .../boot/dts/amlogic/meson-g12b-odroid-n2.dts | 60 +++++++++++++++++++
 1 file changed, 60 insertions(+)
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +60 -0
index 75ff8a7e373d..a7d73c0c8447 100644
@@ -10,6 +10,7 @@
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/gpio/meson-g12a-gpio.h>
 #include <dt-bindings/sound/meson-g12a-tohdmitx.h>
+#include <dt-bindings/thermal/thermal.h>
 
 / {
 	compatible = "hardkernel,odroid-n2", "amlogic,g12b";
@@ -20,6 +21,55 @@
 		ethernet0 = &ethmac;
 	};
 
+	thermal-zones {
+		cpu-thermal {
+			polling-delay = <1000>;
+			polling-delay-passive = <100>;
+			thermal-sensors = <&cpu_temp>;
+
+			trips {
+				cpu_critical: cpu-critical {
+					temperature = <110000>; /* millicelsius */
+					hysteresis = <2000>; /* millicelsius */
+					type = "critical";
+				};
+			};
+
+			cooling-maps {
+				map {
+					trip = <&cpu_critical>;
+					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&cpu100 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&cpu101 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&cpu102 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&cpu103 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+			};
+		};
+
+		ddr-thermal {
+			polling-delay = <1000>;
+			polling-delay-passive = <100>;
+			thermal-sensors = <&ddr_temp>;
+
+			trips {
+				ddr_critical: ddr-critical {
+					temperature = <110000>; /* millicelsius */
+					hysteresis = <2000>; /* millicelsius */
+					type = "critical";
+				};
+			};
+
+			cooling-maps {
+				map {
+					trip = <&ddr_critical>;
+					cooling-device = <&mali THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+			};
+		};
+	};
+
 	chosen {
 		stdout-path = "serial0:115200n8";
 	};
@@ -288,6 +338,7 @@
 	operating-points-v2 = <&cpu_opp_table_0>;
 	clocks = <&clkc CLKID_CPU_CLK>;
 	clock-latency = <50000>;
+	#cooling-cells = <2>;
 };
 
 &cpu1 {
@@ -295,6 +346,7 @@
 	operating-points-v2 = <&cpu_opp_table_0>;
 	clocks = <&clkc CLKID_CPU_CLK>;
 	clock-latency = <50000>;
+	#cooling-cells = <2>;
 };
 
 &cpu100 {
@@ -302,6 +354,7 @@
 	operating-points-v2 = <&cpub_opp_table_1>;
 	clocks = <&clkc CLKID_CPUB_CLK>;
 	clock-latency = <50000>;
+	#cooling-cells = <2>;
 };
 
 &cpu101 {
@@ -309,6 +362,7 @@
 	operating-points-v2 = <&cpub_opp_table_1>;
 	clocks = <&clkc CLKID_CPUB_CLK>;
 	clock-latency = <50000>;
+	#cooling-cells = <2>;
 };
 
 &cpu102 {
@@ -316,6 +370,7 @@
 	operating-points-v2 = <&cpub_opp_table_1>;
 	clocks = <&clkc CLKID_CPUB_CLK>;
 	clock-latency = <50000>;
+	#cooling-cells = <2>;
 };
 
 &cpu103 {
@@ -323,6 +378,7 @@
 	operating-points-v2 = <&cpub_opp_table_1>;
 	clocks = <&clkc CLKID_CPUB_CLK>;
 	clock-latency = <50000>;
+	#cooling-cells = <2>;
 };
 
 &ext_mdio {
@@ -377,6 +433,10 @@
 	};
 };
 
+&mali {
+	#cooling-cells = <2>;
+};
+
 &hdmi_tx {
 	status = "okay";
 	pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
Signature · 1 line
2.17.1
reviewer Acked-by on v3 5/6
#9 lore raw

Re: [PATCH v3 5/6] arm64: dts: amlogic: odroid-n2: add minimal thermal zone

Quoted 6 lines · Guillaume La Roque

Add minimal thermal zone for two temperature sensor One is located close to the DDR and the other one is located close to the PLLs (between the CPU and GPU)

I'm not familiar with the thermal subsystem but this looks sane so:

author maintainer
#10 lore raw

PATCH v3 6/6 MAINTAINERS: add entry for Amlogic Thermal driver

In reply to Guillaume La Roque

Add myself as maintainer for Amlogic Thermal driver.

---
 MAINTAINERS | 9 +++++++++
 1 file changed, 9 insertions(+)
MAINTAINERS +9 -0
index fb2b12f75c37..299f27d11058 100644
@@ -15910,6 +15910,15 @@ F:	Documentation/driver-api/thermal/cpu-cooling-api.rst
 F:	drivers/thermal/cpu_cooling.c
 F:	include/linux/cpu_cooling.h
 
+THERMAL DRIVER FOR AMLOGIC SOCS
+M:	Guillaume La Roque <[email protected]>
+L:	[email protected]
+L:	[email protected]
+W:	http://linux-meson.com/
+S:	Supported
+F:	drivers/thermal/amlogic_thermal.c
+F:	Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml
+
 THINKPAD ACPI EXTRAS DRIVER
 M:	Henrique de Moraes Holschuh <[email protected]>
 L:	[email protected]
Signature · 1 line
2.17.1
maintainer
#11 lore raw
In reply to Guillaume La Roque
Quoted 22 lines · Guillaume La Roque

This patchs series add support of New Amlogic temperature sensor and minimal thermal zone for SEI510 and ODROID-N2 boards.

First implementation was doing on IIO[1] but after comments i move on thermal framework. Formulas and calibration values come from amlogic.

Changes since v2:
- fix yaml documention
- remove unneeded status variable for temperature-sensor node
- rework driver after Martin review
- add some information in commit message

Changes since v1:
- fix enum vs const in documentation
- fix error with thermal-sensor-cells value set to 1 instead of 0
- add some dependencies needed to add cooling-maps

Dependencies :
- patch 3,4 & 5: depends on Neil's patch and series :
- missing dwc2 phy-names[2]
- patchsets to add DVFS on G12a[3] which have deps on [4] and [5]

Quoted 5 lines

[1] https://lore.kernel.org/linux-amlogic/[email protected]/
[2] https://lore.kernel.org/linux-amlogic/[email protected]/
[3] https://lore.kernel.org/linux-amlogic/[email protected]/
[4] https://lore.kernel.org/linux-amlogic/[email protected]/
[5] https://lore.kernel.org/linux-amlogic/[email protected]/

Thank you for the detailed list of dependencies! Much appreciated.

With all the deps, I tested this on sei510 and odroid-n2, and basic functionality seems to work.

As discussed off-list: it would be nice to have an example of how cpufreq could be used as a cooling device for hot temperatures. The vendor kernel has some trip points that could be included as examples, or even included as extra patches.

Also the driver patch is missing the two main thermal maintainers, so please resend at least the driver and bindings including them.

Kevin

maintainer Tested-by
#12 lore raw
Quoted 35 lines · Kevin Hilman
Quoted 22 lines · Guillaume La Roque

This patchs series add support of New Amlogic temperature sensor and minimal thermal zone for SEI510 and ODROID-N2 boards.

First implementation was doing on IIO[1] but after comments i move on thermal framework. Formulas and calibration values come from amlogic.

Changes since v2:
- fix yaml documention
- remove unneeded status variable for temperature-sensor node
- rework driver after Martin review
- add some information in commit message

Changes since v1:
- fix enum vs const in documentation
- fix error with thermal-sensor-cells value set to 1 instead of 0
- add some dependencies needed to add cooling-maps

Dependencies :
- patch 3,4 & 5: depends on Neil's patch and series :
- missing dwc2 phy-names[2]
- patchsets to add DVFS on G12a[3] which have deps on [4] and [5]

Quoted 5 lines

[1] https://lore.kernel.org/linux-amlogic/[email protected]/
[2] https://lore.kernel.org/linux-amlogic/[email protected]/
[3] https://lore.kernel.org/linux-amlogic/[email protected]/
[4] https://lore.kernel.org/linux-amlogic/[email protected]/
[5] https://lore.kernel.org/linux-amlogic/[email protected]/

Thank you for the detailed list of dependencies! Much appreciated.

With all the deps, I tested this on sei510 and odroid-n2, and basic functionality seems to work.

Quoted 7 lines

As discussed off-list: it would be nice to have an example of how cpufreq could be used as a cooling device for hot temperatures. The vendor kernel has some trip points that could be included as examples, or even included as extra patches.

Also the driver patch is missing the two main thermal maintainers, so please resend at least the driver and bindings including them.

Forgot to add...

Tested-by on the v3 series
#13 lore raw
In reply to Guillaume La Roque
Quoted 29 lines · Guillaume La Roque

This patchs series add support of New Amlogic temperature sensor and minimal thermal zone for SEI510 and ODROID-N2 boards.

First implementation was doing on IIO[1] but after comments i move on thermal framework. Formulas and calibration values come from amlogic.

Changes since v2:
- fix yaml documention
- remove unneeded status variable for temperature-sensor node
- rework driver after Martin review
- add some information in commit message

Changes since v1:
- fix enum vs const in documentation
- fix error with thermal-sensor-cells value set to 1 instead of 0
- add some dependencies needed to add cooling-maps

Dependencies :
- patch 3,4 & 5: depends on Neil's patch and series :
- missing dwc2 phy-names[2]
- patchsets to add DVFS on G12a[3] which have deps on [4] and [5]

[1] https://lore.kernel.org/linux-amlogic/[email protected]/
[2] https://lore.kernel.org/linux-amlogic/[email protected]/
[3] https://lore.kernel.org/linux-amlogic/[email protected]/
[4] https://lore.kernel.org/linux-amlogic/[email protected]/
[5] https://lore.kernel.org/linux-amlogic/[email protected]/

Quoted 8 lines

Guillaume La Roque (6):
dt-bindings: thermal: Add DT bindings documentation for Amlogic
Thermal
thermal: amlogic: Add thermal driver to support G12 SoCs
arm64: dts: amlogic: g12: add temperature sensor
arm64: dts: meson: sei510: Add minimal thermal zone
arm64: dts: amlogic: odroid-n2: add minimal thermal zone
MAINTAINERS: add entry for Amlogic Thermal driver

I’ve tested this series with Odroid N2 and Khadas VIM3, X96-Max. Patches to add support for VIM3/X96-max will be submitted once the driver is merged.

VIM3:~ # dmesg | grep thermal

[    0.046375] thermal_sys: Registered thermal governor 'step_wise'

VIM3:~ # cat /sys/devices/virtual/thermal/thermal_zone0/temp 51300

VIM3:~ # cat /sys/devices/virtual/thermal/thermal_zone1/temp 52800

Christian

author maintainer
#14 lore raw

Hi Christian,

thanks for testing on this 3 boards.

guillaume

Quoted 52 lines · Christian Hewitt
Quoted 28 lines · Guillaume La Roque

This patchs series add support of New Amlogic temperature sensor and minimal thermal zone for SEI510 and ODROID-N2 boards.

First implementation was doing on IIO[1] but after comments i move on thermal framework. Formulas and calibration values come from amlogic.

Changes since v2:
- fix yaml documention
- remove unneeded status variable for temperature-sensor node
- rework driver after Martin review
- add some information in commit message

Changes since v1:
- fix enum vs const in documentation
- fix error with thermal-sensor-cells value set to 1 instead of 0
- add some dependencies needed to add cooling-maps

Dependencies :
- patch 3,4 & 5: depends on Neil's patch and series :
- missing dwc2 phy-names[2]
- patchsets to add DVFS on G12a[3] which have deps on [4] and [5]

[1] https://lore.kernel.org/linux-amlogic/[email protected]/
[2] https://lore.kernel.org/linux-amlogic/[email protected]/
[3] https://lore.kernel.org/linux-amlogic/[email protected]/
[4] https://lore.kernel.org/linux-amlogic/[email protected]/
[5] https://lore.kernel.org/linux-amlogic/[email protected]/

Quoted 8 lines

Guillaume La Roque (6):
dt-bindings: thermal: Add DT bindings documentation for Amlogic
Thermal
thermal: amlogic: Add thermal driver to support G12 SoCs
arm64: dts: amlogic: g12: add temperature sensor
arm64: dts: meson: sei510: Add minimal thermal zone
arm64: dts: amlogic: odroid-n2: add minimal thermal zone
MAINTAINERS: add entry for Amlogic Thermal driver

I’ve tested this series with Odroid N2 and Khadas VIM3, X96-Max. Patches to add support for VIM3/X96-max will be submitted once the driver is merged.

VIM3:~ # dmesg | grep thermal

[    0.046375] thermal_sys: Registered thermal governor 'step_wise'

VIM3:~ # cat /sys/devices/virtual/thermal/thermal_zone0/temp 51300

VIM3:~ # cat /sys/devices/virtual/thermal/thermal_zone1/temp 52800

Christian