diff mbox series

[v1,3/4] ASoC: dt-bindings: nxp, tfa989x: Add rcv-gpios property for tfa9897

Message ID 20211024085840.1536438-4-vincent.knecht@mailoo.org
State Changes Requested, archived
Headers show
Series Add tfa9897 speaker/receiver modes switching | expand

Checks

Context Check Description
robh/checkpatch success

Commit Message

Vincent Knecht Oct. 24, 2021, 8:58 a.m. UTC
Add optional rcv-gpios property specific to tfa9897 receiver mode.

Signed-off-by: Vincent Knecht <vincent.knecht@mailoo.org>
---
 .../devicetree/bindings/sound/nxp,tfa989x.yaml         | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Rob Herring Oct. 29, 2021, 2:13 a.m. UTC | #1
On Sun, Oct 24, 2021 at 10:58:39AM +0200, Vincent Knecht wrote:
> Add optional rcv-gpios property specific to tfa9897 receiver mode.
> 
> Signed-off-by: Vincent Knecht <vincent.knecht@mailoo.org>
> ---
>  .../devicetree/bindings/sound/nxp,tfa989x.yaml         | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/sound/nxp,tfa989x.yaml b/Documentation/devicetree/bindings/sound/nxp,tfa989x.yaml
> index 7667471be1e4..a9e15baedafd 100644
> --- a/Documentation/devicetree/bindings/sound/nxp,tfa989x.yaml
> +++ b/Documentation/devicetree/bindings/sound/nxp,tfa989x.yaml
> @@ -12,6 +12,16 @@ maintainers:
>  allOf:
>    - $ref: name-prefix.yaml#
>  
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: nxp,tfa9897
> +    then:
> +      properties:
> +        rcv-gpios:
> +          description: optional GPIO to be asserted when receiver mode is enabled.

Did you test this works? 

You have to define the property outside the if/then schema at the top 
level. Then use an if/then schema to restrict it (rcv-gpios: false).

> +
>  properties:
>    compatible:
>      enum:
> -- 
> 2.31.1
> 
> 
> 
>
Vincent Knecht Oct. 31, 2021, 9:35 a.m. UTC | #2
Le jeudi 28 octobre 2021 à 21:13 -0500, Rob Herring a écrit :
> On Sun, Oct 24, 2021 at 10:58:39AM +0200, Vincent Knecht wrote:
> > Add optional rcv-gpios property specific to tfa9897 receiver mode.
> > 
> > Signed-off-by: Vincent Knecht <vincent.knecht@mailoo.org>
> > ---
> >  .../devicetree/bindings/sound/nxp,tfa989x.yaml         | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/sound/nxp,tfa989x.yaml
> > b/Documentation/devicetree/bindings/sound/nxp,tfa989x.yaml
> > index 7667471be1e4..a9e15baedafd 100644
> > --- a/Documentation/devicetree/bindings/sound/nxp,tfa989x.yaml
> > +++ b/Documentation/devicetree/bindings/sound/nxp,tfa989x.yaml
> > @@ -12,6 +12,16 @@ maintainers:
> >  allOf:
> >    - $ref: name-prefix.yaml#
> >  
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          contains:
> > +            const: nxp,tfa9897
> > +    then:
> > +      properties:
> > +        rcv-gpios:
> > +          description: optional GPIO to be asserted when receiver mode is enabled.
> 
> Did you test this works? 
> 
> You have to define the property outside the if/then schema at the top 
> level. Then use an if/then schema to restrict it (rcv-gpios: false).

Sorry, I only tested validation with dt_binding_check.

I'll send another version later today with
if:
  not:
    properties:
      compatible:
        const: nxp,tfa9897
then:
  properties:
    rcv-gpios: false
and a tfa9897 example section, which passes the check and fails
if rcv-gpio is added to tfa9895.

Thank you
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/sound/nxp,tfa989x.yaml b/Documentation/devicetree/bindings/sound/nxp,tfa989x.yaml
index 7667471be1e4..a9e15baedafd 100644
--- a/Documentation/devicetree/bindings/sound/nxp,tfa989x.yaml
+++ b/Documentation/devicetree/bindings/sound/nxp,tfa989x.yaml
@@ -12,6 +12,16 @@  maintainers:
 allOf:
   - $ref: name-prefix.yaml#
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: nxp,tfa9897
+    then:
+      properties:
+        rcv-gpios:
+          description: optional GPIO to be asserted when receiver mode is enabled.
+
 properties:
   compatible:
     enum: