Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 1bc40efdaf4a
("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: aab1ad11d69f ("ASoC: nau8821: new driver")
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Link: https://patch.msgid.link/20251003-nau8821-jdet-fixes-v1-4-f7b0e2543f09@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Cristian Ciocaltea and committed by
Mark Brown
2b4eda7b a698679f

+27 -6
+27 -6
sound/soc/codecs/nau8821.c
··· 26 26 #include <sound/tlv.h> 27 27 #include "nau8821.h" 28 28 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) 30 31 31 32 static int nau8821_quirk; 32 33 static int quirk_override = -1; ··· 1178 1177 regmap_update_bits(regmap, NAU8821_R1D_I2S_PCM_CTRL2, 1179 1178 NAU8821_I2S_MS_MASK, NAU8821_I2S_MS_SLAVE); 1180 1179 1181 - /* Not bypass de-bounce circuit */ 1182 - regmap_update_bits(regmap, NAU8821_R0D_JACK_DET_CTRL, 1183 - NAU8821_JACK_DET_DB_BYPASS, 0); 1180 + /* Do not bypass de-bounce circuit */ 1181 + if (!(nau8821_quirk & NAU8821_QUIRK_JD_DB_BYPASS)) 1182 + regmap_update_bits(regmap, NAU8821_R0D_JACK_DET_CTRL, 1183 + NAU8821_JACK_DET_DB_BYPASS, 0); 1184 1184 1185 1185 /* Unmask & enable the ejection IRQs */ 1186 1186 regmap_update_bits(regmap, NAU8821_R0F_INTERRUPT_MASK, ··· 1866 1864 DMI_MATCH(DMI_SYS_VENDOR, "Positivo Tecnologia SA"), 1867 1865 DMI_MATCH(DMI_BOARD_NAME, "CW14Q01P-V2"), 1868 1866 }, 1869 - .driver_data = (void *)(NAU8821_JD_ACTIVE_HIGH), 1867 + .driver_data = (void *)(NAU8821_QUIRK_JD_ACTIVE_HIGH), 1868 + }, 1869 + { 1870 + /* Valve Steam Deck LCD */ 1871 + .matches = { 1872 + DMI_MATCH(DMI_SYS_VENDOR, "Valve"), 1873 + DMI_MATCH(DMI_PRODUCT_NAME, "Jupiter"), 1874 + }, 1875 + .driver_data = (void *)(NAU8821_QUIRK_JD_DB_BYPASS), 1876 + }, 1877 + { 1878 + /* Valve Steam Deck OLED */ 1879 + .matches = { 1880 + DMI_MATCH(DMI_SYS_VENDOR, "Valve"), 1881 + DMI_MATCH(DMI_PRODUCT_NAME, "Galileo"), 1882 + }, 1883 + .driver_data = (void *)(NAU8821_QUIRK_JD_DB_BYPASS), 1870 1884 }, 1871 1885 {} 1872 1886 }; ··· 1924 1906 1925 1907 nau8821_check_quirks(); 1926 1908 1927 - if (nau8821_quirk & NAU8821_JD_ACTIVE_HIGH) 1909 + if (nau8821_quirk & NAU8821_QUIRK_JD_ACTIVE_HIGH) 1928 1910 nau8821->jkdet_polarity = 0; 1911 + 1912 + if (nau8821_quirk & NAU8821_QUIRK_JD_DB_BYPASS) 1913 + dev_dbg(dev, "Force bypassing jack detection debounce circuit\n"); 1929 1914 1930 1915 nau8821_print_device_properties(nau8821); 1931 1916