All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paulo Zanoni <paulo.r.zanoni@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: [PATCH 4/8] drm/i915/icp: Get/set proper Raw clock frequency on ICP
Date: Thu, 11 Jan 2018 16:00:06 -0200	[thread overview]
Message-ID: <20180111180010.24357-5-paulo.r.zanoni@intel.com> (raw)
In-Reply-To: <20180111180010.24357-1-paulo.r.zanoni@intel.com>

From: Anusha Srivatsa <anusha.srivatsa@intel.com>

Add register definitions for setting the rawclock.
Set the numerator,denominator and divider values.

v2: Simplify the commit message. Simplify the math.
Add  register bits for numerator. (Paulo)
v3 (from Paulo): coding style bikesheds.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 drivers/gpu/drm/i915/i915_reg.h    |  2 ++
 drivers/gpu/drm/i915/intel_cdclk.c | 29 +++++++++++++++++++++++++++--
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index c0a4fc356145..f756512041c6 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -7352,6 +7352,8 @@ enum {
 #define  CNP_RAWCLK_DIV(div)	((div) << 16)
 #define  CNP_RAWCLK_FRAC_MASK	(0xf << 26)
 #define  CNP_RAWCLK_FRAC(frac)	((frac) << 26)
+#define  ICP_RAWCLK_DEN(den)	((den) << 26)
+#define  ICP_RAWCLK_NUM(num)	((num) << 11)
 
 #define PCH_DPLL_TMR_CFG        _MMIO(0xc6208)
 
diff --git a/drivers/gpu/drm/i915/intel_cdclk.c b/drivers/gpu/drm/i915/intel_cdclk.c
index ca36321eafac..4f921fd331fd 100644
--- a/drivers/gpu/drm/i915/intel_cdclk.c
+++ b/drivers/gpu/drm/i915/intel_cdclk.c
@@ -2342,6 +2342,30 @@ static int cnp_rawclk(struct drm_i915_private *dev_priv)
 	return divider + fraction;
 }
 
+static int icp_rawclk(struct drm_i915_private *dev_priv)
+{
+	u32 rawclk;
+	int divider, numerator, denominator, frequency;
+
+	if (I915_READ(SFUSE_STRAP) & SFUSE_STRAP_RAW_FREQUENCY) {
+		frequency = 24000;
+		divider = 23;
+		numerator = 0;
+		denominator = 0;
+	} else {
+		frequency = 19200;
+		divider = 18;
+		numerator = 1;
+		denominator = 4;
+	}
+
+	rawclk = CNP_RAWCLK_DIV(divider) | ICP_RAWCLK_NUM(numerator) |
+		 ICP_RAWCLK_DEN(denominator);
+
+	I915_WRITE(PCH_RAWCLK_FREQ, rawclk);
+	return frequency;
+}
+
 static int pch_rawclk(struct drm_i915_private *dev_priv)
 {
 	return (I915_READ(PCH_RAWCLK_FREQ) & RAWCLK_FREQ_MASK) * 1000;
@@ -2389,8 +2413,9 @@ static int g4x_hrawclk(struct drm_i915_private *dev_priv)
  */
 void intel_update_rawclk(struct drm_i915_private *dev_priv)
 {
-
-	if (HAS_PCH_CNP(dev_priv))
+	if (HAS_PCH_ICP(dev_priv))
+		dev_priv->rawclk_freq = icp_rawclk(dev_priv);
+	else if (HAS_PCH_CNP(dev_priv))
 		dev_priv->rawclk_freq = cnp_rawclk(dev_priv);
 	else if (HAS_PCH_SPLIT(dev_priv))
 		dev_priv->rawclk_freq = pch_rawclk(dev_priv);
-- 
2.14.3

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

  parent reply	other threads:[~2018-01-11 18:00 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-11 18:00 [PATCH 0/8] ICP initial support Paulo Zanoni
2018-01-11 18:00 ` [PATCH 1/8] drm/i915/cnl: Add Port F definition Paulo Zanoni
2018-01-11 19:37   ` Rodrigo Vivi
2018-01-11 18:00 ` [PATCH 2/8] drm/i915/icl: Add initial Icelake definitions Paulo Zanoni
2018-01-11 18:00 ` [PATCH 3/8] drm/i915/icp: Introduce Ice Lake PCH Paulo Zanoni
2018-01-11 18:00 ` Paulo Zanoni [this message]
2018-01-11 18:00 ` [PATCH 5/8] drm/i915/icp: Add Panel Power Sequencing Support Paulo Zanoni
2018-01-11 18:00 ` [PATCH 6/8] drm/i915/icp: Add backlight Support for ICP Paulo Zanoni
2018-01-11 21:48   ` James Ausmus
2018-01-11 23:57     ` Rodrigo Vivi
2018-01-19 16:40       ` Paulo Zanoni
2018-01-19 17:26         ` Anusha Srivatsa
2018-01-19 17:56           ` Rodrigo Vivi
2018-01-19 18:25             ` Paulo Zanoni
2018-01-19 18:45               ` Srivatsa, Anusha
2018-01-19 18:14           ` James Ausmus
2018-01-19 18:48   ` Paulo Zanoni
2018-01-19 19:45     ` Ausmus, James
2018-01-19 19:56     ` Rodrigo Vivi
2018-01-11 18:00 ` [PATCH 7/8] drm/i915/icp: add ICP gmbus and gpio support Paulo Zanoni
2018-01-11 18:00 ` [PATCH 8/8] drm/i915/icp: Add the ID for ICL PCH - ICP Paulo Zanoni
2018-01-11 18:25 ` ✓ Fi.CI.BAT: success for ICP initial support Patchwork
2018-01-11 19:17 ` ✓ Fi.CI.IGT: " Patchwork
2018-01-19 19:48 ` ✓ Fi.CI.BAT: success for ICP initial support (rev2) Patchwork
2018-01-19 20:20 ` [PATCH 0/8] ICP initial support Paulo Zanoni
2018-01-20  3:33 ` ✓ Fi.CI.IGT: success for ICP initial support (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=20180111180010.24357-5-paulo.r.zanoni@intel.com \
    --to=paulo.r.zanoni@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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.