Skip to contentSkip to conversation

thermal: k3: Add support for bandgap sensors

PATCH Superseded Keerthy 2 participants 9 messages Feb 14, 2020 – Feb 24, 2020

Subsystems (3)

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Keerthy

author
#0 lore raw

v2 cover thermal: k3: Add support for bandgap sensors

Add VTM thermal support. In the Voltage Thermal
Management Module(VTM), K3 AM654 supplies a voltage reference and a temperature sensor feature that are gathered in the band gap voltage and temperature sensor (VBGAPTS) module. The band gap provides current and voltage reference for its internal circuits and other analog IP blocks. The analog-to-digital converter (ADC) produces an output value that is proportional to the silicon temperature.

Add support for bandgap sensors. Currently reading temperatures and trend computing is supported.

Changes in v2:

* Fixed yaml errors
* renamed am654-industrial-thermal.dtsi to k3-am654-industrial-thermal.dtsi to follow the convention for k3 family.

Keerthy (4):
dt-bindings: thermal: k3: Add VTM bindings documentation
thermal: k3: Add support for bandgap sensors
arm64: dts: ti: am654: Add thermal zones
arm64: dts: ti: am6: Add VTM node

 .../bindings/thermal/ti,am654-thermal.yaml    |  57 +++
 arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi    |  11 +
 .../dts/ti/k3-am654-industrial-thermal.dtsi   |  45 +++
 drivers/thermal/Kconfig                       |  12 +
 drivers/thermal/Makefile                      |   1 +
 drivers/thermal/k3_bandgap.c                  | 342 ++++++++++++++++++
 6 files changed, 468 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml
 create mode 100644 arch/arm64/boot/dts/ti/k3-am654-industrial-thermal.dtsi
 create mode 100644 drivers/thermal/k3_bandgap.c
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH v2 1/4 dt-bindings: thermal: k3: Add VTM bindings documentation

Add VTM bindings documentation. In the Voltage Thermal Management Module(VTM), K3 AM654 supplies a voltage reference and a temperature sensor feature that are gathered in the band gap voltage and temperature sensor (VBGAPTS) module. The band gap provides current and voltage reference for its internal circuits and other analog IP blocks. The analog-to-digital converter (ADC) produces an output value that is proportional to the silicon temperature.

---

Changes in v2:

* Fixed make dt_binding_check errors.

 .../bindings/thermal/ti,am654-thermal.yaml    | 57 +++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml
Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml new file +57 -0
new file mode 100644
index 000000000000..1c26ad8cd505
@@ -0,0 +1,57 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/thermal/ti,am654-thermal.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Texas Instruments AM654 VTM (DTS) binding
+
+maintainers:
+  - Keerthy <[email protected]>
+
+properties:
+  compatible:
+    const: ti,am654-vtm
+
+  reg:
+    maxItems: 1
+
+  power-domains:
+    maxItems: 1
+    description: phandle to the associated power domain
+
+  "#thermal-sensor-cells":
+    const: 1
+
+required:
+  - "#thermal-sensor-cells"
+  - compatible
+  - reg
+  - power-domains
+
+additionalProperties: false
+
+examples:
+  - |
+
+    vtm: wkup_vtm0@42050000 {
+        compatible = "ti,am654-vtm";
+        reg = <0x0 0x42050000 0x0 0x25c>;
+        power-domains = <&k3_pds 80 TI_SCI_PD_EXCLUSIVE>;
+        #thermal-sensor-cells = <1>;
+    };
+
+    mpu0_thermal: mpu0_thermal {
+        polling-delay-passive = <250>; /* milliseconds */
+        polling-delay = <500>; /* milliseconds */
+        thermal-sensors = <&wkup_vtm0 0>;
+
+        trips {
+                mpu0_crit: mpu0_crit {
+                        temperature = <125000>; /* milliCelsius */
+                        hysteresis = <2000>; /* milliCelsius */
+                        type = "critical";
+                };
+        };
+    };
+...
Signature · 1 line
2.17.1
maintainer
#2 lore raw

Re: [PATCH v2 1/4] dt-bindings: thermal: k3: Add VTM bindings documentation

Quoted 12 lines · Keerthy

Add VTM bindings documentation. In the Voltage Thermal Management Module(VTM), K3 AM654 supplies a voltage reference and a temperature sensor feature that are gathered in the band gap voltage and temperature sensor (VBGAPTS) module. The band gap provides current and voltage reference for its internal circuits and other analog IP blocks. The analog-to-digital converter (ADC) produces an output value that is proportional to the silicon temperature.

---

Quoted 8 lines

Changes in v2:

* Fixed make dt_binding_check errors.

 .../bindings/thermal/ti,am654-thermal.yaml    | 57 +++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml

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

Documentation/devicetree/bindings/display/simple-framebuffer.example.dts:21.16-37.11: Warning (chosen_node_is_root): /example-0/chosen: chosen node must be at root node
Error: Documentation/devicetree/bindings/thermal/ti,am654-thermal.example.dts:21.41-42 syntax error
FATAL ERROR: Unable to parse input tree
scripts/Makefile.lib:300: recipe for target 'Documentation/devicetree/bindings/thermal/ti,am654-thermal.example.dt.yaml' failed
make[1]: *** [Documentation/devicetree/bindings/thermal/ti,am654-thermal.example.dt.yaml] Error 1
Makefile:1263: recipe for target 'dt_binding_check' failed
make: *** [dt_binding_check] Error 2

See https://patchwork.ozlabs.org/patch/1237882
Please check and re-submit.

author
#3 lore raw

Re: [PATCH v2 1/4] dt-bindings: thermal: k3: Add VTM bindings documentation

Quoted 32 lines · Rob Herring
Quoted 12 lines · Keerthy

Add VTM bindings documentation. In the Voltage Thermal Management Module(VTM), K3 AM654 supplies a voltage reference and a temperature sensor feature that are gathered in the band gap voltage and temperature sensor (VBGAPTS) module. The band gap provides current and voltage reference for its internal circuits and other analog IP blocks. The analog-to-digital converter (ADC) produces an output value that is proportional to the silicon temperature.

---

Quoted 8 lines

Changes in v2:

* Fixed make dt_binding_check errors.

  .../bindings/thermal/ti,am654-thermal.yaml    | 57 +++++++++++++++++++
  1 file changed, 57 insertions(+)

create mode 100644 Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml

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

Documentation/devicetree/bindings/display/simple-framebuffer.example.dts:21.16-37.11: Warning (chosen_node_is_root): /example-0/chosen: chosen node must be at root node
Error: Documentation/devicetree/bindings/thermal/ti,am654-thermal.example.dts:21.41-42 syntax error
FATAL ERROR: Unable to parse input tree
scripts/Makefile.lib:300: recipe for target 'Documentation/devicetree/bindings/thermal/ti,am654-thermal.example.dt.yaml' failed
make[1]: *** [Documentation/devicetree/bindings/thermal/ti,am654-thermal.example.dt.yaml] Error 1
Makefile:1263: recipe for target 'dt_binding_check' failed
make: *** [dt_binding_check] Error 2

Quoted 2 lines

See https://patchwork.ozlabs.org/patch/1237882
Please check and re-submit.

Rob,

I am using:

Tree: https//github.com/devicetree-org/dt-schema.git
branch: master

I have make dt_binding_check working for Documentation/devicetree/bindings/thermal/ti,am654-thermal.example.dt.yaml

Documentation/devicetree/bindings/thermal/ti,am654-thermal.example.dts is created without any errors :

https://pastebin.ubuntu.com/p/6MkMbKPpbY/

I did not see any errors as the other files erred out.

Today i tried with DT_SCHEMA_FILES option and then finally reproduced the errors. It is a bit confusing for the first time users.

Now i have it compiled without any errors.

Posting v3 in a bit.

- Keerthy

Quoted 1 line
maintainer
#4 lore raw

Re: [PATCH v2 1/4] dt-bindings: thermal: k3: Add VTM bindings documentation

Quoted 49 lines · Keerthy
Quoted 32 lines · Rob Herring
Quoted 12 lines · Keerthy

Add VTM bindings documentation. In the Voltage Thermal Management Module(VTM), K3 AM654 supplies a voltage reference and a temperature sensor feature that are gathered in the band gap voltage and temperature sensor (VBGAPTS) module. The band gap provides current and voltage reference for its internal circuits and other analog IP blocks. The analog-to-digital converter (ADC) produces an output value that is proportional to the silicon temperature.

---

Quoted 8 lines

Changes in v2:

* Fixed make dt_binding_check errors.

  .../bindings/thermal/ti,am654-thermal.yaml    | 57 +++++++++++++++++++
  1 file changed, 57 insertions(+)

create mode 100644 Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml

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

Documentation/devicetree/bindings/display/simple-framebuffer.example.dts:21.16-37.11: Warning (chosen_node_is_root): /example-0/chosen: chosen node must be at root node
Error: Documentation/devicetree/bindings/thermal/ti,am654-thermal.example.dts:21.41-42 syntax error
FATAL ERROR: Unable to parse input tree
scripts/Makefile.lib:300: recipe for target 'Documentation/devicetree/bindings/thermal/ti,am654-thermal.example.dt.yaml' failed
make[1]: *** [Documentation/devicetree/bindings/thermal/ti,am654-thermal.example.dt.yaml] Error 1
Makefile:1263: recipe for target 'dt_binding_check' failed
make: *** [dt_binding_check] Error 2

Quoted 2 lines

See https://patchwork.ozlabs.org/patch/1237882
Please check and re-submit.

Rob,

I am using:

Tree: https//github.com/devicetree-org/dt-schema.git
branch: master

I have make dt_binding_check working for Documentation/devicetree/bindings/thermal/ti,am654-thermal.example.dt.yaml

Quoted 6 lines

Documentation/devicetree/bindings/thermal/ti,am654-thermal.example.dts is created without any errors :

https://pastebin.ubuntu.com/p/6MkMbKPpbY/

I did not see any errors as the other files erred out.

'make -k' is your friend.

What branch are you on. Only linux-next breaks generally.

Quoted 11 lines

Today i tried with DT_SCHEMA_FILES option and then finally reproduced the errors. It is a bit confusing for the first time users.

Now i have it compiled without any errors.

Posting v3 in a bit.

- Keerthy

Quoted 1 line
author
#5 lore raw

Re: [PATCH v2 1/4] dt-bindings: thermal: k3: Add VTM bindings documentation

Quoted 50 lines · Rob Herring
Quoted 49 lines · Keerthy
Quoted 32 lines · Rob Herring
Quoted 12 lines · Keerthy

Add VTM bindings documentation. In the Voltage Thermal Management Module(VTM), K3 AM654 supplies a voltage reference and a temperature sensor feature that are gathered in the band gap voltage and temperature sensor (VBGAPTS) module. The band gap provides current and voltage reference for its internal circuits and other analog IP blocks. The analog-to-digital converter (ADC) produces an output value that is proportional to the silicon temperature.

---

Quoted 8 lines

Changes in v2:

* Fixed make dt_binding_check errors.

   .../bindings/thermal/ti,am654-thermal.yaml    | 57 +++++++++++++++++++
   1 file changed, 57 insertions(+)

create mode 100644 Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml

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

Documentation/devicetree/bindings/display/simple-framebuffer.example.dts:21.16-37.11: Warning (chosen_node_is_root): /example-0/chosen: chosen node must be at root node
Error: Documentation/devicetree/bindings/thermal/ti,am654-thermal.example.dts:21.41-42 syntax error
FATAL ERROR: Unable to parse input tree
scripts/Makefile.lib:300: recipe for target 'Documentation/devicetree/bindings/thermal/ti,am654-thermal.example.dt.yaml' failed
make[1]: *** [Documentation/devicetree/bindings/thermal/ti,am654-thermal.example.dt.yaml] Error 1
Makefile:1263: recipe for target 'dt_binding_check' failed
make: *** [dt_binding_check] Error 2

Quoted 2 lines

See https://patchwork.ozlabs.org/patch/1237882
Please check and re-submit.

Rob,

I am using:

Tree: https//github.com/devicetree-org/dt-schema.git
branch: master

I have make dt_binding_check working for Documentation/devicetree/bindings/thermal/ti,am654-thermal.example.dt.yaml

Quoted 9 lines
Quoted 6 lines

Documentation/devicetree/bindings/thermal/ti,am654-thermal.example.dts is created without any errors :

https://pastebin.ubuntu.com/p/6MkMbKPpbY/

I did not see any errors as the other files erred out.

'make -k' is your friend.

Okay

Quoted 1 line

What branch are you on. Only linux-next breaks generally.

linux-next

Thanks,
Keerthy

Quoted 4 lines
Quoted 4 lines

Today i tried with DT_SCHEMA_FILES option and then finally reproduced the errors. It is a bit confusing for the first time users.

Quoted 8 lines
Quoted 8 lines

Now i have it compiled without any errors.

Posting v3 in a bit.

- Keerthy

Quoted 1 line

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

author
#6 lore raw

PATCH v2 2/4 thermal: k3: Add support for bandgap sensors

In reply to Keerthy

The bandgap provides current and voltage reference for its internal circuits and other analog IP blocks. The analog-to-digital converter (ADC) produces an output value that is proportional to the silicon temperature.

Currently reading temperatures and trend computing is supported as there are no active/passive cooling agent supported.

---
 drivers/thermal/Kconfig      |  12 ++
 drivers/thermal/Makefile     |   1 +
 drivers/thermal/k3_bandgap.c | 342 +++++++++++++++++++++++++++++++++++
 3 files changed, 355 insertions(+)
 create mode 100644 drivers/thermal/k3_bandgap.c
drivers/thermal/Kconfig +12 -0
index 5a05db5438d6..fa598eddc7ac 100644
@@ -251,6 +251,18 @@ config IMX_THERMAL
 	  cpufreq is used as the cooling device to throttle CPUs when the
 	  passive trip is crossed.
 
+config K3_THERMAL
+	bool "Texas Instruments K3 thermal support"
+	depends on THERMAL
+	depends on ARCH_K3 || COMPILE_TEST
+	help
+	  If you say yes here you get thermal support for the Texas Instruments
+	  K3 SoC family. The current chip supported is:
+	   - AM654
+
+	  This includes temperature reading functionality and also trend
+	  computation.
+
 config MAX77620_THERMAL
 	tristate "Temperature sensor driver for Maxim MAX77620 PMIC"
 	depends on MFD_MAX77620
drivers/thermal/Makefile +1 -0
index 9fb88e26fb10..5ad6535139ae 100644
@@ -28,6 +28,7 @@ thermal_sys-$(CONFIG_CLOCK_THERMAL)	+= clock_cooling.o
 # devfreq cooling
 thermal_sys-$(CONFIG_DEVFREQ_THERMAL) += devfreq_cooling.o
 
+obj-$(CONFIG_K3_THERMAL)	+= k3_bandgap.o
 # platform thermal drivers
 obj-y				+= broadcom/
 obj-$(CONFIG_THERMAL_MMIO)		+= thermal_mmio.o
drivers/thermal/k3_bandgap.c new file +342 -0

342 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#7 lore raw

PATCH v2 3/4 arm64: dts: ti: am654: Add thermal zones

In reply to Keerthy

The am654 SoC has three thermal zones namely MPU0, MPU1 and MCU zones

---

Changes in v2:

* Renamed am654-industrial-thermal.dtsi to k3-am654-industrial-thermal.dtsi

 .../dts/ti/k3-am654-industrial-thermal.dtsi   | 45 +++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 arch/arm64/boot/dts/ti/k3-am654-industrial-thermal.dtsi
arch/arm64/boot/dts/ti/k3-am654-industrial-thermal.dtsi new file +45 -0
new file mode 100644
index 000000000000..cdc3d40c3f60
@@ -0,0 +1,45 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <dt-bindings/thermal/thermal.h>
+
+mpu0_thermal: mpu0_thermal {
+	polling-delay-passive = <250>; /* milliseconds */
+	polling-delay = <500>; /* milliseconds */
+	thermal-sensors = <&wkup_vtm0 0>;
+
+	trips {
+		mpu0_crit: mpu0_crit {
+			temperature = <125000>; /* milliCelsius */
+			hysteresis = <2000>; /* milliCelsius */
+			type = "critical";
+		};
+	};
+};
+
+mpu1_thermal: mpu1_thermal {
+	polling-delay-passive = <250>; /* milliseconds */
+	polling-delay = <500>; /* milliseconds */
+	thermal-sensors = <&wkup_vtm0 1>;
+
+	trips {
+		mpu1_crit: mpu1_crit {
+			temperature = <125000>; /* milliCelsius */
+			hysteresis = <2000>; /* milliCelsius */
+			type = "critical";
+		};
+	};
+};
+
+mcu_thermal: mcu_thermal {
+	polling-delay-passive = <250>; /* milliseconds */
+	polling-delay = <500>; /* milliseconds */
+	thermal-sensors = <&wkup_vtm0 2>;
+
+	trips {
+		mcu_crit: mcu_crit {
+			temperature = <125000>; /* milliCelsius */
+			hysteresis = <2000>; /* milliCelsius */
+			type = "critical";
+		};
+	};
+};
Signature · 1 line
2.17.1
author
#8 lore raw

PATCH v2 4/4 arm64: dts: ti: am6: Add VTM node

In reply to Keerthy

VTM stands for voltage and thermal management. Add the vtm node and the associated thermal zones on the SoC.

---
 arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi +11 -0
index f4227e2743f2..e7ef96b621b3 100644
@@ -89,4 +89,15 @@
 		clocks = <&k3_clks 59 0>;
 		clock-names = "gpio";
 	};
+
+	wkup_vtm0: wkup_vtm0@42050000 {
+		compatible = "ti,am654-vtm";
+		reg = <0x42050000 0x25c>;
+		power-domains = <&k3_pds 80 TI_SCI_PD_EXCLUSIVE>;
+		#thermal-sensor-cells = <1>;
+	};
+
+	thermal_zones: thermal-zones {
+		#include "k3-am654-industrial-thermal.dtsi"
+	};
 };
Signature · 1 line
2.17.1