Documentation / devicetree / bindings / sound / nuvoton,nau8824.yaml


Based on kernel version 6.11. Page generated on 2024-09-24 08:21 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
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/nuvoton,nau8824.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: NAU8824 audio CODEC

maintainers:
  - John Hsu <KCHSU0@nuvoton.com>

allOf:
  - $ref: dai-common.yaml#

properties:
  compatible:
    enum:
      - nuvoton,nau8824

  reg:
    maxItems: 1
 
  '#sound-dai-cells':
    const: 0

  clocks:
    items:
      - description: The phandle of the master clock to the CODEC

  clock-names:
    items:
      - const: mclk

  interrupts:
    maxItems: 1

  nuvoton,jkdet-polarity:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      JKDET pin polarity.
    enum:
      - 0 # active high
      - 1 # active low
    default: 1

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

  nuvoton,micbias-voltage:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      Micbias voltage level.
    enum:
      - 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
    default: 6

  nuvoton,sar-threshold-num:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      Number of buttons supported.
    minimum: 1
    maximum: 8
    default: 4

  nuvoton,sar-threshold:
    $ref: /schemas/types.yaml#/definitions/uint32-array
    description:
      Impedance threshold for each button. Array that contains up to 8 buttons
      configuration. SAR value is calculated as
      SAR = 255 * MICBIAS / SAR_VOLTAGE * R / (2000 + R) where MICBIAS is
      configured by 'nuvoton,micbias-voltage', SAR_VOLTAGE is configured by
      'nuvoton,sar-voltage', R - button impedance.
      Refer datasheet section 10.2 for more information about threshold
      calculation.
    minItems: 1
    maxItems: 8
    items:
      minimum: 0
      maximum: 255

  nuvoton,sar-hysteresis:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      Button impedance measurement hysteresis.
    default: 0

  nuvoton,sar-voltage:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      Reference voltage for button impedance measurement.
    enum:
      - 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
    default: 6

  nuvoton,sar-compare-time:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      SAR compare time.
    enum:
      - 0 # 500ns
      - 1 # 1us
      - 2 # 2us
      - 3 # 4us
    default: 1

  nuvoton,sar-sampling-time:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      SAR sampling time.
    enum:
      - 0 # 2us
      - 1 # 4us
      - 2 # 8us
      - 3 # 16us
    default: 1

  nuvoton,short-key-debounce:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      Button short key press debounce time.
    enum:
      - 0 # 30 ms
      - 1 # 50 ms
      - 2 # 100 ms
    default: 0

  nuvoton,jack-eject-debounce:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      Jack ejection debounce time.
    enum:
      - 0 # 0 ms
      - 1 # 1 ms
      - 2 # 10 ms
    default: 1

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@1a {
            #sound-dai-cells = <0>;
            compatible = "nuvoton,nau8824";
            reg = <0x1a>;
            interrupt-parent = <&gpio>;
            interrupts = <38 IRQ_TYPE_LEVEL_LOW>;
            nuvoton,vref-impedance = <2>;
            nuvoton,micbias-voltage = <6>;
            nuvoton,sar-threshold-num = <4>;
            // Setup 4 buttons impedance according to Android specification
            nuvoton,sar-threshold = <0xc 0x1e 0x38 0x60>;
            nuvoton,sar-hysteresis = <0>;
            nuvoton,sar-voltage = <6>;
            nuvoton,sar-compare-time = <1>;
            nuvoton,sar-sampling-time = <1>;
            nuvoton,short-key-debounce = <0>;
            nuvoton,jack-eject-debounce = <1>;
        };
    };