aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2014-06-25 15:01:57 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-07-10 16:11:46 -0400
commit9cd86933fe250fd3e698b62505dfe2d43326baaa (patch)
tree491b416afede1bc47045dca70a554093a8a25bd7 /drivers/gpu/drm
parent0e50338cf0f0009a5c9bc847a4c86a1d4438af66 (diff)
drm/i915: Basic shared dpll support for WRPLLs
Just filing in names and ids, but not yet officially registering them so that the hw state cross checker doesn't completely freak out about them. Still since we do already read out and cross check config->shared_dpll the basics are now there to flesh out the wrpll shared dpll implementation. The idea is now to roll out all the callbacks step-by-step and then at the end switch to the shared dpll framework. This way hw and sw changes are clearly separated. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> [imre: added const to hsw_ddi_pll_names (Damien)] Reviewed-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h6
-rw-r--r--drivers/gpu/drm/i915/intel_ddi.c17
-rw-r--r--drivers/gpu/drm/i915/intel_display.c21
3 files changed, 34 insertions, 10 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index a1650d0ba6af..3d8783831e85 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -184,8 +184,10 @@ struct i915_mmu_object;
184enum intel_dpll_id { 184enum intel_dpll_id {
185 DPLL_ID_PRIVATE = -1, /* non-shared dpll in use */ 185 DPLL_ID_PRIVATE = -1, /* non-shared dpll in use */
186 /* real shared dpll ids must be >= 0 */ 186 /* real shared dpll ids must be >= 0 */
187 DPLL_ID_PCH_PLL_A, 187 DPLL_ID_PCH_PLL_A = 0,
188 DPLL_ID_PCH_PLL_B, 188 DPLL_ID_PCH_PLL_B = 1,
189 DPLL_ID_WRPLL1 = 0,
190 DPLL_ID_WRPLL2 = 1,
189}; 191};
190#define I915_NUM_PLLS 2 192#define I915_NUM_PLLS 2
191 193
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 195d52ef512f..bf6f1c2dea8c 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -784,9 +784,11 @@ bool intel_ddi_pll_select(struct intel_crtc *intel_crtc)
784 if (reg == WRPLL_CTL1) { 784 if (reg == WRPLL_CTL1) {
785 plls->wrpll1_refcount++; 785 plls->wrpll1_refcount++;
786 intel_crtc->config.ddi_pll_sel = PORT_CLK_SEL_WRPLL1; 786 intel_crtc->config.ddi_pll_sel = PORT_CLK_SEL_WRPLL1;
787 intel_crtc->config.shared_dpll = DPLL_ID_WRPLL1;
787 } else { 788 } else {
788 plls->wrpll2_refcount++; 789 plls->wrpll2_refcount++;
789 intel_crtc->config.ddi_pll_sel = PORT_CLK_SEL_WRPLL2; 790 intel_crtc->config.ddi_pll_sel = PORT_CLK_SEL_WRPLL2;
791 intel_crtc->config.shared_dpll = DPLL_ID_WRPLL2;
790 } 792 }
791 } 793 }
792 794
@@ -1315,10 +1317,25 @@ int intel_ddi_get_cdclk_freq(struct drm_i915_private *dev_priv)
1315 } 1317 }
1316} 1318}
1317 1319
1320static char *hsw_ddi_pll_names[] = {
1321 "WRPLL 1",
1322 "WRPLL 2",
1323};
1324
1318void intel_ddi_pll_init(struct drm_device *dev) 1325void intel_ddi_pll_init(struct drm_device *dev)
1319{ 1326{
1320 struct drm_i915_private *dev_priv = dev->dev_private; 1327 struct drm_i915_private *dev_priv = dev->dev_private;
1321 uint32_t val = I915_READ(LCPLL_CTL); 1328 uint32_t val = I915_READ(LCPLL_CTL);
1329 int i;
1330
1331 /* Dummy setup until everything is moved over to avoid upsetting the hw
1332 * state cross checker. */
1333 dev_priv->num_shared_dpll = 0;
1334
1335 for (i = 0; i < 2; i++) {
1336 dev_priv->shared_dplls[i].id = i;
1337 dev_priv->shared_dplls[i].name = hsw_ddi_pll_names[i];
1338 }
1322 1339
1323 /* The LCPLL register should be turned on by the BIOS. For now let's 1340 /* The LCPLL register should be turned on by the BIOS. For now let's
1324 * just check its state and print errors in case something is wrong. 1341 * just check its state and print errors in case something is wrong.
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index e26df6783406..0874f3589722 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -7583,6 +7583,16 @@ static void haswell_get_ddi_port_state(struct intel_crtc *crtc,
7583 port = (tmp & TRANS_DDI_PORT_MASK) >> TRANS_DDI_PORT_SHIFT; 7583 port = (tmp & TRANS_DDI_PORT_MASK) >> TRANS_DDI_PORT_SHIFT;
7584 7584
7585 pipe_config->ddi_pll_sel = I915_READ(PORT_CLK_SEL(port)); 7585 pipe_config->ddi_pll_sel = I915_READ(PORT_CLK_SEL(port));
7586
7587 switch (pipe_config->ddi_pll_sel) {
7588 case PORT_CLK_SEL_WRPLL1:
7589 pipe_config->shared_dpll = DPLL_ID_WRPLL1;
7590 break;
7591 case PORT_CLK_SEL_WRPLL2:
7592 pipe_config->shared_dpll = DPLL_ID_WRPLL2;
7593 break;
7594 }
7595
7586 /* 7596 /*
7587 * Haswell has only FDI/PCH transcoder A. It is which is connected to 7597 * Haswell has only FDI/PCH transcoder A. It is which is connected to
7588 * DDI E. So just check whether this pipe is wired to DDI E and whether 7598 * DDI E. So just check whether this pipe is wired to DDI E and whether
@@ -11286,12 +11296,6 @@ static const struct drm_crtc_funcs intel_crtc_funcs = {
11286 .page_flip = intel_crtc_page_flip, 11296 .page_flip = intel_crtc_page_flip,
11287}; 11297};
11288 11298
11289static void intel_cpu_pll_init(struct drm_device *dev)
11290{
11291 if (HAS_DDI(dev))
11292 intel_ddi_pll_init(dev);
11293}
11294
11295static bool ibx_pch_dpll_get_hw_state(struct drm_i915_private *dev_priv, 11299static bool ibx_pch_dpll_get_hw_state(struct drm_i915_private *dev_priv,
11296 struct intel_shared_dpll *pll, 11300 struct intel_shared_dpll *pll,
11297 struct intel_dpll_hw_state *hw_state) 11301 struct intel_dpll_hw_state *hw_state)
@@ -11379,7 +11383,9 @@ static void intel_shared_dpll_init(struct drm_device *dev)
11379{ 11383{
11380 struct drm_i915_private *dev_priv = dev->dev_private; 11384 struct drm_i915_private *dev_priv = dev->dev_private;
11381 11385
11382 if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev)) 11386 if (HAS_DDI(dev))
11387 intel_ddi_pll_init(dev);
11388 else if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev))
11383 ibx_pch_dpll_init(dev); 11389 ibx_pch_dpll_init(dev);
11384 else 11390 else
11385 dev_priv->num_shared_dpll = 0; 11391 dev_priv->num_shared_dpll = 0;
@@ -12536,7 +12542,6 @@ void intel_modeset_init(struct drm_device *dev)
12536 intel_init_dpio(dev); 12542 intel_init_dpio(dev);
12537 intel_reset_dpio(dev); 12543 intel_reset_dpio(dev);
12538 12544
12539 intel_cpu_pll_init(dev);
12540 intel_shared_dpll_init(dev); 12545 intel_shared_dpll_init(dev);
12541 12546
12542 /* Just disable it once at startup */ 12547 /* Just disable it once at startup */