]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.19/alsa-hda-hdmi-consider-eld_valid-when-reporting-jack-event.patch
Linux 4.14.121
[thirdparty/kernel/stable-queue.git] / queue-4.19 / alsa-hda-hdmi-consider-eld_valid-when-reporting-jack-event.patch
1 From 7f641e26a6df9269cb25dd7a4b0a91d6586ed441 Mon Sep 17 00:00:00 2001
2 From: Hui Wang <hui.wang@canonical.com>
3 Date: Mon, 6 May 2019 22:09:32 +0800
4 Subject: ALSA: hda/hdmi - Consider eld_valid when reporting jack event
5
6 From: Hui Wang <hui.wang@canonical.com>
7
8 commit 7f641e26a6df9269cb25dd7a4b0a91d6586ed441 upstream.
9
10 On the machines with AMD GPU or Nvidia GPU, we often meet this issue:
11 after s3, there are 4 HDMI/DP audio devices in the gnome-sound-setting
12 even there is no any monitors plugged.
13
14 When this problem happens, we check the /proc/asound/cardX/eld#N.M, we
15 will find the monitor_present=1, eld_valid=0.
16
17 The root cause is BIOS or GPU driver makes the PRESENCE valid even no
18 monitor plugged, and of course the driver will not get the valid
19 eld_data subsequently.
20
21 In this situation, we should not report the jack_plugged event, to do
22 so, let us change the function hdmi_present_sense_via_verbs(). In this
23 function, it reads the pin_sense via snd_hda_pin_sense(), after
24 calling this function, the jack_dirty is 0, and before exiting
25 via_verbs(), we change the shadow pin_sense according to both
26 monitor_present and eld_valid, then in the snd_hda_jack_report_sync(),
27 since the jack_dirty is still 0, it will report jack event according
28 to this modified shadow pin_sense.
29
30 After this change, the driver will not report Jack_is_plugged event
31 through hdmi_present_sense_via_verbs() if monitor_present is 1 and
32 eld_valid is 0.
33
34 Signed-off-by: Hui Wang <hui.wang@canonical.com>
35 Cc: <stable@vger.kernel.org>
36 Signed-off-by: Takashi Iwai <tiwai@suse.de>
37 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
38
39 ---
40 sound/pci/hda/patch_hdmi.c | 6 ++++--
41 1 file changed, 4 insertions(+), 2 deletions(-)
42
43 --- a/sound/pci/hda/patch_hdmi.c
44 +++ b/sound/pci/hda/patch_hdmi.c
45 @@ -1548,9 +1548,11 @@ static bool hdmi_present_sense_via_verbs
46 ret = !repoll || !eld->monitor_present || eld->eld_valid;
47
48 jack = snd_hda_jack_tbl_get(codec, pin_nid);
49 - if (jack)
50 + if (jack) {
51 jack->block_report = !ret;
52 -
53 + jack->pin_sense = (eld->monitor_present && eld->eld_valid) ?
54 + AC_PINSENSE_PRESENCE : 0;
55 + }
56 mutex_unlock(&per_pin->lock);
57 return ret;
58 }