8e2d710
From 3fb329b2c3b6c2f009aa1255d2436ec49e49877f Mon Sep 17 00:00:00 2001
8e2d710
From: Takashi Iwai <tiwai@suse.de>
8e2d710
Date: Fri, 18 Mar 2016 15:10:08 +0100
8e2d710
Subject: [PATCH 1/3] ALSA: hda - Really restrict i915 notifier to HSW+
8e2d710
MIME-Version: 1.0
8e2d710
Content-Type: text/plain; charset=UTF-8
8e2d710
Content-Transfer-Encoding: 8bit
8e2d710
8e2d710
The commit [b62232d429fa: ALSA: hda - Limit i915 HDMI binding only for
8e2d710
HSW and later] tried to limit the usage of i915 audio notifier to the
8e2d710
recent Intel models and switch to the old method on pre-Haswell
8e2d710
models.  However, it assumed that the i915 component binding hasn't
8e2d710
been done on such models, and the assumption was wrong: namely,
8e2d710
Baytrail had already the i915 component binding due to powerwell
8e2d710
control.  Thus, the workaround wasn't applied to Baytrail.
8e2d710
8e2d710
For fixing this properly, this patch introduces a new flag indicating
8e2d710
the usage of audio notifier and codec_has_acomp() refers to this flag
8e2d710
instead of checking the existence of audio component.
8e2d710
8e2d710
Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
8e2d710
Cc: <stable@vger.kernel.org> # v4.5
8e2d710
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8e2d710
---
8e2d710
 sound/pci/hda/patch_hdmi.c | 24 +++++++++++++++++-------
8e2d710
 1 file changed, 17 insertions(+), 7 deletions(-)
8e2d710
8e2d710
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
8e2d710
index 49ee4e55dd16..8cdb804aa9cf 100644
8e2d710
--- a/sound/pci/hda/patch_hdmi.c
8e2d710
+++ b/sound/pci/hda/patch_hdmi.c
8e2d710
@@ -152,6 +152,7 @@ struct hdmi_spec {
8e2d710
 	struct hda_pcm_stream pcm_playback;
8e2d710
 
8e2d710
 	/* i915/powerwell (Haswell+/Valleyview+) specific */
8e2d710
+	bool use_acomp_notifier; /* use i915 eld_notify callback for hotplug */
8e2d710
 	struct i915_audio_component_audio_ops i915_audio_ops;
8e2d710
 	bool i915_bound; /* was i915 bound in this driver? */
8e2d710
 
8e2d710
@@ -159,8 +160,11 @@ struct hdmi_spec {
8e2d710
 };
8e2d710
 
8e2d710
 #ifdef CONFIG_SND_HDA_I915
8e2d710
-#define codec_has_acomp(codec) \
8e2d710
-	((codec)->bus->core.audio_component != NULL)
8e2d710
+static inline bool codec_has_acomp(struct hda_codec *codec)
8e2d710
+{
8e2d710
+	struct hdmi_spec *spec = codec->spec;
8e2d710
+	return spec->use_acomp_notifier;
8e2d710
+}
8e2d710
 #else
8e2d710
 #define codec_has_acomp(codec)	false
8e2d710
 #endif
8e2d710
@@ -2248,12 +2252,18 @@ static int patch_generic_hdmi(struct hda_codec *codec)
8e2d710
 	codec->spec = spec;
8e2d710
 	hdmi_array_init(spec, 4);
8e2d710
 
8e2d710
+#ifdef CONFIG_SND_HDA_I915
8e2d710
 	/* Try to bind with i915 for Intel HSW+ codecs (if not done yet) */
8e2d710
-	if (!codec_has_acomp(codec) &&
8e2d710
-	    (codec->core.vendor_id >> 16) == 0x8086 &&
8e2d710
-	    is_haswell_plus(codec))
8e2d710
-		if (!snd_hdac_i915_init(&codec->bus->core))
8e2d710
-			spec->i915_bound = true;
8e2d710
+	if ((codec->core.vendor_id >> 16) == 0x8086 &&
8e2d710
+	    is_haswell_plus(codec)) {
8e2d710
+		if (!codec->bus->core.audio_component)
8e2d710
+			if (!snd_hdac_i915_init(&codec->bus->core))
8e2d710
+				spec->i915_bound = true;
8e2d710
+		/* use i915 audio component notifier for hotplug */
8e2d710
+		if (codec->bus->core.audio_component)
8e2d710
+			spec->use_acomp_notifier = true;
8e2d710
+	}
8e2d710
+#endif
8e2d710
 
8e2d710
 	if (is_haswell_plus(codec)) {
8e2d710
 		intel_haswell_enable_all_pins(codec, true);
8e2d710
-- 
8e2d710
2.5.0
8e2d710