Skip to contentSkip to conversation

ASoC: dt-bindings: nau8821: Convert to dtschema

PATCH In review Seven Lee 2 participants 3 messages Jun 26, 2023 – Jul 12, 2023

Subsystems (2)
lore
Share & tools
lore

Seven Lee

author
#0 lore raw

PATCH 1/1 ASoC: dt-bindings: nau8821: Convert to dtschema

Convert the NAU8821 audio CODEC bindings to DT schema.

---
 .../devicetree/bindings/sound/nau8821.txt     |  55 --------
 .../bindings/sound/nuvoton,nau8821.yaml       | 120 ++++++++++++++++++
 2 files changed, 120 insertions(+), 55 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/sound/nau8821.txt
 create mode 100644 Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml
Documentation/devicetree/bindings/sound/nau8821.txt deleted +0 -55
deleted file mode 100644
index 7c84e7c7327a..000000000000
@@ -1,55 +0,0 @@
-Nuvoton NAU88L21 audio codec
-
-This device supports I2C only.
-
-Required properties:
-  - compatible : Must be "nuvoton,nau8821"
-
-  - reg : the I2C address of the device. This is either 0x1B (CSB=0) or 0x54 (CSB=1).
-
-Optional properties:
-  - nuvoton,jkdet-enable: Enable jack detection via JKDET pin.
-  - nuvoton,jkdet-pull-enable: Enable JKDET pin pull. If set - pin pull enabled,
-      otherwise pin in high impedance state.
-  - nuvoton,jkdet-pull-up: Pull-up JKDET pin. If set then JKDET pin is pull up, otherwise pull down.
-  - nuvoton,jkdet-polarity: JKDET pin polarity. 0 - active high, 1 - active low.
-
-  - nuvoton,vref-impedance: VREF Impedance selection
-      0 - Open
-      1 - 25 kOhm
-      2 - 125 kOhm
-      3 - 2.5 kOhm
-
-  - nuvoton,micbias-voltage: Micbias voltage level.
-      0 - VDDA
-      1 - VDDA
-      2 - VDDA * 1.1
-      3 - VDDA * 1.2
-      4 - VDDA * 1.3
-      5 - VDDA * 1.4
-      6 - VDDA * 1.53
-      7 - VDDA * 1.53
-
-  - nuvoton,jack-insert-debounce: number from 0 to 7 that sets debounce time to 2^(n+2) ms
-  - nuvoton,jack-eject-debounce: number from 0 to 7 that sets debounce time to 2^(n+2) ms
-
-  - nuvoton,dmic-clk-threshold: the ADC threshold of DMIC clock.
-  - nuvoton,key_enable: Headset button detection switch.
-
-Example:
-
-  headset: nau8821@1b {
-      compatible = "nuvoton,nau8821";
-      reg = <0x1b>;
-      interrupt-parent = <&gpio>;
-      interrupts = <23 IRQ_TYPE_LEVEL_LOW>;
-      nuvoton,jkdet-enable;
-      nuvoton,jkdet-pull-enable;
-      nuvoton,jkdet-pull-up;
-      nuvoton,jkdet-polarity = <GPIO_ACTIVE_LOW>;
-      nuvoton,vref-impedance = <2>;
-      nuvoton,micbias-voltage = <6>;
-      nuvoton,jack-insert-debounce = <7>;
-      nuvoton,jack-eject-debounce = <7>;
-      nuvoton,dmic-clk-threshold = 3072000;
-  };
Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml new file +120 -0

120 lines not on this page · raw message

Signature · 1 line
2.25.1
#1 lore raw
Quoted 4 lines · Seven Lee

Convert the NAU8821 audio CODEC bindings to DT schema.

---

Thank you for your patch. There is something to discuss/improve.

Quoted 23 lines
Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml new file +23 -0
+
+  nuvoton,jkdet-pull-up:
+    description: Pull-up JKDET pin. If set then JKDET pin is pull up,
+      otherwise pull down.
+    type: boolean
+
+  nuvoton,jkdet-polarity:
+    description: JKDET pin polarity.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum:
+      - 0 # active high
+      - 1 # active low
+    default: 1
+
+  nuvoton,micbias-voltage:
+    description: MICBIAS output level select.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum:
+      - 0 # VDDA
+      - 1 # VDDA * 1
+      - 2 # VDDA * 1.1
+      - 3 # VDDA * 1.2
+      - 4 # VDDA * 1.3

Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml line 65

Quoted 10 lines
Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml new file +10 -0
+      - 5 # VDDA * 1.4
+      - 6 # VDDA * 1.53
+      - 7 # VDDA * 1.53
+    default: 6
+
+  nuvoton,vref-impedance:
+    description: VMID Tie-off impedance select.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum:
+      - 0 # open(default)

Drop "(default)"

Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml line 69

Quoted 4 lines
Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml new file +4 -0
+      - 1 # 25KOhms
+      - 2 # 125KOhms
+      - 3 # 2.5KOhms
+    default: 2

You wrote that default is 0

Quoted 8 lines
Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml new file +8 -0
+
+  nuvoton,jack-insert-debounce:
+    description: number from 0 to 7 that sets debounce time to 2^(n+2)ms.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    maximum: 7
+    default: 7
+
+  nuvoton,jack-eject-debounce:

Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml line 87

Quoted 10 lines
Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml new file +10 -0
+    description: number from 0 to 7 that sets debounce time to 2^(n+2)ms.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    maximum: 7
+    default: 0
+
+  nuvoton,dmic-clk-threshold:
+    description: DMIC clock speed expected value. Unit is Hz.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    default: 3072000
+

You miss nuvoton,key_enable. If this is intentional, mention and shortly explain deviations from pure conversion in the commit msg.

Quoted 10 lines
Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml new file +10 -0
+  '#sound-dai-cells':
+    const: 0
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:

Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml line 107

Quoted 10 lines
Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml new file +10 -0
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        codec@1b {
+            #sound-dai-cells = <0>;
+            compatible = "nuvoton,nau8821";
+            reg = <0x1b>;

compatible is first property, reg is second. Therefore put sound-dai-cells somewhere further.

Best regards,
Krzysztof

author
#2 lore raw

On 6/27/2023 2:31 PM, Krzysztof Kozlowski wrote:

CAUTION - External Email: Do not click links or open attachments unless you acknowledge the sender and content.

On 26/06/2023 12:46, Seven Lee wrote:

Convert the NAU8821 audio CODEC bindings to DT schema.

---

Thank you for your patch. There is something to discuss/improve.

Thank you for your suggestion.

+
+ nuvoton,jkdet-pull-up:
+ description: Pull-up JKDET pin. If set then JKDET pin is pull up,
+ otherwise pull down.
+ type: boolean
+
+ nuvoton,jkdet-polarity:

+    description: JKDET pin polarity.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum:

+ - 0 # active high
+ - 1 # active low
+ default: 1
+
+ nuvoton,micbias-voltage:

+    description: MICBIAS output level select.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum:
+      - 0 # VDDA
+      - 1 # VDDA * 1
+      - 2 # VDDA * 1.1
+      - 3 # VDDA * 1.2
+      - 4 # VDDA * 1.3
+      - 5 # VDDA * 1.4
+      - 6 # VDDA * 1.53
+      - 7 # VDDA * 1.53
+    default: 6
+
+  nuvoton,vref-impedance:
+    description: VMID Tie-off impedance select.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum:

+ - 0 # open(default)

Drop "(default)"

Okay, I will drop it.

+      - 1 # 25KOhms
+      - 2 # 125KOhms
+      - 3 # 2.5KOhms

+ default: 2

You wrote that default is 0

Yes, you are right. I will fix it.

+
+ nuvoton,jack-insert-debounce:

+    description: number from 0 to 7 that sets debounce time to 2^(n+2)ms.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    maximum: 7
+    default: 7
+
+  nuvoton,jack-eject-debounce:
+    description: number from 0 to 7 that sets debounce time to 2^(n+2)ms.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    maximum: 7
+    default: 0
+
+  nuvoton,dmic-clk-threshold:
+    description: DMIC clock speed expected value. Unit is Hz.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    default: 3072000

+

You miss nuvoton,key_enable. If this is intentional, mention and shortly explain deviations from pure conversion in the commit msg.

Yes, I miss the nuvoton,key_enable. I will add it.

+ '#sound-dai-cells':
+ const: 0
+
+required:
+ - compatible
+ - reg
+
+unevaluatedProperties: false
+
+examples:

+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        codec@1b {
+            #sound-dai-cells = <0>;
+            compatible = "nuvoton,nau8821";
+            reg = <0x1b>;

compatible is first property, reg is second. Therefore put sound-dai-cells somewhere further.

Okay, I will fix it.

Best regards,
Krzysztof

________________________________
The privileged confidential information contained in this email is intended for use only by the addressees as indicated by the original sender of this email. If you are not the addressee indicated in this email or are not responsible for delivery of the email to such a person, please kindly reply to the sender indicating this fact and delete all copies of it from your computer and network server immediately. Your cooperation is highly appreciated. It is advised that any unauthorized use of confidential information of Nuvoton is strictly prohibited; and any information in this email irrelevant to the official business of Nuvoton shall be deemed as neither given nor endorsed by Nuvoton.