Skip to content

Commit 6ddc2f7

Browse files
mkumardtiwai
authored andcommitted
ALSA: hda: Avoid unsol event during RPM suspending
There is a corner case with unsol event handling during codec runtime suspending state. When the codec runtime suspend call initiated, the codec->in_pm atomic variable would be 0, currently the codec runtime suspend function calls snd_hdac_enter_pm() which will just increments the codec->in_pm atomic variable. Consider unsol event happened just after this step and before snd_hdac_leave_pm() in the codec runtime suspend function. The snd_hdac_power_up_pm() in the unsol event flow in hdmi_present_sense_via_verbs() function would just increment the codec->in_pm atomic variable without calling pm_runtime_get_sync function. As codec runtime suspend flow is already in progress and in parallel unsol event is also accessing the codec verbs, as soon as codec suspend flow completes and clocks are switched off before completing the unsol event handling as both functions doesn't wait for each other. This will result in below errors [ 589.428020] tegra-hda 3510000.hda: azx_get_response timeout, switching to polling mode: last cmd=0x505f2f57 [ 589.428344] tegra-hda 3510000.hda: spurious response 0x80000074:0x5, last cmd=0x505f2f57 [ 589.428547] tegra-hda 3510000.hda: spurious response 0x80000065:0x5, last cmd=0x505f2f57 To avoid this, the unsol event flow should not perform any codec verb related operations during RPM_SUSPENDING state. Signed-off-by: Mohan Kumar <mkumard@nvidia.com> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20220329155940.26331-1-mkumard@nvidia.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent f30741c commit 6ddc2f7

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

sound/pci/hda/patch_hdmi.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1625,6 +1625,7 @@ static void hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin,
16251625
struct hda_codec *codec = per_pin->codec;
16261626
struct hdmi_spec *spec = codec->spec;
16271627
struct hdmi_eld *eld = &spec->temp_eld;
1628+
struct device *dev = hda_codec_dev(codec);
16281629
hda_nid_t pin_nid = per_pin->pin_nid;
16291630
int dev_id = per_pin->dev_id;
16301631
/*
@@ -1638,8 +1639,13 @@ static void hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin,
16381639
int present;
16391640
int ret;
16401641

1642+
#ifdef CONFIG_PM
1643+
if (dev->power.runtime_status == RPM_SUSPENDING)
1644+
return;
1645+
#endif
1646+
16411647
ret = snd_hda_power_up_pm(codec);
1642-
if (ret < 0 && pm_runtime_suspended(hda_codec_dev(codec)))
1648+
if (ret < 0 && pm_runtime_suspended(dev))
16431649
goto out;
16441650

16451651
present = snd_hda_jack_pin_sense(codec, pin_nid, dev_id);

0 commit comments

Comments
 (0)