public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Paulo Zanoni <przanoni@gmail.com>
To: intel-gfx@lists.freedesktop.org
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: [PATCH 14/19] drm/i915: State readout support for WRPLLs
Date: Fri,  4 Jul 2014 11:27:39 -0300	[thread overview]
Message-ID: <1404484059-4236-2-git-send-email-przanoni@gmail.com> (raw)
In-Reply-To: <1404484059-4236-1-git-send-email-przanoni@gmail.com>

From: Daniel Vetter <daniel.vetter@ffwll.ch>

Still tacked onto the side, but slowly getting there.

v2: Don't forget the debugfs file.

v3 (from Paulo): Don't forget to check the power domains.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c  |  1 +
 drivers/gpu/drm/i915/i915_drv.h      |  1 +
 drivers/gpu/drm/i915/i915_reg.h      |  1 +
 drivers/gpu/drm/i915/intel_ddi.c     | 19 +++++++++++++++++++
 drivers/gpu/drm/i915/intel_display.c |  9 +++++++++
 5 files changed, 31 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index e79ddbf..7d72768 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2409,6 +2409,7 @@ static int i915_shared_dplls_info(struct seq_file *m, void *unused)
 		seq_printf(m, " dpll_md: 0x%08x\n", pll->hw_state.dpll_md);
 		seq_printf(m, " fp0:     0x%08x\n", pll->hw_state.fp0);
 		seq_printf(m, " fp1:     0x%08x\n", pll->hw_state.fp1);
+		seq_printf(m, " wrpll:   0x%08x\n", pll->hw_state.wrpll);
 	}
 	drm_modeset_unlock_all(dev);
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 2ec7cb6..c1fa561 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -197,6 +197,7 @@ struct intel_dpll_hw_state {
 	uint32_t dpll_md;
 	uint32_t fp0;
 	uint32_t fp1;
+	uint32_t wrpll;
 };
 
 struct intel_shared_dpll {
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 3d61a53..654417e 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -5900,6 +5900,7 @@ enum punit_power_well {
 /* WRPLL */
 #define WRPLL_CTL1			0x46040
 #define WRPLL_CTL2			0x46060
+#define WRPLL_CTL(pll)			(pll == 0 ? WRPLL_CTL1 : WRPLL_CTL2)
 #define  WRPLL_PLL_ENABLE		(1<<31)
 #define  WRPLL_PLL_SSC			(1<<28)
 #define  WRPLL_PLL_NON_SSC		(2<<28)
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index fae73d3..79cbb5e 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -790,6 +790,8 @@ bool intel_ddi_pll_select(struct intel_crtc *intel_crtc)
 			intel_crtc->config.ddi_pll_sel = PORT_CLK_SEL_WRPLL2;
 			intel_crtc->config.shared_dpll = DPLL_ID_WRPLL2;
 		}
+
+		intel_crtc->config.dpll_hw_state.wrpll = val;
 	}
 
 	return true;
@@ -1315,6 +1317,21 @@ int intel_ddi_get_cdclk_freq(struct drm_i915_private *dev_priv)
 	}
 }
 
+static bool hsw_ddi_pll_get_hw_state(struct drm_i915_private *dev_priv,
+				     struct intel_shared_dpll *pll,
+				     struct intel_dpll_hw_state *hw_state)
+{
+	uint32_t val;
+
+	if (!intel_display_power_enabled(dev_priv, POWER_DOMAIN_PLLS))
+		return false;
+
+	val = I915_READ(WRPLL_CTL(pll->id));
+	hw_state->wrpll = val;
+
+	return val & WRPLL_PLL_ENABLE;
+}
+
 static char *hsw_ddi_pll_names[] = {
 	"WRPLL 1",
 	"WRPLL 2",
@@ -1333,6 +1350,8 @@ void intel_ddi_pll_init(struct drm_device *dev)
 	for (i = 0; i < 2; i++) {
 		dev_priv->shared_dplls[i].id = i;
 		dev_priv->shared_dplls[i].name = hsw_ddi_pll_names[i];
+		dev_priv->shared_dplls[i].get_hw_state =
+			hsw_ddi_pll_get_hw_state;
 	}
 
 	/* The LCPLL register should be turned on by the BIOS. For now let's
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 1d919ae..594a49f 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -7587,6 +7587,7 @@ static void haswell_get_ddi_port_state(struct intel_crtc *crtc,
 {
 	struct drm_device *dev = crtc->base.dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_shared_dpll *pll;
 	enum port port;
 	uint32_t tmp;
 
@@ -7605,6 +7606,13 @@ static void haswell_get_ddi_port_state(struct intel_crtc *crtc,
 		break;
 	}
 
+	if (pipe_config->shared_dpll >= 0) {
+		pll = &dev_priv->shared_dplls[pipe_config->shared_dpll];
+
+		WARN_ON(!pll->get_hw_state(dev_priv, pll,
+					   &pipe_config->dpll_hw_state));
+	}
+
 	/*
 	 * Haswell has only FDI/PCH transcoder A. It is which is connected to
 	 * DDI E. So just check whether this pipe is wired to DDI E and whether
@@ -10436,6 +10444,7 @@ intel_pipe_config_compare(struct drm_device *dev,
 	PIPE_CONF_CHECK_X(dpll_hw_state.dpll_md);
 	PIPE_CONF_CHECK_X(dpll_hw_state.fp0);
 	PIPE_CONF_CHECK_X(dpll_hw_state.fp1);
+	PIPE_CONF_CHECK_X(dpll_hw_state.wrpll);
 
 	if (IS_G4X(dev) || INTEL_INFO(dev)->gen >= 5)
 		PIPE_CONF_CHECK_I(pipe_bpp);
-- 
2.0.0

  reply	other threads:[~2014-07-04 14:28 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-25 19:01 [PATCH 00/19] ddi: respin of runtime PM for DPMS Imre Deak
2014-06-25 19:01 ` [PATCH 01/19] drm/i915: Check hw state in assert_can_disable_lcpll Imre Deak
2014-06-30 20:59   ` Paulo Zanoni
2014-06-25 19:01 ` [PATCH 02/19] drm/i915: Remove spll_refcount for hsw Imre Deak
2014-06-25 19:01 ` [PATCH 03/19] drm/i915: Clean up WRPLL/SPLL #defines Imre Deak
2014-06-25 19:01 ` [PATCH 04/19] drm/i915: ddi: move pch setup after encoder->pre_enable Imre Deak
2014-06-25 19:01 ` [PATCH 05/19] drm/i915: ddi: move pch cleanup before encoder->post_disable Imre Deak
2014-06-25 19:01 ` [PATCH 06/19] drm/i915: Move the SPLL enabling into hsw_crt_pre_enable Imre Deak
2014-06-25 19:01 ` [PATCH 07/19] drm/i915: Move SPLL disabling into hsw_crt_post_disable Imre Deak
2014-06-25 19:01 ` [PATCH 08/19] drm/i915: Add a debugfs file for the shared dpll state Imre Deak
2014-06-25 19:01 ` [PATCH 09/19] drm/i915: Move ddi_pll_sel into the pipe config Imre Deak
2014-06-25 19:01 ` [PATCH 10/19] drm/i915: State readout and cross-checking for ddi_pll_sel Imre Deak
2014-06-25 19:01 ` [PATCH 11/19] drm/i915: Precompute static ddi_pll_sel values in encoders Imre Deak
2014-07-02 17:17   ` Paulo Zanoni
2014-07-04 14:26   ` [PATCH 10.5/19] drm/i915: BDW also has special-purpose DP DDI clocks Paulo Zanoni
2014-07-04 14:26     ` [PATCH 11/19] drm/i915: Precompute static ddi_pll_sel values in encoders Paulo Zanoni
2014-07-04 14:30     ` [PATCH 10.5/19] drm/i915: BDW also has special-purpose DP DDI clocks Damien Lespiau
2014-06-25 19:01 ` [PATCH 12/19] drm/i915: Basic shared dpll support for WRPLLs Imre Deak
2014-06-25 19:01 ` [PATCH 13/19] drm/i915: Document that the pll->mode_set hook is optional Imre Deak
2014-06-25 19:01 ` [PATCH 14/19] drm/i915: State readout support for WRPLLs Imre Deak
2014-07-04 14:27   ` [PATCH 13.5/19] drm/i915: add POWER_DOMAIN_PLLS Paulo Zanoni
2014-07-04 14:27     ` Paulo Zanoni [this message]
2014-07-10 14:35       ` [PATCH 14/19] drm/i915: State readout support for WRPLLs Damien Lespiau
2014-07-10 14:33     ` [PATCH 13.5/19] drm/i915: add POWER_DOMAIN_PLLS Damien Lespiau
2014-06-25 19:02 ` [PATCH 15/19] drm/i915: ->disable hook for WRPLLs Imre Deak
2014-06-25 19:02 ` [PATCH 16/19] drm/i915: ->enable " Imre Deak
2014-06-25 19:02 ` [PATCH 17/19] drm/i915: Switch to common shared dpll framework " Imre Deak
2014-06-25 19:02 ` [PATCH 18/19] drm/i915: Only touch WRPLL hw state in enable/disable hooks Imre Deak
2014-06-25 19:02 ` [PATCH 19/19] drm/i915: ddi: enable runtime pm during dpms Imre Deak
2014-07-01 21:33 ` [PATCH 00/19] ddi: respin of runtime PM for DPMS Paulo Zanoni
2014-07-10 20:15   ` Daniel Vetter
2014-07-11 15:51     ` Daniel Vetter
2014-07-04 14:30 ` [PATCH 20/19] drm/i915: don't skip shared DPLL assertion on LPT Paulo Zanoni
2014-07-10 14:40   ` Damien Lespiau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1404484059-4236-2-git-send-email-przanoni@gmail.com \
    --to=przanoni@gmail.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox