Thomas Zimmermann ebf85e
From bb911536f07e5ed9147e3acf55a2cd72dffff70d Mon Sep 17 00:00:00 2001
Thomas Zimmermann ebf85e
From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= <ville.syrjala@linux.intel.com>
Thomas Zimmermann ebf85e
Date: Fri, 27 Oct 2017 22:31:26 +0300
Thomas Zimmermann ebf85e
Subject: [PATCH] drm/i915: Eliminate pll->state usage from bxt_calc_pll_link()
Thomas Zimmermann ebf85e
Mime-version: 1.0
Thomas Zimmermann ebf85e
Content-type: text/plain; charset=UTF-8
Thomas Zimmermann ebf85e
Content-transfer-encoding: 8bit
Thomas Zimmermann ebf85e
Git-commit: bb911536f07e5ed9147e3acf55a2cd72dffff70d
Thomas Zimmermann ebf85e
Patch-mainline: v4.16-rc1
Thomas Zimmermann ebf85e
References: FATE#322643 bsc#1055900
Thomas Zimmermann ebf85e
Thomas Zimmermann ebf85e
We should be using the DPLL hw state we got from the current crtc state
Thomas Zimmermann ebf85e
to determine the corresponding port clock frequency rather than getting
Thomas Zimmermann ebf85e
it via the current state programmed into the DPLL.
Thomas Zimmermann ebf85e
Thomas Zimmermann ebf85e
V2: Rebase due to intel_dpll_id changes
Thomas Zimmermann ebf85e
Thomas Zimmermann ebf85e
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Thomas Zimmermann ebf85e
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Thomas Zimmermann ebf85e
Link: https://patchwork.freedesktop.org/patch/msgid/20171027193128.14483-5-ville.syrjala@linux.intel.com
Thomas Zimmermann ebf85e
Acked-by: Takashi Iwai <tiwai@suse.de>
Thomas Zimmermann ebf85e
Thomas Zimmermann ebf85e
---
Thomas Zimmermann ebf85e
 drivers/gpu/drm/i915/intel_ddi.c |   17 +++++------------
Thomas Zimmermann ebf85e
 1 file changed, 5 insertions(+), 12 deletions(-)
Thomas Zimmermann ebf85e
Thomas Zimmermann ebf85e
--- a/drivers/gpu/drm/i915/intel_ddi.c
Thomas Zimmermann ebf85e
+++ b/drivers/gpu/drm/i915/intel_ddi.c
Thomas Zimmermann ebf85e
@@ -1423,19 +1423,16 @@ static void hsw_ddi_clock_get(struct int
Thomas Zimmermann ebf85e
 	ddi_dotclock_get(pipe_config);
Thomas Zimmermann ebf85e
 }
Thomas Zimmermann ebf85e
 
Thomas Zimmermann ebf85e
-static int bxt_calc_pll_link(struct drm_i915_private *dev_priv,
Thomas Zimmermann ebf85e
-			     enum intel_dpll_id pll_id)
Thomas Zimmermann ebf85e
+static int bxt_calc_pll_link(struct intel_crtc_state *crtc_state)
Thomas Zimmermann ebf85e
 {
Thomas Zimmermann ebf85e
-	struct intel_shared_dpll *pll;
Thomas Zimmermann ebf85e
 	struct intel_dpll_hw_state *state;
Thomas Zimmermann ebf85e
 	struct dpll clock;
Thomas Zimmermann ebf85e
 
Thomas Zimmermann ebf85e
 	/* For DDI ports we always use a shared PLL. */
Thomas Zimmermann ebf85e
-	if (WARN_ON(pll_id == DPLL_ID_PRIVATE))
Thomas Zimmermann ebf85e
+	if (WARN_ON(!crtc_state->shared_dpll))
Thomas Zimmermann ebf85e
 		return 0;
Thomas Zimmermann ebf85e
 
Thomas Zimmermann ebf85e
-	pll = &dev_priv->shared_dplls[pll_id];
Thomas Zimmermann ebf85e
-	state = &pll->state.hw_state;
Thomas Zimmermann ebf85e
+	state = &crtc_state->dpll_hw_state;
Thomas Zimmermann ebf85e
 
Thomas Zimmermann ebf85e
 	clock.m1 = 2;
Thomas Zimmermann ebf85e
 	clock.m2 = (state->pll0 & PORT_PLL_M2_MASK) << 22;
Thomas Zimmermann ebf85e
@@ -1449,13 +1446,9 @@ static int bxt_calc_pll_link(struct drm_
Thomas Zimmermann ebf85e
 }
Thomas Zimmermann ebf85e
 
Thomas Zimmermann ebf85e
 static void bxt_ddi_clock_get(struct intel_encoder *encoder,
Thomas Zimmermann ebf85e
-				struct intel_crtc_state *pipe_config)
Thomas Zimmermann ebf85e
+			      struct intel_crtc_state *pipe_config)
Thomas Zimmermann ebf85e
 {
Thomas Zimmermann ebf85e
-	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
Thomas Zimmermann ebf85e
-	enum port port = encoder->port;
Thomas Zimmermann ebf85e
-	enum intel_dpll_id pll_id = port;
Thomas Zimmermann ebf85e
-
Thomas Zimmermann ebf85e
-	pipe_config->port_clock = bxt_calc_pll_link(dev_priv, pll_id);
Thomas Zimmermann ebf85e
+	pipe_config->port_clock = bxt_calc_pll_link(pipe_config);
Thomas Zimmermann ebf85e
 
Thomas Zimmermann ebf85e
 	ddi_dotclock_get(pipe_config);
Thomas Zimmermann ebf85e
 }