1*f126890aSEmmanuel Vadot# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause 2*f126890aSEmmanuel Vadot%YAML 1.2 3*f126890aSEmmanuel Vadot--- 4*f126890aSEmmanuel Vadot$id: http://devicetree.org/schemas/sound/nuvoton,nau8824.yaml# 5*f126890aSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml# 6*f126890aSEmmanuel Vadot 7*f126890aSEmmanuel Vadottitle: NAU8824 audio CODEC 8*f126890aSEmmanuel Vadot 9*f126890aSEmmanuel Vadotmaintainers: 10*f126890aSEmmanuel Vadot - John Hsu <KCHSU0@nuvoton.com> 11*f126890aSEmmanuel Vadot 12*f126890aSEmmanuel VadotallOf: 13*f126890aSEmmanuel Vadot - $ref: dai-common.yaml# 14*f126890aSEmmanuel Vadot 15*f126890aSEmmanuel Vadotproperties: 16*f126890aSEmmanuel Vadot compatible: 17*f126890aSEmmanuel Vadot enum: 18*f126890aSEmmanuel Vadot - nuvoton,nau8824 19*f126890aSEmmanuel Vadot 20*f126890aSEmmanuel Vadot reg: 21*f126890aSEmmanuel Vadot maxItems: 1 22*f126890aSEmmanuel Vadot 23*f126890aSEmmanuel Vadot '#sound-dai-cells': 24*f126890aSEmmanuel Vadot const: 0 25*f126890aSEmmanuel Vadot 26*f126890aSEmmanuel Vadot interrupts: 27*f126890aSEmmanuel Vadot maxItems: 1 28*f126890aSEmmanuel Vadot 29*f126890aSEmmanuel Vadot nuvoton,jkdet-polarity: 30*f126890aSEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32 31*f126890aSEmmanuel Vadot description: 32*f126890aSEmmanuel Vadot JKDET pin polarity. 33*f126890aSEmmanuel Vadot enum: 34*f126890aSEmmanuel Vadot - 0 # active high 35*f126890aSEmmanuel Vadot - 1 # active low 36*f126890aSEmmanuel Vadot default: 1 37*f126890aSEmmanuel Vadot 38*f126890aSEmmanuel Vadot nuvoton,vref-impedance: 39*f126890aSEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32 40*f126890aSEmmanuel Vadot description: 41*f126890aSEmmanuel Vadot VREF Impedance selection. 42*f126890aSEmmanuel Vadot enum: 43*f126890aSEmmanuel Vadot - 0 # Open 44*f126890aSEmmanuel Vadot - 1 # 25 kOhm 45*f126890aSEmmanuel Vadot - 2 # 125 kOhm 46*f126890aSEmmanuel Vadot - 3 # 2.5 kOhm 47*f126890aSEmmanuel Vadot default: 2 48*f126890aSEmmanuel Vadot 49*f126890aSEmmanuel Vadot nuvoton,micbias-voltage: 50*f126890aSEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32 51*f126890aSEmmanuel Vadot description: 52*f126890aSEmmanuel Vadot Micbias voltage level. 53*f126890aSEmmanuel Vadot enum: 54*f126890aSEmmanuel Vadot - 0 # VDDA 55*f126890aSEmmanuel Vadot - 1 # VDDA 56*f126890aSEmmanuel Vadot - 2 # VDDA * 1.1 57*f126890aSEmmanuel Vadot - 3 # VDDA * 1.2 58*f126890aSEmmanuel Vadot - 4 # VDDA * 1.3 59*f126890aSEmmanuel Vadot - 5 # VDDA * 1.4 60*f126890aSEmmanuel Vadot - 6 # VDDA * 1.53 61*f126890aSEmmanuel Vadot - 7 # VDDA * 1.53 62*f126890aSEmmanuel Vadot default: 6 63*f126890aSEmmanuel Vadot 64*f126890aSEmmanuel Vadot nuvoton,sar-threshold-num: 65*f126890aSEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32 66*f126890aSEmmanuel Vadot description: 67*f126890aSEmmanuel Vadot Number of buttons supported. 68*f126890aSEmmanuel Vadot minimum: 1 69*f126890aSEmmanuel Vadot maximum: 8 70*f126890aSEmmanuel Vadot default: 4 71*f126890aSEmmanuel Vadot 72*f126890aSEmmanuel Vadot nuvoton,sar-threshold: 73*f126890aSEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32-array 74*f126890aSEmmanuel Vadot description: 75*f126890aSEmmanuel Vadot Impedance threshold for each button. Array that contains up to 8 buttons 76*f126890aSEmmanuel Vadot configuration. SAR value is calculated as 77*f126890aSEmmanuel Vadot SAR = 255 * MICBIAS / SAR_VOLTAGE * R / (2000 + R) where MICBIAS is 78*f126890aSEmmanuel Vadot configured by 'nuvoton,micbias-voltage', SAR_VOLTAGE is configured by 79*f126890aSEmmanuel Vadot 'nuvoton,sar-voltage', R - button impedance. 80*f126890aSEmmanuel Vadot Refer datasheet section 10.2 for more information about threshold 81*f126890aSEmmanuel Vadot calculation. 82*f126890aSEmmanuel Vadot minItems: 1 83*f126890aSEmmanuel Vadot maxItems: 8 84*f126890aSEmmanuel Vadot items: 85*f126890aSEmmanuel Vadot minimum: 0 86*f126890aSEmmanuel Vadot maximum: 255 87*f126890aSEmmanuel Vadot 88*f126890aSEmmanuel Vadot nuvoton,sar-hysteresis: 89*f126890aSEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32 90*f126890aSEmmanuel Vadot description: 91*f126890aSEmmanuel Vadot Button impedance measurement hysteresis. 92*f126890aSEmmanuel Vadot default: 0 93*f126890aSEmmanuel Vadot 94*f126890aSEmmanuel Vadot nuvoton,sar-voltage: 95*f126890aSEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32 96*f126890aSEmmanuel Vadot description: 97*f126890aSEmmanuel Vadot Reference voltage for button impedance measurement. 98*f126890aSEmmanuel Vadot enum: 99*f126890aSEmmanuel Vadot - 0 # VDDA 100*f126890aSEmmanuel Vadot - 1 # VDDA 101*f126890aSEmmanuel Vadot - 2 # VDDA * 1.1 102*f126890aSEmmanuel Vadot - 3 # VDDA * 1.2 103*f126890aSEmmanuel Vadot - 4 # VDDA * 1.3 104*f126890aSEmmanuel Vadot - 5 # VDDA * 1.4 105*f126890aSEmmanuel Vadot - 6 # VDDA * 1.53 106*f126890aSEmmanuel Vadot - 7 # VDDA * 1.53 107*f126890aSEmmanuel Vadot default: 6 108*f126890aSEmmanuel Vadot 109*f126890aSEmmanuel Vadot nuvoton,sar-compare-time: 110*f126890aSEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32 111*f126890aSEmmanuel Vadot description: 112*f126890aSEmmanuel Vadot SAR compare time. 113*f126890aSEmmanuel Vadot enum: 114*f126890aSEmmanuel Vadot - 0 # 500ns 115*f126890aSEmmanuel Vadot - 1 # 1us 116*f126890aSEmmanuel Vadot - 2 # 2us 117*f126890aSEmmanuel Vadot - 3 # 4us 118*f126890aSEmmanuel Vadot default: 1 119*f126890aSEmmanuel Vadot 120*f126890aSEmmanuel Vadot nuvoton,sar-sampling-time: 121*f126890aSEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32 122*f126890aSEmmanuel Vadot description: 123*f126890aSEmmanuel Vadot SAR sampling time. 124*f126890aSEmmanuel Vadot enum: 125*f126890aSEmmanuel Vadot - 0 # 2us 126*f126890aSEmmanuel Vadot - 1 # 4us 127*f126890aSEmmanuel Vadot - 2 # 8us 128*f126890aSEmmanuel Vadot - 3 # 16us 129*f126890aSEmmanuel Vadot default: 1 130*f126890aSEmmanuel Vadot 131*f126890aSEmmanuel Vadot nuvoton,short-key-debounce: 132*f126890aSEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32 133*f126890aSEmmanuel Vadot description: 134*f126890aSEmmanuel Vadot Button short key press debounce time. 135*f126890aSEmmanuel Vadot enum: 136*f126890aSEmmanuel Vadot - 0 # 30 ms 137*f126890aSEmmanuel Vadot - 1 # 50 ms 138*f126890aSEmmanuel Vadot - 2 # 100 ms 139*f126890aSEmmanuel Vadot default: 0 140*f126890aSEmmanuel Vadot 141*f126890aSEmmanuel Vadot nuvoton,jack-eject-debounce: 142*f126890aSEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32 143*f126890aSEmmanuel Vadot description: 144*f126890aSEmmanuel Vadot Jack ejection debounce time. 145*f126890aSEmmanuel Vadot enum: 146*f126890aSEmmanuel Vadot - 0 # 0 ms 147*f126890aSEmmanuel Vadot - 1 # 1 ms 148*f126890aSEmmanuel Vadot - 2 # 10 ms 149*f126890aSEmmanuel Vadot default: 1 150*f126890aSEmmanuel Vadot 151*f126890aSEmmanuel Vadotrequired: 152*f126890aSEmmanuel Vadot - compatible 153*f126890aSEmmanuel Vadot - reg 154*f126890aSEmmanuel Vadot 155*f126890aSEmmanuel VadotunevaluatedProperties: false 156*f126890aSEmmanuel Vadot 157*f126890aSEmmanuel Vadotexamples: 158*f126890aSEmmanuel Vadot - | 159*f126890aSEmmanuel Vadot #include <dt-bindings/gpio/gpio.h> 160*f126890aSEmmanuel Vadot #include <dt-bindings/interrupt-controller/irq.h> 161*f126890aSEmmanuel Vadot i2c { 162*f126890aSEmmanuel Vadot #address-cells = <1>; 163*f126890aSEmmanuel Vadot #size-cells = <0>; 164*f126890aSEmmanuel Vadot codec@1a { 165*f126890aSEmmanuel Vadot #sound-dai-cells = <0>; 166*f126890aSEmmanuel Vadot compatible = "nuvoton,nau8824"; 167*f126890aSEmmanuel Vadot reg = <0x1a>; 168*f126890aSEmmanuel Vadot interrupt-parent = <&gpio>; 169*f126890aSEmmanuel Vadot interrupts = <38 IRQ_TYPE_LEVEL_LOW>; 170*f126890aSEmmanuel Vadot nuvoton,vref-impedance = <2>; 171*f126890aSEmmanuel Vadot nuvoton,micbias-voltage = <6>; 172*f126890aSEmmanuel Vadot nuvoton,sar-threshold-num = <4>; 173*f126890aSEmmanuel Vadot // Setup 4 buttons impedance according to Android specification 174*f126890aSEmmanuel Vadot nuvoton,sar-threshold = <0xc 0x1e 0x38 0x60>; 175*f126890aSEmmanuel Vadot nuvoton,sar-hysteresis = <0>; 176*f126890aSEmmanuel Vadot nuvoton,sar-voltage = <6>; 177*f126890aSEmmanuel Vadot nuvoton,sar-compare-time = <1>; 178*f126890aSEmmanuel Vadot nuvoton,sar-sampling-time = <1>; 179*f126890aSEmmanuel Vadot nuvoton,short-key-debounce = <0>; 180*f126890aSEmmanuel Vadot nuvoton,jack-eject-debounce = <1>; 181*f126890aSEmmanuel Vadot }; 182*f126890aSEmmanuel Vadot }; 183