[Xenial,2/3] ALSA: hda - hdmi add wmb barrier for audio component
diff mbox

Message ID 1467769687-4777-3-git-send-email-hui.wang@canonical.com
State New
Headers show

Commit Message

Hui Wang July 6, 2016, 1:48 a.m. UTC
From: Libin Yang <libin.yang@linux.intel.com>

BugLink: http://bugs.launchpad.net/bugs/1596871

To make sure audio_ptr is set before intel_audio_codec_enable()
or intel_audio_codec_disable() calling pin_eld_notify(),
this patch adds wmb barrier to prevent optimizing.

Signed-off-by: Libin Yang <libin.yang@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit ec75a940b1037e877efd9a5a9e94eab1e464f73b)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
---
 sound/pci/hda/patch_hdmi.c | 5 +++++
 1 file changed, 5 insertions(+)

Patch
diff mbox

diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 5b6caca..d465ec8 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -2395,6 +2395,11 @@  static int patch_generic_hdmi(struct hda_codec *codec)
 	if (is_haswell_plus(codec) || is_valleyview_plus(codec)) {
 		codec->depop_delay = 0;
 		spec->i915_audio_ops.audio_ptr = codec;
+		/* intel_audio_codec_enable() or intel_audio_codec_disable()
+		 * will call pin_eld_notify with using audio_ptr pointer
+		 * We need make sure audio_ptr is really setup
+		 */
+		wmb();
 		spec->i915_audio_ops.pin_eld_notify = intel_pin_eld_notify;
 		snd_hdac_i915_register_notifier(&spec->i915_audio_ops);
 	}