Skip to contentSkip to conversation

thermal: k3_j72xx_bandgap: Add the bandgap driver support

PATCH Superseded Keerthy 3 participants 5 messages May 11, 2022 – May 16, 2022

Subsystems (2)

v7 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Keerthy

author
#0 lore raw

v7 cover thermal: k3_j72xx_bandgap: Add the bandgap driver support

Add VTM thermal support. In the Voltage Thermal Management Module(VTM), K3 J72XX 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.

Currently reading temperatures only is supported. There are no active/passive cooling agent supported.

J721e SoCs have errata i2128: https://www.ti.com/lit/pdf/sprz455

The series also incorporates workaround for Errata i2128.

Changes in v7:

* Separated the DT patches from this series.
* Fixed description of reg property in the DT documentation patch.

Changes in v6:

* Fixed the DT comments that were missed in v5.
* Changed the offsets, bit masks to 2-D array.
* Clean up

Changes in v5:

* Simplified the computation of the table.
* Removed unnecessary members in the structures.

Changes in v4:

* Fixed compilation warning with W=1.

Changes in v3:

* Removed static look up tables & added functions to dynamically generate them.

Changes in v2:

* Fixed DT binding errors.

Keerthy (2):
dt-bindings: thermal: k3-j72xx: Add VTM bindings documentation
thermal: k3_j72xx_bandgap: Add the bandgap driver support

 .../bindings/thermal/ti,j72xx-thermal.yaml    |  64 ++
 drivers/thermal/Makefile                      |   2 +-
 drivers/thermal/k3_j72xx_bandgap.c            | 566 ++++++++++++++++++
 3 files changed, 631 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/thermal/ti,j72xx-thermal.yaml
 create mode 100644 drivers/thermal/k3_j72xx_bandgap.c
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH v7 1/2 dt-bindings: thermal: k3-j72xx: Add VTM bindings documentation

Add VTM bindings documentation. In the Voltage Thermal Management Module(VTM), K3 J72XX 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.

---
 .../bindings/thermal/ti,j72xx-thermal.yaml    | 64 +++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/thermal/ti,j72xx-thermal.yaml
Documentation/devicetree/bindings/thermal/ti,j72xx-thermal.yaml new file +64 -0
new file mode 100644
index 000000000000..83f8f444a133
@@ -0,0 +1,64 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/thermal/ti,j72xx-thermal.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Texas Instruments J72XX VTM (DTS) binding
+
+maintainers:
+  - Keerthy <[email protected]>
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - ti,j721e-vtm
+          - ti,j7200-vtm
+
+  reg:
+    items:
+      - description: VTM cfg1 register space
+      - description: VTM cfg2 register space
+      - description: VTM efuse register space
+
+  power-domains:
+    maxItems: 1
+
+  "#thermal-sensor-cells":
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - power-domains
+  - "#thermal-sensor-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/soc/ti,sci_pm_domain.h>
+    wkup_vtm0: thermal-sensor@42040000 {
+        compatible = "ti,j721e-vtm";
+        reg = <0x42040000 0x350>,
+            <0x42050000 0x350>,
+            <0x43000300 0x10>;
+        power-domains = <&k3_pds 154 TI_SCI_PD_EXCLUSIVE>;
+        #thermal-sensor-cells = <1>;
+    };
+
+    mpu_thermal: mpu-thermal {
+        polling-delay-passive = <250>; /* milliseconds */
+        polling-delay = <500>; /* milliseconds */
+        thermal-sensors = <&wkup_vtm0 0>;
+
+        trips {
+                mpu_crit: mpu-crit {
+                        temperature = <125000>; /* milliCelsius */
+                        hysteresis = <2000>; /* milliCelsius */
+                        type = "critical";
+                };
+        };
+    };
+...
Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH v7 1/2] dt-bindings: thermal: k3-j72xx: Add VTM bindings documentation

Cc'ing [email protected]

Quoted 85 lines · Keerthy

Add VTM bindings documentation. In the Voltage Thermal Management Module(VTM), K3 J72XX 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.

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

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

Documentation/devicetree/bindings/thermal/ti,j72xx-thermal.yaml new file +64 -0
new file mode 100644
index 000000000000..83f8f444a133
@@ -0,0 +1,64 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/thermal/ti,j72xx-thermal.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Texas Instruments J72XX VTM (DTS) binding
+
+maintainers:
+  - Keerthy <[email protected]>
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - ti,j721e-vtm
+          - ti,j7200-vtm
+
+  reg:
+    items:
+      - description: VTM cfg1 register space
+      - description: VTM cfg2 register space
+      - description: VTM efuse register space
+
+  power-domains:
+    maxItems: 1
+
+  "#thermal-sensor-cells":
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - power-domains
+  - "#thermal-sensor-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/soc/ti,sci_pm_domain.h>
+    wkup_vtm0: thermal-sensor@42040000 {
+        compatible = "ti,j721e-vtm";
+        reg = <0x42040000 0x350>,
+            <0x42050000 0x350>,
+            <0x43000300 0x10>;
+        power-domains = <&k3_pds 154 TI_SCI_PD_EXCLUSIVE>;
+        #thermal-sensor-cells = <1>;
+    };
+
+    mpu_thermal: mpu-thermal {
+        polling-delay-passive = <250>; /* milliseconds */
+        polling-delay = <500>; /* milliseconds */
+        thermal-sensors = <&wkup_vtm0 0>;
+
+        trips {
+                mpu_crit: mpu-crit {
+                        temperature = <125000>; /* milliCelsius */
+                        hysteresis = <2000>; /* milliCelsius */
+                        type = "critical";
+                };
+        };
+    };
+...
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#3 lore raw

Re: [PATCH v7 1/2] dt-bindings: thermal: k3-j72xx: Add VTM bindings documentation

Quoted 2 lines · Daniel Lezcano

Cc'ing [email protected]

Eh, I wished people used automatically scripts/get_maintainers.pl, so there will be no need to Cc someone. It's actually a bit weird because I was reviewing v6...

Quoted 11 lines · Keerthy
Quoted 9 lines

Add VTM bindings documentation. In the Voltage Thermal Management Module(VTM), K3 J72XX 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 1 line
Quoted 1 line

In any case this misses all the review-tags, so I don't know what we are supposed to do here.

Keerthy,
Please add Acked-by/Reviewed-by tags when posting new versions. However, there's no need to repost patches *only* to add the tags. The upstream maintainer will do that for acks received on the version they apply.

https://elixir.bootlin.com/linux/v5.13/source/Documentation/process/submitting-patches.rst#L543

If a tag was not added on purpose, please state why and what changed.

Quoted 20 lines
Quoted 20 lines
---
  .../bindings/thermal/ti,j72xx-thermal.yaml    | 64 +++++++++++++++++++
  1 file changed, 64 insertions(+)

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

Documentation/devicetree/bindings/thermal/ti,j72xx-thermal.yaml new file +9 -0
new file mode 100644
index 000000000000..83f8f444a133
@@ -0,0 +1,64 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/thermal/ti,j72xx-thermal.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Texas Instruments J72XX VTM (DTS) binding
+
+maintainers:
Quoted 8 lines

Documentation/devicetree/bindings/thermal/ti,j72xx-thermal.yaml line 17

Quoted 8 lines
Documentation/devicetree/bindings/thermal/ti,j72xx-thermal.yaml new file +8 -0
+  - Keerthy <[email protected]>
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - ti,j721e-vtm
+          - ti,j7200-vtm

No items, you have only one item.

Best regards,
Krzysztof

author
#4 lore raw

PATCH v7 2/2 thermal: k3_j72xx_bandgap: Add the bandgap driver support

In reply to Keerthy

Add VTM thermal support. In the Voltage Thermal Management Module(VTM), K3 J72XX 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.

Currently reading temperatures only is supported. There are no active/passive cooling agent supported.

J721e SoCs have errata i2128: https://www.ti.com/lit/pdf/sprz455

The VTM Temperature Monitors (TEMPSENSORs) are trimmed during production, with the resulting values stored in software-readable registers. Software should use these register values when translating the Temperature Monitor output codes to temperature values.

It has an involved workaround. Software needs to read the error codes for -40C, 30C, 125C from the efuse for each device & derive a new look up table for adc to temperature conversion. Involved calculating slopes & constants using 3 different straight line equations with adc refernce codes as the y-axis & error codes in the x-axis.

-40C to 30C
30C to 125C
125C to 150C

With the above 2 line equations we derive the full look-up table to workaround the errata i2128 for j721e SoC.

Tested temperature reading on J721e SoC & J7200 SoC.

[[email protected]: Generate look-up tables run-time]
---
 drivers/thermal/Makefile           |   2 +-
 drivers/thermal/k3_j72xx_bandgap.c | 566 +++++++++++++++++++++++++++++
 2 files changed, 567 insertions(+), 1 deletion(-)
 create mode 100644 drivers/thermal/k3_j72xx_bandgap.c
drivers/thermal/Makefile +1 -1
index f0c36a1530d5..def8e1a0399c 100644
@@ -28,7 +28,7 @@ thermal_sys-$(CONFIG_CPU_IDLE_THERMAL)	+= cpuidle_cooling.o
 # devfreq cooling
 thermal_sys-$(CONFIG_DEVFREQ_THERMAL) += devfreq_cooling.o
 
-obj-$(CONFIG_K3_THERMAL)	+= k3_bandgap.o
+obj-$(CONFIG_K3_THERMAL)	+= k3_bandgap.o k3_j72xx_bandgap.o
 # platform thermal drivers
 obj-y				+= broadcom/
 obj-$(CONFIG_THERMAL_MMIO)		+= thermal_mmio.o
drivers/thermal/k3_j72xx_bandgap.c new file +566 -0

566 lines not on this page · raw message

Signature · 1 line
2.17.1