Skip to contentSkip to conversation

dt-bindings: thermal: mediatek: Move auxdac binding to yaml

PATCH In review [email protected] 3 participants 5 messages Jun 1, 2023 – Jun 5, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 dt-bindings: thermal: mediatek: Move auxdac binding to yaml

From: Matthias Brugger <[email protected]>

Convert the older binding to yaml syntax.
The thermal IP has several sensors, to reflect that thermal-sensors-cells is set to '1'. Apart optional regulator for bank supply wasn't part of the old binding description, this patch adds them.

---

Changes in v2:
- drop auxadc and apmixedsys nodes
- maxItems for clocks
- drop obvious description of reset
- mention optional regulators in commit message
- mention thermal-sensors-cells change in commit message

 .../bindings/thermal/mediatek,thermal.yaml    | 152 ++++++++++++++++++
 .../bindings/thermal/mediatek-thermal.txt     |  52 ------
 2 files changed, 152 insertions(+), 52 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/thermal/mediatek,thermal.yaml
 delete mode 100644 Documentation/devicetree/bindings/thermal/mediatek-thermal.txt
Documentation/devicetree/bindings/thermal/mediatek,thermal.yaml new file +152 -0
new file mode 100644
index 000000000000..bbc9c2935da0
@@ -0,0 +1,152 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/thermal/mediatek,thermal.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek Thermal Sensor
+
+maintainers:
+  - Matthias Brugger <[email protected]>
+
+description: |
+  The MediaTek thermal controller measures the on-SoC temperatures.
+  This device does not have its own ADC, instead it directly controls
+  the AUXADC via AHB bus accesses. For this reason this device needs
+  phandles to the AUXADC. Also it controls a mux in the apmixedsys
+  register space via AHB bus accesses, so a phandle to the APMIXEDSYS
+  is also needed.
+
+properties:
+  compatible:
+    oneOf:
+      - enum:
+          - mediatek,mt2701-thermal
+          - mediatek,mt2712-thermal
+          - mediatek,mt7622-thermal
+          - mediatek,mt7986-thermal
+          - mediatek,mt8173-thermal
+          - mediatek,mt8183-thermal
+          - mediatek,mt8365-thermal
+      - items:
+          - const: mediatek,mt7981-thermal
+          - const: mediatek,mt7986-thermal
+      - items:
+          - const: mediatek,mt8516-thermal
+          - const: mediatek,mt2701-thermal
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 2
+
+  clock-names:
+    items:
+      - const: therm
+      - const: auxadc
+
+  resets:
+    maxItems: 1
+
+  reset-names:
+    items:
+      - const: therm
+
+  nvmem-cells:
+    items:
+      - description: Calibration eFuse data. If unspecified default values are used.
+
+  nvmem-cell-names:
+    items:
+      - const: calibration-data
+
+  mediatek,auxadc:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      A phandle to the AUXADC which the thermal controller uses.
+
+  mediatek,apmixedsys:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      A phandle to the APMIXEDSYS controller.
+
+  "#thermal-sensor-cells":
+    const: 1
+
+  bank0-supply:
+    description: Regulator supplying voltage to the first bank
+
+  bank1-supply:
+    description: Regulator supplying voltage to the second bank
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - mediatek,auxadc
+  - mediatek,apmixedsys
+  - "#thermal-sensor-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/clock/mt8173-clk.h>
+    #include <dt-bindings/reset/mt8173-resets.h>
+
+    soc {
+      #address-cells = <2>;
+      #size-cells = <2>;
+
+      thermal: thermal@1100b000 {
+        #thermal-sensor-cells = <1>;
+        compatible = "mediatek,mt8173-thermal";
+        reg = <0 0x1100b000 0 0x1000>;
+        interrupts = <0 70 IRQ_TYPE_LEVEL_LOW>;
+        clocks = <&pericfg CLK_PERI_THERM>, <&pericfg CLK_PERI_AUXADC>;
+        clock-names = "therm", "auxadc";
+        resets = <&pericfg MT8173_PERI_THERM_SW_RST>;
+        reset-names = "therm";
+        mediatek,auxadc = <&auxadc>;
+        mediatek,apmixedsys = <&apmixedsys>;
+        nvmem-cells = <&thermal_calibration_data>;
+        nvmem-cell-names = "calibration-data";
+      };
+
+      thermal-zones {
+        cpu_thermal: cpu-thermal {
+          polling-delay-passive = <1000>;
+          polling-delay = <1000>;
+
+          thermal-sensors = <&thermal 0>;
+          sustainable-power = <1500>;
+
+          trips {
+            threshold: trip-point0 {
+              temperature = <68000>;
+              hysteresis = <2000>;
+              type = "passive";
+            };
+
+            target: trip-point1 {
+              temperature = <85000>;
+              hysteresis = <2000>;
+              type = "passive";
+            };
+
+            cpu_crit: cpu-crit0 {
+              temperature = <115000>;
+              hysteresis = <2000>;
+              type = "critical";
+            };
+          };
+        };
+      };
+    };
+...
Documentation/devicetree/bindings/thermal/mediatek-thermal.txt deleted +0 -52

52 lines not on this page · raw message

Signature · 1 line
2.40.1
#1 lore raw

PATCH v2 2/2 arm64: dts: mt8173: Update thermal node

From: Matthias Brugger <[email protected]>

Following the binding description, update to use thermal-sensor-cells = 1
While at it also fix the node name of the CPU critical trip point.

---

Changes in v2:
- fix node name of CPU critical trip point

 arch/arm64/boot/dts/mediatek/mt8173.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/mediatek/mt8173.dtsi +3 -3
index c47d7d900f28..d760776e3daf 100644
@@ -270,7 +270,7 @@ cpu_thermal: cpu-thermal {
 			polling-delay-passive = <1000>; /* milliseconds */
 			polling-delay = <1000>; /* milliseconds */
 
-			thermal-sensors = <&thermal>;
+			thermal-sensors = <&thermal 0>;
 			sustainable-power = <1500>; /* milliwatts */
 
 			trips {
@@ -286,7 +286,7 @@ target: trip-point1 {
 					type = "passive";
 				};
 
-				cpu_crit: cpu_crit0 {
+				cpu_crit: cpu-crit0 {
 					temperature = <115000>;
 					hysteresis = <2000>;
 					type = "critical";
@@ -766,7 +766,7 @@ spi: spi@1100a000 {
 		};
 
 		thermal: thermal@1100b000 {
-			#thermal-sensor-cells = <0>;
+			#thermal-sensor-cells = <1>;
 			compatible = "mediatek,mt8173-thermal";
 			reg = <0 0x1100b000 0 0x1000>;
 			interrupts = <0 70 IRQ_TYPE_LEVEL_LOW>;
Signature · 1 line
2.40.1
maintainer Reviewed-by on v2 2/2
#2 lore raw

Re: [PATCH v2 2/2] arm64: dts: mt8173: Update thermal node

Il 01/06/23 15:44, [email protected] ha scritto:

Quoted 8 lines

From: Matthias Brugger <[email protected]>

Following the binding description, update to use thermal-sensor-cells = 1
While at it also fix the node name of the CPU critical trip point.

#3 lore raw
In reply to [email protected]
Quoted 33 lines · On Thu, Jun 01, 2023 at 03:44:24PM +0200, [email protected] wrote:

From: Matthias Brugger <[email protected]>

Convert the older binding to yaml syntax.
The thermal IP has several sensors, to reflect that thermal-sensors-cells is set to '1'. Apart optional regulator for bank supply wasn't part of the old binding description, this patch adds them.

---

Changes in v2:
- drop auxadc and apmixedsys nodes
- maxItems for clocks
- drop obvious description of reset
- mention optional regulators in commit message
- mention thermal-sensors-cells change in commit message

 .../bindings/thermal/mediatek,thermal.yaml    | 152 ++++++++++++++++++
 .../bindings/thermal/mediatek-thermal.txt     |  52 ------
 2 files changed, 152 insertions(+), 52 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/thermal/mediatek,thermal.yaml
 delete mode 100644 Documentation/devicetree/bindings/thermal/mediatek-thermal.txt
Documentation/devicetree/bindings/thermal/mediatek,thermal.yaml new file +2 -0
new file mode 100644
index 000000000000..bbc9c2935da0
@@ -0,0 +1,152 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2

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

Quoted 10 lines
Documentation/devicetree/bindings/thermal/mediatek,thermal.yaml new file +10 -0
+---
+$id: http://devicetree.org/schemas/thermal/mediatek,thermal.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek Thermal Sensor
+
+maintainers:
+  - Matthias Brugger <[email protected]>
+
+description: |
                ^

You don't need this btw, unless you have formatting to preserve.

Quoted 4 lines
Documentation/devicetree/bindings/thermal/mediatek,thermal.yaml new file +4 -0
+  The MediaTek thermal controller measures the on-SoC temperatures.
+  This device does not have its own ADC, instead it directly controls
+  the AUXADC via AHB bus accesses. For this reason this device needs
+  phandles to the AUXADC. Also it controls a mux in the apmixedsys

Documentation/devicetree/bindings/thermal/mediatek,thermal.yaml line 65

Quoted 10 lines
Documentation/devicetree/bindings/thermal/mediatek,thermal.yaml new file +8 -0
+  register space via AHB bus accesses, so a phandle to the APMIXEDSYS
+  is also needed.
 
+  reset-names:
+    items:
+      - const: therm
 
+  nvmem-cell-names:
+    items:
+      - const: calibration-data

You don't need the "items: - const:", "const:" alone is sufficient.

Documentation/devicetree/bindings/thermal/mediatek,thermal.yaml

Quoted 5 lines
Documentation/devicetree/bindings/thermal/mediatek,thermal.yaml new file +5 -0
+
+  mediatek,auxadc:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      A phandle to the AUXADC which the thermal controller uses...

...to read the on-SoC temperatures as it does not have its own ADC.

Moving the information out of the description down here seems like it would be better than what the original text binding does. Sorry for not point that out last time around.

Documentation/devicetree/bindings/thermal/mediatek,thermal.yaml

Quoted 5 lines
Documentation/devicetree/bindings/thermal/mediatek,thermal.yaml new file +5 -0
+
+  mediatek,apmixedsys:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      A phandle to the APMIXEDSYS controller...

Ideally the information about the purpose of the mux would go here, but I don't know the purpose of it :)

Documentation/devicetree/bindings/thermal/mediatek,thermal.yaml line 81

Quoted 5 lines
Documentation/devicetree/bindings/thermal/mediatek,thermal.yaml new file +5 -0
+  "#thermal-sensor-cells":
+    const: 1
+
+  bank0-supply:
+    description: Regulator supplying voltage to the first bank

Since I am an eejit, first bank of what? Sensors?

Otherwise, LGTM.

Cheers,
Conor.

maintainer Reviewed-by on v2 1/2
#4 lore raw
In reply to [email protected]

Il 01/06/23 15:44, [email protected] ha scritto:

Quoted 9 lines

From: Matthias Brugger <[email protected]>

Convert the older binding to yaml syntax.
The thermal IP has several sensors, to reflect that thermal-sensors-cells is set to '1'. Apart optional regulator for bank supply wasn't part of the old binding description, this patch adds them.