1518a1742SDavid Lin# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause 2518a1742SDavid Lin%YAML 1.2 3518a1742SDavid Lin--- 4518a1742SDavid Lin$id: http://devicetree.org/schemas/sound/nuvoton,nau8824.yaml# 5518a1742SDavid Lin$schema: http://devicetree.org/meta-schemas/core.yaml# 6518a1742SDavid Lin 7518a1742SDavid Lintitle: NAU8824 audio CODEC 8518a1742SDavid Lin 9518a1742SDavid Linmaintainers: 10518a1742SDavid Lin - John Hsu <KCHSU0@nuvoton.com> 11518a1742SDavid Lin 12518a1742SDavid LinallOf: 13518a1742SDavid Lin - $ref: dai-common.yaml# 14518a1742SDavid Lin 15518a1742SDavid Linproperties: 16518a1742SDavid Lin compatible: 17518a1742SDavid Lin enum: 18518a1742SDavid Lin - nuvoton,nau8824 19518a1742SDavid Lin 20518a1742SDavid Lin reg: 21518a1742SDavid Lin maxItems: 1 22518a1742SDavid Lin 23518a1742SDavid Lin '#sound-dai-cells': 24518a1742SDavid Lin const: 0 25518a1742SDavid Lin 26*fcad7177SMaxim Kochetkov clocks: 27*fcad7177SMaxim Kochetkov items: 28*fcad7177SMaxim Kochetkov - description: The phandle of the master clock to the CODEC 29*fcad7177SMaxim Kochetkov 30*fcad7177SMaxim Kochetkov clock-names: 31*fcad7177SMaxim Kochetkov items: 32*fcad7177SMaxim Kochetkov - const: mclk 33*fcad7177SMaxim Kochetkov 34518a1742SDavid Lin interrupts: 35518a1742SDavid Lin maxItems: 1 36518a1742SDavid Lin 37518a1742SDavid Lin nuvoton,jkdet-polarity: 38518a1742SDavid Lin $ref: /schemas/types.yaml#/definitions/uint32 39518a1742SDavid Lin description: 40518a1742SDavid Lin JKDET pin polarity. 41518a1742SDavid Lin enum: 42518a1742SDavid Lin - 0 # active high 43518a1742SDavid Lin - 1 # active low 44518a1742SDavid Lin default: 1 45518a1742SDavid Lin 46518a1742SDavid Lin nuvoton,vref-impedance: 47518a1742SDavid Lin $ref: /schemas/types.yaml#/definitions/uint32 48518a1742SDavid Lin description: 49518a1742SDavid Lin VREF Impedance selection. 50518a1742SDavid Lin enum: 51518a1742SDavid Lin - 0 # Open 52518a1742SDavid Lin - 1 # 25 kOhm 53518a1742SDavid Lin - 2 # 125 kOhm 54518a1742SDavid Lin - 3 # 2.5 kOhm 55518a1742SDavid Lin default: 2 56518a1742SDavid Lin 57518a1742SDavid Lin nuvoton,micbias-voltage: 58518a1742SDavid Lin $ref: /schemas/types.yaml#/definitions/uint32 59518a1742SDavid Lin description: 60518a1742SDavid Lin Micbias voltage level. 61518a1742SDavid Lin enum: 62518a1742SDavid Lin - 0 # VDDA 63518a1742SDavid Lin - 1 # VDDA 64518a1742SDavid Lin - 2 # VDDA * 1.1 65518a1742SDavid Lin - 3 # VDDA * 1.2 66518a1742SDavid Lin - 4 # VDDA * 1.3 67518a1742SDavid Lin - 5 # VDDA * 1.4 68518a1742SDavid Lin - 6 # VDDA * 1.53 69518a1742SDavid Lin - 7 # VDDA * 1.53 70518a1742SDavid Lin default: 6 71518a1742SDavid Lin 72518a1742SDavid Lin nuvoton,sar-threshold-num: 73518a1742SDavid Lin $ref: /schemas/types.yaml#/definitions/uint32 74518a1742SDavid Lin description: 75518a1742SDavid Lin Number of buttons supported. 76518a1742SDavid Lin minimum: 1 77518a1742SDavid Lin maximum: 8 78518a1742SDavid Lin default: 4 79518a1742SDavid Lin 80518a1742SDavid Lin nuvoton,sar-threshold: 81518a1742SDavid Lin $ref: /schemas/types.yaml#/definitions/uint32-array 82518a1742SDavid Lin description: 83518a1742SDavid Lin Impedance threshold for each button. Array that contains up to 8 buttons 84518a1742SDavid Lin configuration. SAR value is calculated as 85518a1742SDavid Lin SAR = 255 * MICBIAS / SAR_VOLTAGE * R / (2000 + R) where MICBIAS is 86518a1742SDavid Lin configured by 'nuvoton,micbias-voltage', SAR_VOLTAGE is configured by 87518a1742SDavid Lin 'nuvoton,sar-voltage', R - button impedance. 88518a1742SDavid Lin Refer datasheet section 10.2 for more information about threshold 89518a1742SDavid Lin calculation. 90518a1742SDavid Lin minItems: 1 91518a1742SDavid Lin maxItems: 8 92518a1742SDavid Lin items: 93518a1742SDavid Lin minimum: 0 94518a1742SDavid Lin maximum: 255 95518a1742SDavid Lin 96518a1742SDavid Lin nuvoton,sar-hysteresis: 97518a1742SDavid Lin $ref: /schemas/types.yaml#/definitions/uint32 98518a1742SDavid Lin description: 99518a1742SDavid Lin Button impedance measurement hysteresis. 100518a1742SDavid Lin default: 0 101518a1742SDavid Lin 102518a1742SDavid Lin nuvoton,sar-voltage: 103518a1742SDavid Lin $ref: /schemas/types.yaml#/definitions/uint32 104518a1742SDavid Lin description: 105518a1742SDavid Lin Reference voltage for button impedance measurement. 106518a1742SDavid Lin enum: 107518a1742SDavid Lin - 0 # VDDA 108518a1742SDavid Lin - 1 # VDDA 109518a1742SDavid Lin - 2 # VDDA * 1.1 110518a1742SDavid Lin - 3 # VDDA * 1.2 111518a1742SDavid Lin - 4 # VDDA * 1.3 112518a1742SDavid Lin - 5 # VDDA * 1.4 113518a1742SDavid Lin - 6 # VDDA * 1.53 114518a1742SDavid Lin - 7 # VDDA * 1.53 115518a1742SDavid Lin default: 6 116518a1742SDavid Lin 117518a1742SDavid Lin nuvoton,sar-compare-time: 118518a1742SDavid Lin $ref: /schemas/types.yaml#/definitions/uint32 119518a1742SDavid Lin description: 120518a1742SDavid Lin SAR compare time. 121518a1742SDavid Lin enum: 122518a1742SDavid Lin - 0 # 500ns 123518a1742SDavid Lin - 1 # 1us 124518a1742SDavid Lin - 2 # 2us 125518a1742SDavid Lin - 3 # 4us 126518a1742SDavid Lin default: 1 127518a1742SDavid Lin 128518a1742SDavid Lin nuvoton,sar-sampling-time: 129518a1742SDavid Lin $ref: /schemas/types.yaml#/definitions/uint32 130518a1742SDavid Lin description: 131518a1742SDavid Lin SAR sampling time. 132518a1742SDavid Lin enum: 133518a1742SDavid Lin - 0 # 2us 134518a1742SDavid Lin - 1 # 4us 135518a1742SDavid Lin - 2 # 8us 136518a1742SDavid Lin - 3 # 16us 137518a1742SDavid Lin default: 1 138518a1742SDavid Lin 139518a1742SDavid Lin nuvoton,short-key-debounce: 140518a1742SDavid Lin $ref: /schemas/types.yaml#/definitions/uint32 141518a1742SDavid Lin description: 142518a1742SDavid Lin Button short key press debounce time. 143518a1742SDavid Lin enum: 144518a1742SDavid Lin - 0 # 30 ms 145518a1742SDavid Lin - 1 # 50 ms 146518a1742SDavid Lin - 2 # 100 ms 147518a1742SDavid Lin default: 0 148518a1742SDavid Lin 149518a1742SDavid Lin nuvoton,jack-eject-debounce: 150518a1742SDavid Lin $ref: /schemas/types.yaml#/definitions/uint32 151518a1742SDavid Lin description: 152518a1742SDavid Lin Jack ejection debounce time. 153518a1742SDavid Lin enum: 154518a1742SDavid Lin - 0 # 0 ms 155518a1742SDavid Lin - 1 # 1 ms 156518a1742SDavid Lin - 2 # 10 ms 157518a1742SDavid Lin default: 1 158518a1742SDavid Lin 159518a1742SDavid Linrequired: 160518a1742SDavid Lin - compatible 161518a1742SDavid Lin - reg 162518a1742SDavid Lin 163518a1742SDavid LinunevaluatedProperties: false 164518a1742SDavid Lin 165518a1742SDavid Linexamples: 166518a1742SDavid Lin - | 167518a1742SDavid Lin #include <dt-bindings/gpio/gpio.h> 168518a1742SDavid Lin #include <dt-bindings/interrupt-controller/irq.h> 169518a1742SDavid Lin i2c { 170518a1742SDavid Lin #address-cells = <1>; 171518a1742SDavid Lin #size-cells = <0>; 172518a1742SDavid Lin codec@1a { 173518a1742SDavid Lin #sound-dai-cells = <0>; 174518a1742SDavid Lin compatible = "nuvoton,nau8824"; 175518a1742SDavid Lin reg = <0x1a>; 176518a1742SDavid Lin interrupt-parent = <&gpio>; 177518a1742SDavid Lin interrupts = <38 IRQ_TYPE_LEVEL_LOW>; 178518a1742SDavid Lin nuvoton,vref-impedance = <2>; 179518a1742SDavid Lin nuvoton,micbias-voltage = <6>; 180518a1742SDavid Lin nuvoton,sar-threshold-num = <4>; 181518a1742SDavid Lin // Setup 4 buttons impedance according to Android specification 182518a1742SDavid Lin nuvoton,sar-threshold = <0xc 0x1e 0x38 0x60>; 183518a1742SDavid Lin nuvoton,sar-hysteresis = <0>; 184518a1742SDavid Lin nuvoton,sar-voltage = <6>; 185518a1742SDavid Lin nuvoton,sar-compare-time = <1>; 186518a1742SDavid Lin nuvoton,sar-sampling-time = <1>; 187518a1742SDavid Lin nuvoton,short-key-debounce = <0>; 188518a1742SDavid Lin nuvoton,jack-eject-debounce = <1>; 189518a1742SDavid Lin }; 190518a1742SDavid Lin }; 191