stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	"Imre Deak" <imre.deak@intel.com>
Subject: [PATCH 5.10 10/20] drm/i915/tgl: Fix Combo PHY DPLL fractional divider for 38.4MHz ref clock
Date: Thu,  7 Jan 2021 15:34:05 +0100	[thread overview]
Message-ID: <20210107143053.839232037@linuxfoundation.org> (raw)
In-Reply-To: <20210107143052.392839477@linuxfoundation.org>

From: Imre Deak <imre.deak@intel.com>

commit 0e2497e334de42dbaaee8e325241b5b5b34ede7e upstream.

Apply Display WA #22010492432 for combo PHY PLLs too. This should fix a
problem where the PLL output frequency is slightly off with the current
PLL fractional divider value.

I haven't seen an actual case where this causes a problem, but let's
follow the spec. It's also needed on some EHL platforms, but for that we
also need a way to distinguish the affected EHL SKUs, so I leave that
for a follow-up.

v2:
- Apply the WA at one place when calculating the PLL dividers from the
  frequency and the frequency from the dividers for all the combo PLL
  use cases (DP, HDMI, TBT). (Ville)

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201003001846.1271151-6-imre.deak@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/gpu/drm/i915/display/intel_dpll_mgr.c |   41 +++++++++++++++-----------
 1 file changed, 25 insertions(+), 16 deletions(-)

--- a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
+++ b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
@@ -2622,11 +2622,22 @@ static bool cnl_ddi_hdmi_pll_dividers(st
 	return true;
 }
 
+/*
+ * Display WA #22010492432: tgl
+ * Program half of the nominal DCO divider fraction value.
+ */
+static bool
+tgl_combo_pll_div_frac_wa_needed(struct drm_i915_private *i915)
+{
+	return IS_TIGERLAKE(i915) && i915->dpll.ref_clks.nssc == 38400;
+}
+
 static int __cnl_ddi_wrpll_get_freq(struct drm_i915_private *dev_priv,
 				    const struct intel_shared_dpll *pll,
 				    int ref_clock)
 {
 	const struct intel_dpll_hw_state *pll_state = &pll->state.hw_state;
+	u32 dco_fraction;
 	u32 p0, p1, p2, dco_freq;
 
 	p0 = pll_state->cfgcr1 & DPLL_CFGCR1_PDIV_MASK;
@@ -2669,8 +2680,13 @@ static int __cnl_ddi_wrpll_get_freq(stru
 	dco_freq = (pll_state->cfgcr0 & DPLL_CFGCR0_DCO_INTEGER_MASK) *
 		   ref_clock;
 
-	dco_freq += (((pll_state->cfgcr0 & DPLL_CFGCR0_DCO_FRACTION_MASK) >>
-		      DPLL_CFGCR0_DCO_FRACTION_SHIFT) * ref_clock) / 0x8000;
+	dco_fraction = (pll_state->cfgcr0 & DPLL_CFGCR0_DCO_FRACTION_MASK) >>
+		       DPLL_CFGCR0_DCO_FRACTION_SHIFT;
+
+	if (tgl_combo_pll_div_frac_wa_needed(dev_priv))
+		dco_fraction *= 2;
+
+	dco_freq += (dco_fraction * ref_clock) / 0x8000;
 
 	if (drm_WARN_ON(&dev_priv->drm, p0 == 0 || p1 == 0 || p2 == 0))
 		return 0;
@@ -2948,16 +2964,6 @@ static const struct skl_wrpll_params tgl
 	/* the following params are unused */
 };
 
-/*
- * Display WA #22010492432: tgl
- * Divide the nominal .dco_fraction value by 2.
- */
-static const struct skl_wrpll_params tgl_tbt_pll_38_4MHz_values = {
-	.dco_integer = 0x54, .dco_fraction = 0x1800,
-	/* the following params are unused */
-	.pdiv = 0, .kdiv = 0, .qdiv_mode = 0, .qdiv_ratio = 0,
-};
-
 static bool icl_calc_dp_combo_pll(struct intel_crtc_state *crtc_state,
 				  struct skl_wrpll_params *pll_params)
 {
@@ -2991,14 +2997,12 @@ static bool icl_calc_tbt_pll(struct inte
 			MISSING_CASE(dev_priv->dpll.ref_clks.nssc);
 			fallthrough;
 		case 19200:
+		case 38400:
 			*pll_params = tgl_tbt_pll_19_2MHz_values;
 			break;
 		case 24000:
 			*pll_params = tgl_tbt_pll_24MHz_values;
 			break;
-		case 38400:
-			*pll_params = tgl_tbt_pll_38_4MHz_values;
-			break;
 		}
 	} else {
 		switch (dev_priv->dpll.ref_clks.nssc) {
@@ -3065,9 +3069,14 @@ static void icl_calc_dpll_state(struct d
 				const struct skl_wrpll_params *pll_params,
 				struct intel_dpll_hw_state *pll_state)
 {
+	u32 dco_fraction = pll_params->dco_fraction;
+
 	memset(pll_state, 0, sizeof(*pll_state));
 
-	pll_state->cfgcr0 = DPLL_CFGCR0_DCO_FRACTION(pll_params->dco_fraction) |
+	if (tgl_combo_pll_div_frac_wa_needed(i915))
+		dco_fraction = DIV_ROUND_CLOSEST(dco_fraction, 2);
+
+	pll_state->cfgcr0 = DPLL_CFGCR0_DCO_FRACTION(dco_fraction) |
 			    pll_params->dco_integer;
 
 	pll_state->cfgcr1 = DPLL_CFGCR1_QDIV_RATIO(pll_params->qdiv_ratio) |



  parent reply	other threads:[~2021-01-07 14:35 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-07 14:33 [PATCH 5.10 00/20] 5.10.6-rc1 review Greg Kroah-Hartman
2021-01-07 14:33 ` [PATCH 5.10 01/20] Revert "drm/amd/display: Fix memory leaks in S3 resume" Greg Kroah-Hartman
2021-01-07 14:33 ` [PATCH 5.10 02/20] Revert "mtd: spinand: Fix OOB read" Greg Kroah-Hartman
2021-01-07 14:33 ` [PATCH 5.10 03/20] rtc: pcf2127: move watchdog initialisation to a separate function Greg Kroah-Hartman
2021-01-07 14:33 ` [PATCH 5.10 04/20] rtc: pcf2127: only use watchdog when explicitly available Greg Kroah-Hartman
2021-01-07 14:34 ` [PATCH 5.10 05/20] dt-bindings: rtc: add reset-source property Greg Kroah-Hartman
2021-01-07 14:34 ` [PATCH 5.10 06/20] kdev_t: always inline major/minor helper functions Greg Kroah-Hartman
2021-01-07 14:34 ` [PATCH 5.10 07/20] Bluetooth: Fix attempting to set RPA timeout when unsupported Greg Kroah-Hartman
2021-01-07 14:34 ` [PATCH 5.10 08/20] ALSA: hda/realtek - Modify Dell platform name Greg Kroah-Hartman
2021-01-07 14:34 ` [PATCH 5.10 09/20] ALSA: hda/hdmi: Fix incorrect mutex unlock in silent_stream_disable() Greg Kroah-Hartman
2021-01-07 14:34 ` Greg Kroah-Hartman [this message]
2021-01-07 14:34 ` [PATCH 5.10 11/20] scsi: ufs: Allow an error return value from ->device_reset() Greg Kroah-Hartman
2021-01-07 14:34 ` [PATCH 5.10 12/20] scsi: ufs: Re-enable WriteBooster after device reset Greg Kroah-Hartman
2021-01-07 14:34 ` [PATCH 5.10 13/20] RDMA/core: remove use of dma_virt_ops Greg Kroah-Hartman
2021-01-07 14:34 ` [PATCH 5.10 14/20] RDMA/siw,rxe: Make emulated devices virtual in the device tree Greg Kroah-Hartman
2021-01-07 14:34 ` [PATCH 5.10 15/20] fuse: fix bad inode Greg Kroah-Hartman
2021-01-07 14:34 ` [PATCH 5.10 16/20] perf: Break deadlock involving exec_update_mutex Greg Kroah-Hartman
2021-01-07 14:34 ` [PATCH 5.10 17/20] rwsem: Implement down_read_killable_nested Greg Kroah-Hartman
2021-01-07 14:34 ` [PATCH 5.10 18/20] rwsem: Implement down_read_interruptible Greg Kroah-Hartman
2021-01-07 14:34 ` [PATCH 5.10 19/20] exec: Transform exec_update_mutex into a rw_semaphore Greg Kroah-Hartman
2021-01-07 14:34 ` [PATCH 5.10 20/20] mwifiex: Fix possible buffer overflows in mwifiex_cmd_802_11_ad_hoc_start Greg Kroah-Hartman
2021-01-07 20:20 ` [PATCH 5.10 00/20] 5.10.6-rc1 review Jon Hunter
2021-01-10 11:30   ` Greg Kroah-Hartman
2021-01-08  1:10 ` Shuah Khan
2021-01-10 11:30   ` Greg Kroah-Hartman
2021-01-08  2:02 ` Naresh Kamboju
2021-01-10 11:30   ` Greg Kroah-Hartman
2021-01-08 17:41 ` Guenter Roeck
2021-01-10 11:31   ` Greg Kroah-Hartman

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=20210107143053.839232037@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=imre.deak@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=ville.syrjala@linux.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).