The default jack detection type overridden by sof_sdw_quirk

From: Chris Chiu
Date: Wed Oct 13 2021 - 06:01:23 EST


Hi,
I have an Intel AlderLake machine which uses the sof-soundwire
driver for audio functions. When the headset is plugged in, it will
incorrectly trigger the event KEY_PLAYPAUSE and never stops. To fix
the problem, I used to apply the quirk RT711_JD2 proposed in
sound/soc/intel/boards/sof_sdw.c and the jack detect function will
work as expected.
However, when I look into the code of sound/soc/codecs/rt711.c and
rt711-sdca.c, the default value for jd_src
(https://github.com/torvalds/linux/blob/master/sound/soc/codecs/rt711.c#L1209)
is already RT711_JD2, which means it is overridden by other drivers.
After digging deeper, the jd_src value is overridden by
rt711_add_codec_device_props() with the value RT711_JD1 comes from
sof_sdw_quirk.
Is there any reason why sof_sdw_quirk is assigned with RT711_JD1
by default? Can I simply fix it by assigning the sof_sdw_quirk to
RT711_JD_NULL as follows?
-unsigned long sof_sdw_quirk = RT711_JD1;
+unsigned long sof_sdw_quirk = RT711_JD_NULL;

Please let me know if there's any potential problem I didn't
notice and suggest if there's any better solution. Thanks

Chris