diff mbox series

[01/12] ASoC: dt-bindings: amlogic,gx-sound-card: correct maxItems constraints

Message ID 20230731094303.185067-2-krzysztof.kozlowski@linaro.org (mailing list archive)
State New, archived
Headers show
Series ASoC: dt-bindings: Add sound-card-common.yaml | expand

Commit Message

Krzysztof Kozlowski July 31, 2023, 9:42 a.m. UTC
minItems without maxItems implies upper limit, so add some high maxItems
to fix dtbs_check warnings like:

  meson-gxm-s912-libretech-pc.dtb: sound: audio-routing: ['AU2 INL', 'ACODEC LOLN', 'AU2 INR', 'ACODEC LORN', '7J4-14 LEFT', 'AU2 OUTL', '7J4-11 RIGHT', 'AU2 OUTR'] is too long

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 .../devicetree/bindings/sound/amlogic,gx-sound-card.yaml        | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jerome Brunet July 31, 2023, 9:52 a.m. UTC | #1
On Mon 31 Jul 2023 at 11:42, Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:

> minItems without maxItems implies upper limit, so add some high maxItems
> to fix dtbs_check warnings like:
>
>   meson-gxm-s912-libretech-pc.dtb: sound: audio-routing: ['AU2 INL', 'ACODEC LOLN', 'AU2 INR', 'ACODEC LORN', '7J4-14 LEFT', 'AU2 OUTL', '7J4-11 RIGHT', 'AU2 OUTR'] is too long

The only contraints is that values come in pair and there is no upper
limit to the number of routes a device (using this driver) may have.

The upper limit of 8 might work now but is very likely to be wrong for
the next device to come.

Is there way to correctly describe this "pair" contraint with DT schema ?

If not, then I guess the most adequate solution is to drop minItems and
give no bound, like simple-card is doing for the same type of properties.

Same goes for the audio-widgets property

>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
>  .../devicetree/bindings/sound/amlogic,gx-sound-card.yaml        | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml b/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml
> index b358fd601ed3..45d6202d9730 100644
> --- a/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml
> +++ b/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml
> @@ -21,6 +21,7 @@ properties:
>    audio-routing:
>      $ref: /schemas/types.yaml#/definitions/non-unique-string-array
>      minItems: 2
> +    maxItems: 32
>      description: |-
>        A list of the connections between audio components. Each entry is a
>        pair of strings, the first being the connection's sink, the second
> @@ -29,6 +30,7 @@ properties:
>    audio-widgets:
>      $ref: /schemas/types.yaml#/definitions/non-unique-string-array
>      minItems: 2
> +    maxItems: 8
>      description: |-
>        A list off component DAPM widget. Each entry is a pair of strings,
>        the first being the widget type, the second being the widget name
Mark Brown July 31, 2023, 2:46 p.m. UTC | #2
On Mon, Jul 31, 2023 at 11:52:53AM +0200, Jerome Brunet wrote:

> The upper limit of 8 might work now but is very likely to be wrong for
> the next device to come.

> Is there way to correctly describe this "pair" contraint with DT schema ?

> If not, then I guess the most adequate solution is to drop minItems and
> give no bound, like simple-card is doing for the same type of properties.

> Same goes for the audio-widgets property

Right, dropping minItems seems better than pulling a maxItems out of
thin air.
Krzysztof Kozlowski Aug. 10, 2023, 6:29 a.m. UTC | #3
On 31/07/2023 16:46, Mark Brown wrote:
>> The upper limit of 8 might work now but is very likely to be wrong for
>> the next device to come.
> 
>> Is there way to correctly describe this "pair" contraint with DT schema ?
> 
>> If not, then I guess the most adequate solution is to drop minItems and
>> give no bound, like simple-card is doing for the same type of properties.
> 
>> Same goes for the audio-widgets property
> 
> Right, dropping minItems seems better than pulling a maxItems out of
> thin air.

OK, I will drop the min/maxItems and send v2.

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml b/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml
index b358fd601ed3..45d6202d9730 100644
--- a/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml
+++ b/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml
@@ -21,6 +21,7 @@  properties:
   audio-routing:
     $ref: /schemas/types.yaml#/definitions/non-unique-string-array
     minItems: 2
+    maxItems: 32
     description: |-
       A list of the connections between audio components. Each entry is a
       pair of strings, the first being the connection's sink, the second
@@ -29,6 +30,7 @@  properties:
   audio-widgets:
     $ref: /schemas/types.yaml#/definitions/non-unique-string-array
     minItems: 2
+    maxItems: 8
     description: |-
       A list off component DAPM widget. Each entry is a pair of strings,
       the first being the widget type, the second being the widget name