Documentation / devicetree / bindings / sound / allwinner,sun4i-a10-codec.yaml


Based on kernel version 6.8. Page generated on 2024-03-11 21:26 EST.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268
# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/allwinner,sun4i-a10-codec.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Allwinner A10 Codec

maintainers:
  - Chen-Yu Tsai <wens@csie.org>
  - Maxime Ripard <mripard@kernel.org>

properties:
  "#sound-dai-cells":
    const: 0

  compatible:
    enum:
      - allwinner,sun4i-a10-codec
      - allwinner,sun6i-a31-codec
      - allwinner,sun7i-a20-codec
      - allwinner,sun8i-a23-codec
      - allwinner,sun8i-h3-codec
      - allwinner,sun8i-v3s-codec

  reg:
    maxItems: 1

  interrupts:
    maxItems: 1

  clocks:
    items:
      - description: Bus Clock
      - description: Module Clock

  clock-names:
    items:
      - const: apb
      - const: codec

  dmas:
    items:
      - description: RX DMA Channel
      - description: TX DMA Channel

  dma-names:
    items:
      - const: rx
      - const: tx

  resets:
    maxItems: 1

  allwinner,audio-routing:
    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 being the connection's source.
    $ref: /schemas/types.yaml#/definitions/non-unique-string-array
    minItems: 2
    maxItems: 18
    items:
      enum:
        # Audio Pins on the SoC
        - HP
        - HPCOM
        - LINEIN
        - LINEOUT
        - MIC1
        - MIC2
        - MIC3
 
        # Microphone Biases from the SoC
        - HBIAS
        - MBIAS
 
        # Board Connectors
        - Headphone
        - Headset Mic
        - Line In
        - Line Out
        - Mic
        - Speaker

  allwinner,codec-analog-controls:
    $ref: /schemas/types.yaml#/definitions/phandle
    description: Phandle to the codec analog controls in the PRCM

  allwinner,pa-gpios:
    maxItems: 1
    description: GPIO to enable the external amplifier

required:
  - "#sound-dai-cells"
  - compatible
  - reg
  - interrupts
  - clocks
  - clock-names
  - dmas
  - dma-names

allOf:
  - $ref: dai-common.yaml#
  - if:
      properties:
        compatible:
          enum:
            - allwinner,sun6i-a31-codec
            - allwinner,sun8i-a23-codec
            - allwinner,sun8i-h3-codec
            - allwinner,sun8i-v3s-codec

    then:
      if:
        properties:
          compatible:
            const: allwinner,sun6i-a31-codec

      then:
        required:
          - resets
          - allwinner,audio-routing

      else:
        required:
          - resets
          - allwinner,audio-routing
          - allwinner,codec-analog-controls

  - if:
      properties:
        compatible:
          enum:
            - allwinner,sun6i-a31-codec

    then:
      properties:
        allwinner,audio-routing:
          items:
            enum:
              - HP
              - HPCOM
              - LINEIN
              - LINEOUT
              - MIC1
              - MIC2
              - MIC3
              - HBIAS
              - MBIAS
              - Headphone
              - Headset Mic
              - Line In
              - Line Out
              - Mic
              - Speaker

  - if:
      properties:
        compatible:
          enum:
            - allwinner,sun8i-a23-codec

    then:
      properties:
        allwinner,audio-routing:
          items:
            enum:
              - HP
              - HPCOM
              - LINEIN
              - MIC1
              - MIC2
              - HBIAS
              - MBIAS
              - Headphone
              - Headset Mic
              - Line In
              - Line Out
              - Mic
              - Speaker

  - if:
      properties:
        compatible:
          enum:
            - allwinner,sun8i-h3-codec

    then:
      properties:
        allwinner,audio-routing:
          items:
            enum:
              - HP
              - HPCOM
              - LINEIN
              - LINEOUT
              - MIC1
              - MIC2
              - HBIAS
              - MBIAS
              - Headphone
              - Headset Mic
              - Line In
              - Line Out
              - Mic
              - Speaker

  - if:
      properties:
        compatible:
          enum:
            - allwinner,sun8i-v3s-codec

    then:
      properties:
        allwinner,audio-routing:
          items:
            enum:
              - HP
              - HPCOM
              - MIC1
              - HBIAS
              - Headphone
              - Headset Mic
              - Line In
              - Line Out
              - Mic
              - Speaker

unevaluatedProperties: false

examples:
  - |
    codec@1c22c00 {
        #sound-dai-cells = <0>;
        compatible = "allwinner,sun7i-a20-codec";
        reg = <0x01c22c00 0x40>;
        interrupts = <0 30 4>;
        clocks = <&apb0_gates 0>, <&codec_clk>;
        clock-names = "apb", "codec";
        dmas = <&dma 0 19>, <&dma 0 19>;
        dma-names = "rx", "tx";
    };

  - |
    codec@1c22c00 {
        #sound-dai-cells = <0>;
        compatible = "allwinner,sun6i-a31-codec";
        reg = <0x01c22c00 0x98>;
        interrupts = <0 29 4>;
        clocks = <&ccu 61>, <&ccu 135>;
        clock-names = "apb", "codec";
        resets = <&ccu 42>;
        dmas = <&dma 15>, <&dma 15>;
        dma-names = "rx", "tx";
        allwinner,audio-routing =
            "Headphone", "HP",
            "Speaker", "LINEOUT",
            "LINEIN", "Line In",
            "MIC1", "MBIAS",
            "MIC1", "Mic",
            "MIC2", "HBIAS",
            "MIC2", "Headset Mic";
    };

...