All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vandita Kulkarni <vandita.kulkarni@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: jani.nikula@intel.com, paulo.r.zanoni@intel.com
Subject: [RFC 1/3] drm/i915/icl: Restructure ICL DPLL enable functionality
Date: Fri, 14 Sep 2018 12:24:12 +0530	[thread overview]
Message-ID: <1536908054-2176-2-git-send-email-vandita.kulkarni@intel.com> (raw)
In-Reply-To: <1536908054-2176-1-git-send-email-vandita.kulkarni@intel.com>

From: Madhav Chauhan <madhav.chauhan@intel.com>

In Gen11, DPLL 0 and 1 are shared between DDI and DSI.
Most of the steps for enabling DPLL are common across DDI
and DSI. This patch makes icl_dpll_enable() generic which
will be used by all the encoders.

Signed-off-by: Madhav Chauhan <madhav.chauhan@intel.com>
Signed-off-by: Vandita Kulkarni <vandita.kulkarni@intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c      | 12 ++++++++++++
 drivers/gpu/drm/i915/intel_dpll_mgr.c | 19 ++-----------------
 drivers/gpu/drm/i915/intel_dpll_mgr.h |  2 +-
 3 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index cd01a09..2942a24 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -2810,6 +2810,18 @@ static void intel_ddi_clk_select(struct intel_encoder *encoder,
 	mutex_lock(&dev_priv->dpll_lock);
 
 	if (IS_ICELAKE(dev_priv)) {
+		enum intel_dpll_id id = pll->info->id;
+		i915_reg_t enable_reg = icl_pll_id_to_enable_reg(id);
+
+		val = I915_READ(enable_reg);
+		val |= PLL_ENABLE;
+		I915_WRITE(enable_reg, val);
+
+		/* TODO: wait times missing from the spec. */
+		if (intel_wait_for_register(dev_priv, enable_reg, PLL_LOCK,
+					    PLL_LOCK, 5))
+			DRM_ERROR("PLL %d not locked\n", id);
+
 		if (port >= PORT_C)
 			I915_WRITE(DDI_CLK_SEL(port),
 				   icl_pll_to_ddi_pll_sel(encoder, pll));
diff --git a/drivers/gpu/drm/i915/intel_dpll_mgr.c b/drivers/gpu/drm/i915/intel_dpll_mgr.c
index e6cac92..36ed155 100644
--- a/drivers/gpu/drm/i915/intel_dpll_mgr.c
+++ b/drivers/gpu/drm/i915/intel_dpll_mgr.c
@@ -2930,7 +2930,7 @@ static bool icl_calc_mg_pll_state(struct intel_crtc_state *crtc_state,
 	return pll;
 }
 
-static i915_reg_t icl_pll_id_to_enable_reg(enum intel_dpll_id id)
+i915_reg_t icl_pll_id_to_enable_reg(enum intel_dpll_id id)
 {
 	switch (id) {
 	default:
@@ -3119,22 +3119,7 @@ static void icl_pll_enable(struct drm_i915_private *dev_priv,
 	default:
 		MISSING_CASE(id);
 	}
-
-	/*
-	 * DVFS pre sequence would be here, but in our driver the cdclk code
-	 * paths should already be setting the appropriate voltage, hence we do
-	 * nothign here.
-	 */
-
-	val = I915_READ(enable_reg);
-	val |= PLL_ENABLE;
-	I915_WRITE(enable_reg, val);
-
-	if (intel_wait_for_register(dev_priv, enable_reg, PLL_LOCK, PLL_LOCK,
-				    1)) /* 600us actually. */
-		DRM_ERROR("PLL %d not locked\n", id);
-
-	/* DVFS post sequence would be here. See the comment above. */
+	/* Encoder specific PLL enable steps are added in encoder file */
 }
 
 static void icl_pll_disable(struct drm_i915_private *dev_priv,
diff --git a/drivers/gpu/drm/i915/intel_dpll_mgr.h b/drivers/gpu/drm/i915/intel_dpll_mgr.h
index bf0de8a..9e89265 100644
--- a/drivers/gpu/drm/i915/intel_dpll_mgr.h
+++ b/drivers/gpu/drm/i915/intel_dpll_mgr.h
@@ -345,5 +345,5 @@ void intel_dpll_dump_hw_state(struct drm_i915_private *dev_priv,
 int icl_calc_dp_combo_pll_link(struct drm_i915_private *dev_priv,
 			       uint32_t pll_id);
 int cnl_hdmi_pll_ref_clock(struct drm_i915_private *dev_priv);
-
+i915_reg_t icl_pll_id_to_enable_reg(enum intel_dpll_id id);
 #endif /* _INTEL_DPLL_MGR_H_ */
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-09-14  7:07 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-14  6:54 [RFC 0/3] Enable ICL DSI PLL Vandita Kulkarni
2018-09-14  6:54 ` Vandita Kulkarni [this message]
2018-09-14 16:06   ` [RFC 1/3] drm/i915/icl: Restructure ICL DPLL enable functionality Ville Syrjälä
2018-09-19 17:31     ` Kulkarni, Vandita
2018-09-26 14:26       ` Ville Syrjälä
2018-10-01  6:38         ` Kulkarni, Vandita
2018-10-03  7:54     ` Jani Nikula
2018-10-03  8:00       ` Jani Nikula
2018-10-03 11:41         ` Jani Nikula
2018-10-04  2:49           ` Kulkarni, Vandita
2018-10-04  9:01             ` Jani Nikula
2018-09-14  6:54 ` [RFC 2/3] drm/i915/icl: Enable Gen11 DSI PLL Vandita Kulkarni
2018-09-14  6:54 ` [RFC 3/3] drm/i915/icl: Calculate DPLL params for DSI Vandita Kulkarni
2018-09-14 16:09   ` Ville Syrjälä
2018-09-20  8:49     ` Kulkarni, Vandita
2018-09-26 14:21       ` Ville Syrjälä
2018-10-01 11:30         ` Kulkarni, Vandita
2018-10-01 12:29           ` Chauhan, Madhav
2018-09-14  9:32 ` ✗ Fi.CI.BAT: failure for Enable ICL DSI PLL Patchwork
2018-10-03  7:58 ` ✗ Fi.CI.BAT: failure for Enable ICL DSI PLL (rev2) Patchwork

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=1536908054-2176-2-git-send-email-vandita.kulkarni@intel.com \
    --to=vandita.kulkarni@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.