aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_cs8409.c
diff options
context:
space:
mode:
authorStefan Binding <sbinding@opensource.cirrus.com>2021-11-28 11:55:58 +0000
committerTakashi Iwai <tiwai@suse.de>2021-11-29 09:22:56 +0100
commit65cc4ad62a9ed47c0b4fcd7af667d97d7c29f19d (patch)
treec232ec28b7271958a3e7d11590bccc5f8ef71f7e /sound/pci/hda/patch_cs8409.c
parentMerge tag 'asoc-fix-v5.16-rc3' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus (diff)
downloadlinux-dev-65cc4ad62a9ed47c0b4fcd7af667d97d7c29f19d.tar.xz
linux-dev-65cc4ad62a9ed47c0b4fcd7af667d97d7c29f19d.zip
ALSA: hda/cs8409: Set PMSG_ON earlier inside cs8409 driver
For cs8409, it is required to run Jack Detect on resume. Jack Detect on cs8409+cs42l42 requires an interrupt from cs42l42 to be sent to cs8409 which is propogated to the driver via an unsolicited event. However, the hda_codec drops unsolicited events if the power_state is not set to PMSG_ON. Which is set at the end of the resume call. This means there is a race condition between setting power_state to PMSG_ON and receiving the interrupt. To solve this, we can add an API to set the power_state earlier and call that before we start Jack Detect. This does not cause issues, since we know inside our driver that we are already initialized, and ready to handle the unsolicited events. Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com> Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com> Cc: <stable@vger.kernel.org> # v5.15+ Link: https://lore.kernel.org/r/20211128115558.71683-1-vitalyr@opensource.cirrus.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to '')
-rw-r--r--sound/pci/hda/patch_cs8409.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_cs8409.c b/sound/pci/hda/patch_cs8409.c
index 31ff11ab868e..039b9f2f8e94 100644
--- a/sound/pci/hda/patch_cs8409.c
+++ b/sound/pci/hda/patch_cs8409.c
@@ -750,6 +750,11 @@ static void cs42l42_resume(struct sub_codec *cs42l42)
if (cs42l42->full_scale_vol)
cs8409_i2c_write(cs42l42, 0x2001, 0x01);
+ /* we have to explicitly allow unsol event handling even during the
+ * resume phase so that the jack event is processed properly
+ */
+ snd_hda_codec_allow_unsol_events(cs42l42->codec);
+
cs42l42_enable_jack_detect(cs42l42);
}