Home Home > GIT Browse > SLE15-SP1-UPDATE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-05-17 15:33:05 +0200
committerTakashi Iwai <tiwai@suse.de>2019-05-17 15:33:05 +0200
commit09863d30bd7399fa7fbe23f547a592093ecb4baf (patch)
tree86d5a99c3ceabd5e639d3ed1942694fc2cd8bb08
parent43cb3c80c70d6f496165f1cf5101080783768092 (diff)
drm/i915: Force 2*96 MHz cdclk on glk/cnl when audio power isSLE15-SP1-UPDATE
enabled (bsc#1111666).
-rw-r--r--patches.drm/drm-i915-Force-2-96-MHz-cdclk-on-glk-cnl-when-audio-.patch271
-rw-r--r--series.conf1
2 files changed, 272 insertions, 0 deletions
diff --git a/patches.drm/drm-i915-Force-2-96-MHz-cdclk-on-glk-cnl-when-audio-.patch b/patches.drm/drm-i915-Force-2-96-MHz-cdclk-on-glk-cnl-when-audio-.patch
new file mode 100644
index 0000000000..d5ca7b05b6
--- /dev/null
+++ b/patches.drm/drm-i915-Force-2-96-MHz-cdclk-on-glk-cnl-when-audio-.patch
@@ -0,0 +1,271 @@
+From 905801fe72377b4dc53c6e13eea1a91c6a4aa0c4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= <ville.syrjala@linux.intel.com>
+Date: Wed, 20 Mar 2019 15:54:36 +0200
+Subject: [PATCH] drm/i915: Force 2*96 MHz cdclk on glk/cnl when audio power is enabled
+Mime-version: 1.0
+Content-type: text/plain; charset=UTF-8
+Content-transfer-encoding: 8bit
+Git-commit: 905801fe72377b4dc53c6e13eea1a91c6a4aa0c4
+Patch-mainline: v5.2-rc1
+References: bsc#1111666
+
+[ Backport note: slightly modified the context to apply cleanly without the
+ prerequisite changes (d31c85fc8642) about display power cookie.
+ The actual regression report is found in bko#203623 -- tiwai ]
+
+CDCLK has to be at least twice the BLCK regardless of audio. Audio
+driver has to probe using this hook and increase the clock even in
+absence of any display.
+
+V2: Use atomic refcount for get_power, put_power so that we can call each once(Abhay).
+V3: Reset power well 2 to avoid any transaction on iDisp link during cdclk change(Abhay).
+V4: Remove Power well 2 reset workaround(Ville).
+V5: Remove unwanted Power well 2 register defined in v4(Abhay).
+V6:
+- Use a dedicated flag instead of state->modeset for min CDCLK changes
+- Make get/put audio power domain symmetric
+- Rebased on top of intel_wakeref tracking changes.
+
+Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
+Signed-off-by: Abhay Kumar <abhay.kumar@intel.com>
+Tested-by: Abhay Kumar <abhay.kumar@intel.com>
+Signed-off-by: Imre Deak <imre.deak@intel.com>
+Reviewed-by: Clint Taylor <Clinton.A.Taylor@intel.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20190320135439.12201-1-imre.deak@intel.com
+Acked-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ drivers/gpu/drm/i915/i915_drv.h | 3 +
+ drivers/gpu/drm/i915/intel_audio.c | 57 +++++++++++++++++++++++++++++++++++
+ drivers/gpu/drm/i915/intel_cdclk.c | 30 ++++++------------
+ drivers/gpu/drm/i915/intel_display.c | 9 ++++-
+ drivers/gpu/drm/i915/intel_drv.h | 3 +
+ 5 files changed, 81 insertions(+), 21 deletions(-)
+
+--- a/drivers/gpu/drm/i915/i915_drv.h
++++ b/drivers/gpu/drm/i915/i915_drv.h
+@@ -1732,6 +1732,8 @@ struct drm_i915_private {
+ struct intel_cdclk_state actual;
+ /* The current hardware cdclk state */
+ struct intel_cdclk_state hw;
++
++ int force_min_cdclk;
+ } cdclk;
+
+ /**
+@@ -1852,6 +1854,7 @@ struct drm_i915_private {
+ *
+ */
+ struct mutex av_mutex;
++ int audio_power_refcount;
+
+ struct {
+ struct mutex mutex;
+--- a/drivers/gpu/drm/i915/intel_audio.c
++++ b/drivers/gpu/drm/i915/intel_audio.c
+@@ -742,13 +742,70 @@ void intel_init_audio_hooks(struct drm_i
+ }
+ }
+
++static void glk_force_audio_cdclk(struct drm_i915_private *dev_priv,
++ bool enable)
++{
++ struct drm_modeset_acquire_ctx ctx;
++ struct drm_atomic_state *state;
++ int ret;
++
++ drm_modeset_acquire_init(&ctx, 0);
++ state = drm_atomic_state_alloc(&dev_priv->drm);
++ if (WARN_ON(!state))
++ return;
++
++ state->acquire_ctx = &ctx;
++
++retry:
++ to_intel_atomic_state(state)->cdclk.force_min_cdclk_changed = true;
++ to_intel_atomic_state(state)->cdclk.force_min_cdclk =
++ enable ? 2 * 96000 : 0;
++
++ /*
++ * Protects dev_priv->cdclk.force_min_cdclk
++ * Need to lock this here in case we have no active pipes
++ * and thus wouldn't lock it during the commit otherwise.
++ */
++ ret = drm_modeset_lock(&dev_priv->drm.mode_config.connection_mutex,
++ &ctx);
++ if (!ret)
++ ret = drm_atomic_commit(state);
++
++ if (ret == -EDEADLK) {
++ drm_atomic_state_clear(state);
++ drm_modeset_backoff(&ctx);
++ goto retry;
++ }
++
++ WARN_ON(ret);
++
++ drm_atomic_state_put(state);
++
++ drm_modeset_drop_locks(&ctx);
++ drm_modeset_acquire_fini(&ctx);
++}
++
+ static void i915_audio_component_get_power(struct device *kdev)
+ {
++ struct drm_i915_private *dev_priv = kdev_to_i915(kdev);
++
+ intel_display_power_get(kdev_to_i915(kdev), POWER_DOMAIN_AUDIO);
++
++ /* Force CDCLK to 2*BCLK as long as we need audio to be powered. */
++ if (dev_priv->audio_power_refcount++ == 0)
++ if (IS_CANNONLAKE(dev_priv) || IS_GEMINILAKE(dev_priv))
++ glk_force_audio_cdclk(dev_priv, true);
+ }
+
+ static void i915_audio_component_put_power(struct device *kdev)
+ {
++ struct drm_i915_private *dev_priv = kdev_to_i915(kdev);
++
++ /* Stop forcing CDCLK to 2*BCLK if no need for audio to be powered. */
++ if (--dev_priv->audio_power_refcount == 0)
++ if (IS_CANNONLAKE(dev_priv) || IS_GEMINILAKE(dev_priv))
++ glk_force_audio_cdclk(dev_priv, false);
++
+ intel_display_power_put(kdev_to_i915(kdev), POWER_DOMAIN_AUDIO);
+ }
+
+--- a/drivers/gpu/drm/i915/intel_cdclk.c
++++ b/drivers/gpu/drm/i915/intel_cdclk.c
+@@ -2185,19 +2185,8 @@ int intel_crtc_compute_min_cdclk(const s
+ /*
+ * According to BSpec, "The CD clock frequency must be at least twice
+ * the frequency of the Azalia BCLK." and BCLK is 96 MHz by default.
+- *
+- * FIXME: Check the actual, not default, BCLK being used.
+- *
+- * FIXME: This does not depend on ->has_audio because the higher CDCLK
+- * is required for audio probe, also when there are no audio capable
+- * displays connected at probe time. This leads to unnecessarily high
+- * CDCLK when audio is not required.
+- *
+- * FIXME: This limit is only applied when there are displays connected
+- * at probe time. If we probe without displays, we'll still end up using
+- * the platform minimum CDCLK, failing audio probe.
+ */
+- if (INTEL_GEN(dev_priv) >= 9)
++ if (crtc_state->has_audio && INTEL_GEN(dev_priv) >= 9)
+ min_cdclk = max(2 * 96000, min_cdclk);
+
+ /*
+@@ -2237,7 +2226,7 @@ static int intel_compute_min_cdclk(struc
+ intel_state->min_cdclk[i] = min_cdclk;
+ }
+
+- min_cdclk = 0;
++ min_cdclk = intel_state->cdclk.force_min_cdclk;
+ for_each_pipe(dev_priv, pipe)
+ min_cdclk = max(intel_state->min_cdclk[pipe], min_cdclk);
+
+@@ -2298,7 +2287,8 @@ static int vlv_modeset_calc_cdclk(struct
+ vlv_calc_voltage_level(dev_priv, cdclk);
+
+ if (!intel_state->active_crtcs) {
+- cdclk = vlv_calc_cdclk(dev_priv, 0);
++ cdclk = vlv_calc_cdclk(dev_priv,
++ intel_state->cdclk.force_min_cdclk);
+
+ intel_state->cdclk.actual.cdclk = cdclk;
+ intel_state->cdclk.actual.voltage_level =
+@@ -2331,7 +2321,7 @@ static int bdw_modeset_calc_cdclk(struct
+ bdw_calc_voltage_level(cdclk);
+
+ if (!intel_state->active_crtcs) {
+- cdclk = bdw_calc_cdclk(0);
++ cdclk = bdw_calc_cdclk(intel_state->cdclk.force_min_cdclk);
+
+ intel_state->cdclk.actual.cdclk = cdclk;
+ intel_state->cdclk.actual.voltage_level =
+@@ -2403,7 +2393,7 @@ static int skl_modeset_calc_cdclk(struct
+ skl_calc_voltage_level(cdclk);
+
+ if (!intel_state->active_crtcs) {
+- cdclk = skl_calc_cdclk(0, vco);
++ cdclk = skl_calc_cdclk(intel_state->cdclk.force_min_cdclk, vco);
+
+ intel_state->cdclk.actual.vco = vco;
+ intel_state->cdclk.actual.cdclk = cdclk;
+@@ -2442,10 +2432,10 @@ static int bxt_modeset_calc_cdclk(struct
+
+ if (!intel_state->active_crtcs) {
+ if (IS_GEMINILAKE(dev_priv)) {
+- cdclk = glk_calc_cdclk(0);
++ cdclk = glk_calc_cdclk(intel_state->cdclk.force_min_cdclk);
+ vco = glk_de_pll_vco(dev_priv, cdclk);
+ } else {
+- cdclk = bxt_calc_cdclk(0);
++ cdclk = bxt_calc_cdclk(intel_state->cdclk.force_min_cdclk);
+ vco = bxt_de_pll_vco(dev_priv, cdclk);
+ }
+
+@@ -2481,7 +2471,7 @@ static int cnl_modeset_calc_cdclk(struct
+ cnl_compute_min_voltage_level(intel_state));
+
+ if (!intel_state->active_crtcs) {
+- cdclk = cnl_calc_cdclk(0);
++ cdclk = cnl_calc_cdclk(intel_state->cdclk.force_min_cdclk);
+ vco = cnl_cdclk_pll_vco(dev_priv, cdclk);
+
+ intel_state->cdclk.actual.vco = vco;
+@@ -2517,7 +2507,7 @@ static int icl_modeset_calc_cdclk(struct
+ cnl_compute_min_voltage_level(intel_state));
+
+ if (!intel_state->active_crtcs) {
+- cdclk = icl_calc_cdclk(0, ref);
++ cdclk = icl_calc_cdclk(intel_state->cdclk.force_min_cdclk, ref);
+ vco = icl_calc_cdclk_pll_vco(dev_priv, cdclk);
+
+ intel_state->cdclk.actual.vco = vco;
+--- a/drivers/gpu/drm/i915/intel_display.c
++++ b/drivers/gpu/drm/i915/intel_display.c
+@@ -12305,6 +12305,11 @@ static int intel_modeset_checks(struct d
+ return -EINVAL;
+ }
+
++ /* keep the current setting */
++ if (!intel_state->cdclk.force_min_cdclk_changed)
++ intel_state->cdclk.force_min_cdclk =
++ dev_priv->cdclk.force_min_cdclk;
++
+ intel_state->modeset = true;
+ intel_state->active_crtcs = dev_priv->active_crtcs;
+ intel_state->cdclk.logical = dev_priv->cdclk.logical;
+@@ -12400,7 +12405,7 @@ static int intel_atomic_check(struct drm
+ struct drm_crtc *crtc;
+ struct drm_crtc_state *old_crtc_state, *crtc_state;
+ int ret, i;
+- bool any_ms = false;
++ bool any_ms = intel_state->cdclk.force_min_cdclk_changed;
+
+ /* Catch I915_MODE_FLAG_INHERITED */
+ for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state,
+@@ -12959,6 +12964,8 @@ static int intel_atomic_commit(struct dr
+ dev_priv->active_crtcs = intel_state->active_crtcs;
+ dev_priv->cdclk.logical = intel_state->cdclk.logical;
+ dev_priv->cdclk.actual = intel_state->cdclk.actual;
++ dev_priv->cdclk.force_min_cdclk =
++ intel_state->cdclk.force_min_cdclk;
+ }
+
+ drm_atomic_state_get(state);
+--- a/drivers/gpu/drm/i915/intel_drv.h
++++ b/drivers/gpu/drm/i915/intel_drv.h
+@@ -467,6 +467,9 @@ struct intel_atomic_state {
+ * state only when all crtc's are DPMS off.
+ */
+ struct intel_cdclk_state actual;
++
++ int force_min_cdclk;
++ bool force_min_cdclk_changed;
+ } cdclk;
+
+ bool dpll_set, modeset;
diff --git a/series.conf b/series.conf
index 65c406f8e7..64c03602b2 100644
--- a/series.conf
+++ b/series.conf
@@ -45789,6 +45789,7 @@
patches.drm/drm-fb-helper-dpms_legacy-Only-set-on-connectors-in-.patch
patches.drm/drm-fb-helper-generic-Call-drm_client_add-after-setu.patch
patches.drm/drm-vmwgfx-Remove-set-but-not-used-variable-restart.patch
+ patches.drm/drm-i915-Force-2-96-MHz-cdclk-on-glk-cnl-when-audio-.patch
patches.drm/0004-drm-i915-gvt-Fix-incorrect-mask-of-mmio-0x22028-in-g.patch
patches.drm/0005-drm-meson-add-size-and-alignment-requirements-for-du.patch
patches.drm/drm-tegra-gem-Fix-CPU-cache-maintenance-for-BO-s-all.patch