diff mbox series

[v2] ASoC: dt-bindings: imx-audio-spdif: convert to YAML

Message ID 1712561233-27250-1-git-send-email-shengjiu.wang@nxp.com (mailing list archive)
State New
Headers show
Series [v2] ASoC: dt-bindings: imx-audio-spdif: convert to YAML | expand

Commit Message

Shengjiu Wang April 8, 2024, 7:27 a.m. UTC
Convert the imx-audio-spdif binding to YAML.

When testing dtbs_check, found below compatible strings
are not listed in document:

fsl,imx-sabreauto-spdif
fsl,imx6sx-sdb-spdif

So add them in yaml file to pass the test.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
changes in v2:
- change file name to imx-spdif.yaml
- remove |
- add anyof for spdif-in and spdif-out requirement
- change example name to sound

 .../bindings/sound/imx-audio-spdif.txt        | 36 ----------
 .../devicetree/bindings/sound/imx-spdif.yaml  | 70 +++++++++++++++++++
 2 files changed, 70 insertions(+), 36 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/sound/imx-audio-spdif.txt
 create mode 100644 Documentation/devicetree/bindings/sound/imx-spdif.yaml

Comments

Krzysztof Kozlowski April 8, 2024, 7:55 a.m. UTC | #1
On 08/04/2024 09:27, Shengjiu Wang wrote:
> Convert the imx-audio-spdif binding to YAML.
> 
> When testing dtbs_check, found below compatible strings
> are not listed in document:
> 
> fsl,imx-sabreauto-spdif
> fsl,imx6sx-sdb-spdif
> 
> So add them in yaml file to pass the test.
> 
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> ---
> changes in v2:
> - change file name to imx-spdif.yaml

How does your compatible look like? fsl,imx-audio-spdif, so use that.

> - remove |
> - add anyof for spdif-in and spdif-out requirement
> - change example name to sound
> 

> diff --git a/Documentation/devicetree/bindings/sound/imx-spdif.yaml b/Documentation/devicetree/bindings/sound/imx-spdif.yaml
> new file mode 100644
> index 000000000000..beb214b51a50
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/imx-spdif.yaml
> @@ -0,0 +1,70 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/sound/imx-spdif.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Freescale i.MX audio complex with S/PDIF transceiver
> +
> +maintainers:
> +  - Shengjiu Wang <shengjiu.wang@nxp.com>
> +
> +properties:
> +  compatible:
> +    oneOf:
> +      - items:
> +          - enum:
> +              - fsl,imx-audio-spdif> +          - enum:
> +              - fsl,imx-sabreauto-spdif
> +              - fsl,imx6sx-sdb-spdif

This does not make much sense. You have mixed fallback with specific
compatible. I suggest you to fix your DTS and submit proper bindings.

> +      - enum:
> +          - fsl,imx-audio-spdif
> +
> +  model:
> +    $ref: /schemas/types.yaml#/definitions/string
> +    description: User specified audio sound card name
> +
> +  spdif-controller:
> +    $ref: /schemas/types.yaml#/definitions/phandle
> +    description: The phandle of the i.MX S/PDIF controller
> +
> +  spdif-out:
> +    type: boolean
> +    description:
> +      If present, the transmitting function of S/PDIF will be enabled,
> +      indicating there's a physical S/PDIF out connector or jack on the
> +      board or it's connecting to some other IP block, such as an HDMI
> +      encoder or display-controller.
> +
> +  spdif-in:
> +    type: boolean
> +    description:
> +      If present, the receiving function of S/PDIF will be enabled,
> +      indicating there is a physical S/PDIF in connector/jack on the board.
> +
> +required:
> +  - compatible
> +  - model
> +  - spdif-controller
> +
> +anyOf:
> +  - required:
> +      - spdif-in
> +  - required:
> +      - spdif-out
> +  - required:
> +      - spdif-out
> +      - spdif-in

Do you need the last required block?

> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    sound {

That's a random change...

Instead of sending two patches per day, please carefully address the
feedback.

> +        compatible = "fsl,imx-audio-spdif";
> +        model = "imx-spdif";
> +        spdif-controller = <&spdif>;
> +        spdif-out;
> +        spdif-in;
> +    };

Best regards,
Krzysztof
Shengjiu Wang April 8, 2024, 8:01 a.m. UTC | #2
On Mon, Apr 8, 2024 at 3:55 PM Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
>
> On 08/04/2024 09:27, Shengjiu Wang wrote:
> > Convert the imx-audio-spdif binding to YAML.
> >
> > When testing dtbs_check, found below compatible strings
> > are not listed in document:
> >
> > fsl,imx-sabreauto-spdif
> > fsl,imx6sx-sdb-spdif
> >
> > So add them in yaml file to pass the test.
> >
> > Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> > ---
> > changes in v2:
> > - change file name to imx-spdif.yaml
>
> How does your compatible look like? fsl,imx-audio-spdif, so use that.

Oh, it seems I misunderstood your meaning. you think the name should
be the same as compatible string...

>
> > - remove |
> > - add anyof for spdif-in and spdif-out requirement
> > - change example name to sound
> >
>
> > diff --git a/Documentation/devicetree/bindings/sound/imx-spdif.yaml b/Documentation/devicetree/bindings/sound/imx-spdif.yaml
> > new file mode 100644
> > index 000000000000..beb214b51a50
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/sound/imx-spdif.yaml
> > @@ -0,0 +1,70 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/sound/imx-spdif.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Freescale i.MX audio complex with S/PDIF transceiver
> > +
> > +maintainers:
> > +  - Shengjiu Wang <shengjiu.wang@nxp.com>
> > +
> > +properties:
> > +  compatible:
> > +    oneOf:
> > +      - items:
> > +          - enum:
> > +              - fsl,imx-audio-spdif> +          - enum:
> > +              - fsl,imx-sabreauto-spdif
> > +              - fsl,imx6sx-sdb-spdif
>
> This does not make much sense. You have mixed fallback with specific
> compatible. I suggest you to fix your DTS and submit proper bindings.

ok.

>
> > +      - enum:
> > +          - fsl,imx-audio-spdif
> > +
> > +  model:
> > +    $ref: /schemas/types.yaml#/definitions/string
> > +    description: User specified audio sound card name
> > +
> > +  spdif-controller:
> > +    $ref: /schemas/types.yaml#/definitions/phandle
> > +    description: The phandle of the i.MX S/PDIF controller
> > +
> > +  spdif-out:
> > +    type: boolean
> > +    description:
> > +      If present, the transmitting function of S/PDIF will be enabled,
> > +      indicating there's a physical S/PDIF out connector or jack on the
> > +      board or it's connecting to some other IP block, such as an HDMI
> > +      encoder or display-controller.
> > +
> > +  spdif-in:
> > +    type: boolean
> > +    description:
> > +      If present, the receiving function of S/PDIF will be enabled,
> > +      indicating there is a physical S/PDIF in connector/jack on the board.
> > +
> > +required:
> > +  - compatible
> > +  - model
> > +  - spdif-controller
> > +
> > +anyOf:
> > +  - required:
> > +      - spdif-in
> > +  - required:
> > +      - spdif-out
> > +  - required:
> > +      - spdif-out
> > +      - spdif-in
>
> Do you need the last required block?

Yes,  one of them or both are required.

>
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > +  - |
> > +    sound {
>
> That's a random change...
>
> Instead of sending two patches per day, please carefully address the
> feedback.

In v1 you suggest to change it to spdif?  but spdif may conflict
with the fsl,spdif.yaml.   so which name I should use?

best regards
wang shengjiu
>
> > +        compatible = "fsl,imx-audio-spdif";
> > +        model = "imx-spdif";
> > +        spdif-controller = <&spdif>;
> > +        spdif-out;
> > +        spdif-in;
> > +    };
>
> Best regards,
> Krzysztof
>
Krzysztof Kozlowski April 8, 2024, 3:06 p.m. UTC | #3
On 08/04/2024 10:01, Shengjiu Wang wrote:
>>> +
>>> +anyOf:
>>> +  - required:
>>> +      - spdif-in
>>> +  - required:
>>> +      - spdif-out
>>> +  - required:
>>> +      - spdif-out
>>> +      - spdif-in
>>
>> Do you need the last required block?
> 
> Yes,  one of them or both are required.

And? It's already there: that's the meaning of any. It is not oneOf...
Before answering please test your changes and ideas. I pointed issue
here and you responded just to close my comment. That does not make me
happy, just wastes my time.

> 
>>
>>> +
>>> +additionalProperties: false
>>> +
>>> +examples:
>>> +  - |
>>> +    sound {
>>
>> That's a random change...
>>
>> Instead of sending two patches per day, please carefully address the
>> feedback.
> 
> In v1 you suggest to change it to spdif?  but spdif may conflict
> with the fsl,spdif.yaml.   so which name I should use?

I don't understand where is the conflict. That's a different binding.

Best regards,
Krzysztof
Shengjiu Wang April 9, 2024, 1:37 a.m. UTC | #4
On Mon, Apr 8, 2024 at 11:06 PM Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
>
> On 08/04/2024 10:01, Shengjiu Wang wrote:
> >>> +
> >>> +anyOf:
> >>> +  - required:
> >>> +      - spdif-in
> >>> +  - required:
> >>> +      - spdif-out
> >>> +  - required:
> >>> +      - spdif-out
> >>> +      - spdif-in
> >>
> >> Do you need the last required block?
> >
> > Yes,  one of them or both are required.
>
> And? It's already there: that's the meaning of any. It is not oneOf...
> Before answering please test your changes and ideas. I pointed issue
> here and you responded just to close my comment. That does not make me
> happy, just wastes my time.

Maybe I didn't express clearly.

we need at least one of them (spdif-in, spdif-out) in the node.  which means
that we need to select  "spdif-in",  or "spdif-out",  or "spdif-in and
spdif-out".

So my understanding is that need to use "anyOf", if it is wrong, please let
me know.

>
> >
> >>
> >>> +
> >>> +additionalProperties: false
> >>> +
> >>> +examples:
> >>> +  - |
> >>> +    sound {
> >>
> >> That's a random change...

So  I can use "sound-spdif", right?

best regards
wang shengjiu

> >>
> >> Instead of sending two patches per day, please carefully address the
> >> feedback.
> >
> > In v1 you suggest to change it to spdif?  but spdif may conflict
> > with the fsl,spdif.yaml.   so which name I should use?
>
> I don't understand where is the conflict. That's a different binding.
>
>
Krzysztof Kozlowski April 9, 2024, 6:30 a.m. UTC | #5
On 09/04/2024 03:37, Shengjiu Wang wrote:
> On Mon, Apr 8, 2024 at 11:06 PM Krzysztof Kozlowski
> <krzysztof.kozlowski@linaro.org> wrote:
>>
>> On 08/04/2024 10:01, Shengjiu Wang wrote:
>>>>> +
>>>>> +anyOf:
>>>>> +  - required:
>>>>> +      - spdif-in
>>>>> +  - required:
>>>>> +      - spdif-out
>>>>> +  - required:
>>>>> +      - spdif-out
>>>>> +      - spdif-in
>>>>
>>>> Do you need the last required block?
>>>
>>> Yes,  one of them or both are required.
>>
>> And? It's already there: that's the meaning of any. It is not oneOf...
>> Before answering please test your changes and ideas. I pointed issue
>> here and you responded just to close my comment. That does not make me
>> happy, just wastes my time.
> 
> Maybe I didn't express clearly.
> 
> we need at least one of them (spdif-in, spdif-out) in the node.  which means
> that we need to select  "spdif-in",  or "spdif-out",  or "spdif-in and
> spdif-out".
> 
> So my understanding is that need to use "anyOf", if it is wrong, please let
> me know.

Third time: it is wrong.

Can you test the code instead continuing this discussion

Best regards,
Krzysztof
Shengjiu Wang April 9, 2024, 6:52 a.m. UTC | #6
On Tue, Apr 9, 2024 at 2:30 PM Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
>
> On 09/04/2024 03:37, Shengjiu Wang wrote:
> > On Mon, Apr 8, 2024 at 11:06 PM Krzysztof Kozlowski
> > <krzysztof.kozlowski@linaro.org> wrote:
> >>
> >> On 08/04/2024 10:01, Shengjiu Wang wrote:
> >>>>> +
> >>>>> +anyOf:
> >>>>> +  - required:
> >>>>> +      - spdif-in
> >>>>> +  - required:
> >>>>> +      - spdif-out
> >>>>> +  - required:
> >>>>> +      - spdif-out
> >>>>> +      - spdif-in
> >>>>
> >>>> Do you need the last required block?
> >>>
> >>> Yes,  one of them or both are required.
> >>
> >> And? It's already there: that's the meaning of any. It is not oneOf...
> >> Before answering please test your changes and ideas. I pointed issue
> >> here and you responded just to close my comment. That does not make me
> >> happy, just wastes my time.
> >
> > Maybe I didn't express clearly.
> >
> > we need at least one of them (spdif-in, spdif-out) in the node.  which means
> > that we need to select  "spdif-in",  or "spdif-out",  or "spdif-in and
> > spdif-out".
> >
> > So my understanding is that need to use "anyOf", if it is wrong, please let
> > me know.
>
> Third time: it is wrong.
>
> Can you test the code instead continuing this discussion

Every time I change I definitely do dtbs_check test.
But There is no error reported by dtbs_check.

But finally I understand that
anyOf:
  - required:
      - spdif-in
  - required:
      - spdif-out
  - required:
      - spdif-out
      - spdif-in

is equal to:
anyOf:
  - required:
      - spdif-in
  - required:
      - spdif-out

best regards
Shengjiu Wang
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/sound/imx-audio-spdif.txt b/Documentation/devicetree/bindings/sound/imx-audio-spdif.txt
deleted file mode 100644
index da84a442ccea..000000000000
--- a/Documentation/devicetree/bindings/sound/imx-audio-spdif.txt
+++ /dev/null
@@ -1,36 +0,0 @@ 
-Freescale i.MX audio complex with S/PDIF transceiver
-
-Required properties:
-
-  - compatible		: "fsl,imx-audio-spdif"
-
-  - model		: The user-visible name of this sound complex
-
-  - spdif-controller	: The phandle of the i.MX S/PDIF controller
-
-
-Optional properties:
-
-  - spdif-out		: This is a boolean property. If present, the
-			  transmitting function of S/PDIF will be enabled,
-			  indicating there's a physical S/PDIF out connector
-			  or jack on the board or it's connecting to some
-			  other IP block, such as an HDMI encoder or
-			  display-controller.
-
-  - spdif-in		: This is a boolean property. If present, the receiving
-			  function of S/PDIF will be enabled, indicating there
-			  is a physical S/PDIF in connector/jack on the board.
-
-* Note: At least one of these two properties should be set in the DT binding.
-
-
-Example:
-
-sound-spdif {
-	compatible = "fsl,imx-audio-spdif";
-	model = "imx-spdif";
-	spdif-controller = <&spdif>;
-	spdif-out;
-	spdif-in;
-};
diff --git a/Documentation/devicetree/bindings/sound/imx-spdif.yaml b/Documentation/devicetree/bindings/sound/imx-spdif.yaml
new file mode 100644
index 000000000000..beb214b51a50
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/imx-spdif.yaml
@@ -0,0 +1,70 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/imx-spdif.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Freescale i.MX audio complex with S/PDIF transceiver
+
+maintainers:
+  - Shengjiu Wang <shengjiu.wang@nxp.com>
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - enum:
+              - fsl,imx-audio-spdif
+          - enum:
+              - fsl,imx-sabreauto-spdif
+              - fsl,imx6sx-sdb-spdif
+      - enum:
+          - fsl,imx-audio-spdif
+
+  model:
+    $ref: /schemas/types.yaml#/definitions/string
+    description: User specified audio sound card name
+
+  spdif-controller:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: The phandle of the i.MX S/PDIF controller
+
+  spdif-out:
+    type: boolean
+    description:
+      If present, the transmitting function of S/PDIF will be enabled,
+      indicating there's a physical S/PDIF out connector or jack on the
+      board or it's connecting to some other IP block, such as an HDMI
+      encoder or display-controller.
+
+  spdif-in:
+    type: boolean
+    description:
+      If present, the receiving function of S/PDIF will be enabled,
+      indicating there is a physical S/PDIF in connector/jack on the board.
+
+required:
+  - compatible
+  - model
+  - spdif-controller
+
+anyOf:
+  - required:
+      - spdif-in
+  - required:
+      - spdif-out
+  - required:
+      - spdif-out
+      - spdif-in
+
+additionalProperties: false
+
+examples:
+  - |
+    sound {
+        compatible = "fsl,imx-audio-spdif";
+        model = "imx-spdif";
+        spdif-controller = <&spdif>;
+        spdif-out;
+        spdif-in;
+    };