Add support of New Amlogic temperature sensor for G12 SoCs
Subsystems (4)
Guillaume La Roque
maintainercover 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.
Dependencies :
- patch 3: depends on Neil's patchs :
- missing dwc2 phy-names[1]
- rework on G12 DT[2]
[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]/
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 | 58 +++ MAINTAINERS | 9 + .../boot/dts/amlogic/meson-g12-common.dtsi | 22 ++ .../boot/dts/amlogic/meson-g12a-sei510.dts | 13 + .../boot/dts/amlogic/meson-g12b-odroid-n2.dts | 13 + drivers/thermal/Kconfig | 12 +- drivers/thermal/Makefile | 1 + drivers/thermal/amlogic_thermal.c | 335 ++++++++++++++++++ 8 files changed, 462 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml create mode 100644 drivers/thermal/amlogic_thermal.c
Signature · 1 line
2.17.1
Guillaume La Roque
maintainerPATCH 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 | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml
Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml new file +58 -0
@@ -0,0 +1,58 @@ +# 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 Driver + +maintainers: + - Guillaume La Roque <[email protected]> + +description: Amlogic Thermal driver + +properties: + compatible: + oneOf: + - items: + - enum: + - amlogic,g12-cpu-thermal + - amlogic,g12-ddr-thermal + - enum: + - amlogic,g12-thermal + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + maxItems: 1 + + amlogic,ao-secure: + description: phandle to the ao-secure syscon + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + + +required: + - compatible + - reg + - interrupts + - clocks + - amlogic,ao-secure + +examples: + - | + cpu_temp: temperature-sensor@ff634800 { + compatible = "amlogic,g12-cpu-thermal", + "amlogic,g12-thermal"; + reg = <0x0 0xff634800 0x0 0x50>; + interrupts = <0x0 0x24 0x0>; + clocks = <&clk 164>; + status = "okay"; + #thermal-sensor-cells = <1>; + amlogic,ao-secure = <&sec_AO>; + }; +...
Signature · 1 line
2.17.1
Guillaume La Roque
maintainerPATCH 2/6 thermal: amlogic: Add thermal driver to support G12 SoCs
In reply to Guillaume La Roque--- drivers/thermal/Kconfig | 12 +- drivers/thermal/Makefile | 1 + drivers/thermal/amlogic_thermal.c | 335 ++++++++++++++++++++++++++++++ 3 files changed, 347 insertions(+), 1 deletion(-) create mode 100644 drivers/thermal/amlogic_thermal.c
drivers/thermal/Kconfig +11 -1
@@ -1,4 +1,3 @@ -# SPDX-License-Identifier: GPL-2.0-only # # Generic thermal sysfs drivers configuration #
@@ -348,6 +347,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
@@ -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 +335 -0
335 lines not on this page · raw message
Signature · 1 line
2.17.1
Guillaume La Roque
maintainerPATCH 3/6 arm64: dts: amlogic: g12: add temperature sensor
In reply to Guillaume La RoqueAdd cpu and ddr temperature sensors for G12 Socs
--- .../boot/dts/amlogic/meson-g12-common.dtsi | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+)
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +22 -0
@@ -1353,6 +1353,28 @@ }; }; + 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>; + status = "okay"; + #thermal-sensor-cells = <1>; + 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>; + status = "okay"; + #thermal-sensor-cells = <1>; + 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
Guillaume La Roque
maintainerPATCH 4/6 arm64: dts: meson: sei510: Add minimal thermal zone
In reply to Guillaume La RoqueAdd minimal thermal zone for DDR and CPU sensor
--- arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts | 13 +++++++++++++ 1 file changed, 13 insertions(+)
arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts +13 -0
@@ -33,6 +33,19 @@ ethernet0 = ðmac; }; + thermal-zones { + soc_thermal { + polling-delay = <1000>; + polling-delay-passive = <100>; + thermal-sensors = <&cpu_temp 0>; + }; + ddr_thermal { + polling-delay = <1000>; + polling-delay-passive = <100>; + thermal-sensors = <&ddr_temp 1>; + }; + }; + mono_dac: audio-codec-0 { compatible = "maxim,max98357a"; #sound-dai-cells = <0>;
Signature · 1 line
2.17.1
Guillaume La Roque
maintainerPATCH 5/6 arm64: dts: amlogic: odroid-n2: add minimal thermal zone
In reply to Guillaume La RoqueAdd minimal thermal zone for DDR and CPU sensor
--- .../arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts | 13 +++++++++++++ 1 file changed, 13 insertions(+)
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +13 -0
@@ -20,6 +20,19 @@ ethernet0 = ðmac; }; + thermal-zones { + soc_thermal { + polling-delay = <1000>; + polling-delay-passive = <100>; + thermal-sensors = <&cpu_temp 0>; + }; + ddr_thermal { + polling-delay = <1000>; + polling-delay-passive = <100>; + thermal-sensors = <&ddr_temp 1>; + }; + }; + chosen { stdout-path = "serial0:115200n8"; };
Signature · 1 line
2.17.1
Guillaume La Roque
maintainerPATCH 6/6 MAINTAINERS: add entry for Amlogic Thermal driver
In reply to Guillaume La RoqueAdd myself as maintainer for Amlogic Thermal driver.
--- MAINTAINERS | 9 +++++++++ 1 file changed, 9 insertions(+)
MAINTAINERS +9 -0
@@ -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
Re: [PATCH 1/6] dt-bindings: thermal: Add DT bindings documentation for Amlogic Thermal
In reply to Guillaume La RoqueQuoted 28 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.Signed-off-by Guillaume La Roque <[email protected]>--- .../bindings/thermal/amlogic,thermal.yaml | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/amlogic,thermal.yamlDocumentation/devicetree/bindings/thermal/amlogic,thermal.yaml new file +12
-0@@ -0,0 +1,58 @@ +# 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 Driver + +maintainers: + - Guillaume La Roque <[email protected]> + +description: Amlogic Thermal driver
Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml line 22
Quoted 10 lines
Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml new file +10
-0+ +properties: + compatible: + oneOf: + - items: + - enum: + - amlogic,g12-cpu-thermal + - amlogic,g12-ddr-thermal + - enum: + - amlogic,g12-thermal
Shouldn't be :
compatible:
items:
- enum:
- amlogic,g12-cpu-thermal
- amlogic,g12-ddr-thermal
- const:
- amlogic,g12-thermal
instead ?
Quoted 38 lines
Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml new file +36
-0+ + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + maxItems: 1 + + amlogic,ao-secure: + description: phandle to the ao-secure syscon + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + + +required: + - compatible + - reg + - interrupts + - clocks + - amlogic,ao-secure + +examples: + - | + cpu_temp: temperature-sensor@ff634800 { + compatible = "amlogic,g12-cpu-thermal", + "amlogic,g12-thermal"; + reg = <0x0 0xff634800 0x0 0x50>; + interrupts = <0x0 0x24 0x0>; + clocks = <&clk 164>; + status = "okay"; + #thermal-sensor-cells = <1>; + amlogic,ao-secure = <&sec_AO>; + }; +...
Re: [PATCH 2/6] thermal: amlogic: Add thermal driver to support G12 SoCs
In reply to Guillaume La RoqueQuoted 13 lines · Guillaume La Roque
Signed-off-by Guillaume La Roque <[email protected]>--- drivers/thermal/Kconfig | 12 +- drivers/thermal/Makefile | 1 + drivers/thermal/amlogic_thermal.c | 335 ++++++++++++++++++++++++++++++ 3 files changed, 347 insertions(+), 1 deletion(-) create mode 100644 drivers/thermal/amlogic_thermal.cdrivers/thermal/Kconfig +0
-0
drivers/thermal/Kconfig line 1
Quoted 1 line
drivers/thermal/Kconfig +0
-1@@ -1,4 +1,3 @@ -# SPDX-License-Identifier: GPL-2.0-only
|\ typo ?
Quoted 21 lines
drivers/thermal/Kconfig +11
-0# # Generic thermal sysfs drivers configuration #@@ -348,6 +347,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"
[...]
Re: [PATCH 4/6] arm64: dts: meson: sei510: Add minimal thermal zone
In reply to Guillaume La RoqueQuoted 12 lines · Guillaume La Roque
Add minimal thermal zone for DDR and CPU sensor
Signed-off-by Guillaume La Roque <[email protected]>--- arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts | 13 +++++++++++++ 1 file changed, 13 insertions(+)arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts +0
-0
arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts line 40
Quoted 8 lines
arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts +5
-0@@ -33,6 +33,19 @@ ethernet0 = ðmac; }; + thermal-zones { + soc_thermal { + polling-delay = <1000>; + polling-delay-ptripsassive = <100>; + thermal-sensors = <&cpu_temp 0>;
Seems the trips & cooling-maps are required as described in thermal.txt
For the soc_thermal zone it's esy to add a cooling map with the CPU and cooling devices, but for the ddr_thermal, no idea if we can use the CPUs within 2 cooling maps.
arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts line 41
Quoted 1 line
arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts +1
-0+ };
I would add a blank line between the zones, same for other files.
Quoted 11 lines
arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts +7
-0+ ddr_thermal { + polling-delay = <1000>; + polling-delay-passive = <100>; + thermal-sensors = <&ddr_temp 1>; + }; + }; + mono_dac: audio-codec-0 { compatible = "maxim,max98357a"; #sound-dai-cells = <0>;
Re: [PATCH 6/6] MAINTAINERS: add entry for Amlogic Thermal driver
In reply to Guillaume La RoqueQuoted 18 lines · Guillaume La Roque
Add myself as maintainer for Amlogic Thermal driver.
Signed-off-by Guillaume La Roque <[email protected]>--- MAINTAINERS | 9 +++++++++ 1 file changed, 9 insertions(+)MAINTAINERS +2
-0@@ -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]>
MAINTAINERS F: Documentation/driver-api/thermal/cpu-cooling-api.rst · line 15924
Quoted 10 lines
MAINTAINERS +7
-0+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]
Rob Herring
maintainerRe: [PATCH 1/6] dt-bindings: thermal: Add DT bindings documentation for Amlogic Thermal
In reply to Neil ArmstrongQuoted 50 lines · Neil Armstrong
Quoted 28 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.Signed-off-by Guillaume La Roque <[email protected]>--- .../bindings/thermal/amlogic,thermal.yaml | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/amlogic,thermal.yamlDocumentation/devicetree/bindings/thermal/amlogic,thermal.yaml new file +12
-0@@ -0,0 +1,58 @@ +# 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 Driver + +maintainers: + - Guillaume La Roque <[email protected]> + +description: Amlogic Thermal driverDocumentation/devicetree/bindings/thermal/amlogic,thermal.yaml line 22
Quoted 10 lines
Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml new file +10
-0+ +properties: + compatible: + oneOf: + - items: + - enum: + - amlogic,g12-cpu-thermal + - amlogic,g12-ddr-thermal + - enum: + - amlogic,g12-thermalShouldn't be :
compatible:
items:
- enum:
- amlogic,g12-cpu-thermal
- amlogic,g12-ddr-thermal
- const:
- amlogic,g12-thermal
Quoted 1 line
instead ?
Yes, except 'const' is a string, not list value.
Quoted 15 lines
Quoted 5 lines
Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml new file +4
-0+ + reg: + maxItems: 1 +Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml line 36
Quoted 10 lines
Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml new file +10
-0+ interrupts: + maxItems: 1 + + clocks: + maxItems: 1 + + amlogic,ao-secure: + description: phandle to the ao-secure syscon + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32
phandle, not uint32
Quoted 15 lines
Quoted 15 lines
Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml new file +15
-0+ + +required: + - compatible + - reg + - interrupts + - clocks + - amlogic,ao-secure + +examples: + - | + cpu_temp: temperature-sensor@ff634800 { + compatible = "amlogic,g12-cpu-thermal", + "amlogic,g12-thermal"; + reg = <0x0 0xff634800 0x0 0x50>;
Quoted 8 lines
Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml line 58
Quoted 8 lines
Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml new file +7
-0+ interrupts = <0x0 0x24 0x0>; + clocks = <&clk 164>; + status = "okay"; + #thermal-sensor-cells = <1>; + amlogic,ao-secure = <&sec_AO>; + }; +...
Fix this.
Quoted 2 lines
Quoted 1 line