aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_display.c
diff options
context:
space:
mode:
authorAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>2014-10-20 06:46:45 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-10-24 10:34:06 -0400
commit409ee761fdc3b39e34ffccea375e7f0f13fce9cc (patch)
treecf29ba1782fa3973b5bf8d4141b1ec0623081f8b /drivers/gpu/drm/i915/intel_display.c
parentc7653199c01a2499ea134ead0fe03f2451c28518 (diff)
drm/i915: Make intel_pipe_has_type() and some callers take intel_crtc
For consistency, since that's the rule followed for internal functions. Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c106
1 files changed, 54 insertions, 52 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index b9f0f38bd482..103972c131b6 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -406,22 +406,22 @@ static void vlv_clock(int refclk, intel_clock_t *clock)
406/** 406/**
407 * Returns whether any output on the specified pipe is of the specified type 407 * Returns whether any output on the specified pipe is of the specified type
408 */ 408 */
409static bool intel_pipe_has_type(struct drm_crtc *crtc, int type) 409static bool intel_pipe_has_type(struct intel_crtc *crtc, int type)
410{ 410{
411 struct drm_device *dev = crtc->dev; 411 struct drm_device *dev = crtc->base.dev;
412 struct intel_encoder *encoder; 412 struct intel_encoder *encoder;
413 413
414 for_each_encoder_on_crtc(dev, crtc, encoder) 414 for_each_encoder_on_crtc(dev, &crtc->base, encoder)
415 if (encoder->type == type) 415 if (encoder->type == type)
416 return true; 416 return true;
417 417
418 return false; 418 return false;
419} 419}
420 420
421static const intel_limit_t *intel_ironlake_limit(struct drm_crtc *crtc, 421static const intel_limit_t *intel_ironlake_limit(struct intel_crtc *crtc,
422 int refclk) 422 int refclk)
423{ 423{
424 struct drm_device *dev = crtc->dev; 424 struct drm_device *dev = crtc->base.dev;
425 const intel_limit_t *limit; 425 const intel_limit_t *limit;
426 426
427 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { 427 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
@@ -442,9 +442,9 @@ static const intel_limit_t *intel_ironlake_limit(struct drm_crtc *crtc,
442 return limit; 442 return limit;
443} 443}
444 444
445static const intel_limit_t *intel_g4x_limit(struct drm_crtc *crtc) 445static const intel_limit_t *intel_g4x_limit(struct intel_crtc *crtc)
446{ 446{
447 struct drm_device *dev = crtc->dev; 447 struct drm_device *dev = crtc->base.dev;
448 const intel_limit_t *limit; 448 const intel_limit_t *limit;
449 449
450 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { 450 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
@@ -463,9 +463,9 @@ static const intel_limit_t *intel_g4x_limit(struct drm_crtc *crtc)
463 return limit; 463 return limit;
464} 464}
465 465
466static const intel_limit_t *intel_limit(struct drm_crtc *crtc, int refclk) 466static const intel_limit_t *intel_limit(struct intel_crtc *crtc, int refclk)
467{ 467{
468 struct drm_device *dev = crtc->dev; 468 struct drm_device *dev = crtc->base.dev;
469 const intel_limit_t *limit; 469 const intel_limit_t *limit;
470 470
471 if (HAS_PCH_SPLIT(dev)) 471 if (HAS_PCH_SPLIT(dev))
@@ -584,7 +584,7 @@ i9xx_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc,
584 intel_clock_t clock; 584 intel_clock_t clock;
585 int err = target; 585 int err = target;
586 586
587 if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_LVDS)) { 587 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
588 /* 588 /*
589 * For LVDS just rely on its current settings for dual-channel. 589 * For LVDS just rely on its current settings for dual-channel.
590 * We haven't figured out how to reliably set up different 590 * We haven't figured out how to reliably set up different
@@ -645,7 +645,7 @@ pnv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc,
645 intel_clock_t clock; 645 intel_clock_t clock;
646 int err = target; 646 int err = target;
647 647
648 if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_LVDS)) { 648 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
649 /* 649 /*
650 * For LVDS just rely on its current settings for dual-channel. 650 * For LVDS just rely on its current settings for dual-channel.
651 * We haven't figured out how to reliably set up different 651 * We haven't figured out how to reliably set up different
@@ -708,7 +708,7 @@ g4x_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc,
708 int err_most = (target >> 8) + (target >> 9); 708 int err_most = (target >> 8) + (target >> 9);
709 found = false; 709 found = false;
710 710
711 if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_LVDS)) { 711 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
712 if (intel_is_dual_link_lvds(dev)) 712 if (intel_is_dual_link_lvds(dev))
713 clock.p2 = limit->p2.p2_fast; 713 clock.p2 = limit->p2.p2_fast;
714 else 714 else
@@ -1567,7 +1567,7 @@ static int intel_num_dvo_pipes(struct drm_device *dev)
1567 1567
1568 for_each_intel_crtc(dev, crtc) 1568 for_each_intel_crtc(dev, crtc)
1569 count += crtc->active && 1569 count += crtc->active &&
1570 intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_DVO); 1570 intel_pipe_has_type(crtc, INTEL_OUTPUT_DVO);
1571 1571
1572 return count; 1572 return count;
1573} 1573}
@@ -1646,7 +1646,7 @@ static void i9xx_disable_pll(struct intel_crtc *crtc)
1646 1646
1647 /* Disable DVO 2x clock on both PLLs if necessary */ 1647 /* Disable DVO 2x clock on both PLLs if necessary */
1648 if (IS_I830(dev) && 1648 if (IS_I830(dev) &&
1649 intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_DVO) && 1649 intel_pipe_has_type(crtc, INTEL_OUTPUT_DVO) &&
1650 intel_num_dvo_pipes(dev) == 1) { 1650 intel_num_dvo_pipes(dev) == 1) {
1651 I915_WRITE(DPLL(PIPE_B), 1651 I915_WRITE(DPLL(PIPE_B),
1652 I915_READ(DPLL(PIPE_B)) & ~DPLL_DVO_2X_MODE); 1652 I915_READ(DPLL(PIPE_B)) & ~DPLL_DVO_2X_MODE);
@@ -1884,7 +1884,7 @@ static void ironlake_enable_pch_transcoder(struct drm_i915_private *dev_priv,
1884 val &= ~TRANS_INTERLACE_MASK; 1884 val &= ~TRANS_INTERLACE_MASK;
1885 if ((pipeconf_val & PIPECONF_INTERLACE_MASK) == PIPECONF_INTERLACED_ILK) 1885 if ((pipeconf_val & PIPECONF_INTERLACE_MASK) == PIPECONF_INTERLACED_ILK)
1886 if (HAS_PCH_IBX(dev_priv->dev) && 1886 if (HAS_PCH_IBX(dev_priv->dev) &&
1887 intel_pipe_has_type(crtc, INTEL_OUTPUT_SDVO)) 1887 intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_SDVO))
1888 val |= TRANS_LEGACY_INTERLACED_ILK; 1888 val |= TRANS_LEGACY_INTERLACED_ILK;
1889 else 1889 else
1890 val |= TRANS_INTERLACED; 1890 val |= TRANS_INTERLACED;
@@ -2007,7 +2007,7 @@ static void intel_enable_pipe(struct intel_crtc *crtc)
2007 * need the check. 2007 * need the check.
2008 */ 2008 */
2009 if (!HAS_PCH_SPLIT(dev_priv->dev)) 2009 if (!HAS_PCH_SPLIT(dev_priv->dev))
2010 if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_DSI)) 2010 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DSI))
2011 assert_dsi_pll_enabled(dev_priv); 2011 assert_dsi_pll_enabled(dev_priv);
2012 else 2012 else
2013 assert_pll_enabled(dev_priv, pipe); 2013 assert_pll_enabled(dev_priv, pipe);
@@ -2846,8 +2846,8 @@ static void intel_update_pipe_size(struct intel_crtc *crtc)
2846 ((adjusted_mode->crtc_hdisplay - 1) << 16) | 2846 ((adjusted_mode->crtc_hdisplay - 1) << 16) |
2847 (adjusted_mode->crtc_vdisplay - 1)); 2847 (adjusted_mode->crtc_vdisplay - 1));
2848 if (!crtc->config.pch_pfit.enabled && 2848 if (!crtc->config.pch_pfit.enabled &&
2849 (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_LVDS) || 2849 (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) ||
2850 intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_EDP))) { 2850 intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP))) {
2851 I915_WRITE(PF_CTL(crtc->pipe), 0); 2851 I915_WRITE(PF_CTL(crtc->pipe), 0);
2852 I915_WRITE(PF_WIN_POS(crtc->pipe), 0); 2852 I915_WRITE(PF_WIN_POS(crtc->pipe), 0);
2853 I915_WRITE(PF_WIN_SZ(crtc->pipe), 0); 2853 I915_WRITE(PF_WIN_SZ(crtc->pipe), 0);
@@ -3755,8 +3755,8 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)
3755 3755
3756 /* For PCH DP, enable TRANS_DP_CTL */ 3756 /* For PCH DP, enable TRANS_DP_CTL */
3757 if (HAS_PCH_CPT(dev) && 3757 if (HAS_PCH_CPT(dev) &&
3758 (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT) || 3758 (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT) ||
3759 intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP))) { 3759 intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_EDP))) {
3760 u32 bpc = (I915_READ(PIPECONF(pipe)) & PIPECONF_BPC_MASK) >> 5; 3760 u32 bpc = (I915_READ(PIPECONF(pipe)) & PIPECONF_BPC_MASK) >> 5;
3761 reg = TRANS_DP_CTL(pipe); 3761 reg = TRANS_DP_CTL(pipe);
3762 temp = I915_READ(reg); 3762 temp = I915_READ(reg);
@@ -4033,7 +4033,7 @@ static void intel_crtc_load_lut(struct drm_crtc *crtc)
4033 return; 4033 return;
4034 4034
4035 if (!HAS_PCH_SPLIT(dev_priv->dev)) { 4035 if (!HAS_PCH_SPLIT(dev_priv->dev)) {
4036 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DSI)) 4036 if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DSI))
4037 assert_dsi_pll_enabled(dev_priv); 4037 assert_dsi_pll_enabled(dev_priv);
4038 else 4038 else
4039 assert_pll_enabled(dev_priv, pipe); 4039 assert_pll_enabled(dev_priv, pipe);
@@ -4834,7 +4834,7 @@ static void valleyview_crtc_enable(struct drm_crtc *crtc)
4834 if (intel_crtc->active) 4834 if (intel_crtc->active)
4835 return; 4835 return;
4836 4836
4837 is_dsi = intel_pipe_has_type(crtc, INTEL_OUTPUT_DSI); 4837 is_dsi = intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DSI);
4838 4838
4839 if (!is_dsi) { 4839 if (!is_dsi) {
4840 if (IS_CHERRYVIEW(dev)) 4840 if (IS_CHERRYVIEW(dev))
@@ -5028,7 +5028,7 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
5028 if (encoder->post_disable) 5028 if (encoder->post_disable)
5029 encoder->post_disable(encoder); 5029 encoder->post_disable(encoder);
5030 5030
5031 if (!intel_pipe_has_type(crtc, INTEL_OUTPUT_DSI)) { 5031 if (!intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DSI)) {
5032 if (IS_CHERRYVIEW(dev)) 5032 if (IS_CHERRYVIEW(dev))
5033 chv_disable_pll(dev_priv, pipe); 5033 chv_disable_pll(dev_priv, pipe);
5034 else if (IS_VALLEYVIEW(dev)) 5034 else if (IS_VALLEYVIEW(dev))
@@ -5411,7 +5411,7 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc,
5411 * - LVDS dual channel mode 5411 * - LVDS dual channel mode
5412 * - Double wide pipe 5412 * - Double wide pipe
5413 */ 5413 */
5414 if ((intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_LVDS) && 5414 if ((intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) &&
5415 intel_is_dual_link_lvds(dev)) || pipe_config->double_wide) 5415 intel_is_dual_link_lvds(dev)) || pipe_config->double_wide)
5416 pipe_config->pipe_src_w &= ~1; 5416 pipe_config->pipe_src_w &= ~1;
5417 5417
@@ -5599,9 +5599,9 @@ static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv)
5599 && !(dev_priv->quirks & QUIRK_LVDS_SSC_DISABLE); 5599 && !(dev_priv->quirks & QUIRK_LVDS_SSC_DISABLE);
5600} 5600}
5601 5601
5602static int i9xx_get_refclk(struct drm_crtc *crtc, int num_connectors) 5602static int i9xx_get_refclk(struct intel_crtc *crtc, int num_connectors)
5603{ 5603{
5604 struct drm_device *dev = crtc->dev; 5604 struct drm_device *dev = crtc->base.dev;
5605 struct drm_i915_private *dev_priv = dev->dev_private; 5605 struct drm_i915_private *dev_priv = dev->dev_private;
5606 int refclk; 5606 int refclk;
5607 5607
@@ -5649,7 +5649,7 @@ static void i9xx_update_pll_dividers(struct intel_crtc *crtc,
5649 crtc->config.dpll_hw_state.fp0 = fp; 5649 crtc->config.dpll_hw_state.fp0 = fp;
5650 5650
5651 crtc->lowfreq_avail = false; 5651 crtc->lowfreq_avail = false;
5652 if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_LVDS) && 5652 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) &&
5653 reduced_clock && i915.powersave) { 5653 reduced_clock && i915.powersave) {
5654 crtc->config.dpll_hw_state.fp1 = fp2; 5654 crtc->config.dpll_hw_state.fp1 = fp2;
5655 crtc->lowfreq_avail = true; 5655 crtc->lowfreq_avail = true;
@@ -5818,16 +5818,16 @@ static void vlv_prepare_pll(struct intel_crtc *crtc)
5818 5818
5819 /* Set HBR and RBR LPF coefficients */ 5819 /* Set HBR and RBR LPF coefficients */
5820 if (crtc->config.port_clock == 162000 || 5820 if (crtc->config.port_clock == 162000 ||
5821 intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_ANALOG) || 5821 intel_pipe_has_type(crtc, INTEL_OUTPUT_ANALOG) ||
5822 intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_HDMI)) 5822 intel_pipe_has_type(crtc, INTEL_OUTPUT_HDMI))
5823 vlv_dpio_write(dev_priv, pipe, VLV_PLL_DW10(pipe), 5823 vlv_dpio_write(dev_priv, pipe, VLV_PLL_DW10(pipe),
5824 0x009f0003); 5824 0x009f0003);
5825 else 5825 else
5826 vlv_dpio_write(dev_priv, pipe, VLV_PLL_DW10(pipe), 5826 vlv_dpio_write(dev_priv, pipe, VLV_PLL_DW10(pipe),
5827 0x00d0000f); 5827 0x00d0000f);
5828 5828
5829 if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_EDP) || 5829 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP) ||
5830 intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_DISPLAYPORT)) { 5830 intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT)) {
5831 /* Use SSC source */ 5831 /* Use SSC source */
5832 if (pipe == PIPE_A) 5832 if (pipe == PIPE_A)
5833 vlv_dpio_write(dev_priv, pipe, VLV_PLL_DW5(pipe), 5833 vlv_dpio_write(dev_priv, pipe, VLV_PLL_DW5(pipe),
@@ -5847,8 +5847,8 @@ static void vlv_prepare_pll(struct intel_crtc *crtc)
5847 5847
5848 coreclk = vlv_dpio_read(dev_priv, pipe, VLV_PLL_DW7(pipe)); 5848 coreclk = vlv_dpio_read(dev_priv, pipe, VLV_PLL_DW7(pipe));
5849 coreclk = (coreclk & 0x0000ff00) | 0x01c00000; 5849 coreclk = (coreclk & 0x0000ff00) | 0x01c00000;
5850 if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_DISPLAYPORT) || 5850 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT) ||
5851 intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_EDP)) 5851 intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP))
5852 coreclk |= 0x01000000; 5852 coreclk |= 0x01000000;
5853 vlv_dpio_write(dev_priv, pipe, VLV_PLL_DW7(pipe), coreclk); 5853 vlv_dpio_write(dev_priv, pipe, VLV_PLL_DW7(pipe), coreclk);
5854 5854
@@ -5918,7 +5918,7 @@ static void chv_prepare_pll(struct intel_crtc *crtc)
5918 (2 << DPIO_CHV_FEEDFWD_GAIN_SHIFT)); 5918 (2 << DPIO_CHV_FEEDFWD_GAIN_SHIFT));
5919 5919
5920 /* Loop filter */ 5920 /* Loop filter */
5921 refclk = i9xx_get_refclk(&crtc->base, 0); 5921 refclk = i9xx_get_refclk(crtc, 0);
5922 loopfilter = 5 << DPIO_CHV_PROP_COEFF_SHIFT | 5922 loopfilter = 5 << DPIO_CHV_PROP_COEFF_SHIFT |
5923 2 << DPIO_CHV_GAIN_CTRL_SHIFT; 5923 2 << DPIO_CHV_GAIN_CTRL_SHIFT;
5924 if (refclk == 100000) 5924 if (refclk == 100000)
@@ -5950,12 +5950,12 @@ static void i9xx_update_pll(struct intel_crtc *crtc,
5950 5950
5951 i9xx_update_pll_dividers(crtc, reduced_clock); 5951 i9xx_update_pll_dividers(crtc, reduced_clock);
5952 5952
5953 is_sdvo = intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_SDVO) || 5953 is_sdvo = intel_pipe_has_type(crtc, INTEL_OUTPUT_SDVO) ||
5954 intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_HDMI); 5954 intel_pipe_has_type(crtc, INTEL_OUTPUT_HDMI);
5955 5955
5956 dpll = DPLL_VGA_MODE_DIS; 5956 dpll = DPLL_VGA_MODE_DIS;
5957 5957
5958 if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_LVDS)) 5958 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS))
5959 dpll |= DPLLB_MODE_LVDS; 5959 dpll |= DPLLB_MODE_LVDS;
5960 else 5960 else
5961 dpll |= DPLLB_MODE_DAC_SERIAL; 5961 dpll |= DPLLB_MODE_DAC_SERIAL;
@@ -5968,7 +5968,7 @@ static void i9xx_update_pll(struct intel_crtc *crtc,
5968 if (is_sdvo) 5968 if (is_sdvo)
5969 dpll |= DPLL_SDVO_HIGH_SPEED; 5969 dpll |= DPLL_SDVO_HIGH_SPEED;
5970 5970
5971 if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_DISPLAYPORT)) 5971 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT))
5972 dpll |= DPLL_SDVO_HIGH_SPEED; 5972 dpll |= DPLL_SDVO_HIGH_SPEED;
5973 5973
5974 /* compute bitmask from p1 value */ 5974 /* compute bitmask from p1 value */
@@ -5998,7 +5998,7 @@ static void i9xx_update_pll(struct intel_crtc *crtc,
5998 5998
5999 if (crtc->config.sdvo_tv_clock) 5999 if (crtc->config.sdvo_tv_clock)
6000 dpll |= PLL_REF_INPUT_TVCLKINBC; 6000 dpll |= PLL_REF_INPUT_TVCLKINBC;
6001 else if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_LVDS) && 6001 else if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) &&
6002 intel_panel_use_ssc(dev_priv) && num_connectors < 2) 6002 intel_panel_use_ssc(dev_priv) && num_connectors < 2)
6003 dpll |= PLLB_REF_INPUT_SPREADSPECTRUMIN; 6003 dpll |= PLLB_REF_INPUT_SPREADSPECTRUMIN;
6004 else 6004 else
@@ -6027,7 +6027,7 @@ static void i8xx_update_pll(struct intel_crtc *crtc,
6027 6027
6028 dpll = DPLL_VGA_MODE_DIS; 6028 dpll = DPLL_VGA_MODE_DIS;
6029 6029
6030 if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_LVDS)) { 6030 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
6031 dpll |= (1 << (clock->p1 - 1)) << DPLL_FPA01_P1_POST_DIV_SHIFT; 6031 dpll |= (1 << (clock->p1 - 1)) << DPLL_FPA01_P1_POST_DIV_SHIFT;
6032 } else { 6032 } else {
6033 if (clock->p1 == 2) 6033 if (clock->p1 == 2)
@@ -6038,10 +6038,10 @@ static void i8xx_update_pll(struct intel_crtc *crtc,
6038 dpll |= PLL_P2_DIVIDE_BY_4; 6038 dpll |= PLL_P2_DIVIDE_BY_4;
6039 } 6039 }
6040 6040
6041 if (!IS_I830(dev) && intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_DVO)) 6041 if (!IS_I830(dev) && intel_pipe_has_type(crtc, INTEL_OUTPUT_DVO))
6042 dpll |= DPLL_DVO_2X_MODE; 6042 dpll |= DPLL_DVO_2X_MODE;
6043 6043
6044 if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_LVDS) && 6044 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) &&
6045 intel_panel_use_ssc(dev_priv) && num_connectors < 2) 6045 intel_panel_use_ssc(dev_priv) && num_connectors < 2)
6046 dpll |= PLLB_REF_INPUT_SPREADSPECTRUMIN; 6046 dpll |= PLLB_REF_INPUT_SPREADSPECTRUMIN;
6047 else 6047 else
@@ -6072,7 +6072,7 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc)
6072 crtc_vtotal -= 1; 6072 crtc_vtotal -= 1;
6073 crtc_vblank_end -= 1; 6073 crtc_vblank_end -= 1;
6074 6074
6075 if (intel_pipe_has_type(&intel_crtc->base, INTEL_OUTPUT_SDVO)) 6075 if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_SDVO))
6076 vsyncshift = (adjusted_mode->crtc_htotal - 1) / 2; 6076 vsyncshift = (adjusted_mode->crtc_htotal - 1) / 2;
6077 else 6077 else
6078 vsyncshift = adjusted_mode->crtc_hsync_start - 6078 vsyncshift = adjusted_mode->crtc_hsync_start -
@@ -6230,7 +6230,7 @@ static void i9xx_set_pipeconf(struct intel_crtc *intel_crtc)
6230 6230
6231 if (intel_crtc->config.adjusted_mode.flags & DRM_MODE_FLAG_INTERLACE) { 6231 if (intel_crtc->config.adjusted_mode.flags & DRM_MODE_FLAG_INTERLACE) {
6232 if (INTEL_INFO(dev)->gen < 4 || 6232 if (INTEL_INFO(dev)->gen < 4 ||
6233 intel_pipe_has_type(&intel_crtc->base, INTEL_OUTPUT_SDVO)) 6233 intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_SDVO))
6234 pipeconf |= PIPECONF_INTERLACE_W_FIELD_INDICATION; 6234 pipeconf |= PIPECONF_INTERLACE_W_FIELD_INDICATION;
6235 else 6235 else
6236 pipeconf |= PIPECONF_INTERLACE_W_SYNC_SHIFT; 6236 pipeconf |= PIPECONF_INTERLACE_W_SYNC_SHIFT;
@@ -6274,7 +6274,7 @@ static int i9xx_crtc_mode_set(struct intel_crtc *crtc,
6274 return 0; 6274 return 0;
6275 6275
6276 if (!crtc->config.clock_set) { 6276 if (!crtc->config.clock_set) {
6277 refclk = i9xx_get_refclk(&crtc->base, num_connectors); 6277 refclk = i9xx_get_refclk(crtc, num_connectors);
6278 6278
6279 /* 6279 /*
6280 * Returns a set of divisors for the desired target clock with 6280 * Returns a set of divisors for the desired target clock with
@@ -6282,7 +6282,7 @@ static int i9xx_crtc_mode_set(struct intel_crtc *crtc,
6282 * the clock equation: reflck * (5 * (m1 + 2) + (m2 + 2)) / (n + 6282 * the clock equation: reflck * (5 * (m1 + 2) + (m2 + 2)) / (n +
6283 * 2) / p1 / p2. 6283 * 2) / p1 / p2.
6284 */ 6284 */
6285 limit = intel_limit(&crtc->base, refclk); 6285 limit = intel_limit(crtc, refclk);
6286 ok = dev_priv->display.find_dpll(limit, crtc, 6286 ok = dev_priv->display.find_dpll(limit, crtc,
6287 crtc->config.port_clock, 6287 crtc->config.port_clock,
6288 refclk, NULL, &clock); 6288 refclk, NULL, &clock);
@@ -7114,7 +7114,7 @@ static bool ironlake_compute_clocks(struct drm_crtc *crtc,
7114 const intel_limit_t *limit; 7114 const intel_limit_t *limit;
7115 bool ret, is_lvds = false; 7115 bool ret, is_lvds = false;
7116 7116
7117 is_lvds = intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS); 7117 is_lvds = intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_LVDS);
7118 7118
7119 refclk = ironlake_get_refclk(crtc); 7119 refclk = ironlake_get_refclk(crtc);
7120 7120
@@ -7123,7 +7123,7 @@ static bool ironlake_compute_clocks(struct drm_crtc *crtc,
7123 * refclk, or FALSE. The returned values represent the clock equation: 7123 * refclk, or FALSE. The returned values represent the clock equation:
7124 * reflck * (5 * (m1 + 2) + (m2 + 2)) / (n + 2) / p1 / p2. 7124 * reflck * (5 * (m1 + 2) + (m2 + 2)) / (n + 2) / p1 / p2.
7125 */ 7125 */
7126 limit = intel_limit(crtc, refclk); 7126 limit = intel_limit(intel_crtc, refclk);
7127 ret = dev_priv->display.find_dpll(limit, intel_crtc, 7127 ret = dev_priv->display.find_dpll(limit, intel_crtc,
7128 intel_crtc->config.port_clock, 7128 intel_crtc->config.port_clock,
7129 refclk, NULL, clock); 7129 refclk, NULL, clock);
@@ -7259,7 +7259,7 @@ static int ironlake_crtc_mode_set(struct intel_crtc *crtc,
7259 bool is_lvds = false; 7259 bool is_lvds = false;
7260 struct intel_shared_dpll *pll; 7260 struct intel_shared_dpll *pll;
7261 7261
7262 is_lvds = intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_LVDS); 7262 is_lvds = intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS);
7263 7263
7264 WARN(!(HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev)), 7264 WARN(!(HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev)),
7265 "Unexpected PCH type %d\n", INTEL_PCH_TYPE(dev)); 7265 "Unexpected PCH type %d\n", INTEL_PCH_TYPE(dev));
@@ -8049,6 +8049,7 @@ static void haswell_write_eld(struct drm_connector *connector,
8049 struct drm_display_mode *mode) 8049 struct drm_display_mode *mode)
8050{ 8050{
8051 struct drm_i915_private *dev_priv = connector->dev->dev_private; 8051 struct drm_i915_private *dev_priv = connector->dev->dev_private;
8052 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
8052 uint8_t *eld = connector->eld; 8053 uint8_t *eld = connector->eld;
8053 uint32_t eldv; 8054 uint32_t eldv;
8054 uint32_t i; 8055 uint32_t i;
@@ -8089,7 +8090,7 @@ static void haswell_write_eld(struct drm_connector *connector,
8089 8090
8090 eldv = AUDIO_ELD_VALID_A << (pipe * 4); 8091 eldv = AUDIO_ELD_VALID_A << (pipe * 4);
8091 8092
8092 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT)) { 8093 if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT)) {
8093 DRM_DEBUG_DRIVER("ELD: DisplayPort detected\n"); 8094 DRM_DEBUG_DRIVER("ELD: DisplayPort detected\n");
8094 eld[5] |= (1 << 2); /* Conn_Type, 0x1 = DisplayPort */ 8095 eld[5] |= (1 << 2); /* Conn_Type, 0x1 = DisplayPort */
8095 I915_WRITE(aud_config, AUD_CONFIG_N_VALUE_INDEX); /* 0x1 = DP */ 8096 I915_WRITE(aud_config, AUD_CONFIG_N_VALUE_INDEX); /* 0x1 = DP */
@@ -8132,6 +8133,7 @@ static void ironlake_write_eld(struct drm_connector *connector,
8132 struct drm_display_mode *mode) 8133 struct drm_display_mode *mode)
8133{ 8134{
8134 struct drm_i915_private *dev_priv = connector->dev->dev_private; 8135 struct drm_i915_private *dev_priv = connector->dev->dev_private;
8136 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
8135 uint8_t *eld = connector->eld; 8137 uint8_t *eld = connector->eld;
8136 uint32_t eldv; 8138 uint32_t eldv;
8137 uint32_t i; 8139 uint32_t i;
@@ -8185,7 +8187,7 @@ static void ironlake_write_eld(struct drm_connector *connector,
8185 eldv = IBX_ELD_VALIDB << ((i - 1) * 4); 8187 eldv = IBX_ELD_VALIDB << ((i - 1) * 4);
8186 } 8188 }
8187 8189
8188 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT)) { 8190 if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT)) {
8189 DRM_DEBUG_DRIVER("ELD: DisplayPort detected\n"); 8191 DRM_DEBUG_DRIVER("ELD: DisplayPort detected\n");
8190 eld[5] |= (1 << 2); /* Conn_Type, 0x1 = DisplayPort */ 8192 eld[5] |= (1 << 2); /* Conn_Type, 0x1 = DisplayPort */
8191 I915_WRITE(aud_config, AUD_CONFIG_N_VALUE_INDEX); /* 0x1 = DP */ 8193 I915_WRITE(aud_config, AUD_CONFIG_N_VALUE_INDEX); /* 0x1 = DP */
@@ -10880,7 +10882,7 @@ static void update_scanline_offset(struct intel_crtc *crtc)
10880 10882
10881 crtc->scanline_offset = vtotal - 1; 10883 crtc->scanline_offset = vtotal - 1;
10882 } else if (HAS_DDI(dev) && 10884 } else if (HAS_DDI(dev) &&
10883 intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_HDMI)) { 10885 intel_pipe_has_type(crtc, INTEL_OUTPUT_HDMI)) {
10884 crtc->scanline_offset = 2; 10886 crtc->scanline_offset = 2;
10885 } else 10887 } else
10886 crtc->scanline_offset = 1; 10888 crtc->scanline_offset = 1;