Re: [PATCH v3] dt-bindings: gpio: add common consumer GPIO lines

From: Rob Herring
Date: Fri Apr 01 2022 - 11:45:04 EST


On Fri, Apr 1, 2022 at 8:27 AM Krzysztof Kozlowski
<krzysztof.kozlowski@xxxxxxxxxx> wrote:
>
> On 01/04/2022 15:13, Rob Herring wrote:
> > On Fri, 01 Apr 2022 09:27:14 +0200, Krzysztof Kozlowski wrote:
> >> Typical GPIO lines like enable, powerdown, reset or wakeup are not
> >> documented as common, which leads to new variations of these (e.g.
> >> pwdn-gpios). Add a common schema which serves also as a documentation
> >> for preferred naming.
> >>
> >> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
> >>
> >> ---
> >>
> >> Changes since v2:
> >> 1. Correct email.
> >>
> >> Changes since v1:
> >> 1. Select-true, add maxItems and description for each entry (Rob).
> >> 2. Mention ACTIVE_LOW in bindings description (Linus).
> >> 3. Add allOf for pwrseq reset-gpios case.
> >>
> >> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
> >> ---
> >> .../bindings/gpio/gpio-consumer-common.yaml | 64 +++++++++++++++++++
> >> 1 file changed, 64 insertions(+)
> >> create mode 100644 Documentation/devicetree/bindings/gpio/gpio-consumer-common.yaml
> >>
> >
> > My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> > on your patch (DT_CHECKER_FLAGS is new in v5.13):
> >
> > yamllint warnings/errors:
> >
> > dtschema/dtc warnings/errors:
> > /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/regulator/richtek,rt4801-regulator.example.dt.yaml: rt4801@73: enable-gpios: [[4294967295, 2, 0], [4294967295, 3, 0]] is too long
> > From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/gpio/gpio-consumer-common.yaml
> >
>
> Hi Rob,
>
> With v1, you proposed to use maxItems for all these standard gpios, but
> as we see here there are two exceptions:
> 1. pwrseq might have up to 32 reset-gpios,
> 2. richtek,rt4801 uses up to 2 enable-gpios.

There's always an outlier...

> One way is to add exceptions in gpio-consumer-common.yaml, like I did
> for reset-gpios and pwrseq. However this scales poor if more of such
> usages appear.

I'd reject any new cases, but even just 2 I don't really like.

> Maybe let's drop the maxItems for all of them?

Let's just drop it at least for now (though it seems we can keep it
for powerdown-gpios).

A possible solution here may be adding 'maxItems: 1' automatically to
schemas if not specified. I've been thinking of doing this on standard
unit properties. That's another case of
99% of cases are a single entry with a few outliers.

Rob