mbox series

[0/3] pcf857x: DTS fixes and DT binding to json-schema conversion

Message ID cover.1621583562.git.geert+renesas@glider.be
Headers show
Series pcf857x: DTS fixes and DT binding to json-schema conversion | expand

Message

Geert Uytterhoeven May 21, 2021, 7:54 a.m. UTC
Hi all,

This patch series converts the PCF857x-compatible I/O expanders Device
Tree binding documentation to json-schema, after fixing a few issues in
DTS files.

Thanks for your comments!

Geert Uytterhoeven (3):
  ARM: dts: dra7x-evm: Align GPIO hog names with dt-schema
  ARM: dts: imx: emcon-avari: Fix nxp,pca8574 #gpio-cells
  dt-bindings: gpio: pcf857x: Convert to json-schema

 .../devicetree/bindings/gpio/gpio-pcf857x.txt |  69 ----------
 .../devicetree/bindings/gpio/nxp,pcf8575.yaml | 120 ++++++++++++++++++
 arch/arm/boot/dts/dra7-evm.dts                |   2 +-
 arch/arm/boot/dts/dra71-evm.dts               |   2 +-
 arch/arm/boot/dts/dra72-evm-common.dtsi       |   2 +-
 arch/arm/boot/dts/dra76-evm.dts               |   2 +-
 arch/arm/boot/dts/imx6qdl-emcon-avari.dtsi    |   2 +-
 7 files changed, 125 insertions(+), 74 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/gpio/gpio-pcf857x.txt
 create mode 100644 Documentation/devicetree/bindings/gpio/nxp,pcf8575.yaml

Comments

Geert Uytterhoeven May 21, 2021, 10:23 a.m. UTC | #1
Hi Linus,

On Fri, May 21, 2021 at 12:04 PM Linus Walleij <linus.walleij@linaro.org> wrote:
> On Fri, May 21, 2021 at 9:54 AM Geert Uytterhoeven
> <geert+renesas@glider.be> wrote:
> > Convert the PCF857x-compatible I/O expanders Device Tree binding
> > documentation to json-schema.
> >
> > Document missing compatible values, properties, and gpio hogs.
> >
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>
> (...)
> > Perhaps the "ti,pcf8575" construct should be removed, and the few users
> > fixed instead?
>
> You would rather list it as deprecated I think?
> It is ABI...

All DTS files use the "nxp,pcf8575" fallback, except for
arch/x86/platform/ce4100/falconfalls.dts.
The latter ain't working with Linux, as the Linux driver doesn't
match against "ti,pcf8575"...

> > +  gpio-controller: true
>
> So this is implicitly using the generic schema in
> /dtschema/schemas/gpio/gpio.yaml

if you leave it out:

    Documentation/devicetree/bindings/gpio/nxp,pcf8575.yaml: ignoring,
error in schema: properties
    warning: no schema found in file:
Documentation/devicetree/bindings/gpio/nxp,pcf8575.yaml
    Documentation/devicetree/bindings/gpio/nxp,pcf8575.yaml:
properties: 'gpio-controller' is a dependency of '#gpio-cells'
    from schema $id: http://devicetree.org/meta-schemas/gpios.yaml#

> > +  lines-initial-states:
> > +    $ref: /schemas/types.yaml#/definitions/uint32
> > +    description:
> > +      Bitmask that specifies the initial state of each line.
> > +      When a bit is set to zero, the corresponding line will be initialized to
> > +      the input (pulled-up) state.
> > +      When the  bit is set to one, the line will be initialized to the
> > +      low-level output state.
> > +      If the property is not specified all lines will be initialized to the
> > +      input state.
>
> Is this something we standardized or something that should
> actually be a custom "nxp," property we just missed it?
> (Looks like the latter... oh well, now it is there.)

Too late for an "nxp," prefix.
See the NOTE in drivers/gpio/gpio-pcf857x.c:

        /* NOTE:  these chips have strange "quasi-bidirectional" I/O pins.
         * We can't actually know whether a pin is configured (a) as output
         * and driving the signal low, or (b) as input and reporting a low
         * value ... without knowing the last value written since the chip
         * came out of reset (if any).  We can't read the latched output.
         *
         * In short, the only reliable solution for setting up pin direction
         * is to do it explicitly.  The setup() method can do that, but it
         * may cause transient glitching since it can't know the last value
         * written (some pins may need to be driven low).
         *
         * Using n_latch avoids that trouble.  When left initialized to zero,
         * our software copy of the "latch" then matches the chip's all-ones
         * reset state.  Otherwise it flags pins to be driven low.
         */

> > +patternProperties:
> > +  "^(hog-[0-9]+|.+-hog(-[0-9]+)?)$":
> > +    type: object
>
> But this is already in
> /dtschema/schemas/gpio/gpio-hog.yaml
> for nodename, isn't that where it properly belongs?
>
> I'm however confused here Rob will know what to do.

If we leave this out, something still has to refer to it?
I see no other binding doing that...

Gr{oetje,eeting}s,

                        Geert
Geert Uytterhoeven May 27, 2021, 3:04 p.m. UTC | #2
Hi Rob,

On Fri, May 21, 2021 at 8:24 PM Rob Herring <robh@kernel.org> wrote:
> On Fri, May 21, 2021 at 12:23:47PM +0200, Geert Uytterhoeven wrote:
> > On Fri, May 21, 2021 at 12:04 PM Linus Walleij <linus.walleij@linaro.org> wrote:
> > > On Fri, May 21, 2021 at 9:54 AM Geert Uytterhoeven
> > > <geert+renesas@glider.be> wrote:
> > > > Convert the PCF857x-compatible I/O expanders Device Tree binding
> > > > documentation to json-schema.
> > > >
> > > > Document missing compatible values, properties, and gpio hogs.
> > > >
> > > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > >
> > > (...)
> > > > Perhaps the "ti,pcf8575" construct should be removed, and the few users
> > > > fixed instead?
> > >
> > > You would rather list it as deprecated I think?
> > > It is ABI...
> >
> > All DTS files use the "nxp,pcf8575" fallback, except for
> > arch/x86/platform/ce4100/falconfalls.dts.
> > The latter ain't working with Linux, as the Linux driver doesn't
> > match against "ti,pcf8575"...

Correction: i2c_device_id-based matching ignores the vendor part
of the compatible value.  One day this is gonna bite us...

> Perhaps can it just be removed?

I think so.  All other users of similar I2C GPIO expanders just
use the compatible values of the original NXP parts.

> > > > +patternProperties:
> > > > +  "^(hog-[0-9]+|.+-hog(-[0-9]+)?)$":
> > > > +    type: object
> > >
> > > But this is already in
> > > /dtschema/schemas/gpio/gpio-hog.yaml
> > > for nodename, isn't that where it properly belongs?
> > >
> > > I'm however confused here Rob will know what to do.
>
> This one is a bit odd.
>
> > If we leave this out, something still has to refer to it?
> > I see no other binding doing that...
>
> It's selected by 'gpio-hog' being present, but here you need to make
> sure that's the case.

OK. Fixed.

> And I would hope you could define the node name to be just 1 of the 2
> cases.

Yep, the latter is fine.

Gr{oetje,eeting}s,

                        Geert