Skip to content

Commit af66058

Browse files
cristiccgregkh
authored andcommitted
ASoC: nau8821: Add DMI quirk to bypass jack debounce circuit
[ Upstream commit 2b4eda7 ] Stress testing the audio jack hotplug handling on a few Steam Deck units revealed that the debounce circuit is responsible for having a negative impact on the detection reliability, e.g. in some cases the ejection interrupt is not fired, while in other instances it goes into a kind of invalid state and generates a flood of misleading interrupts. Add new entries to the DMI table introduced via commit 1bc40ef ("ASoC: nau8821: Add DMI quirk mechanism for active-high jack-detect") and extend the quirk logic to allow bypassing the debounce circuit used for jack detection on Valve Steam Deck LCD and OLED models. While at it, rename existing NAU8821_JD_ACTIVE_HIGH quirk bitfield to NAU8821_QUIRK_JD_ACTIVE_HIGH. This should help improve code readability by differentiating from similarly named register bits. Fixes: aab1ad1 ("ASoC: nau8821: new driver") Signed-off-by: Cristian Ciocaltea <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 129cef0 commit af66058

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

sound/soc/codecs/nau8821.c

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
#include <sound/tlv.h>
2727
#include "nau8821.h"
2828

29-
#define NAU8821_JD_ACTIVE_HIGH BIT(0)
29+
#define NAU8821_QUIRK_JD_ACTIVE_HIGH BIT(0)
30+
#define NAU8821_QUIRK_JD_DB_BYPASS BIT(1)
3031

3132
static int nau8821_quirk;
3233
static int quirk_override = -1;
@@ -1166,9 +1167,10 @@ static void nau8821_setup_inserted_irq(struct nau8821 *nau8821)
11661167
regmap_update_bits(regmap, NAU8821_R1D_I2S_PCM_CTRL2,
11671168
NAU8821_I2S_MS_MASK, NAU8821_I2S_MS_SLAVE);
11681169

1169-
/* Not bypass de-bounce circuit */
1170-
regmap_update_bits(regmap, NAU8821_R0D_JACK_DET_CTRL,
1171-
NAU8821_JACK_DET_DB_BYPASS, 0);
1170+
/* Do not bypass de-bounce circuit */
1171+
if (!(nau8821_quirk & NAU8821_QUIRK_JD_DB_BYPASS))
1172+
regmap_update_bits(regmap, NAU8821_R0D_JACK_DET_CTRL,
1173+
NAU8821_JACK_DET_DB_BYPASS, 0);
11721174

11731175
regmap_update_bits(regmap, NAU8821_R0F_INTERRUPT_MASK,
11741176
NAU8821_IRQ_EJECT_EN, 0);
@@ -1863,7 +1865,23 @@ static const struct dmi_system_id nau8821_quirk_table[] = {
18631865
DMI_MATCH(DMI_SYS_VENDOR, "Positivo Tecnologia SA"),
18641866
DMI_MATCH(DMI_BOARD_NAME, "CW14Q01P-V2"),
18651867
},
1866-
.driver_data = (void *)(NAU8821_JD_ACTIVE_HIGH),
1868+
.driver_data = (void *)(NAU8821_QUIRK_JD_ACTIVE_HIGH),
1869+
},
1870+
{
1871+
/* Valve Steam Deck LCD */
1872+
.matches = {
1873+
DMI_MATCH(DMI_SYS_VENDOR, "Valve"),
1874+
DMI_MATCH(DMI_PRODUCT_NAME, "Jupiter"),
1875+
},
1876+
.driver_data = (void *)(NAU8821_QUIRK_JD_DB_BYPASS),
1877+
},
1878+
{
1879+
/* Valve Steam Deck OLED */
1880+
.matches = {
1881+
DMI_MATCH(DMI_SYS_VENDOR, "Valve"),
1882+
DMI_MATCH(DMI_PRODUCT_NAME, "Galileo"),
1883+
},
1884+
.driver_data = (void *)(NAU8821_QUIRK_JD_DB_BYPASS),
18671885
},
18681886
{}
18691887
};
@@ -1905,9 +1923,12 @@ static int nau8821_i2c_probe(struct i2c_client *i2c)
19051923

19061924
nau8821_check_quirks();
19071925

1908-
if (nau8821_quirk & NAU8821_JD_ACTIVE_HIGH)
1926+
if (nau8821_quirk & NAU8821_QUIRK_JD_ACTIVE_HIGH)
19091927
nau8821->jkdet_polarity = 0;
19101928

1929+
if (nau8821_quirk & NAU8821_QUIRK_JD_DB_BYPASS)
1930+
dev_dbg(dev, "Force bypassing jack detection debounce circuit\n");
1931+
19111932
nau8821_print_device_properties(nau8821);
19121933

19131934
nau8821_reset_chip(nau8821->regmap);

0 commit comments

Comments
 (0)