1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #ifndef __DRIVERS_I2C_NAU8825_CHIP_H__
4 #define __DRIVERS_I2C_NAU8825_CHIP_H__
6 #include <acpi/acpi_device.h>
8 #define NAU8825_MAX_BUTTONS 8
11 * Nuvoton NAU8825 audio codec devicetree bindings
12 * linux/Documentation/devicetree/bindings/sound/nau8825.txt
14 struct drivers_i2c_nau8825_config
{
15 /* Interrupt configuration */
17 struct acpi_gpio irq_gpio
;
19 /* I2C Bus Frequency in Hertz (default 400kHz) */
20 unsigned int bus_speed
;
22 /* Enable jack detection via JKDET pin */
23 unsigned int jkdet_enable
;
25 /* Enable JKDET pin pull if set, otherwise high impedance state */
26 unsigned int jkdet_pull_enable
;
28 /* Pull-up JKDET pin if set, otherwise pull down */
29 unsigned int jkdet_pull_up
;
31 /* JKDET pin polarity, 0 => active high, 1 => active low */
32 unsigned int jkdet_polarity
;
35 * VREF Impedance selection
41 unsigned int vref_impedance
;
43 /* Button impedance measurement hysteresis */
44 unsigned int sar_hysteresis
;
47 * Reference voltage for button impedance measurement and micbias
57 unsigned int micbias_voltage
;
58 unsigned int sar_voltage
;
67 unsigned int sar_compare_time
;
76 unsigned int sar_sampling_time
;
79 * Button short key press debounce time
85 unsigned int short_key_debounce
;
87 /* Debounce time 2^(n+2) ms (0-7) for jack insert */
88 unsigned int jack_insert_debounce
;
90 /* Debounce time 2^(n+2) ms (0-7) for jack eject */
91 unsigned int jack_eject_debounce
;
93 /* Number of buttons supported, up to 8 */
94 unsigned int sar_threshold_num
;
97 * Impedance threshold for each button, up to 8
98 * SAR = 255 * micbias_voltage / sar_voltage * R / (2000 + R)
99 * R is Button impedance
101 uint64_t sar_threshold
[NAU8825_MAX_BUTTONS
];
103 /* Make the drive strength of ADCOUT IO PIN strong if set.
104 * Otherwise, the drive keeps normal strength.
109 #endif /* __DRIVERS_I2C_NAU8825_CHIP_H__ */