1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #ifndef __DRIVERS_I2C_CS42L42_CHIP_H__
4 #define __DRIVERS_I2C_CS42L42_CHIP_H__
6 #include <acpi/acpi_device.h>
8 enum cs42l42_ts_dbnc_rise
{
19 enum cs42l42_ts_dbnc_fall
{
30 enum cs42l42_hs_bias_ramp_rate
{
31 HSBIAS_RAMP_FAST_RISE_SLOW_FALL
= 0,
34 HSBIAS_RAMP_SLOWEST
= 3,
38 * Cirrus Logic CS42L42 Audio Codec devicetree bindings
39 * linux/Documentation/devicetree/bindings/sound/cs42l42.txt
41 struct drivers_i2c_cs42l42_config
{
42 /* Interrupt configuration */
45 /* Use GPIO based interrupt instead of PIRQ */
46 struct acpi_gpio irq_gpio
;
48 /* Use GPIO based reset gpio */
49 struct acpi_gpio reset_gpio
;
51 /* I2C Bus Frequency in Hertz (default 400kHz) */
52 unsigned int bus_speed
;
54 /* Define cs42L42 parameters */
56 * cirrus,ts-inv : Boolean property. For jacks that invert the tip sense
57 * polarity. Normal jacks will short tip sense pin to HS1 when headphones are
58 * plugged in and leave tip sense floating when not plugged in. Inverting jacks
59 * short tip sense when unplugged and float when plugged in.
60 * false = Non-inverted
62 * Default = Non-inverted
66 * cirrus,ts-dbnc-rise : Debounce the rising edge of TIP_SENSE_PLUG. With no
67 * debounce, the tip sense pin might be noisy on a plug event.
68 * Default = RISE_DEB_1000_MS
70 enum cs42l42_ts_dbnc_rise ts_dbnc_rise
;
72 * cirrus,ts-dbnc-fall : Debounce the falling edge of TIP_SENSE_UNPLUG.
73 * With no debounce, the tip sense pin might be noisy on an unplug event.
74 * Default = FALL_DEB_1000_MS
76 enum cs42l42_ts_dbnc_fall ts_dbnc_fall
;
78 * cirrus,btn-det-init-dbnce : This sets how long the driver sleeps after
79 * enabling button detection interrupts. After auto-detection and before
80 * servicing button interrupts, the HS bias needs time to settle. If you
81 * don't wait, there is possibility for erroneous button interrupt.
82 * Value in ms, 0 - 200.
85 unsigned int btn_det_init_dbnce
;
87 * cirrus,btn-det-event-dbnce : This sets how long the driver delays after
88 * receiving a button press interrupt. With level detect interrupts, you want
89 * to wait a small amount of time to make sure the button press is making a
90 * clean connection with the bias resistors.
91 * Value in ms, 0 - 20.
94 unsigned int btn_det_event_dbnce
;
96 * cirrus,bias-lvls : For a level-detect headset button scheme, each button
97 * will bias the mic pin to a certain voltage. To determine which button was
98 * pressed, the driver will compare this biased voltage to sequential,
99 * decreasing voltages and will stop when a comparator is tripped,
100 * indicating a comparator voltage < bias voltage. This value represents a
101 * percentage of the internally generated HS bias voltage. For different
102 * hardware setups, a designer might want to tweak this. This is an array of
103 * descending values for the comparator voltage.
107 * Default = < 15 8 4 1>
109 uint64_t bias_lvls
[4];
110 /* headset bias ramp rate */
111 enum cs42l42_hs_bias_ramp_rate hs_bias_ramp_rate
;
113 * cirrus,hs-bias-sense-disable: This is boolean property. If present the
114 * HSBIAS sense is disabled. Configures HSBIAS output current sense through
115 * the external 2.21-k resistor. HSBIAS_SENSE is hardware feature to reduce
116 * the potential pop noise during the headset plug out slowly. But on some
117 * platforms ESD voltage will affect it causing test to fail, especially
118 * with CTIA headset type. For different hardware setups, a designer might
119 * want to tweak default behavior.
121 bool hs_bias_sense_disable
;
124 #endif /* __DRIVERS_I2C_CS42L42_CHIP_H__ */