Skip to contentSkip to conversation

dt-bindings: mfd: twl: Convert trivial subdevices to json-schema

PATCH In review Andreas Kemnade 2 participants 2 messages Mar 18, 2024

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

PATCH 1/1 dt-bindings: mfd: twl: Convert trivial subdevices to json-schema

Convert subdevices with just an interrupt and compatbile to json-schema and wire up already converted subdevices. RTC is available in all variants, so allow it unconditionally GPADC binding for TWL603X uses two different compatibles, so specify just the compatible and not include it.

---
Well, my name is in that yaml file, so I should take care of my sheep, in case a step-by-step approach is acceptable this is at least a checkpoint for me that I understand multi file binding mechanics properly.

 .../bindings/input/twl4030-pwrbutton.txt      | 21 ------
 .../devicetree/bindings/mfd/ti,twl.yaml       | 68 +++++++++++++++++++
 .../devicetree/bindings/rtc/twl-rtc.txt       | 11 ---
 .../bindings/watchdog/twl4030-wdt.txt         | 10 ---
 4 files changed, 68 insertions(+), 42 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
 delete mode 100644 Documentation/devicetree/bindings/rtc/twl-rtc.txt
 delete mode 100644 Documentation/devicetree/bindings/watchdog/twl4030-wdt.txt
Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt deleted +0 -21
deleted file mode 100644
index 6c201a2ba8acf..0000000000000
@@ -1,21 +0,0 @@
-Texas Instruments TWL family (twl4030) pwrbutton module
-
-This module is part of the TWL4030. For more details about the whole
-chip see Documentation/devicetree/bindings/mfd/ti,twl.yaml.
-
-This module provides a simple power button event via an Interrupt.
-
-Required properties:
-- compatible: should be one of the following
-   - "ti,twl4030-pwrbutton": For controllers compatible with twl4030
-- interrupts: should be one of the following
-   - <8>: For controllers compatible with twl4030
-
-Example:
-
-&twl {
-	twl_pwrbutton: pwrbutton {
-		compatible = "ti,twl4030-pwrbutton";
-		interrupts = <8>;
-	};
-};
Documentation/devicetree/bindings/mfd/ti,twl.yaml +68 -0

80 lines not on this page · raw message

Documentation/devicetree/bindings/rtc/twl-rtc.txt deleted +0 -11
deleted file mode 100644
index 8f9a94f2f8969..0000000000000
@@ -1,11 +0,0 @@
-* Texas Instruments TWL4030/6030 RTC
-
-Required properties:
-- compatible : Should be "ti,twl4030-rtc"
-- interrupts : Should be the interrupt number.
-
-Example:
-	rtc {
-		compatible = "ti,twl4030-rtc";
-		interrupts = <11>;
-	};
Documentation/devicetree/bindings/watchdog/twl4030-wdt.txt deleted +0 -10
deleted file mode 100644
index 80a37193c0b86..0000000000000
@@ -1,10 +0,0 @@
-Device tree bindings for twl4030-wdt driver (TWL4030 watchdog)
-
-Required properties:
-	compatible = "ti,twl4030-wdt";
-
-Example:
-
-watchdog {
-	compatible = "ti,twl4030-wdt";
-};
Signature · 1 line
2.39.2
maintainer
#1 lore raw
Quoted 58 lines · Andreas Kemnade

Convert subdevices with just an interrupt and compatbile to json-schema and wire up already converted subdevices. RTC is available in all variants, so allow it unconditionally GPADC binding for TWL603X uses two different compatibles, so specify just the compatible and not include it.

---
Well, my name is in that yaml file, so I should take care of my sheep, in case a step-by-step approach is acceptable this is at least a checkpoint for me that I understand multi file binding mechanics properly.

 .../bindings/input/twl4030-pwrbutton.txt      | 21 ------
 .../devicetree/bindings/mfd/ti,twl.yaml       | 68 +++++++++++++++++++
 .../devicetree/bindings/rtc/twl-rtc.txt       | 11 ---
 .../bindings/watchdog/twl4030-wdt.txt         | 10 ---
 4 files changed, 68 insertions(+), 42 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
 delete mode 100644 Documentation/devicetree/bindings/rtc/twl-rtc.txt
 delete mode 100644 Documentation/devicetree/bindings/watchdog/twl4030-wdt.txt
Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt deleted +0 -21
deleted file mode 100644
index 6c201a2ba8acf..0000000000000
@@ -1,21 +0,0 @@
-Texas Instruments TWL family (twl4030) pwrbutton module
-
-This module is part of the TWL4030. For more details about the whole
-chip see Documentation/devicetree/bindings/mfd/ti,twl.yaml.
-
-This module provides a simple power button event via an Interrupt.
-
-Required properties:
-- compatible: should be one of the following
-   - "ti,twl4030-pwrbutton": For controllers compatible with twl4030
-- interrupts: should be one of the following
-   - <8>: For controllers compatible with twl4030
-
-Example:
-
-&twl {
-	twl_pwrbutton: pwrbutton {
-		compatible = "ti,twl4030-pwrbutton";
-		interrupts = <8>;
-	};
-};
Documentation/devicetree/bindings/mfd/ti,twl.yaml +1 -0
index 52ed228fb1e7e..03d725d5294db 100644
@@ -15,6 +15,65 @@ description: |
   USB transceiver or Audio amplifier.
   These chips are connected to an i2c bus.
 
+allOf:

Documentation/devicetree/bindings/mfd/ti,twl.yaml description: | · line 28

Quoted 10 lines
Documentation/devicetree/bindings/mfd/ti,twl.yaml +10 -0
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: ti,twl4030
+    then:
+      properties:
+        madc:
+          type: object
+          $ref: ../iio/adc/ti,twl4030-madc.yaml

Use 'absolute' paths: /schemas/iio/...

Documentation/devicetree/bindings/mfd/ti,twl.yaml description: | · line 29

Quoted 1 line
Documentation/devicetree/bindings/mfd/ti,twl.yaml +1 -0
+

Drop blank line

Documentation/devicetree/bindings/mfd/ti,twl.yaml description: | · line 30

Quoted 1 line
Documentation/devicetree/bindings/mfd/ti,twl.yaml +1 -0
+          unevaluatedProperties: false

blank line between DT properties

Documentation/devicetree/bindings/mfd/ti,twl.yaml description: | · line 42

Quoted 12 lines
Documentation/devicetree/bindings/mfd/ti,twl.yaml +12 -0
+        bci:
+          type: object
+          $ref: ../power/supply/twl4030-charger.yaml
+
+          unevaluatedProperties: false
+        pwrbutton:
+          type: object
+          properties:
+            compatible:
+              const: ti,twl4030-pwrbutton
+            interrupts:
+              const: 8

As 'interrupts' is a matrix, this needs to be:

interrupts:
items:
- items:
- const: 8

Documentation/devicetree/bindings/mfd/ti,twl.yaml description: | · line 44

Quoted 2 lines
Documentation/devicetree/bindings/mfd/ti,twl.yaml +2 -0
+
+          additionalProperties: false

In the indented cases, it is preferred to put this before 'properties'.

Quoted 51 lines
Documentation/devicetree/bindings/mfd/ti,twl.yaml +41 -0
+        watchdog:
+          type: object
+          properties:
+            compatible:
+              const: ti,twl4030-wdt
+
+          additionalProperties: false
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: ti,twl6030
+    then:
+      properties:
+        gpadc:
+          type: object
+          properties:
+            compatible:
+              const: ti,twl6030-gpadc
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: ti,twl6032
+    then:
+      properties:
+        gpadc:
+          type: object
+          properties:
+            compatible:
+              const: ti,twl6032-gpadc
+
 properties:
   compatible:
     description:
@@ -42,6 +101,15 @@ properties:
   "#clock-cells":
     const: 1
 
+  rtc:
+    type: object
+    properties:
+      compatible:
+        const: ti,twl4030-rtc
+      interrupts:
+        maxItems: 1
+    additionalProperties: false
+
 additionalProperties: false
 
 required: