]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-4.4/alsa-hda-hdmi-consider-eld_valid-when-reporting-jack-event.patch
drop drm-rockchip-shutdown-drm-subsystem-on-shutdown.patch from 4.4.y and 4.9.y
[thirdparty/kernel/stable-queue.git] / queue-4.4 / alsa-hda-hdmi-consider-eld_valid-when-reporting-jack-event.patch
CommitLineData
0e6eeba7
GKH
1From 7f641e26a6df9269cb25dd7a4b0a91d6586ed441 Mon Sep 17 00:00:00 2001
2From: Hui Wang <hui.wang@canonical.com>
3Date: Mon, 6 May 2019 22:09:32 +0800
4Subject: ALSA: hda/hdmi - Consider eld_valid when reporting jack event
5
6From: Hui Wang <hui.wang@canonical.com>
7
8commit 7f641e26a6df9269cb25dd7a4b0a91d6586ed441 upstream.
9
10On the machines with AMD GPU or Nvidia GPU, we often meet this issue:
11after s3, there are 4 HDMI/DP audio devices in the gnome-sound-setting
12even there is no any monitors plugged.
13
14When this problem happens, we check the /proc/asound/cardX/eld#N.M, we
15will find the monitor_present=1, eld_valid=0.
16
17The root cause is BIOS or GPU driver makes the PRESENCE valid even no
18monitor plugged, and of course the driver will not get the valid
19eld_data subsequently.
20
21In this situation, we should not report the jack_plugged event, to do
22so, let us change the function hdmi_present_sense_via_verbs(). In this
23function, it reads the pin_sense via snd_hda_pin_sense(), after
24calling this function, the jack_dirty is 0, and before exiting
25via_verbs(), we change the shadow pin_sense according to both
26monitor_present and eld_valid, then in the snd_hda_jack_report_sync(),
27since the jack_dirty is still 0, it will report jack event according
28to this modified shadow pin_sense.
29
30After this change, the driver will not report Jack_is_plugged event
31through hdmi_present_sense_via_verbs() if monitor_present is 1 and
32eld_valid is 0.
33
34Signed-off-by: Hui Wang <hui.wang@canonical.com>
35Cc: <stable@vger.kernel.org>
36Signed-off-by: Takashi Iwai <tiwai@suse.de>
37Signed-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@@ -1636,9 +1636,11 @@ static bool hdmi_present_sense(struct hd
46 ret = !repoll || !pin_eld->monitor_present || pin_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 snd_hda_power_down_pm(codec);
58 return ret;