From 3341f884d75929a009801d4299d219e64c64a33c Mon Sep 17 00:00:00 2001
From: Maksim Kiselev <bigunclemax@gmail.com>
Date: Sat, 5 Aug 2023 21:05:01 +0300
Subject: [PATCH 07/14] ASoC: dt-bindings: sun4i-a10-codec: Add binding for
 Allwinner D1 SoC

The Allwinner D1 SoC has a internal audio codec that similar to previous
ones, but it contains a three ADC channels instead of two, and also has
a separate clocks for ADC and DAC modules.

Signed-off-by: Maksim Kiselev <bigunclemax@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
---
 .../sound/allwinner,sun4i-a10-codec.yaml      | 64 ++++++++++++++++---
 1 file changed, 56 insertions(+), 8 deletions(-)

--- a/Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-codec.yaml
+++ b/Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-codec.yaml
@@ -22,6 +22,7 @@ properties:
       - allwinner,sun8i-a23-codec
       - allwinner,sun8i-h3-codec
       - allwinner,sun8i-v3s-codec
+      - allwinner,sun20i-d1-codec
 
   reg:
     maxItems: 1
@@ -29,15 +30,9 @@ properties:
   interrupts:
     maxItems: 1
 
-  clocks:
-    items:
-      - description: Bus Clock
-      - description: Module Clock
+  clocks: true
 
-  clock-names:
-    items:
-      - const: apb
-      - const: codec
+  clock-names: true
 
   dmas:
     items:
@@ -106,11 +101,42 @@ allOf:
   - if:
       properties:
         compatible:
+          const: allwinner,sun20i-d1-codec
+    then:
+      properties:
+        clocks:
+          items:
+            - description: Bus Clock
+            - description: ADC Module Clock
+            - description: DAC Module Clock
+
+        clock-names:
+          items:
+            - const: apb
+            - const: adc
+            - const: dac
+
+    else:
+      properties:
+        clocks:
+          items:
+            - description: Bus Clock
+            - description: Module Clock
+
+        clock-names:
+          items:
+            - const: apb
+            - const: codec
+
+  - if:
+      properties:
+        compatible:
           enum:
             - allwinner,sun6i-a31-codec
             - allwinner,sun8i-a23-codec
             - allwinner,sun8i-h3-codec
             - allwinner,sun8i-v3s-codec
+            - allwinner,sun20i-d1-codec
 
     then:
       if:
@@ -225,6 +251,28 @@ allOf:
               - Headphone
               - Headset Mic
               - Line In
+              - Line Out
+              - Mic
+              - Speaker
+
+  - if:
+      properties:
+        compatible:
+          enum:
+            - allwinner,sun20i-d1-codec
+
+    then:
+      properties:
+        allwinner,audio-routing:
+          items:
+            enum:
+              - HP
+              - LINEIN
+              - MIC3
+              - MBIAS
+              - Headphone
+              - Headset Mic
+              - Line In
               - Line Out
               - Mic
               - Speaker
