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