Skip to content

Commit 2b4eda7

Browse files
cristiccbroonie
authored andcommitted
ASoC: nau8821: Add DMI quirk to bypass jack debounce circuit
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]>
1 parent a698679 commit 2b4eda7

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;
@@ -1177,9 +1178,10 @@ static void nau8821_setup_inserted_irq(struct nau8821 *nau8821)
11771178
regmap_update_bits(regmap, NAU8821_R1D_I2S_PCM_CTRL2,
11781179
NAU8821_I2S_MS_MASK, NAU8821_I2S_MS_SLAVE);
11791180

1180-
/* Not bypass de-bounce circuit */
1181-
regmap_update_bits(regmap, NAU8821_R0D_JACK_DET_CTRL,
1182-
NAU8821_JACK_DET_DB_BYPASS, 0);
1181+
/* Do not bypass de-bounce circuit */
1182+
if (!(nau8821_quirk & NAU8821_QUIRK_JD_DB_BYPASS))
1183+
regmap_update_bits(regmap, NAU8821_R0D_JACK_DET_CTRL,
1184+
NAU8821_JACK_DET_DB_BYPASS, 0);
11831185

11841186
/* Unmask & enable the ejection IRQs */
11851187
regmap_update_bits(regmap, NAU8821_R0F_INTERRUPT_MASK,
@@ -1864,7 +1866,23 @@ static const struct dmi_system_id nau8821_quirk_table[] = {
18641866
DMI_MATCH(DMI_SYS_VENDOR, "Positivo Tecnologia SA"),
18651867
DMI_MATCH(DMI_BOARD_NAME, "CW14Q01P-V2"),
18661868
},
1867-
.driver_data = (void *)(NAU8821_JD_ACTIVE_HIGH),
1869+
.driver_data = (void *)(NAU8821_QUIRK_JD_ACTIVE_HIGH),
1870+
},
1871+
{
1872+
/* Valve Steam Deck LCD */
1873+
.matches = {
1874+
DMI_MATCH(DMI_SYS_VENDOR, "Valve"),
1875+
DMI_MATCH(DMI_PRODUCT_NAME, "Jupiter"),
1876+
},
1877+
.driver_data = (void *)(NAU8821_QUIRK_JD_DB_BYPASS),
1878+
},
1879+
{
1880+
/* Valve Steam Deck OLED */
1881+
.matches = {
1882+
DMI_MATCH(DMI_SYS_VENDOR, "Valve"),
1883+
DMI_MATCH(DMI_PRODUCT_NAME, "Galileo"),
1884+
},
1885+
.driver_data = (void *)(NAU8821_QUIRK_JD_DB_BYPASS),
18681886
},
18691887
{}
18701888
};
@@ -1906,9 +1924,12 @@ static int nau8821_i2c_probe(struct i2c_client *i2c)
19061924

19071925
nau8821_check_quirks();
19081926

1909-
if (nau8821_quirk & NAU8821_JD_ACTIVE_HIGH)
1927+
if (nau8821_quirk & NAU8821_QUIRK_JD_ACTIVE_HIGH)
19101928
nau8821->jkdet_polarity = 0;
19111929

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

19141935
nau8821_reset_chip(nau8821->regmap);

0 commit comments

Comments
 (0)