Skip to contentSkip to conversation

SKL S3, take 2

PATCH In review Damien Lespiau 3 participants 13 messages May 18, 2015 – May 19, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover SKL S3, take 2

Here's an update of my SKL S3 series:

- Spotted a problem in the BXT resume path, we were missing a bxt_cdclk_init in the S3 path (we only had it in the runtime resume path). Consolidated the two paths to reduce the chances of this happening again.
- Updated the SKL display re-init on resume based on Ville's comments. The major change is that we now poll the PCU for its ACK before changing CDCLK and this does solve the problem I was seeing (it typically takes 3/4 cycles separated by 10us to get the PCU to answer 'GO!')

Signature · 26 lines
Damien

Damien Lespiau (8):
  drm/i915: Fix 'suspedn' typo
  drm/i915/vlv/chv: Move resume_prepare() after uncore_early_sanitize()
  drm/i915/bxt: Also add bxt_resume_prepare() to the S3/S4 path
  drm/i915: Extract a common intel_resume_prepare() function
  drm/i915: Add a space after ',' and don't capitalize mid-sentence
  drm/i915: Kill the dev variable in intel_suspend_complete()
  drm/i915: Store boot CDCLK in dev_priv on DDI platforms
  drm/i915/skl: Deinit/init the display at suspend/resume

 drivers/gpu/drm/i915/i915_drv.c      |  63 ++++++-----
 drivers/gpu/drm/i915/i915_reg.h      |   3 +
 drivers/gpu/drm/i915/intel_ddi.c     |   6 +-
 drivers/gpu/drm/i915/intel_display.c | 210 +++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h     |   2 +
 5 files changed, 253 insertions(+), 31 deletions(-)

-- 
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 1/8 drm/i915: Fix 'suspedn' typo

---
 drivers/gpu/drm/i915/i915_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.c +1 -1
index 51149fb..5cc57f2 100644
@@ -989,7 +989,7 @@ static int i915_pm_suspend_late(struct device *dev)
 	struct drm_device *drm_dev = dev_to_i915(dev)->dev;
 
 	/*
-	 * We have a suspedn ordering issue with the snd-hda driver also
+	 * We have a suspend ordering issue with the snd-hda driver also
 	 * requiring our device to be power up. Due to the lack of a
 	 * parent/child relationship we currently solve this with an late
 	 * suspend hook.
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

PATCH 2/8 drm/i915/vlv/chv: Move resume_prepare() after uncore_early_sanitize()

In reply to Damien Lespiau

It's probably a good idea to run the uncore sanitize function before vlv_resume_prepare() writes registers.

At the same time, moving the debug message makes it dispay something if skl_resume_prepare ever returns non 0. Oh, and re-order the if/else ladder to have some semblence of ordering.

---
 drivers/gpu/drm/i915/i915_drv.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +8 -8
index 5cc57f2..5a9399c 100644
@@ -808,17 +808,17 @@ static int i915_drm_resume_early(struct drm_device *dev)
 
 	pci_set_master(dev->pdev);
 
-	if (IS_VALLEYVIEW(dev_priv))
-		ret = vlv_resume_prepare(dev_priv, false);
-	if (ret)
-		DRM_ERROR("Resume prepare failed: %d,Continuing resume\n", ret);
-
 	intel_uncore_early_sanitize(dev, true);
 
-	if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
-		hsw_disable_pc8(dev_priv);
-	else if (IS_SKYLAKE(dev_priv))
+	if (IS_SKYLAKE(dev_priv))
 		ret = skl_resume_prepare(dev_priv);
+	else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
+		hsw_disable_pc8(dev_priv);
+	else if (IS_VALLEYVIEW(dev_priv))
+		ret = vlv_resume_prepare(dev_priv, false);
+
+	if (ret)
+		DRM_ERROR("Resume prepare failed: %d,Continuing resume\n", ret);
 
 	intel_uncore_sanitize(dev);
 	intel_power_domains_init_hw(dev_priv);
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Re: [PATCH 2/8] drm/i915/vlv/chv: Move resume_prepare() after uncore_early_sanitize()

Quoted 29 lines · Damien Lespiau

It's probably a good idea to run the uncore sanitize function before vlv_resume_prepare() writes registers.

At the same time, moving the debug message makes it dispay something if skl_resume_prepare ever returns non 0. Oh, and re-order the if/else ladder to have some semblence of ordering.

---
 drivers/gpu/drm/i915/i915_drv.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +0 -7
index 5cc57f2..5a9399c 100644
@@ -808,17 +808,17 @@ static int i915_drm_resume_early(struct drm_device *dev)
 
 	pci_set_master(dev->pdev);
 
-	if (IS_VALLEYVIEW(dev_priv))
-		ret = vlv_resume_prepare(dev_priv, false);
-	if (ret)
-		DRM_ERROR("Resume prepare failed: %d,Continuing resume\n", ret);
-
 	intel_uncore_early_sanitize(dev, true);
 
-	if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
-		hsw_disable_pc8(dev_priv);

drivers/gpu/drm/i915/i915_drv.c static int i915_drm_resume_early(struct drm_device *dev) · line 821

Quoted 10 lines
drivers/gpu/drm/i915/i915_drv.c +8 -1
-	else if (IS_SKYLAKE(dev_priv))
+	if (IS_SKYLAKE(dev_priv))
 		ret = skl_resume_prepare(dev_priv);
+	else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
+		hsw_disable_pc8(dev_priv);
+	else if (IS_VALLEYVIEW(dev_priv))
+		ret = vlv_resume_prepare(dev_priv, false);
+
+	if (ret)
+		DRM_ERROR("Resume prepare failed: %d,Continuing resume\n", ret);

vlv_resume_prepare() needs to run before intel_uncore_early_sanitize(), as the former includes the steps to wake the HW from RC6 for the first time after suspend. At the time intel_resume_prepare() was removed, I suggested to instead split out the part from vlv_resume_prepare() that needs to be done early into a separate function, so that would be one way to go about this.

drivers/gpu/drm/i915/i915_drv.c static int i915_drm_resume_early(struct drm_device *dev) · line 824

Quoted 3 lines
drivers/gpu/drm/i915/i915_drv.c +0 -0
 	intel_uncore_sanitize(dev);
 	intel_power_domains_init_hw(dev_priv);

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

Re: [PATCH 2/8] drm/i915/vlv/chv: Move resume_prepare() after uncore_early_sanitize()

Quoted 26 lines
Quoted 26 lines
drivers/gpu/drm/i915/i915_drv.c +7 -8
index 5cc57f2..5a9399c 100644
@@ -808,17 +808,17 @@ static int i915_drm_resume_early(struct drm_device *dev)
 
 	pci_set_master(dev->pdev);
 
-	if (IS_VALLEYVIEW(dev_priv))
-		ret = vlv_resume_prepare(dev_priv, false);
-	if (ret)
-		DRM_ERROR("Resume prepare failed: %d,Continuing resume\n", ret);
-
 	intel_uncore_early_sanitize(dev, true);
 
-	if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
-		hsw_disable_pc8(dev_priv);
-	else if (IS_SKYLAKE(dev_priv))
+	if (IS_SKYLAKE(dev_priv))
 		ret = skl_resume_prepare(dev_priv);
+	else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
+		hsw_disable_pc8(dev_priv);
+	else if (IS_VALLEYVIEW(dev_priv))
+		ret = vlv_resume_prepare(dev_priv, false);
+
+	if (ret)
Quoted 8 lines

drivers/gpu/drm/i915/i915_drv.c static int i915_drm_resume_early(struct drm_device *dev) · line 821

Quoted 1 line
drivers/gpu/drm/i915/i915_drv.c +1 -0
+		DRM_ERROR("Resume prepare failed: %d,Continuing resume\n", ret);

vlv_resume_prepare() needs to run before intel_uncore_early_sanitize(), as the former includes the steps to wake the HW from RC6 for the first time after suspend. At the time intel_resume_prepare() was removed, I suggested to instead split out the part from vlv_resume_prepare() that needs to be done early into a separate function, so that would be one way to go about this.

Oh, that was a carefully crafted trap! Will see what I can do. Thankfully the active ingredients of that series don't depend on that refactoring.

Signature · 5 lines
Damien
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

PATCH 3/8 drm/i915/bxt: Also add bxt_resume_prepare() to the S3/S4 path

In reply to Damien Lespiau

Currently bxt_resume_prepare() is only used in the runtime-resume path. Add it to the full S3/S4 path as well.

---
 drivers/gpu/drm/i915/i915_drv.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.c +4 -1
index 5a9399c..7eb751b 100644
@@ -595,6 +595,7 @@ static int intel_suspend_complete(struct drm_i915_private *dev_priv);
 static int vlv_resume_prepare(struct drm_i915_private *dev_priv,
 			      bool rpm_resume);
 static int skl_resume_prepare(struct drm_i915_private *dev_priv);
+static int bxt_resume_prepare(struct drm_i915_private *dev_priv);
 
 
 static int i915_drm_suspend(struct drm_device *dev)
@@ -810,7 +811,9 @@ static int i915_drm_resume_early(struct drm_device *dev)
 
 	intel_uncore_early_sanitize(dev, true);
 
-	if (IS_SKYLAKE(dev_priv))
+	if (IS_BROXTON(dev))
+		ret = bxt_resume_prepare(dev_priv);
+	else if (IS_SKYLAKE(dev_priv))
 		ret = skl_resume_prepare(dev_priv);
 	else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
 		hsw_disable_pc8(dev_priv);
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 3/8
#6 lore raw

Re: [PATCH 3/8] drm/i915/bxt: Also add bxt_resume_prepare() to the S3/S4 path

Quoted 5 lines · Damien Lespiau

Currently bxt_resume_prepare() is only used in the runtime-resume path. Add it to the full S3/S4 path as well.

Yep, this slipped past the review of "drm/i915/bxt: Add DC9 Trigger sequence". The fix looks ok:

Quoted 17 lines
---
 drivers/gpu/drm/i915/i915_drv.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.c +1 -0
index 5a9399c..7eb751b 100644
@@ -595,6 +595,7 @@ static int intel_suspend_complete(struct drm_i915_private *dev_priv);
 static int vlv_resume_prepare(struct drm_i915_private *dev_priv,
 			      bool rpm_resume);
 static int skl_resume_prepare(struct drm_i915_private *dev_priv);
+static int bxt_resume_prepare(struct drm_i915_private *dev_priv);
 
 
 static int i915_drm_suspend(struct drm_device *dev)

drivers/gpu/drm/i915/i915_drv.c static int i915_drm_resume_early(struct drm_device *dev) · line 819

Quoted 10 lines
drivers/gpu/drm/i915/i915_drv.c +3 -1
@@ -810,7 +811,9 @@ static int i915_drm_resume_early(struct drm_device *dev)
 
 	intel_uncore_early_sanitize(dev, true);
 
-	if (IS_SKYLAKE(dev_priv))
+	if (IS_BROXTON(dev))
+		ret = bxt_resume_prepare(dev_priv);
+	else if (IS_SKYLAKE(dev_priv))
 		ret = skl_resume_prepare(dev_priv);
 	else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
 		hsw_disable_pc8(dev_priv);

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw

PATCH 4/8 drm/i915: Extract a common intel_resume_prepare() function

In reply to Damien Lespiau

On the suspend path, we shove the common low level code in intel_suspend_complete() that is then called in both the runtime pm path and the full S3/S4 path.

Let's do the same for the resume path, extracting an intel_resume_prepare() function. This is especially nice as we forgot on the two paths for BXT, so that should eliminate a source of bugs in the future.

---
 drivers/gpu/drm/i915/i915_drv.c | 47 ++++++++++++++++++++---------------------
 1 file changed, 23 insertions(+), 24 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +23 -24
index 7eb751b..a29db40 100644
@@ -592,11 +592,8 @@ static void intel_suspend_encoders(struct drm_i915_private *dev_priv)
 }
 
 static int intel_suspend_complete(struct drm_i915_private *dev_priv);
-static int vlv_resume_prepare(struct drm_i915_private *dev_priv,
-			      bool rpm_resume);
-static int skl_resume_prepare(struct drm_i915_private *dev_priv);
-static int bxt_resume_prepare(struct drm_i915_private *dev_priv);
-
+static int intel_resume_prepare(struct drm_i915_private *dev_priv,
+				bool rpm_resume);
 
 static int i915_drm_suspend(struct drm_device *dev)
 {
@@ -811,15 +808,7 @@ static int i915_drm_resume_early(struct drm_device *dev)
 
 	intel_uncore_early_sanitize(dev, true);
 
-	if (IS_BROXTON(dev))
-		ret = bxt_resume_prepare(dev_priv);
-	else if (IS_SKYLAKE(dev_priv))
-		ret = skl_resume_prepare(dev_priv);
-	else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
-		hsw_disable_pc8(dev_priv);
-	else if (IS_VALLEYVIEW(dev_priv))
-		ret = vlv_resume_prepare(dev_priv, false);
-
+	intel_resume_prepare(dev_priv, false);
 	if (ret)
 		DRM_ERROR("Resume prepare failed: %d,Continuing resume\n", ret);
 
@@ -1556,14 +1545,7 @@ static int intel_runtime_resume(struct device *device)
 	if (IS_GEN6(dev_priv))
 		intel_init_pch_refclk(dev);
 
-	if (IS_BROXTON(dev))
-		ret = bxt_resume_prepare(dev_priv);
-	else if (IS_SKYLAKE(dev))
-		ret = skl_resume_prepare(dev_priv);
-	else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
-		hsw_disable_pc8(dev_priv);
-	else if (IS_VALLEYVIEW(dev_priv))
-		ret = vlv_resume_prepare(dev_priv, true);
+	ret = intel_resume_prepare(dev_priv, true);
 
 	/*
 	 * No point of rolling back things in case of an error, as the best
@@ -1584,8 +1566,8 @@ static int intel_runtime_resume(struct device *device)
 }
 
 /*
- * This function implements common functionality of runtime and system
- * suspend sequence.
+ * This 2 functions implement common functionality of runtime and system
+ * suspend/resume sequence.
  */
 static int intel_suspend_complete(struct drm_i915_private *dev_priv)
 {
@@ -1606,6 +1588,23 @@ static int intel_suspend_complete(struct drm_i915_private *dev_priv)
 	return ret;
 }
 
+static int
+intel_resume_prepare(struct drm_i915_private *dev_priv, bool rpm_resume)
+{
+	int ret = 0;
+
+	if (IS_BROXTON(dev_priv))
+		ret = bxt_resume_prepare(dev_priv);
+	else if (IS_SKYLAKE(dev_priv))
+		ret = skl_resume_prepare(dev_priv);
+	else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
+		hsw_disable_pc8(dev_priv);
+	else if (IS_VALLEYVIEW(dev_priv))
+		ret = vlv_resume_prepare(dev_priv, rpm_resume);
+
+	return ret;
+}
+
 static const struct dev_pm_ops i915_pm_ops = {
 	/*
 	 * S0ix (via system suspend) and S3 event handlers [PMSG_SUSPEND,
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw

PATCH 5/8 drm/i915: Add a space after ', ' and don't capitalize mid-sentence

In reply to Damien Lespiau

Couldn't let it go!

---
 drivers/gpu/drm/i915/i915_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.c +2 -1
index a29db40..6d8af59 100644
@@ -810,7 +810,8 @@ static int i915_drm_resume_early(struct drm_device *dev)
 
 	intel_resume_prepare(dev_priv, false);
 	if (ret)
-		DRM_ERROR("Resume prepare failed: %d,Continuing resume\n", ret);
+		DRM_ERROR("Resume prepare failed: %d, continuing anyway\n",
+			  ret);
 
 	intel_uncore_sanitize(dev);
 	intel_power_domains_init_hw(dev_priv);
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw

PATCH 6/8 drm/i915: Kill the dev variable in intel_suspend_complete()

In reply to Damien Lespiau

The macros we use there are the magic ones that can take either dev or dev_priv. We'd like to move as much as possible towards dev_priv though.

---
 drivers/gpu/drm/i915/i915_drv.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +4 -5
index 6d8af59..3505136 100644
@@ -1572,16 +1572,15 @@ static int intel_runtime_resume(struct device *device)
  */
 static int intel_suspend_complete(struct drm_i915_private *dev_priv)
 {
-	struct drm_device *dev = dev_priv->dev;
 	int ret;
 
-	if (IS_BROXTON(dev))
+	if (IS_BROXTON(dev_priv))
 		ret = bxt_suspend_complete(dev_priv);
-	else if (IS_SKYLAKE(dev))
+	else if (IS_SKYLAKE(dev_priv))
 		ret = skl_suspend_complete(dev_priv);
-	else if (IS_HASWELL(dev) || IS_BROADWELL(dev))
+	else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
 		ret = hsw_suspend_complete(dev_priv);
-	else if (IS_VALLEYVIEW(dev))
+	else if (IS_VALLEYVIEW(dev_priv))
 		ret = vlv_suspend_complete(dev_priv);
 	else
 		ret = 0;
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw

PATCH 7/8 drm/i915: Store boot CDCLK in dev_priv on DDI platforms

In reply to Damien Lespiau

Right not we don't initialize the stored CDCLK on DDI platforms. Fix that.

---
 drivers/gpu/drm/i915/intel_ddi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +2 -2
index c82c981..d8aee51 100644
@@ -2485,8 +2485,8 @@ void intel_ddi_pll_init(struct drm_device *dev)
 	else
 		hsw_shared_dplls_init(dev_priv);
 
-	DRM_DEBUG_KMS("CDCLK running at %dKHz\n",
-		      dev_priv->display.get_display_clock_speed(dev));
+	dev_priv->cdclk_freq = dev_priv->display.get_display_clock_speed(dev);
+	DRM_DEBUG_KMS("CDCLK running at %dKHz\n", dev_priv->cdclk_freq);
 
 	if (IS_SKYLAKE(dev)) {
 		if (!(I915_READ(LCPLL1_CTL) & LCPLL_PLL_ENABLE))
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw

PATCH 8/8 drm/i915/skl: Deinit/init the display at suspend/resume

In reply to Damien Lespiau

We need to re-init the display hardware when going out of suspend. This includes:

- Hooking the PCH to the reset logic
- Restoring CDCDLK
- Enabling the DDB power

Among those, only the CDCDLK one is a bit tricky. There's some complexity in that:

- DPLL0 (which is the source for CDCLK) has two VCOs, each with a set of supported frequencies. As eDP also uses DPLL0 for its link rate, once DPLL0 is on, we restrict the possible eDP link rates the chosen VCO.
- CDCLK also limits the bandwidth available to push pixels.

So, as a first step, this commit restore what the BIOS set, until I can do more testing.

In case that's of interest for the reviewer, I've unit tested the function that derives the decimal frequency field:

  #include <stdio.h>
  #include <stdint.h>
  #include <assert.h>

  #define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
  static const struct dpll_freq {
          unsigned int freq;
          unsigned int decimal;
  } freqs[] = {
          { .freq = 308570, .decimal = 0b01001100111},
          { .freq = 337500, .decimal = 0b01010100001},
          { .freq = 432000, .decimal = 0b01101011110},
          { .freq = 450000, .decimal = 0b01110000010},
          { .freq = 540000, .decimal = 0b10000110110},
          { .freq = 617140, .decimal = 0b10011010000},
          { .freq = 675000, .decimal = 0b10101000100},

};

  static void intbits(unsigned int v)
  {
          int i;
          for(i = 10; i >= 0; i--)
                  putchar('0' + ((v >> i) & 1));

}

  static unsigned int freq_decimal(unsigned int freq /* in kHz */)
  {
          return (freq - 1000) / 500;
  }

  static void test_freq(const struct dpll_freq *entry)
  {
          unsigned int decimal = freq_decimal(entry->freq);
          printf("freq: %d, expected: ", entry->freq);
          intbits(entry->decimal);
          printf(", got: ");
          intbits(decimal);
          putchar('\n');

          assert(decimal == entry->decimal);

}

  int main(int argc, char **argv)
  {
          int i;
          for (i = 0; i < ARRAY_SIZE(freqs); i++)
                  test_freq(&freqs[i]);

          return 0;

}

v2:
- Rebase on top of -nightly
- Use (freq - 1000) / 500 for the decimal frequency (Ville)
- Fix setting the enable bit of HSW_NDE_RSTWRN_OPT (Ville)
- Rename skl_display_{resume,suspend} to skl_{init,uninit}_cdclk to be consistent with the BXT code (Ville)
- Store boot CDCLK in ddi_pll_init (Ville)
- Merge dev_priv's skl_boot_cdclk into cdclk_freq
- Use LCPLL_PLL_LOCK instead of (1 << 30) (Ville)
- Replace various '0' by SKL_DPLL0 to be a bit more explicit that we're programming DPLL0
- Busy poll the PCU before doing the frequency change. It takes about 3/4 cycles, each separated by 10us, to get the ACK from the CPU (Ville)

---
 drivers/gpu/drm/i915/i915_drv.c      |   3 +
 drivers/gpu/drm/i915/i915_reg.h      |   3 +
 drivers/gpu/drm/i915/intel_ddi.c     |   2 +
 drivers/gpu/drm/i915/intel_display.c | 210 +++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h     |   2 +
 5 files changed, 220 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +3 -0
index 3505136..b444b73 100644
@@ -1036,6 +1036,8 @@ static int skl_suspend_complete(struct drm_i915_private *dev_priv)
 	 */
 	intel_csr_load_status_set(dev_priv, FW_UNINITIALIZED);
 
+	skl_uninit_cdclk(dev_priv);
+
 	return 0;
 }
 
@@ -1082,6 +1084,7 @@ static int skl_resume_prepare(struct drm_i915_private *dev_priv)
 {
 	struct drm_device *dev = dev_priv->dev;
 
+	skl_init_cdclk(dev_priv);
 	intel_csr_load_program(dev);
 
 	return 0;
drivers/gpu/drm/i915/i915_reg.h +3 -0
index 77055b9..58e0253 100644
@@ -6692,6 +6692,9 @@ enum skl_disp_power_wells {
 #define     GEN9_MEM_LATENCY_LEVEL_1_5_SHIFT	8
 #define     GEN9_MEM_LATENCY_LEVEL_2_6_SHIFT	16
 #define     GEN9_MEM_LATENCY_LEVEL_3_7_SHIFT	24
+#define   SKL_PCODE_CDCLK_CONTROL		0x7
+#define     SKL_CDCLK_PREPARE_FOR_CHANGE	0x3
+#define     SKL_CDCLK_READY_FOR_CHANGE		0x1
 #define   GEN6_PCODE_WRITE_MIN_FREQ_TABLE	0x8
 #define   GEN6_PCODE_READ_MIN_FREQ_TABLE	0x9
 #define   GEN6_READ_OC_PARAMS			0xc
drivers/gpu/drm/i915/intel_ddi.c +2 -0
index d8aee51..04132c0 100644
@@ -2491,6 +2491,8 @@ void intel_ddi_pll_init(struct drm_device *dev)
 	if (IS_SKYLAKE(dev)) {
 		if (!(I915_READ(LCPLL1_CTL) & LCPLL_PLL_ENABLE))
 			DRM_ERROR("LCPLL1 is disabled\n");
+		else
+			intel_display_power_get(dev_priv, POWER_DOMAIN_PLLS);
 	} else if (IS_BROXTON(dev)) {
 		broxton_init_cdclk(dev);
 		broxton_ddi_phy_init(dev);
drivers/gpu/drm/i915/intel_display.c +210 -0

216 lines not on this page · raw message

drivers/gpu/drm/i915/intel_drv.h +2 -0
index 47bc729..4640fb6 100644
@@ -1117,6 +1117,8 @@ void broxton_ddi_phy_init(struct drm_device *dev);
 void broxton_ddi_phy_uninit(struct drm_device *dev);
 void bxt_enable_dc9(struct drm_i915_private *dev_priv);
 void bxt_disable_dc9(struct drm_i915_private *dev_priv);
+void skl_init_cdclk(struct drm_i915_private *dev_priv);
+void skl_uninit_cdclk(struct drm_i915_private *dev_priv);
 void intel_dp_get_m_n(struct intel_crtc *crtc,
 		      struct intel_crtc_state *pipe_config);
 void intel_dp_set_m_n(struct intel_crtc *crtc, enum link_m_n_set m_n);
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tested-by on v1 8/8
#12 lore raw

Re: [PATCH 8/8] drm/i915/skl: Deinit/init the display at suspend/resume

Task id: 6430 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied

PNV                                  234/234              234/234
ILK                                  262/262              262/262
SNB                 -1              282/282              281/282
IVB                                  300/300              300/300
BYT                                  256/256              256/256
BDW                                  275/275              275/275

-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied
SNB igt@pm_rpm@dpms-mode-unset-non-lpsp DMESG_WARN(7)PASS(1) DMESG_WARN(1)
(dmesg patch applied)WARNING:at_drivers/gpu/drm/i915/intel_uncore.c:#assert_device_not_suspended[i915]()@WARNING:.* at .* assert_device_not_suspended+0x
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx