[v2,1/2] ASoC: dt-bindings: Added schema for "nuvoton,nau8325"

Message ID 20240222083825.190854-2-wtli@nuvoton.com
State New
Headers
Series ASoC: nau8325: Modify driver code and dtschema. |

Commit Message

Seven Lee Feb. 22, 2024, 8:38 a.m. UTC
  Added a DT schema for describing nau8325 audio amplifiers.

Signed-off-by: Seven Lee <wtli@nuvoton.com>
---
 .../bindings/sound/nuvoton,nau8325.yaml       | 82 +++++++++++++++++++
 1 file changed, 82 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/nuvoton,nau8325.yaml
  

Comments

Rob Herring Feb. 22, 2024, 9:44 a.m. UTC | #1
On Thu, 22 Feb 2024 16:38:24 +0800, Seven Lee wrote:
> Added a DT schema for describing nau8325 audio amplifiers.
> 
> Signed-off-by: Seven Lee <wtli@nuvoton.com>
> ---
>  .../bindings/sound/nuvoton,nau8325.yaml       | 82 +++++++++++++++++++
>  1 file changed, 82 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/sound/nuvoton,nau8325.yaml
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/nuvoton,nau8325.yaml: properties:nuvoton,dac-vref:enum:0: 'VDDA' is not of type 'integer'
	hint: An integer type must have integer constraints
	from schema $id: http://devicetree.org/meta-schemas/types.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/nuvoton,nau8325.yaml: properties:nuvoton,dac-vref:enum:1: 'VDDA*1.5/1.8V' is not of type 'integer'
	hint: An integer type must have integer constraints
	from schema $id: http://devicetree.org/meta-schemas/types.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/nuvoton,nau8325.yaml: properties:nuvoton,dac-vref:enum:2: 'VDDA*1.6/1.8V' is not of type 'integer'
	hint: An integer type must have integer constraints
	from schema $id: http://devicetree.org/meta-schemas/types.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/nuvoton,nau8325.yaml: properties:nuvoton,dac-vref:enum:3: 'VDDA*1.7/1.8V' is not of type 'integer'
	hint: An integer type must have integer constraints
	from schema $id: http://devicetree.org/meta-schemas/types.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/nuvoton,nau8325.example.dtb: codec@21: nuvoton,dac-vref:0: [2] is not one of ['VDDA', 'VDDA*1.5/1.8V', 'VDDA*1.6/1.8V', 'VDDA*1.7/1.8V']
	from schema $id: http://devicetree.org/schemas/sound/nuvoton,nau8325.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/nuvoton,nau8325.example.dtb: codec@21: Unevaluated properties are not allowed ('nuvoton,dac-vref' was unexpected)
	from schema $id: http://devicetree.org/schemas/sound/nuvoton,nau8325.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240222083825.190854-2-wtli@nuvoton.com

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
  
Rob Herring Feb. 22, 2024, 2:16 p.m. UTC | #2
On Thu, Feb 22, 2024 at 04:38:24PM +0800, Seven Lee wrote:
> Added a DT schema for describing nau8325 audio amplifiers.

Please test your bindings before sending.

> 
> Signed-off-by: Seven Lee <wtli@nuvoton.com>
> ---
>  .../bindings/sound/nuvoton,nau8325.yaml       | 82 +++++++++++++++++++
>  1 file changed, 82 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/sound/nuvoton,nau8325.yaml
> 
> diff --git a/Documentation/devicetree/bindings/sound/nuvoton,nau8325.yaml b/Documentation/devicetree/bindings/sound/nuvoton,nau8325.yaml
> new file mode 100644
> index 000000000000..fc72baf0bb7a
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/nuvoton,nau8325.yaml
> @@ -0,0 +1,82 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/sound/nuvoton,nau8325.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: NAU8325 audio Amplifier
> +
> +maintainers:
> +  - Seven Lee <WTLI@nuvoton.com>
> +
> +allOf:
> +  - $ref: dai-common.yaml#
> +
> +properties:
> +  compatible:
> +    const: nuvoton,nau8325
> +
> +  reg:
> +    maxItems: 1
> +
> +  nuvoton,vref-impedance:
> +    $ref: /schemas/types.yaml#/definitions/uint32

Use standard unit suffixes.

> +    description:
> +      VREF impedance selection.
> +    enum:
> +      - 0 # Open
> +      - 1 # 25kOhm
> +      - 2 # 125kOhm
> +      - 3 # 2.5kOhm
> +    default: 2
> +
> +  nuvoton,dac-vref:
> +    $ref: /schemas/types.yaml#/definitions/uint32

Use standard unit suffixes.

> +    description:
> +      DAC Reference Voltage Setting.
> +    enum:
> +      - VDDA

in Volts?

> +      - VDDA*1.5/1.8V

Volts/Volts

So 2 different units?

> +      - VDDA*1.6/1.8V
> +      - VDDA*1.7/1.8V
> +    default: 2
> +
> +  nuvoton,alc-enable:
> +    description:
> +      Enable digital automatic level control (ALC) function.
> +    type: boolean
> +
> +  nuvoton,clock-detection-disable:
> +    description:
> +      When clock detection is enabled, it will detect whether MCLK
> +      and FS are within the range. MCLK range is from 2.048MHz to 24.576MHz.
> +      FS range is from 8kHz to 96kHz.
> +    type: boolean
> +
> +  nuvoton,clock-det-data:
> +    description:
> +      Request clock detection to require 2048 non-zero samples before enabling
> +      the audio paths. If set then non-zero samples is required, otherwise it
> +      doesn't matter.
> +    type: boolean
> +
> +required:
> +  - compatible
> +  - reg
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +        codec@21 {
> +            compatible = "nuvoton,nau8325";
> +            reg = <0x21>;
> +            nuvoton,vref-impedance = <2>;
> +            nuvoton,dac-vref = <2>;
> +            nuvoton,alc-enable;
> +            nuvoton,clock-det-data;
> +        };
> +    };
> -- 
> 2.25.1
>
  
Seven Lee March 1, 2024, 6:26 a.m. UTC | #3
Rob Herring 於 2/22/2024 10:16 PM 寫道:
> CAUTION - External Email: Do not click links or open attachments unless you acknowledge the sender and content.
>
>
> On Thu, Feb 22, 2024 at 04:38:24PM +0800, Seven Lee wrote:
>> Added a DT schema for describing nau8325 audio amplifiers.
> Please test your bindings before sending.

okay, thanks.

>
>> Signed-off-by: Seven Lee <wtli@nuvoton.com>
>> ---
>>   .../bindings/sound/nuvoton,nau8325.yaml       | 82 +++++++++++++++++++
>>   1 file changed, 82 insertions(+)
>>   create mode 100644 Documentation/devicetree/bindings/sound/nuvoton,nau8325.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/sound/nuvoton,nau8325.yaml b/Documentation/devicetree/bindings/sound/nuvoton,nau8325.yaml
>> new file mode 100644
>> index 000000000000..fc72baf0bb7a
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/sound/nuvoton,nau8325.yaml
>> @@ -0,0 +1,82 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/sound/nuvoton,nau8325.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: NAU8325 audio Amplifier
>> +
>> +maintainers:
>> +  - Seven Lee <WTLI@nuvoton.com>
>> +
>> +allOf:
>> +  - $ref: dai-common.yaml#
>> +
>> +properties:
>> +  compatible:
>> +    const: nuvoton,nau8325
>> +
>> +  reg:
>> +    maxItems: 1
>> +
>> +  nuvoton,vref-impedance:
>> +    $ref: /schemas/types.yaml#/definitions/uint32
> Use standard unit suffixes.

okay, I will use standard unit suffixes.

>
>> +    description:
>> +      VREF impedance selection.
>> +    enum:
>> +      - 0 # Open
>> +      - 1 # 25kOhm
>> +      - 2 # 125kOhm
>> +      - 3 # 2.5kOhm
>> +    default: 2
>> +
>> +  nuvoton,dac-vref:
>> +    $ref: /schemas/types.yaml#/definitions/uint32
> Use standard unit suffixes.

okay, I will use standard unit suffixes.

>
>> +    description:
>> +      DAC Reference Voltage Setting.
>> +    enum:
>> +      - VDDA
> in Volts?

yes, this is Volts.

>
>> +      - VDDA*1.5/1.8V
> Volts/Volts
>
> So 2 different units?

Both units are volts. I will modify the enum definition.

>
>> +      - VDDA*1.6/1.8V
>> +      - VDDA*1.7/1.8V
>> +    default: 2
>> +
>> +  nuvoton,alc-enable:
>> +    description:
>> +      Enable digital automatic level control (ALC) function.
>> +    type: boolean
>> +
>> +  nuvoton,clock-detection-disable:
>> +    description:
>> +      When clock detection is enabled, it will detect whether MCLK
>> +      and FS are within the range. MCLK range is from 2.048MHz to 24.576MHz.
>> +      FS range is from 8kHz to 96kHz.
>> +    type: boolean
>> +
>> +  nuvoton,clock-det-data:
>> +    description:
>> +      Request clock detection to require 2048 non-zero samples before enabling
>> +      the audio paths. If set then non-zero samples is required, otherwise it
>> +      doesn't matter.
>> +    type: boolean
>> +
>> +required:
>> +  - compatible
>> +  - reg
>> +
>> +unevaluatedProperties: false
>> +
>> +examples:
>> +  - |
>> +    i2c {
>> +        #address-cells = <1>;
>> +        #size-cells = <0>;
>> +        codec@21 {
>> +            compatible = "nuvoton,nau8325";
>> +            reg = <0x21>;
>> +            nuvoton,vref-impedance = <2>;
>> +            nuvoton,dac-vref = <2>;
>> +            nuvoton,alc-enable;
>> +            nuvoton,clock-det-data;
>> +        };
>> +    };
>> --
>> 2.25.1
>>
  

Patch

diff --git a/Documentation/devicetree/bindings/sound/nuvoton,nau8325.yaml b/Documentation/devicetree/bindings/sound/nuvoton,nau8325.yaml
new file mode 100644
index 000000000000..fc72baf0bb7a
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/nuvoton,nau8325.yaml
@@ -0,0 +1,82 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/nuvoton,nau8325.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NAU8325 audio Amplifier
+
+maintainers:
+  - Seven Lee <WTLI@nuvoton.com>
+
+allOf:
+  - $ref: dai-common.yaml#
+
+properties:
+  compatible:
+    const: nuvoton,nau8325
+
+  reg:
+    maxItems: 1
+
+  nuvoton,vref-impedance:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      VREF impedance selection.
+    enum:
+      - 0 # Open
+      - 1 # 25kOhm
+      - 2 # 125kOhm
+      - 3 # 2.5kOhm
+    default: 2
+
+  nuvoton,dac-vref:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      DAC Reference Voltage Setting.
+    enum:
+      - VDDA
+      - VDDA*1.5/1.8V
+      - VDDA*1.6/1.8V
+      - VDDA*1.7/1.8V
+    default: 2
+
+  nuvoton,alc-enable:
+    description:
+      Enable digital automatic level control (ALC) function.
+    type: boolean
+
+  nuvoton,clock-detection-disable:
+    description:
+      When clock detection is enabled, it will detect whether MCLK
+      and FS are within the range. MCLK range is from 2.048MHz to 24.576MHz.
+      FS range is from 8kHz to 96kHz.
+    type: boolean
+
+  nuvoton,clock-det-data:
+    description:
+      Request clock detection to require 2048 non-zero samples before enabling
+      the audio paths. If set then non-zero samples is required, otherwise it
+      doesn't matter.
+    type: boolean
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        codec@21 {
+            compatible = "nuvoton,nau8325";
+            reg = <0x21>;
+            nuvoton,vref-impedance = <2>;
+            nuvoton,dac-vref = <2>;
+            nuvoton,alc-enable;
+            nuvoton,clock-det-data;
+        };
+    };