All of lore.kernel.org
 help / color / mirror / Atom feed
From: "José Roberto de Souza" <jose.souza@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Taylor@freedesktop.org
Subject: [PATCH 13/14] drm/i915/tgl: Use dkl pll hardcoded values
Date: Fri, 13 Sep 2019 15:32:50 -0700	[thread overview]
Message-ID: <20190913223251.354877-14-jose.souza@intel.com> (raw)
In-Reply-To: <20190913223251.354877-1-jose.souza@intel.com>

From: "Taylor, Clinton A" <clinton.a.taylor@intel.com>

BSpec PLL calculation are not validated/ready yet, so for now it is
providing a table with hardcoded values to all DP link rates.
So for now lets override the calculated values with the hardcoded
ones.

With this hardcoded values the port clock calculation for 5.4Ghz
don't match but this is a minor error that we can live for now.

Bspec: 49204

Signed-off-by: Taylor, Clinton A <clinton.a.taylor@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
---
 drivers/gpu/drm/i915/display/intel_dpll_mgr.c | 66 +++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
index 25be6229b122..5b568dd57a5a 100644
--- a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
+++ b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
@@ -2667,6 +2667,65 @@ static bool tgl_dkl_pll_find_divisors(int clock_khz, bool is_dp, bool use_ssc,
 	return false;
 }
 
+struct tgl_dp_frequencies {
+	u32 hsclkctl;
+	u32 coreclkctl1;
+	u32 ssc_reg;
+};
+
+static void
+tgl_dkl_pll_overwrite_with_hardcoded_values(int clock_khz,
+					    struct intel_dpll_hw_state *state,
+					    bool is_dp)
+{
+	const struct tgl_dp_frequencies tgl_dkl_pll_dp_frequencies[] = {
+		{ 0x011D, 0x10080510, 0x401320ff },	/* 8p1 */
+		{ 0x121D, 0x10080510, 0x401320ff },	/* 5p4 */
+		{ 0x521D, 0x10080A12, 0x401320ff },	/* 2p7 */
+		{ 0x621D, 0x10080A12, 0x401320ff },	/* 1p62 */
+	};
+	int i;
+
+	if (!is_dp) {
+		/* No hardcoded values for HDMI */
+		MISSING_CASE(!is_dp);
+		return;
+	}
+
+	switch (clock_khz) {
+	case 810000:
+		i = 0;
+		break;
+	case 540000:
+		i = 1;
+		break;
+	case 270000:
+		i = 2;
+		break;
+	case 162000:
+		i = 3;
+		break;
+	default:
+		MISSING_CASE(clock_khz);
+		return;
+	}
+
+	state->mg_clktop2_coreclkctl1 = tgl_dkl_pll_dp_frequencies[i].coreclkctl1;
+	state->mg_clktop2_coreclkctl1 &= MG_CLKTOP2_CORECLKCTL1_A_DIVRATIO_MASK;
+
+	state->mg_clktop2_hsclkctl = tgl_dkl_pll_dp_frequencies[i].hsclkctl;
+	state->mg_clktop2_hsclkctl &= (MG_CLKTOP2_HSCLKCTL_TLINEDRV_CLKSEL_MASK |
+				       MG_CLKTOP2_HSCLKCTL_CORE_INPUTSEL_MASK |
+				       MG_CLKTOP2_HSCLKCTL_HSDIV_RATIO_MASK |
+				       MG_CLKTOP2_HSCLKCTL_DSDIV_RATIO_MASK);
+
+	state->mg_pll_ssc = tgl_dkl_pll_dp_frequencies[i].ssc_reg;
+	state->mg_pll_ssc &= (DKL_PLL_SSC_IREF_NDIV_RATIO_MASK |
+			      DKL_PLL_SSC_STEP_LEN_MASK |
+			      DKL_PLL_SSC_STEP_NUM_MASK |
+			      DKL_PLL_SSC_EN);
+}
+
 /*
  * The specification for this function uses real numbers, so the math had to be
  * adapted to integer-only calculation, that's why it looks so different.
@@ -2798,6 +2857,13 @@ static bool tgl_calc_dkl_pll_state(struct intel_crtc_state *crtc_state,
 			DKL_PLL_TDC_SSC_STEP_SIZE(ssc_stepsize) |
 			DKL_PLL_TDC_FEED_FWD_GAIN(feedfwgain);
 
+	/*
+	 * BSpec PLL calculations are not validated/ready yet, so for now lets
+	 * fallback to the hardcoded table.
+	 */
+	tgl_dkl_pll_overwrite_with_hardcoded_values(symbol_frequency,
+						    pll_state, is_dp);
+
 	return true;
 }
 
-- 
2.23.0

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

  parent reply	other threads:[~2019-09-13 22:32 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-13 22:32 [PATCH 00/14] TGL TC enabling José Roberto de Souza
2019-09-13 22:32 ` [PATCH 01/14] drm/i915/tgl: Add missing ddi clock select during DP init sequence José Roberto de Souza
2019-09-13 22:32 ` [PATCH 02/14] drm/i915/tgl: TC helper function to return pin mapping José Roberto de Souza
2019-09-14  5:54   ` Lucas De Marchi
2019-09-17 21:15     ` Souza, Jose
2019-09-13 22:32 ` [PATCH 03/14] drm/i915/tgl: Finish modular FIA support on registers José Roberto de Souza
2019-09-14  6:24   ` Lucas De Marchi
2019-09-18  1:08     ` Souza, Jose
2019-09-13 22:32 ` [PATCH 04/14] drm/i915/tgl: Fix driver crash when update_active_dpll is called José Roberto de Souza
2019-09-14  6:32   ` Lucas De Marchi
2019-09-17 22:59     ` Souza, Jose
2019-09-13 22:32 ` [PATCH 05/14] drm/i915/tgl: Add dkl phy registers José Roberto de Souza
2019-09-13 22:32 ` [PATCH 06/14] drm/i915/tgl: Add initial dkl pll support José Roberto de Souza
2019-09-13 22:32 ` [PATCH 07/14] drm/i915/tgl: Add support for dkl pll write José Roberto de Souza
2019-09-14  6:41   ` Lucas De Marchi
2019-09-16  8:48     ` Jani Nikula
2019-09-13 22:32 ` [PATCH 08/14] drm/i915/tgl: Add dkl phy programming sequences José Roberto de Souza
2019-09-13 22:32 ` [PATCH 09/14] drm/i915/icl: Unify disable and enable phy clock gating functions José Roberto de Souza
2019-09-13 22:32 ` [PATCH 10/14] drm/i915/tgl: Fix dkl phy register space addressing José Roberto de Souza
2019-09-14  7:26   ` Lucas De Marchi
2019-09-18 19:55     ` Souza, Jose
2019-09-13 22:32 ` [PATCH 11/14] drm/i915/tgl: Check the UC health of tc controllers after power on José Roberto de Souza
2019-09-13 22:32 ` [PATCH 12/14] drm/i915: Add dkl phy pll calculations José Roberto de Souza
2019-09-14  7:38   ` Lucas De Marchi
2019-09-13 22:32 ` José Roberto de Souza [this message]
2019-09-13 22:32 ` [PATCH 14/14] drm/i915/tgl: initialize TC and TBT ports José Roberto de Souza
2019-09-13 22:53 ` ✗ Fi.CI.CHECKPATCH: warning for TGL TC enabling Patchwork
2019-09-13 23:12 ` ✓ Fi.CI.BAT: success " Patchwork
2019-09-15  7:07 ` ✓ Fi.CI.IGT: " 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=20190913223251.354877-14-jose.souza@intel.com \
    --to=jose.souza@intel.com \
    --cc=Taylor@freedesktop.org \
    --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.