Skip to contentSkip to conversation

thermal: k3: Add support for bandgap sensors

PATCH Superseded Keerthy 3 participants 11 messages Feb 19, 2020 – Feb 24, 2020

Subsystems (3)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Keerthy

author
#0 lore raw

v3 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 v3:

* Fixed errors seen with:
dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml

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 v3 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 v3:

* Fixed errors seen with:
dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml

 .../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..b6dc95c3acab
@@ -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:
+  - |
+    #include <dt-bindings/soc/ti,sci_pm_domain.h>
+    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 = <&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 v3 1/4] dt-bindings: thermal: k3: Add VTM bindings documentation

Quoted 38 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.

---

Changes in v3:

* Fixed errors seen with:
dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml

 .../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 +11 -0
new file mode 100644
index 000000000000..b6dc95c3acab
@@ -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]>
+

Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml line 21

Quoted 10 lines
Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml new file +10 -0
+properties:
+  compatible:
+    const: ti,am654-vtm
+
+  reg:
+    maxItems: 1
+
+  power-domains:
+    maxItems: 1
+    description: phandle to the associated power domain

No need to redefine a standard property description.

Quoted 6 lines
Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml new file +6 -0
+
+  "#thermal-sensor-cells":
+    const: 1
+
+required:
+  - "#thermal-sensor-cells"

Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml line 37

Quoted 10 lines
Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml new file +10 -0
+  - compatible
+  - reg
+  - power-domains
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/soc/ti,sci_pm_domain.h>
+    vtm: wkup_vtm0@42050000 {

thermal-sensor@...

Use generic node names and don't use '_' in node names.

Quoted 23 lines
Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml new file +20 -0
+        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 = <&vtm0 0>;
+
+        trips {
+                mpu0_crit: mpu0_crit {
+                        temperature = <125000>; /* milliCelsius */
+                        hysteresis = <2000>; /* milliCelsius */
+                        type = "critical";
+                };
+        };
+    };
+...
Signature · 1 line
2.17.1
author
#3 lore raw

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

Quoted 43 lines · Rob Herring
Quoted 42 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.

---

Changes in v3:

* Fixed errors seen with:
dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml

  .../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 +15 -0
new file mode 100644
index 000000000000..b6dc95c3acab
@@ -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
+
Quoted 8 lines

Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml line 21

Quoted 6 lines
Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml new file +6 -0
+  reg:
+    maxItems: 1
+
+  power-domains:
+    maxItems: 1
+    description: phandle to the associated power domain

No need to redefine a standard property description.

Okay.

Quoted 20 lines
Quoted 7 lines
Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml new file +6 -0
+
+  "#thermal-sensor-cells":
+    const: 1
+
+required:
+  - "#thermal-sensor-cells"

Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml line 37

Quoted 10 lines
Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml new file +10 -0
+  - compatible
+  - reg
+  - power-domains
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/soc/ti,sci_pm_domain.h>
+    vtm: wkup_vtm0@42050000 {

thermal-sensor@...

Quoted 1 line

Use generic node names and don't use '_' in node names

vtm stands for voltage thermal manager and comprises of multiple sensors. This is similar to omap bandgap. Should i replace vtm with more generic name like thermal? as used in:

Documentation/devicetree/bindings/thermal/st,stm32-thermal.yaml

- Keerthy

Quoted 24 lines
Quoted 24 lines
Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml new file +20 -0
+        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 = <&vtm0 0>;
+
+        trips {
+                mpu0_crit: mpu0_crit {
+                        temperature = <125000>; /* milliCelsius */
+                        hysteresis = <2000>; /* milliCelsius */
+                        type = "critical";
+                };
+        };
+    };
+...
Signature · 1 line
2.17.1
maintainer
#4 lore raw

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

Quoted 78 lines · Keerthy
Quoted 43 lines · Rob Herring
Quoted 42 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.

---

Changes in v3:

* Fixed errors seen with:
dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml

  .../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 +15 -0
new file mode 100644
index 000000000000..b6dc95c3acab
@@ -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
+
Quoted 8 lines

Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml line 21

Quoted 6 lines
Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml new file +6 -0
+  reg:
+    maxItems: 1
+
+  power-domains:
+    maxItems: 1
+    description: phandle to the associated power domain

No need to redefine a standard property description.

Okay.

Quoted 20 lines
Quoted 7 lines
Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml new file +6 -0
+
+  "#thermal-sensor-cells":
+    const: 1
+
+required:
+  - "#thermal-sensor-cells"

Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml line 37

Quoted 10 lines
Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml new file +10 -0
+  - compatible
+  - reg
+  - power-domains
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/soc/ti,sci_pm_domain.h>
+    vtm: wkup_vtm0@42050000 {

thermal-sensor@...

Quoted 5 lines
Quoted 1 line

Use generic node names and don't use '_' in node names

vtm stands for voltage thermal manager and comprises of multiple sensors. This is similar to omap bandgap. Should i replace vtm with more generic name like thermal? as used in:

'vtm' is a label and source construct only (until you do overlays), so I don't care what you put really.

Rob

author
#5 lore raw

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

Quoted 79 lines · Rob Herring
Quoted 78 lines · Keerthy
Quoted 43 lines · Rob Herring
Quoted 42 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.

---

Changes in v3:

* Fixed errors seen with:
dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml

   .../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 +15 -0
new file mode 100644
index 000000000000..b6dc95c3acab
@@ -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
+
Quoted 8 lines

Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml line 21

Quoted 6 lines
Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml new file +6 -0
+  reg:
+    maxItems: 1
+
+  power-domains:
+    maxItems: 1
+    description: phandle to the associated power domain

No need to redefine a standard property description.

Okay.

Quoted 20 lines
Quoted 7 lines
Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml new file +6 -0
+
+  "#thermal-sensor-cells":
+    const: 1
+
+required:
+  - "#thermal-sensor-cells"

Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml line 37

Quoted 10 lines
Documentation/devicetree/bindings/thermal/ti,am654-thermal.yaml new file +10 -0
+  - compatible
+  - reg
+  - power-domains
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/soc/ti,sci_pm_domain.h>
+    vtm: wkup_vtm0@42050000 {

thermal-sensor@...

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Use generic node names and don't use '_' in node names

vtm stands for voltage thermal manager and comprises of multiple sensors. This is similar to omap bandgap. Should i replace vtm with more generic name like thermal? as used in:

'vtm' is a label and source construct only (until you do overlays), so I don't care what you put really.

Okay.

I will change in to:

vtm: thermal@42050000 {

Regards,
Keerthy

Quoted 3 lines

Rob

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

author
#6 lore raw

PATCH v3 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
#7 lore raw
Quoted 21 lines · 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 +0 -0
index 5a05db5438d6..fa598eddc7ac 100644

drivers/thermal/Kconfig config IMX_THERMAL · line 255

Quoted 5 lines
drivers/thermal/Kconfig +2 -0
@@ -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"

Hi,
Why is this bool and not tristate?

Quoted 25 lines
drivers/thermal/Kconfig +10 -0
+	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/k3_bandgap.c new file +5 -0
new file mode 100644
index 000000000000..35d904eb9857
@@ -0,0 +1,342 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * TI Bandgap temperature sensor driver for K3 SoC Family
+ *
+ * Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/

drivers/thermal/k3_bandgap.c

Quoted 10 lines
drivers/thermal/k3_bandgap.c new file +9 -0
+ */
 
+static int k3_bgp_read_temp(struct k3_thermal_data *devdata,
+			    int *temp)
+{
+	struct k3_bandgap *bgp;
+	unsigned int dtemp, s0, s1, s2;
+
+	bgp = devdata->bgp;
+	/**

"/**" is used to indicate kernel-doc notation in the Linux kernel source files, but this comment is not kernel-doc notation, so please just use "/*".

drivers/thermal/k3_bandgap.c line 142

Quoted 8 lines
drivers/thermal/k3_bandgap.c new file +8 -0
+	 * Errata is applicable for am654 pg 1.0 silicon. There
+	 * is a variation of the order for 8-10 degree centigrade.
+	 * Work around that by getting the average of two closest
+	 * readings out of three readings everytime we want to
+	 * report temperatures.
+	 *
+	 * Errata workaround.
+	 */

thanks.

Signature · 1 line
~Randy
author
#8 lore raw
Quoted 25 lines · Randy Dunlap
Quoted 24 lines · 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 +0 -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.
 
Quoted 5 lines

drivers/thermal/Kconfig config IMX_THERMAL · line 255

Quoted 2 lines
drivers/thermal/Kconfig +2 -0
+config K3_THERMAL
+	bool "Texas Instruments K3 thermal support"

Hi,
Why is this bool and not tristate?

Definitely can work as tristate. I will fix it next version.

Quoted 28 lines
Quoted 27 lines
drivers/thermal/Kconfig +10 -0
+	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/k3_bandgap.c new file +6 -0
new file mode 100644
index 000000000000..35d904eb9857
@@ -0,0 +1,342 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * TI Bandgap temperature sensor driver for K3 SoC Family
+ *
+ * Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/
+ */
Quoted 11 lines

drivers/thermal/k3_bandgap.c line 134

Quoted 8 lines
drivers/thermal/k3_bandgap.c new file +8 -0
+static int k3_bgp_read_temp(struct k3_thermal_data *devdata,
+			    int *temp)
+{
+	struct k3_bandgap *bgp;
+	unsigned int dtemp, s0, s1, s2;
+
+	bgp = devdata->bgp;
+	/**

"/**" is used to indicate kernel-doc notation in the Linux kernel source files, but this comment is not kernel-doc notation, so please just use "/*".

Okay

Quoted 10 lines

drivers/thermal/k3_bandgap.c line 142

Quoted 9 lines
drivers/thermal/k3_bandgap.c new file +8 -0
+	 * Errata is applicable for am654 pg 1.0 silicon. There
+	 * is a variation of the order for 8-10 degree centigrade.
+	 * Work around that by getting the average of two closest
+	 * readings out of three readings everytime we want to
+	 * report temperatures.
+	 *
+	 * Errata workaround.
+	 */

thanks.

Thanks for the review.

- Keerthy

Quoted 1 line

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

author
#9 lore raw

PATCH v3 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

---
 .../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
#10 lore raw

PATCH v3 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