All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Horatiu Vultur <horatiu.vultur@microchip.com>
Cc: Peter Rosin <peda@axentia.se>,
	linux-i2c@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/2] dt-bindings: i2c-mux: Add property for settle time
Date: Tue, 2 Nov 2021 13:37:20 -0500	[thread overview]
Message-ID: <YYGFYLtehnDOgA9d@robh.at.kernel.org> (raw)
In-Reply-To: <20211101213201.wdjsuexuuinepu3m@soft-dev3-1.localhost>

On Mon, Nov 01, 2021 at 10:32:01PM +0100, Horatiu Vultur wrote:
> The 11/01/2021 15:32, Peter Rosin wrote:
> 
> Hi Peter,
> 
> > 
> > On 2021-11-01 13:25, Horatiu Vultur wrote:
> > > Some HW requires some time for the signals to settle after the muxing is
> > > changed. Allow this time to be specified in device tree.
> > >
> > > Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> > > ---
> > >  Documentation/devicetree/bindings/i2c/i2c-mux.yaml | 6 ++++++
> > >  1 file changed, 6 insertions(+)
> > >
> > > diff --git a/Documentation/devicetree/bindings/i2c/i2c-mux.yaml b/Documentation/devicetree/bindings/i2c/i2c-mux.yaml
> > > index 24cac36037f5..4628ff6340c1 100644
> > > --- a/Documentation/devicetree/bindings/i2c/i2c-mux.yaml
> > > +++ b/Documentation/devicetree/bindings/i2c/i2c-mux.yaml
> > > @@ -29,6 +29,12 @@ properties:
> > >    '#size-cells':
> > >      const: 0
> > >
> > > +  settle-time-us:
> > > +    default: 0
> > > +    description:
> > > +      The time required for the signals to settle. Currently only the
> > > +      i2c-mux-gpmux driver supports this optional binding.
> > 
> > The information about how i2c-mux-gpmux is special is bound to go stale,
> > and I don't think we should mention such specific details in the binding.
> > What I meant was a generic warnings about optional bindings perhaps not
> > being supported by all drivers, along the lines of this from i2c.txt:
> > 
> > "These properties may not be supported by all drivers. However, if a driver
> >  wants to support one of the below features, it should adapt these bindings."
> > 
> > However, I now notice that this sentence makes no sense. It looks like it
> > should be s/adapt/adopt/.
> > 
> > And, in the i2c-mux.yaml case it can simply say "Optional properties"
> > instead of "These properites" (which refers to a subset of properties
> > immediately below the text) since with a yaml binding it is always
> > clear which properties are optional and which are required. Lastly, I
> > guess this warning belongs in the description.
> > 
> > > +
> > >  patternProperties:
> > >    '^i2c@[0-9a-f]+$':
> > >      $ref: /schemas/i2c/i2c-controller.yaml
> > >
> > 
> > Since this is the first optional property, you now need to specify what
> > properties are required, which is everything but settle-time-us. If you
> > don't, all properties are required. Which is not what we want...
> > 
> > Something like this should do it, I think:
> > 
> > required:
> >   - compatible
> >   - '#address-cells'
> >   - '#size-cells'
> 
> Thanks for a detail explanation but I am still struggling with these
> bindings. Were you thinking to have something like this?
> 
> ---
> diff --git a/Documentation/devicetree/bindings/i2c/i2c-mux.yaml b/Documentation/devicetree/bindings/i2c/i2c-mux.yaml
> index 24cac36037f5..c9fde1bb0fea 100644
> --- a/Documentation/devicetree/bindings/i2c/i2c-mux.yaml
> +++ b/Documentation/devicetree/bindings/i2c/i2c-mux.yaml
> @@ -19,6 +19,9 @@ description: |+
>    populating the i2c child busses.  If an 'i2c-mux' subnode is present, only
>    subnodes of this will be considered as i2c child busses.
> 
> +  Optional properties may not be supported by all drivers. However, if a driver
> +  wants to support one of the below features, it should adopt these bindings.
> +
>  properties:
>    $nodename:
>      pattern: '^(i2c-?)?mux'
> @@ -29,6 +32,11 @@ properties:
>    '#size-cells':
>      const: 0
> 
> +  settle-time-us:
> +    default: 0
> +    description:
> +      The time required for the signals to settle.
> +
>  patternProperties:
>    '^i2c@[0-9a-f]+$':
>      $ref: /schemas/i2c/i2c-controller.yaml
> @@ -41,6 +49,11 @@ patternProperties:
> 
>  additionalProperties: true
> 
> +required:
> +  - compatible

compatible should not be required here.

> +  - '#address-cells'
> +  - '#size-cells'
> +
>  examples:
>    - |
>      /*
> ---
> 
> If I have this then my problem is with the required properties because then I
> start to get new warnings once I run:
> 
> make ARCH=arm CROSS_COMPILE=arm-linux- dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/i2c/i2c-mux.yaml
> 
> For example, one of new the warnings is this:
> 
> /home/hvultur/linux/arch/arm/boot/dts/am335x-icev2.dt.yaml: mux-mii-hog: 'compatible' is a required property
> 	From schema: /home/hvultur/linux/Documentation/devicetree/bindings/i2c/i2c-mux.yaml
> /home/hvultur/linux/arch/arm/boot/dts/am335x-icev2.dt.yaml: mux-mii-hog: '#address-cells' is a required property
> 	From schema: /home/hvultur/linux/Documentation/devicetree/bindings/i2c/i2c-mux.yaml
> /home/hvultur/linux/arch/arm/boot/dts/am335x-icev2.dt.yaml: mux-mii-hog: '#size-cells' is a required property
> 	From schema: /home/hvultur/linux/Documentation/devicetree/bindings/i2c/i2c-mux.yaml

This is because of the $nodename pattern being pretty lax and matches 
on mux-mii-hog by mistake. We have 2 options. Change the nodename 
pattern to '^(i2c-?)?mux(@.*)?$' or add 'select: false'. The former 
would still match on 'mux' or 'mux@.*' which might still have problems. 
For the latter, we just need to make sure all the i2c-mux schemas have a 
$ref to this schema. Also, with that change we'd stop checking 'i2c-mux' 
nodes that don't yet have a specific schema. That said, I do lean toward 
the latter option.

Rob

  reply	other threads:[~2021-11-02 18:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-01 12:25 [PATCH v3 0/2] i2c-mux-gpmux: Support settle-time-us property Horatiu Vultur
2021-11-01 12:25 ` [PATCH v3 1/2] dt-bindings: i2c-mux: Add property for settle time Horatiu Vultur
2021-11-01 14:32   ` Peter Rosin
2021-11-01 21:32     ` Horatiu Vultur
2021-11-02 18:37       ` Rob Herring [this message]
2021-11-02 22:27         ` Horatiu Vultur
2021-11-03 11:44           ` Peter Rosin
2021-11-03 14:13             ` Rob Herring
2021-11-01 12:25 ` [PATCH v3 2/2] i2c-mux-gpmux: Support settle-time-us property Horatiu Vultur

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YYGFYLtehnDOgA9d@robh.at.kernel.org \
    --to=robh@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=horatiu.vultur@microchip.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peda@axentia.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.