Re: [PATCH] dt-bindings: mfd: max77620: Convert to json-schema

Linus Walleij
2020-07-07T11:28:58Z

Hi Thierry,

thanks for doing this!

On Tue, Jun 9, 2020 at 6:26 PM Thierry Reding <thierry.reding@gmail.com> wrote:

> 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).

> diff --git a/Documentation/devicetree/bindings/mfd/max77620.yaml b/Documentation/devicetree/bindings/mfd/max77620.yaml
(...)
> +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!)

> + "^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:
> + $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