]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
ALSA: hda/hdmi - Consider eld_valid when reporting jack event
authorHui Wang <hui.wang@canonical.com>
Tue, 7 May 2019 02:57:00 +0000 (04:57 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 14 May 2019 12:57:45 +0000 (14:57 +0200)
BugLink: https://bugs.launchpad.net/bugs/1827967
On the machines with AMD GPU or Nvidia GPU, we often meet this issue:
after s3, there are 4 HDMI/DP audio devices in the gnome-sound-setting
even there is no any monitors plugged.

When this problem happens, we check the /proc/asound/cardX/eld#N.M, we
will find the monitor_present=1, eld_valid=0.

The root cause is BIOS or GPU driver makes the PRESENCE valid even no
monitor plugged, and of course the driver will not get the valid
eld_data subsequently.

In this situation, we should not report the jack_plugged event, to do
so, let us change the function hdmi_present_sense_via_verbs(). In this
function, it reads the pin_sense via snd_hda_pin_sense(), after
calling this function, the jack_dirty is 0, and before exiting
via_verbs(), we change the shadow pin_sense according to both
monitor_present and eld_valid, then in the snd_hda_jack_report_sync(),
since the jack_dirty is still 0, it will report jack event according
to this modified shadow pin_sense.

After this change, the driver will not report Jack_is_plugged event
through hdmi_present_sense_via_verbs() if monitor_present is 1 and
eld_valid is 0.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit 7f641e26a6df9269cb25dd7a4b0a91d6586ed441
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Acked-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
sound/pci/hda/patch_hdmi.c

index 3503ffbaa2a20160a1afcae4fb17ac8e76c7563c..34d7085dfca86f77085314a93bef8bde02d9169d 100644 (file)
@@ -1549,9 +1549,11 @@ static bool hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin,
        ret = !repoll || !eld->monitor_present || eld->eld_valid;
 
        jack = snd_hda_jack_tbl_get(codec, pin_nid);
-       if (jack)
+       if (jack) {
                jack->block_report = !ret;
-
+               jack->pin_sense = (eld->monitor_present && eld->eld_valid) ?
+                       AC_PINSENSE_PRESENCE : 0;
+       }
        mutex_unlock(&per_pin->lock);
        return ret;
 }