Skip to contentSkip to conversation

dt-bindings: mfd: max77620: Convert to json-schema

PATCH In review Thierry Reding 4 participants 4 messages Jun 9, 2020 – Jul 7, 2020

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

PATCH 1/1 dt-bindings: mfd: max77620: Convert to json-schema

From: Thierry Reding <[email protected]>

Convert the Maxim MAX77620 PMIC device tree bindings from free-form text format to json-schema.

This also pulls in the GPIO, regulator, pinmux and thermal bindings for the corresponding subdevices into the top-level binding so that it can be described more consistently.

---
 .../bindings/gpio/gpio-max77620.txt           |  25 -
 .../devicetree/bindings/mfd/max77620.txt      | 162 -----
 .../devicetree/bindings/mfd/max77620.yaml     | 662 ++++++++++++++++++
 .../bindings/pinctrl/pinctrl-max77620.txt     | 127 ----
 .../bindings/regulator/regulator-max77620.txt | 222 ------
 .../bindings/thermal/max77620_thermal.txt     |  70 --
 6 files changed, 662 insertions(+), 606 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/gpio/gpio-max77620.txt
 delete mode 100644 Documentation/devicetree/bindings/mfd/max77620.txt
 create mode 100644 Documentation/devicetree/bindings/mfd/max77620.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/pinctrl-max77620.txt
 delete mode 100644 Documentation/devicetree/bindings/regulator/regulator-max77620.txt
 delete mode 100644 Documentation/devicetree/bindings/thermal/max77620_thermal.txt
Documentation/devicetree/bindings/gpio/gpio-max77620.txt deleted +0 -25
deleted file mode 100644
index 410e716fd3d2..000000000000
@@ -1,25 +0,0 @@
-GPIO driver for MAX77620 Power management IC from Maxim Semiconductor.
-
-Device has 8 GPIO pins which can be configured as GPIO as well as the
-special IO functions.
-
-Required properties:
--------------------
-- gpio-controller : 	Marks the device node as a gpio controller.
-- #gpio-cells : 	Should be two.  The first cell is the pin number and
-			the second cell is used to specify the gpio polarity:
-				0 = active high
-				1 = active low
-For more details, please refer generic GPIO DT binding document
-<devicetree/bindings/gpio/gpio.txt>.
-
-Example:
---------
-#include <dt-bindings/mfd/max77620.h>
-...
-max77620@3c {
-	compatible = "maxim,max77620";
-
-	gpio-controller;
-	#gpio-cells = <2>;
-};
Documentation/devicetree/bindings/mfd/max77620.txt deleted +0 -162

162 lines not on this page · raw message

Documentation/devicetree/bindings/mfd/max77620.yaml new file +662 -0

662 lines not on this page · raw message

Documentation/devicetree/bindings/pinctrl/pinctrl-max77620.txt deleted +0 -127

127 lines not on this page · raw message

Documentation/devicetree/bindings/regulator/regulator-max77620.txt deleted +0 -222

222 lines not on this page · raw message

Documentation/devicetree/bindings/thermal/max77620_thermal.txt deleted +0 -70

70 lines not on this page · raw message

Signature · 1 line
2.24.1
#2 lore raw
In reply to Thierry Reding
Quoted 10 lines · Thierry Reding

From: Thierry Reding <[email protected]>

Convert the Maxim MAX77620 PMIC device tree bindings from free-form text format to json-schema.

This also pulls in the GPIO, regulator, pinmux and thermal bindings for the corresponding subdevices into the top-level binding so that it can be described more consistently.

Quoted 14 lines
---
 .../bindings/gpio/gpio-max77620.txt           |  25 -
 .../devicetree/bindings/mfd/max77620.txt      | 162 -----
 .../devicetree/bindings/mfd/max77620.yaml     | 662 ++++++++++++++++++
 .../bindings/pinctrl/pinctrl-max77620.txt     | 127 ----
 .../bindings/regulator/regulator-max77620.txt | 222 ------
 .../bindings/thermal/max77620_thermal.txt     |  70 --
 6 files changed, 662 insertions(+), 606 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/gpio/gpio-max77620.txt
 delete mode 100644 Documentation/devicetree/bindings/mfd/max77620.txt
 create mode 100644 Documentation/devicetree/bindings/mfd/max77620.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/pinctrl-max77620.txt
 delete mode 100644 Documentation/devicetree/bindings/regulator/regulator-max77620.txt
 delete mode 100644 Documentation/devicetree/bindings/thermal/max77620_thermal.txt

Wow, what a beast. I can see why Rob is putting this one off!

Changes look okay to me, but Rob and Linus should review.

Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
#3 lore raw
In reply to Thierry Reding

Hi Thierry,

thanks for doing this!

Quoted 6 lines · Thierry Reding
 delete mode 100644 Documentation/devicetree/bindings/gpio/gpio-max77620.txt
 delete mode 100644 Documentation/devicetree/bindings/mfd/max77620.txt
 create mode 100644 Documentation/devicetree/bindings/mfd/max77620.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/pinctrl-max77620.txt
 delete mode 100644 Documentation/devicetree/bindings/regulator/regulator-max77620.txt
 delete mode 100644 Documentation/devicetree/bindings/thermal/max77620_thermal.txt

So everything goes in under the MFD node now I suppose (why not).

Quoted 1 line
Documentation/devicetree/bindings/mfd/max77620.yaml +0 -0

(...)

Documentation/devicetree/bindings/mfd/max77620.yaml line 314

Quoted 12 lines
Documentation/devicetree/bindings/mfd/max77620.yaml +12 -0
+patternProperties:
+  "^gpio(@[0-9]+)?$":
+    type: object
+    properties:
+      gpio-hog:
+        $ref: "/schemas/types.yaml#/definitions/flag"
+
+      output-high:
+        $ref: "/schemas/types.yaml#/definitions/flag"
+
+      gpios:
+        $ref: "/schemas/types.yaml#/definitions/uint32-matrix"

This looks strange. ^gpio(@[0-9]+)?$ seems like the node for the gpio-controller per se, and that should have a subnode for the hog, but this makes it look like that hog is directly in the gpio controller node.

The current gpio.txt lists this example:

        qe_pio_a: gpio-controller@1400 {
                compatible = "fsl,qe-pario-bank-a", "fsl,qe-pario-bank";
                reg = <0x1400 0x18>;
                gpio-controller;
                #gpio-cells = <2>;

                line_b {
                        gpio-hog;
                        gpios = <6 0>;
                        output-low;
                        line-name = "foo-bar-gpio";
                };
        };

I know I should make a generic gpio.yaml include you can just use for all of this but you know ... time. (Volunteers welcome!)

Quoted 28 lines
Documentation/devicetree/bindings/mfd/max77620.yaml +28 -0
+  "^pinmux(@[0-9]+)?$":
+    type: object
+    patternProperties:
+      "^gpio[0-7_]+$":
+        type: object
+        properties:
+          pins:
+            items:
+              pattern: "^gpio[0-7]$"
+            minItems: 1
+            maxItems: 8
+
+          function:
+            $ref: "/schemas/types.yaml#/definitions/string"
+            enum:
+              - gpio
+              - lpm-control-in
+              - fps-out
+              - 32k-out1
+              - sd0-dvs-in
+              - sd1-dvs-in
+              - reference-out
+
+          drive-push-pull:
+            $ref: "/schemas/types.yaml#/definitions/uint32"
+            enum: [ 0, 1 ]
+
+          drive-open-drain:

Documentation/devicetree/bindings/mfd/max77620.yaml line 353

Quoted 10 lines
Documentation/devicetree/bindings/mfd/max77620.yaml +10 -0
+            $ref: "/schemas/types.yaml#/definitions/uint32"
+            enum: [ 0, 1 ]
+
+          bias-pull-up:
+            $ref: "/schemas/types.yaml#/definitions/uint32"
+            enum: [ 0, 1 ]
+
+          bias-pull-down:
+            $ref: "/schemas/types.yaml#/definitions/uint32"
+            enum: [ 0, 1 ]

This seems to reinvent large parts of Rob's already provided:
Documentation/devicetree/bindings/pinctrl/pinmux-node.yaml Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml

So just $ref-include these instead. See other bindings for examples. Since this is placed in mfd you might need some ../pinctrl... path.

Yours,
Linus Walleij