[4/4] ALSA: hda - Wake the codec up on hotplug notify events
diff mbox

Message ID 1437465447-8974-5-git-send-email-david.henningsson@canonical.com
State New
Headers show

Commit Message

David Henningsson July 21, 2015, 7:57 a.m. UTC
As a first cautious step, we're not going to trust the information
coming directly from the i915 driver, we're just going to use
the fact that there was an event to wakeup the codec and ask for
its status.

This fixes the issue with lost unsol events in power save mode,
the codec and controller can now sleep in D3 and still know when
the HDMI monitor has been connected.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
---
 sound/pci/hda/patch_hdmi.c |   22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

Patch
diff mbox

diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 2f24338..230d83d 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -2316,6 +2316,24 @@  static void haswell_set_power_state(struct hda_codec *codec, hda_nid_t fg,
 	snd_hda_codec_set_power_to_all(codec, fg, power_state);
 }
 
+static void intel_haswell_hotplug_notify(struct hdac_device *dev,
+					 const struct i915_audio_hotplug_info *info)
+{
+	struct hda_codec *codec = container_of(dev, struct hda_codec, core);
+	int pin_nid = info->port + 0x04;
+
+	check_presence_and_report(codec, pin_nid);
+}
+
+static void intel_valleyview_hotplug_notify(struct hdac_device *dev,
+					    const struct i915_audio_hotplug_info *info)
+{
+	struct hda_codec *codec = container_of(dev, struct hda_codec, core);
+	int pin_nid = 0x03; /* TODO: Ask Intel engineers to verify this */
+
+	check_presence_and_report(codec, pin_nid);
+}
+
 static int patch_generic_hdmi(struct hda_codec *codec)
 {
 	struct hdmi_spec *spec;
@@ -2331,7 +2349,9 @@  static int patch_generic_hdmi(struct hda_codec *codec)
 	if (is_haswell_plus(codec)) {
 		intel_haswell_enable_all_pins(codec, true);
 		intel_haswell_fixup_enable_dp12(codec);
-	}
+		codec->core.hotplug_notify = intel_haswell_hotplug_notify;
+	} else if (is_valleyview_plus(codec))
+		codec->core.hotplug_notify = intel_valleyview_hotplug_notify;
 
 	/* For Valleyview/Cherryview, only the display codec is in the display
 	 * power well and can use link_power ops to request/release the power.