From: Conor Dooley <conor@kernel.org>
To: "Vankar, Chintan" <c-vankar@ti.com>
Cc: Andrew Davis <afd@ti.com>, Conor Dooley <conor+dt@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Rob Herring <robh@kernel.org>, Peter Rosin <peda@axentia.se>,
tglx@linutronix.de, gregkh@linuxfoundation.org, vigneshr@ti.com,
nm@ti.com, s-vadapalli@ti.com, danishanwar@ti.com,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [RFC PATCH 1/2] devicetree: bindings: mux: reg-mux: Update bindings for reg-mux for new property
Date: Mon, 3 Mar 2025 16:58:26 +0000 [thread overview]
Message-ID: <20250303-mummify-mutation-67595b7ceba5@spud> (raw)
In-Reply-To: <acde31c5-fe23-4c7b-a823-61ea0958504b@ti.com>
[-- Attachment #1: Type: text/plain, Size: 4996 bytes --]
On Sat, Mar 01, 2025 at 03:08:40AM +0530, Vankar, Chintan wrote:
> Hello Conor, Andrew,
>
> On 3/1/2025 12:22 AM, Conor Dooley wrote:
> > On Thu, Feb 27, 2025 at 03:26:31PM -0600, Andrew Davis wrote:
> > > On 2/27/25 2:22 PM, Chintan Vankar wrote:
> > > > DT-binding of reg-mux is defined in such a way that one need to provide
> > > > register offset and mask in a "mux-reg-masks" property and corresponding
> > > > register value in "idle-states" property. This constraint forces to define
> > > > these values in such a way that "mux-reg-masks" and "idle-states" must be
> > > > in sync with each other. This implementation would be more complex if
> > > > specific register or set of registers need to be configured which has
> > > > large memory space. Introduce a new property "mux-reg-masks-state" which
> > > > allow to specify offset, mask and value as a tuple in a single property.
> > > >
> > > > Signed-off-by: Chintan Vankar <c-vankar@ti.com>
> > > > ---
> > > > .../devicetree/bindings/mux/reg-mux.yaml | 29 +++++++++++++++++--
> > > > 1 file changed, 27 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/Documentation/devicetree/bindings/mux/reg-mux.yaml b/Documentation/devicetree/bindings/mux/reg-mux.yaml
> > > > index dc4be092fc2f..a73c5efcf860 100644
> > > > --- a/Documentation/devicetree/bindings/mux/reg-mux.yaml
> > > > +++ b/Documentation/devicetree/bindings/mux/reg-mux.yaml
> > > > @@ -32,11 +32,36 @@ properties:
> > > > - description: pre-shifted bitfield mask
> > > > description: Each entry pair describes a single mux control.
> > > > - idle-states: true
> > > > + idle-states:
> > > > + description: Each entry describes mux register state.
> > > > +
> > > > + mux-reg-masks-state:
> > > > + $ref: /schemas/types.yaml#/definitions/uint32-matrix
> > > > + items:
> > > > + items:
> > > > + - description: register offset
> > > > + - description: pre-shifted bitfield mask
> > > > + - description: register value to be set
> > > > + description: This property is an extension of mux-reg-masks which
> > > > + allows specifying register offset, mask and register
> > > > + value to be set in a single property.
> > > > +
> > > > +allOf:
> > > > + - if:
> > > > + properties:
> > > > + compatible:
> > > > + contains:
> > > > + enum:
> > > > + - reg-mux
> > > > + - mmio-mux
> > >
> > > These are the only two possible compatibles, is this "if" check needed?
> >
> > Aye.
> >
> > > > + then:
> > > > + properties:
> > > > + mux-reg-masks: true
> > > > + mux-reg-masks-state: true
> > >
> > > You need one, but cannot have both, right? There should be some
> > > way to describe that.
> > >
> > > Also an example added below would be good.
> >
> > From the example schema:
> > # if/then schema can be used to handle conditions on a property affecting
> > # another property. A typical case is a specific 'compatible' value changes the
> > # constraints on other properties.
> > #
> > # For multiple 'if' schema, group them under an 'allOf'.
> > #
> > # If the conditionals become too unweldy, then it may be better to just split
> > # the binding into separate schema documents.
> > allOf:
> > - if:
> > properties:
> > compatible:
> > contains:
> > const: vendor,soc2-ip
> > then:
> > required:
> > - foo-supply
> > else:
> > # If otherwise the property is not allowed:
> > properties:
> > foo-supply: false
> >
> > What's missing from here is making one of the properties required,
> > so
> > oneOf:
> > - required:
> > - masks
> > - required:
> > - masks-state
> >
> > >
> > > Andrew
>
> Thanks for reviewing this patch.
>
> For the use-case we have following three rules to be followed:
> 1. "mux-reg-masks" and "mux-reg-masks-state" should be mutually
> exclusive.
> 2. "mux-reg-masks-state" and "idle-states" should also be mutually
> exclusive.
> 3. If "mux-reg-masks" is present then "idle-states" might or might not
> be there.
>
> For the above conditions I have tried to write a binding as:
>
> allOf:
> - not:
> required: [mux-reg-masks, mux-reg-masks-state]
>
> - if:
> required: [mux-reg-masks-state]
> then:
> not:
> required: [idle-states]
Why'd you pick two different syntax here?
The normal syntax for mutual exclusion is:
if:
required:
- foo
then:
properties:
foobar: false
>
> - if:
> required: [mux-reg-masks]
> then:
> properties:
> idle-states:
> description: It can be present with mux-reg-masks, but not
> required
This one here is the default, I don't think it needs an if/else.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2025-03-03 16:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-27 20:22 [RFC PATCH 0/2] Extend mmio-mux driver to configure mux with Chintan Vankar
2025-02-27 20:22 ` [RFC PATCH 1/2] devicetree: bindings: mux: reg-mux: Update bindings for reg-mux for new property Chintan Vankar
2025-02-27 21:26 ` Andrew Davis
2025-02-28 18:52 ` Conor Dooley
2025-02-28 21:38 ` Vankar, Chintan
2025-03-03 16:58 ` Conor Dooley [this message]
2025-03-03 18:45 ` Vankar, Chintan
2025-02-27 20:22 ` [RFC PATCH 2/2] mux: mmio: Extend mmio-mux driver to configure mux with new DT property Chintan Vankar
2025-02-27 21:39 ` Andrew Davis
2025-03-04 5:16 ` Vankar, Chintan
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=20250303-mummify-mutation-67595b7ceba5@spud \
--to=conor@kernel.org \
--cc=afd@ti.com \
--cc=c-vankar@ti.com \
--cc=conor+dt@kernel.org \
--cc=danishanwar@ti.com \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nm@ti.com \
--cc=peda@axentia.se \
--cc=robh@kernel.org \
--cc=s-vadapalli@ti.com \
--cc=tglx@linutronix.de \
--cc=vigneshr@ti.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox