diff mbox series

[2/4] ASoC: dt-bindings: document the adau1373 Codec

Message ID 20241021-adau1373-shutdown-v1-2-bec4ff9dfa16@analog.com (mailing list archive)
State New, archived
Headers show
Series ASoC: codecs: adau1373: drop platform data | expand

Commit Message

Nuno Sa Oct. 21, 2024, 1:46 p.m. UTC
Describe the adau1373 Low Power Codec with Speaker and
Headphone Amplifier.

While at it, properly add a MAINTAINERS entry for ADI sound bindings.

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
---
 .../devicetree/bindings/sound/adi,adau1373.yaml    | 102 +++++++++++++++++++++
 MAINTAINERS                                        |   1 +
 2 files changed, 103 insertions(+)

Comments

Krzysztof Kozlowski Oct. 22, 2024, 6:06 a.m. UTC | #1
On Mon, Oct 21, 2024 at 03:46:46PM +0200, Nuno Sa wrote:
> Describe the adau1373 Low Power Codec with Speaker and
> Headphone Amplifier.
> 
> While at it, properly add a MAINTAINERS entry for ADI sound bindings.
> 
> Signed-off-by: Nuno Sa <nuno.sa@analog.com>
> ---
>  .../devicetree/bindings/sound/adi,adau1373.yaml    | 102 +++++++++++++++++++++
>  MAINTAINERS                                        |   1 +
>  2 files changed, 103 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/sound/adi,adau1373.yaml b/Documentation/devicetree/bindings/sound/adi,adau1373.yaml
> new file mode 100644
> index 0000000000000000000000000000000000000000..b2b5b2226ed7b354f2fb7871c17272b347921fa5
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/adi,adau1373.yaml
> @@ -0,0 +1,102 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/sound/adi,adau1373.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +

Just one blank line

> +title: Analog Devices ADAU1373 CODEC
> +
> +maintainers:
> +  - Nuno Sá <nuno.sa@analog.com>
> +
> +description: |
> +  Analog Devices ADAU1373 Low power codec with speaker and headphone amplifiers.
> +  https://www.analog.com/media/en/technical-documentation/data-sheets/ADAU1373.pdf
> +
> +allOf:
> +  - $ref: dai-common.yaml#
> +
> +properties:
> +  compatible:
> +    enum:
> +      - adi,adau1373
> +
> +  reg:
> +    maxItems: 1
> +
> +  "#sound-dai-cells":
> +    const: 0
> +
> +  powerdown-gpios:
> +    description: GPIO used for hardware power-down.
> +    maxItems: 1
> +
> +  adi,micbias1-microvolt:
> +    description:
> +      This property sets the microphone bias voltage for the first microphone.
> +    enum: [1800000, 2200000, 2600000, 2900000]
> +    default: 2900000
> +
> +  adi,micbias2-microvolt:
> +    description:
> +      This property sets the microphone bias voltage for the second microphone.
> +    enum: [1800000, 2200000, 2600000, 2900000]
> +    default: 2900000
> +
> +  adi,input1-differential:
> +    description: This property sets the first analog input as differential.
> +    type: boolean
> +
> +  adi,input2-differential:
> +    description: This property sets the second analog input as differential.
> +    type: boolean
> +
> +  adi,input3-differential:
> +    description: This property sets the third analog input as differential.
> +    type: boolean
> +
> +  adi,input4-differential:
> +    description: This property sets the fourth analog input as differential.
> +    type: boolean
> +
> +  adi,lineout-differential:
> +    description: This property sets the line output as differential.
> +    type: boolean
> +
> +  adi,lineout-gnd-sense:
> +    description: This property enables the line output ground sense control.
> +    type: boolean
> +
> +  adi,drc-settings:
> +    description:
> +      This setting is used to control the dynamic range of the signal. The
> +      device provides a maximum of three full band DRCs with 13 entries each.
> +    $ref: /schemas/types.yaml#/definitions/uint8-array
> +    oneOf:
> +      - minItems: 13
> +      - minItems: 26
> +      - minItems: 39

and maxItems?

> +
> +required:
> +  - "#sound-dai-cells"
> +  - compatible
> +  - reg
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/gpio/gpio.h>
> +
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +        audio-codec@1a {
> +                compatible = "adi,adau1373";

Messed indentation.

> +                reg = <0x1a>;
> +                #sound-dai-cells = <0>;
> +                powerdown-gpios = <&gpio 100 GPIO_ACTIVE_LOW>;

Extend the example, you have like 10 unused properties.

Best regards,
Krzysztof
Nuno Sá Oct. 22, 2024, 6:42 a.m. UTC | #2
On Tue, 2024-10-22 at 08:06 +0200, Krzysztof Kozlowski wrote:
> On Mon, Oct 21, 2024 at 03:46:46PM +0200, Nuno Sa wrote:
> > Describe the adau1373 Low Power Codec with Speaker and
> > Headphone Amplifier.
> > 
> > While at it, properly add a MAINTAINERS entry for ADI sound bindings.
> > 
> > Signed-off-by: Nuno Sa <nuno.sa@analog.com>
> > ---
> >  .../devicetree/bindings/sound/adi,adau1373.yaml    | 102
> > +++++++++++++++++++++
> >  MAINTAINERS                                        |   1 +
> >  2 files changed, 103 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/sound/adi,adau1373.yaml
> > b/Documentation/devicetree/bindings/sound/adi,adau1373.yaml
> > new file mode 100644
> > index
> > 0000000000000000000000000000000000000000..b2b5b2226ed7b354f2fb7871c17272b347
> > 921fa5
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/sound/adi,adau1373.yaml
> > @@ -0,0 +1,102 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/sound/adi,adau1373.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +
> 
> Just one blank line
> 
> > +title: Analog Devices ADAU1373 CODEC
> > +
> > +maintainers:
> > +  - Nuno Sá <nuno.sa@analog.com>
> > +
> > +description: |
> > +  Analog Devices ADAU1373 Low power codec with speaker and headphone
> > amplifiers.
> > + 
> > https://www.analog.com/media/en/technical-documentation/data-sheets/ADAU1373.pdf
> > +
> > +allOf:
> > +  - $ref: dai-common.yaml#
> > +
> > +properties:
> > +  compatible:
> > +    enum:
> > +      - adi,adau1373
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  "#sound-dai-cells":
> > +    const: 0
> > +
> > +  powerdown-gpios:
> > +    description: GPIO used for hardware power-down.
> > +    maxItems: 1
> > +
> > +  adi,micbias1-microvolt:
> > +    description:
> > +      This property sets the microphone bias voltage for the first
> > microphone.
> > +    enum: [1800000, 2200000, 2600000, 2900000]
> > +    default: 2900000
> > +
> > +  adi,micbias2-microvolt:
> > +    description:
> > +      This property sets the microphone bias voltage for the second
> > microphone.
> > +    enum: [1800000, 2200000, 2600000, 2900000]
> > +    default: 2900000
> > +
> > +  adi,input1-differential:
> > +    description: This property sets the first analog input as differential.
> > +    type: boolean
> > +
> > +  adi,input2-differential:
> > +    description: This property sets the second analog input as
> > differential.
> > +    type: boolean
> > +
> > +  adi,input3-differential:
> > +    description: This property sets the third analog input as differential.
> > +    type: boolean
> > +
> > +  adi,input4-differential:
> > +    description: This property sets the fourth analog input as
> > differential.
> > +    type: boolean
> > +
> > +  adi,lineout-differential:
> > +    description: This property sets the line output as differential.
> > +    type: boolean
> > +
> > +  adi,lineout-gnd-sense:
> > +    description: This property enables the line output ground sense
> > control.
> > +    type: boolean
> > +
> > +  adi,drc-settings:
> > +    description:
> > +      This setting is used to control the dynamic range of the signal. The
> > +      device provides a maximum of three full band DRCs with 13 entries
> > each.
> > +    $ref: /schemas/types.yaml#/definitions/uint8-array
> > +    oneOf:
> > +      - minItems: 13
> > +      - minItems: 26
> > +      - minItems: 39
> 
> and maxItems?

Hmm, I had the idea that if maxItems was omitted, then it's the same as
minItems? Because that's the intent... We can either have an array of 13, 26 or
39 entries.

> 
> > +
> > +required:
> > +  - "#sound-dai-cells"
> > +  - compatible
> > +  - reg
> > +
> > +unevaluatedProperties: false
> > +
> > +examples:
> > +  - |
> > +    #include <dt-bindings/gpio/gpio.h>
> > +
> > +    i2c {
> > +        #address-cells = <1>;
> > +        #size-cells = <0>;
> > +        audio-codec@1a {
> > +                compatible = "adi,adau1373";
> 
> Messed indentation.

WIll fix. Normally my IDE handles this pretty well...
> 
> > +                reg = <0x1a>;
> > +                #sound-dai-cells = <0>;
> > +                powerdown-gpios = <&gpio 100 GPIO_ACTIVE_LOW>;
> 
> Extend the example, you have like 10 unused properties.

Will do

Thanks!
- Nuno Sá
Krzysztof Kozlowski Oct. 26, 2024, 6:14 p.m. UTC | #3
On 22/10/2024 08:42, Nuno Sá wrote:
>>> +    $ref: /schemas/types.yaml#/definitions/uint8-array
>>> +    oneOf:
>>> +      - minItems: 13
>>> +      - minItems: 26
>>> +      - minItems: 39
>>
>> and maxItems?
> 
> Hmm, I had the idea that if maxItems was omitted, then it's the same as
> minItems? Because that's the intent... We can either have an array of 13, 26 or
> 39 entries.

That's not the case and none of the files follow such logic. If you
manage to find one file, please correct or report it.

Best regards,
Krzysztof
Nuno Sá Oct. 28, 2024, 2:10 p.m. UTC | #4
On Sat, 2024-10-26 at 20:14 +0200, Krzysztof Kozlowski wrote:
> On 22/10/2024 08:42, Nuno Sá wrote:
> > > > +    $ref: /schemas/types.yaml#/definitions/uint8-array
> > > > +    oneOf:
> > > > +      - minItems: 13
> > > > +      - minItems: 26
> > > > +      - minItems: 39
> > > 
> > > and maxItems?
> > 
> > Hmm, I had the idea that if maxItems was omitted, then it's the same as
> > minItems? Because that's the intent... We can either have an array of 13, 26 or
> > 39 entries.
> 
> That's not the case and none of the files follow such logic. If you
> manage to find one file, please correct or report it.
> 

Okay... will add maxItems

FWIW, playing with the DT example and validating the bindings works (and fails) as
expected when omitting maxItems.

- Nuno Sá
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/sound/adi,adau1373.yaml b/Documentation/devicetree/bindings/sound/adi,adau1373.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..b2b5b2226ed7b354f2fb7871c17272b347921fa5
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/adi,adau1373.yaml
@@ -0,0 +1,102 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/adi,adau1373.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+
+title: Analog Devices ADAU1373 CODEC
+
+maintainers:
+  - Nuno Sá <nuno.sa@analog.com>
+
+description: |
+  Analog Devices ADAU1373 Low power codec with speaker and headphone amplifiers.
+  https://www.analog.com/media/en/technical-documentation/data-sheets/ADAU1373.pdf
+
+allOf:
+  - $ref: dai-common.yaml#
+
+properties:
+  compatible:
+    enum:
+      - adi,adau1373
+
+  reg:
+    maxItems: 1
+
+  "#sound-dai-cells":
+    const: 0
+
+  powerdown-gpios:
+    description: GPIO used for hardware power-down.
+    maxItems: 1
+
+  adi,micbias1-microvolt:
+    description:
+      This property sets the microphone bias voltage for the first microphone.
+    enum: [1800000, 2200000, 2600000, 2900000]
+    default: 2900000
+
+  adi,micbias2-microvolt:
+    description:
+      This property sets the microphone bias voltage for the second microphone.
+    enum: [1800000, 2200000, 2600000, 2900000]
+    default: 2900000
+
+  adi,input1-differential:
+    description: This property sets the first analog input as differential.
+    type: boolean
+
+  adi,input2-differential:
+    description: This property sets the second analog input as differential.
+    type: boolean
+
+  adi,input3-differential:
+    description: This property sets the third analog input as differential.
+    type: boolean
+
+  adi,input4-differential:
+    description: This property sets the fourth analog input as differential.
+    type: boolean
+
+  adi,lineout-differential:
+    description: This property sets the line output as differential.
+    type: boolean
+
+  adi,lineout-gnd-sense:
+    description: This property enables the line output ground sense control.
+    type: boolean
+
+  adi,drc-settings:
+    description:
+      This setting is used to control the dynamic range of the signal. The
+      device provides a maximum of three full band DRCs with 13 entries each.
+    $ref: /schemas/types.yaml#/definitions/uint8-array
+    oneOf:
+      - minItems: 13
+      - minItems: 26
+      - minItems: 39
+
+required:
+  - "#sound-dai-cells"
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        audio-codec@1a {
+                compatible = "adi,adau1373";
+                reg = <0x1a>;
+                #sound-dai-cells = <0>;
+                powerdown-gpios = <&gpio 100 GPIO_ACTIVE_LOW>;
+        };
+    };
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index c1a2c296446c0724a0c6e70c845e5e5e1e693fd5..a3bf361f7b80774ae2228f2d71a3f477eb497ec5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1521,6 +1521,7 @@  L:	linux-sound@vger.kernel.org
 S:	Supported
 W:	http://wiki.analog.com/
 W:	https://ez.analog.com/linux-software-drivers
+F:	Documentation/devicetree/bindings/sound/adi,*
 F:	sound/soc/codecs/ad1*
 F:	sound/soc/codecs/ad7*
 F:	sound/soc/codecs/adau*