diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-03-28 17:11:26 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-03-28 17:14:59 -0400 |
commit | 93e537a10f2c8c0f2e74409b6cb473fc221758fa (patch) | |
tree | 1ec06814cdd68b8952c97a69d0af44978dcb2668 /drivers | |
parent | 23f54beafee1c31c7f0127650ec2903d80b3dfeb (diff) |
drm/i915: split LVDS update code out of i9xx_crtc_mode_set
Just to make things clearer and reduce the size of this monstrosity.
v2: make sure 8xx PLL update function calls update_lvds too (Daniel)
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
danvet: fixed patch ordering to avoid breaking bisect.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 106 |
1 files changed, 58 insertions, 48 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index a7c2ddc96f0e..d6a394fdeb26 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -5134,6 +5134,62 @@ static void i9xx_update_pll_dividers(struct drm_crtc *crtc, | |||
5134 | } | 5134 | } |
5135 | } | 5135 | } |
5136 | 5136 | ||
5137 | static void intel_update_lvds(struct drm_crtc *crtc, intel_clock_t *clock, | ||
5138 | struct drm_display_mode *adjusted_mode) | ||
5139 | { | ||
5140 | struct drm_device *dev = crtc->dev; | ||
5141 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
5142 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
5143 | int pipe = intel_crtc->pipe; | ||
5144 | u32 temp, lvds_sync = 0; | ||
5145 | |||
5146 | temp = I915_READ(LVDS); | ||
5147 | temp |= LVDS_PORT_EN | LVDS_A0A2_CLKA_POWER_UP; | ||
5148 | if (pipe == 1) { | ||
5149 | temp |= LVDS_PIPEB_SELECT; | ||
5150 | } else { | ||
5151 | temp &= ~LVDS_PIPEB_SELECT; | ||
5152 | } | ||
5153 | /* set the corresponsding LVDS_BORDER bit */ | ||
5154 | temp |= dev_priv->lvds_border_bits; | ||
5155 | /* Set the B0-B3 data pairs corresponding to whether we're going to | ||
5156 | * set the DPLLs for dual-channel mode or not. | ||
5157 | */ | ||
5158 | if (clock->p2 == 7) | ||
5159 | temp |= LVDS_B0B3_POWER_UP | LVDS_CLKB_POWER_UP; | ||
5160 | else | ||
5161 | temp &= ~(LVDS_B0B3_POWER_UP | LVDS_CLKB_POWER_UP); | ||
5162 | |||
5163 | /* It would be nice to set 24 vs 18-bit mode (LVDS_A3_POWER_UP) | ||
5164 | * appropriately here, but we need to look more thoroughly into how | ||
5165 | * panels behave in the two modes. | ||
5166 | */ | ||
5167 | /* set the dithering flag on LVDS as needed */ | ||
5168 | if (INTEL_INFO(dev)->gen >= 4) { | ||
5169 | if (dev_priv->lvds_dither) | ||
5170 | temp |= LVDS_ENABLE_DITHER; | ||
5171 | else | ||
5172 | temp &= ~LVDS_ENABLE_DITHER; | ||
5173 | } | ||
5174 | if (adjusted_mode->flags & DRM_MODE_FLAG_NHSYNC) | ||
5175 | lvds_sync |= LVDS_HSYNC_POLARITY; | ||
5176 | if (adjusted_mode->flags & DRM_MODE_FLAG_NVSYNC) | ||
5177 | lvds_sync |= LVDS_VSYNC_POLARITY; | ||
5178 | if ((temp & (LVDS_HSYNC_POLARITY | LVDS_VSYNC_POLARITY)) | ||
5179 | != lvds_sync) { | ||
5180 | char flags[2] = "-+"; | ||
5181 | DRM_INFO("Changing LVDS panel from " | ||
5182 | "(%chsync, %cvsync) to (%chsync, %cvsync)\n", | ||
5183 | flags[!(temp & LVDS_HSYNC_POLARITY)], | ||
5184 | flags[!(temp & LVDS_VSYNC_POLARITY)], | ||
5185 | flags[!(lvds_sync & LVDS_HSYNC_POLARITY)], | ||
5186 | flags[!(lvds_sync & LVDS_VSYNC_POLARITY)]); | ||
5187 | temp &= ~(LVDS_HSYNC_POLARITY | LVDS_VSYNC_POLARITY); | ||
5188 | temp |= lvds_sync; | ||
5189 | } | ||
5190 | I915_WRITE(LVDS, temp); | ||
5191 | } | ||
5192 | |||
5137 | static int i9xx_crtc_mode_set(struct drm_crtc *crtc, | 5193 | static int i9xx_crtc_mode_set(struct drm_crtc *crtc, |
5138 | struct drm_display_mode *mode, | 5194 | struct drm_display_mode *mode, |
5139 | struct drm_display_mode *adjusted_mode, | 5195 | struct drm_display_mode *adjusted_mode, |
@@ -5155,7 +5211,6 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc, | |||
5155 | const intel_limit_t *limit; | 5211 | const intel_limit_t *limit; |
5156 | int ret; | 5212 | int ret; |
5157 | u32 temp; | 5213 | u32 temp; |
5158 | u32 lvds_sync = 0; | ||
5159 | 5214 | ||
5160 | list_for_each_entry(encoder, &mode_config->encoder_list, base.head) { | 5215 | list_for_each_entry(encoder, &mode_config->encoder_list, base.head) { |
5161 | if (encoder->base.crtc != crtc) | 5216 | if (encoder->base.crtc != crtc) |
@@ -5341,53 +5396,8 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc, | |||
5341 | * This is an exception to the general rule that mode_set doesn't turn | 5396 | * This is an exception to the general rule that mode_set doesn't turn |
5342 | * things on. | 5397 | * things on. |
5343 | */ | 5398 | */ |
5344 | if (is_lvds) { | 5399 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) |
5345 | temp = I915_READ(LVDS); | 5400 | intel_update_lvds(crtc, &clock, adjusted_mode); |
5346 | temp |= LVDS_PORT_EN | LVDS_A0A2_CLKA_POWER_UP; | ||
5347 | if (pipe == 1) { | ||
5348 | temp |= LVDS_PIPEB_SELECT; | ||
5349 | } else { | ||
5350 | temp &= ~LVDS_PIPEB_SELECT; | ||
5351 | } | ||
5352 | /* set the corresponsding LVDS_BORDER bit */ | ||
5353 | temp |= dev_priv->lvds_border_bits; | ||
5354 | /* Set the B0-B3 data pairs corresponding to whether we're going to | ||
5355 | * set the DPLLs for dual-channel mode or not. | ||
5356 | */ | ||
5357 | if (clock.p2 == 7) | ||
5358 | temp |= LVDS_B0B3_POWER_UP | LVDS_CLKB_POWER_UP; | ||
5359 | else | ||
5360 | temp &= ~(LVDS_B0B3_POWER_UP | LVDS_CLKB_POWER_UP); | ||
5361 | |||
5362 | /* It would be nice to set 24 vs 18-bit mode (LVDS_A3_POWER_UP) | ||
5363 | * appropriately here, but we need to look more thoroughly into how | ||
5364 | * panels behave in the two modes. | ||
5365 | */ | ||
5366 | /* set the dithering flag on LVDS as needed */ | ||
5367 | if (INTEL_INFO(dev)->gen >= 4) { | ||
5368 | if (dev_priv->lvds_dither) | ||
5369 | temp |= LVDS_ENABLE_DITHER; | ||
5370 | else | ||
5371 | temp &= ~LVDS_ENABLE_DITHER; | ||
5372 | } | ||
5373 | if (adjusted_mode->flags & DRM_MODE_FLAG_NHSYNC) | ||
5374 | lvds_sync |= LVDS_HSYNC_POLARITY; | ||
5375 | if (adjusted_mode->flags & DRM_MODE_FLAG_NVSYNC) | ||
5376 | lvds_sync |= LVDS_VSYNC_POLARITY; | ||
5377 | if ((temp & (LVDS_HSYNC_POLARITY | LVDS_VSYNC_POLARITY)) | ||
5378 | != lvds_sync) { | ||
5379 | char flags[2] = "-+"; | ||
5380 | DRM_INFO("Changing LVDS panel from " | ||
5381 | "(%chsync, %cvsync) to (%chsync, %cvsync)\n", | ||
5382 | flags[!(temp & LVDS_HSYNC_POLARITY)], | ||
5383 | flags[!(temp & LVDS_VSYNC_POLARITY)], | ||
5384 | flags[!(lvds_sync & LVDS_HSYNC_POLARITY)], | ||
5385 | flags[!(lvds_sync & LVDS_VSYNC_POLARITY)]); | ||
5386 | temp &= ~(LVDS_HSYNC_POLARITY | LVDS_VSYNC_POLARITY); | ||
5387 | temp |= lvds_sync; | ||
5388 | } | ||
5389 | I915_WRITE(LVDS, temp); | ||
5390 | } | ||
5391 | 5401 | ||
5392 | if (is_dp) { | 5402 | if (is_dp) { |
5393 | intel_dp_set_m_n(crtc, mode, adjusted_mode); | 5403 | intel_dp_set_m_n(crtc, mode, adjusted_mode); |