intel-gfx.lists.freedesktop.org archive mirror
 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 2/3] drm/i915/icl: Enable Gen11 DSI PLL
Date: Fri, 14 Sep 2018 12:24:13 +0530	[thread overview]
Message-ID: <1536908054-2176-3-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>

This patch implements steps specific to DSI for
enabling PLL.

Signed-off-by: Madhav Chauhan <madhav.chauhan@intel.com>
Signed-off-by: Vandita Kulkarni <vandita.kulkarni@intel.com>
---
 drivers/gpu/drm/i915/icl_dsi.c | 41 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 40 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/icl_dsi.c b/drivers/gpu/drm/i915/icl_dsi.c
index 13830e4..c530e25 100644
--- a/drivers/gpu/drm/i915/icl_dsi.c
+++ b/drivers/gpu/drm/i915/icl_dsi.c
@@ -54,6 +54,45 @@ static void gen11_dsi_program_esc_clk_div(struct intel_encoder *encoder)
 	}
 }
 
+static void gen11_dsi_pll_enable(struct intel_encoder *encoder,
+				 const struct intel_crtc_state *pipe_config)
+{
+	struct drm_crtc *crtc = pipe_config->base.crtc;
+	struct drm_i915_private *dev_priv = to_i915(crtc->dev);
+	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+	struct intel_shared_dpll *pll = intel_crtc->config->shared_dpll;
+	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
+	enum intel_dpll_id id = pll->info->id;
+	i915_reg_t enable_reg = icl_pll_id_to_enable_reg(id);
+	enum port port;
+	uint32_t val;
+
+	/**
+	 * Note: Following PLL enable steps are specific to DSI,
+	 * some common steps for all encoder will be done by dpll_enable().
+	 */
+
+	mutex_lock(&dev_priv->dpll_lock);
+
+	for_each_dsi_port(port, intel_dsi->ports) {
+		val = I915_READ(DPCLKA_CFGCR0_ICL);
+		val &= ~DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(port);
+		val |= DPCLKA_CFGCR0_DDI_CLK_SEL(pll->info->id, port);
+		I915_WRITE(DPCLKA_CFGCR0_ICL, val);
+		POSTING_READ(DPCLKA_CFGCR0_ICL);
+	}
+
+	mutex_unlock(&dev_priv->dpll_lock);
+
+	gen11_dsi_program_esc_clk_div(encoder);
+	val = I915_READ(enable_reg);
+	val |= PLL_ENABLE;
+	I915_WRITE(enable_reg, val);
+
+	if (wait_for_us((I915_READ(enable_reg) & PLL_LOCK), 600))
+		DRM_ERROR("PLL %d not locked\n", id);
+}
+
 static void gen11_dsi_enable_io_power(struct intel_encoder *encoder)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
@@ -120,7 +159,7 @@ static void __attribute__((unused))
 	gen11_dsi_enable_io_power(encoder);
 
 	/* step3: enable DSI PLL */
-	gen11_dsi_program_esc_clk_div(encoder);
+	gen11_dsi_pll_enable(encoder, pipe_config);
 
 	/* step4: enable DSI port and DPHY */
 	gen11_dsi_enable_port_and_phy(encoder);
-- 
1.9.1

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

  parent reply	other threads:[~2018-09-14  7:08 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 ` [RFC 1/3] drm/i915/icl: Restructure ICL DPLL enable functionality Vandita Kulkarni
2018-09-14 16:06   ` 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 ` Vandita Kulkarni [this message]
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-3-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).