927eaa2
From 74f829a6e44fe217b6161f8935524fc807be0648 Mon Sep 17 00:00:00 2001
927eaa2
From: Chris Wilson <chris@chris-wilson.co.uk>
927eaa2
Date: Sat, 9 Jul 2016 11:01:20 +0100
927eaa2
Subject: [PATCH] drm/i915: Acquire audio powerwell for HD-Audio registers
927eaa2
927eaa2
On Haswell/Broadwell, the HD-Audio block is inside the HDMI/display
927eaa2
power well and so the sna-hda audio codec acquires the display power
927eaa2
well while it is operational. However, Skylake separates the powerwells
927eaa2
again, but yet we still need the audio powerwell to setup the registers.
927eaa2
(But then the hardware uses those registers even while powered off???)
927eaa2
927eaa2
v2: Grab both rpm wakelock and audio wakelock
927eaa2
927eaa2
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96214
927eaa2
Fixes: 03b135cebc47 "ALSA: hda - remove dependency on i915 power well for SKL")
927eaa2
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
927eaa2
Cc: Libin Yang <libin.yang@intel.com>
927eaa2
Cc: Takashi Iwai <tiwai@suse.de>
927eaa2
Cc: Marius Vlad <marius.c.vlad@intel.com>
927eaa2
---
927eaa2
 drivers/gpu/drm/i915/intel_audio.c | 6 ++++++
927eaa2
 1 file changed, 6 insertions(+)
927eaa2
927eaa2
diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c
927eaa2
index 5d5f6bc10e85..948a7a52e3f8 100644
927eaa2
--- a/drivers/gpu/drm/i915/intel_audio.c
927eaa2
+++ b/drivers/gpu/drm/i915/intel_audio.c
927eaa2
@@ -600,6 +600,8 @@ static void i915_audio_component_codec_wake_override(struct device *dev,
927eaa2
 	if (!IS_SKYLAKE(dev_priv) && !IS_KABYLAKE(dev_priv))
927eaa2
 		return;
927eaa2
 
927eaa2
+	i915_audio_component_get_power(dev);
927eaa2
+
927eaa2
 	/*
927eaa2
 	 * Enable/disable generating the codec wake signal, overriding the
927eaa2
 	 * internal logic to generate the codec wake to controller.
927eaa2
@@ -615,6 +617,8 @@ static void i915_audio_component_codec_wake_override(struct device *dev,
927eaa2
 		I915_WRITE(HSW_AUD_CHICKENBIT, tmp);
927eaa2
 		usleep_range(1000, 1500);
927eaa2
 	}
927eaa2
+
927eaa2
+	i915_audio_component_put_power(dev);
927eaa2
 }
927eaa2
 
927eaa2
 /* Get CDCLK in kHz  */
927eaa2
@@ -648,6 +652,7 @@ static int i915_audio_component_sync_audio_rate(struct device *dev,
927eaa2
 	    !IS_HASWELL(dev_priv))
927eaa2
 		return 0;
927eaa2
 
927eaa2
+	i915_audio_component_get_power(dev);
927eaa2
 	mutex_lock(&dev_priv->av_mutex);
927eaa2
 	/* 1. get the pipe */
927eaa2
 	intel_encoder = dev_priv->dig_port_map[port];
927eaa2
@@ -698,6 +703,7 @@ static int i915_audio_component_sync_audio_rate(struct device *dev,
927eaa2
 
927eaa2
  unlock:
927eaa2
 	mutex_unlock(&dev_priv->av_mutex);
927eaa2
+	i915_audio_component_put_power(dev);
927eaa2
 	return err;
927eaa2
 }
927eaa2
 
927eaa2
-- 
927eaa2
2.8.1
927eaa2