aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2011-03-30 16:01:08 -0400
committerKeith Packard <keithp@keithp.com>2011-05-10 16:56:37 -0400
commita07d67870565e1015935f7a8d8d6ac5f507442c5 (patch)
tree893324efe83a935c3c31ed433cf77278d5e04280
parent8febb2974faf0608111fd3c4dc36fa7f0f1cbfc2 (diff)
drm/i915: Drop remaining pre-Ironlake code from ironlake_crtc_mode_set().
Signed-off-by: Eric Anholt <eric@anholt.net> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--drivers/gpu/drm/i915/intel_display.c119
1 files changed, 36 insertions, 83 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index b41c87ac561f..832210bac9b4 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4924,7 +4924,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
4924 int refclk, num_connectors = 0; 4924 int refclk, num_connectors = 0;
4925 intel_clock_t clock, reduced_clock; 4925 intel_clock_t clock, reduced_clock;
4926 u32 dpll, fp = 0, fp2 = 0, dspcntr, pipeconf; 4926 u32 dpll, fp = 0, fp2 = 0, dspcntr, pipeconf;
4927 bool ok, has_reduced_clock = false, is_sdvo = false, is_dvo = false; 4927 bool ok, has_reduced_clock = false, is_sdvo = false;
4928 bool is_crt = false, is_lvds = false, is_tv = false, is_dp = false; 4928 bool is_crt = false, is_lvds = false, is_tv = false, is_dp = false;
4929 struct intel_encoder *has_edp_encoder = NULL; 4929 struct intel_encoder *has_edp_encoder = NULL;
4930 struct drm_mode_config *mode_config = &dev->mode_config; 4930 struct drm_mode_config *mode_config = &dev->mode_config;
@@ -4950,9 +4950,6 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
4950 if (encoder->needs_tv_clock) 4950 if (encoder->needs_tv_clock)
4951 is_tv = true; 4951 is_tv = true;
4952 break; 4952 break;
4953 case INTEL_OUTPUT_DVO:
4954 is_dvo = true;
4955 break;
4956 case INTEL_OUTPUT_TVOUT: 4953 case INTEL_OUTPUT_TVOUT:
4957 is_tv = true; 4954 is_tv = true;
4958 break; 4955 break;
@@ -4974,13 +4971,11 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
4974 refclk = dev_priv->lvds_ssc_freq * 1000; 4971 refclk = dev_priv->lvds_ssc_freq * 1000;
4975 DRM_DEBUG_KMS("using SSC reference clock of %d MHz\n", 4972 DRM_DEBUG_KMS("using SSC reference clock of %d MHz\n",
4976 refclk / 1000); 4973 refclk / 1000);
4977 } else if (!IS_GEN2(dev)) { 4974 } else {
4978 refclk = 96000; 4975 refclk = 96000;
4979 if (!has_edp_encoder || 4976 if (!has_edp_encoder ||
4980 intel_encoder_is_pch_edp(&has_edp_encoder->base)) 4977 intel_encoder_is_pch_edp(&has_edp_encoder->base))
4981 refclk = 120000; /* 120Mhz refclk */ 4978 refclk = 120000; /* 120Mhz refclk */
4982 } else {
4983 refclk = 48000;
4984 } 4979 }
4985 4980
4986 /* 4981 /*
@@ -5169,17 +5164,10 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
5169 udelay(200); 5164 udelay(200);
5170 } 5165 }
5171 5166
5172 if (IS_PINEVIEW(dev)) { 5167 fp = clock.n << 16 | clock.m1 << 8 | clock.m2;
5173 fp = (1 << clock.n) << 16 | clock.m1 << 8 | clock.m2; 5168 if (has_reduced_clock)
5174 if (has_reduced_clock) 5169 fp2 = reduced_clock.n << 16 | reduced_clock.m1 << 8 |
5175 fp2 = (1 << reduced_clock.n) << 16 | 5170 reduced_clock.m2;
5176 reduced_clock.m1 << 8 | reduced_clock.m2;
5177 } else {
5178 fp = clock.n << 16 | clock.m1 << 8 | clock.m2;
5179 if (has_reduced_clock)
5180 fp2 = reduced_clock.n << 16 | reduced_clock.m1 << 8 |
5181 reduced_clock.m2;
5182 }
5183 5171
5184 /* Enable autotuning of the PLL clock (if permissible) */ 5172 /* Enable autotuning of the PLL clock (if permissible) */
5185 factor = 21; 5173 factor = 21;
@@ -5196,59 +5184,38 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
5196 5184
5197 dpll = 0; 5185 dpll = 0;
5198 5186
5199 if (!IS_GEN2(dev)) { 5187 if (is_lvds)
5200 if (is_lvds) 5188 dpll |= DPLLB_MODE_LVDS;
5201 dpll |= DPLLB_MODE_LVDS; 5189 else
5202 else 5190 dpll |= DPLLB_MODE_DAC_SERIAL;
5203 dpll |= DPLLB_MODE_DAC_SERIAL; 5191 if (is_sdvo) {
5204 if (is_sdvo) { 5192 int pixel_multiplier = intel_mode_get_pixel_multiplier(adjusted_mode);
5205 int pixel_multiplier = intel_mode_get_pixel_multiplier(adjusted_mode); 5193 if (pixel_multiplier > 1) {
5206 if (pixel_multiplier > 1) { 5194 dpll |= (pixel_multiplier - 1) << PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT;
5207 if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev))
5208 dpll |= (pixel_multiplier - 1) << SDVO_MULTIPLIER_SHIFT_HIRES;
5209 else
5210 dpll |= (pixel_multiplier - 1) << PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT;
5211 }
5212 dpll |= DPLL_DVO_HIGH_SPEED;
5213 } 5195 }
5214 if (is_dp || intel_encoder_is_pch_edp(&has_edp_encoder->base)) 5196 dpll |= DPLL_DVO_HIGH_SPEED;
5215 dpll |= DPLL_DVO_HIGH_SPEED; 5197 }
5198 if (is_dp || intel_encoder_is_pch_edp(&has_edp_encoder->base))
5199 dpll |= DPLL_DVO_HIGH_SPEED;
5216 5200
5217 /* compute bitmask from p1 value */ 5201 /* compute bitmask from p1 value */
5218 if (IS_PINEVIEW(dev)) 5202 dpll |= (1 << (clock.p1 - 1)) << DPLL_FPA01_P1_POST_DIV_SHIFT;
5219 dpll |= (1 << (clock.p1 - 1)) << DPLL_FPA01_P1_POST_DIV_SHIFT_PINEVIEW; 5203 /* also FPA1 */
5220 else { 5204 dpll |= (1 << (clock.p1 - 1)) << DPLL_FPA1_P1_POST_DIV_SHIFT;
5221 dpll |= (1 << (clock.p1 - 1)) << DPLL_FPA01_P1_POST_DIV_SHIFT; 5205
5222 /* also FPA1 */ 5206 switch (clock.p2) {
5223 dpll |= (1 << (clock.p1 - 1)) << DPLL_FPA1_P1_POST_DIV_SHIFT; 5207 case 5:
5224 if (IS_G4X(dev) && has_reduced_clock) 5208 dpll |= DPLL_DAC_SERIAL_P2_CLOCK_DIV_5;
5225 dpll |= (1 << (reduced_clock.p1 - 1)) << DPLL_FPA1_P1_POST_DIV_SHIFT; 5209 break;
5226 } 5210 case 7:
5227 switch (clock.p2) { 5211 dpll |= DPLLB_LVDS_P2_CLOCK_DIV_7;
5228 case 5: 5212 break;
5229 dpll |= DPLL_DAC_SERIAL_P2_CLOCK_DIV_5; 5213 case 10:
5230 break; 5214 dpll |= DPLL_DAC_SERIAL_P2_CLOCK_DIV_10;
5231 case 7: 5215 break;
5232 dpll |= DPLLB_LVDS_P2_CLOCK_DIV_7; 5216 case 14:
5233 break; 5217 dpll |= DPLLB_LVDS_P2_CLOCK_DIV_14;
5234 case 10: 5218 break;
5235 dpll |= DPLL_DAC_SERIAL_P2_CLOCK_DIV_10;
5236 break;
5237 case 14:
5238 dpll |= DPLLB_LVDS_P2_CLOCK_DIV_14;
5239 break;
5240 }
5241 } else {
5242 if (is_lvds) {
5243 dpll |= (1 << (clock.p1 - 1)) << DPLL_FPA01_P1_POST_DIV_SHIFT;
5244 } else {
5245 if (clock.p1 == 2)
5246 dpll |= PLL_P1_DIVIDE_BY_TWO;
5247 else
5248 dpll |= (clock.p1 - 2) << DPLL_FPA01_P1_POST_DIV_SHIFT;
5249 if (clock.p2 == 4)
5250 dpll |= PLL_P2_DIVIDE_BY_4;
5251 }
5252 } 5219 }
5253 5220
5254 if (is_sdvo && is_tv) 5221 if (is_sdvo && is_tv)
@@ -5268,20 +5235,6 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
5268 /* Set up the display plane register */ 5235 /* Set up the display plane register */
5269 dspcntr = DISPPLANE_GAMMA_ENABLE; 5236 dspcntr = DISPPLANE_GAMMA_ENABLE;
5270 5237
5271 if (pipe == 0 && INTEL_INFO(dev)->gen < 4) {
5272 /* Enable pixel doubling when the dot clock is > 90% of the (display)
5273 * core speed.
5274 *
5275 * XXX: No double-wide on 915GM pipe B. Is that the only reason for the
5276 * pipe == 0 check?
5277 */
5278 if (mode->clock >
5279 dev_priv->display.get_display_clock_speed(dev) * 9 / 10)
5280 pipeconf |= PIPECONF_DOUBLE_WIDE;
5281 else
5282 pipeconf &= ~PIPECONF_DOUBLE_WIDE;
5283 }
5284
5285 DRM_DEBUG_KMS("Mode for pipe %c:\n", pipe == 0 ? 'A' : 'B'); 5238 DRM_DEBUG_KMS("Mode for pipe %c:\n", pipe == 0 ? 'A' : 'B');
5286 drm_mode_debug_printmodeline(mode); 5239 drm_mode_debug_printmodeline(mode);
5287 5240