diff options
author | Eric Anholt <eric@anholt.net> | 2009-10-22 19:11:14 -0400 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2010-02-26 16:23:17 -0500 |
commit | bad720ff3e8e47a04bd88d9bbc8317e7d7e049d3 (patch) | |
tree | f799c660fbe0530398366f46da0fb25381b78978 /drivers/gpu/drm/i915/intel_display.c | |
parent | 1089e3009572e07a1fe12c3408828f27c96453be (diff) |
drm/i915: Add initial bits for VGA modesetting bringup on Sandybridge.
Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 1b5cd833bc70..ce28f18e0852 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -232,7 +232,7 @@ struct intel_limit { | |||
232 | #define G4X_P2_DISPLAY_PORT_FAST 10 | 232 | #define G4X_P2_DISPLAY_PORT_FAST 10 |
233 | #define G4X_P2_DISPLAY_PORT_LIMIT 0 | 233 | #define G4X_P2_DISPLAY_PORT_LIMIT 0 |
234 | 234 | ||
235 | /* Ironlake */ | 235 | /* Ironlake / Sandybridge */ |
236 | /* as we calculate clock using (register_value + 2) for | 236 | /* as we calculate clock using (register_value + 2) for |
237 | N/M1/M2, so here the range value for them is (actual_value-2). | 237 | N/M1/M2, so here the range value for them is (actual_value-2). |
238 | */ | 238 | */ |
@@ -690,7 +690,7 @@ static const intel_limit_t *intel_limit(struct drm_crtc *crtc) | |||
690 | struct drm_device *dev = crtc->dev; | 690 | struct drm_device *dev = crtc->dev; |
691 | const intel_limit_t *limit; | 691 | const intel_limit_t *limit; |
692 | 692 | ||
693 | if (IS_IRONLAKE(dev)) | 693 | if (HAS_PCH_SPLIT(dev)) |
694 | limit = intel_ironlake_limit(crtc); | 694 | limit = intel_ironlake_limit(crtc); |
695 | else if (IS_G4X(dev)) { | 695 | else if (IS_G4X(dev)) { |
696 | limit = intel_g4x_limit(crtc); | 696 | limit = intel_g4x_limit(crtc); |
@@ -1371,7 +1371,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, | |||
1371 | dspcntr &= ~DISPPLANE_TILED; | 1371 | dspcntr &= ~DISPPLANE_TILED; |
1372 | } | 1372 | } |
1373 | 1373 | ||
1374 | if (IS_IRONLAKE(dev)) | 1374 | if (HAS_PCH_SPLIT(dev)) |
1375 | /* must disable */ | 1375 | /* must disable */ |
1376 | dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE; | 1376 | dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE; |
1377 | 1377 | ||
@@ -1432,7 +1432,7 @@ static void i915_disable_vga (struct drm_device *dev) | |||
1432 | u8 sr1; | 1432 | u8 sr1; |
1433 | u32 vga_reg; | 1433 | u32 vga_reg; |
1434 | 1434 | ||
1435 | if (IS_IRONLAKE(dev)) | 1435 | if (HAS_PCH_SPLIT(dev)) |
1436 | vga_reg = CPU_VGACNTRL; | 1436 | vga_reg = CPU_VGACNTRL; |
1437 | else | 1437 | else |
1438 | vga_reg = VGACNTRL; | 1438 | vga_reg = VGACNTRL; |
@@ -2116,7 +2116,7 @@ static bool intel_crtc_mode_fixup(struct drm_crtc *crtc, | |||
2116 | struct drm_display_mode *adjusted_mode) | 2116 | struct drm_display_mode *adjusted_mode) |
2117 | { | 2117 | { |
2118 | struct drm_device *dev = crtc->dev; | 2118 | struct drm_device *dev = crtc->dev; |
2119 | if (IS_IRONLAKE(dev)) { | 2119 | if (HAS_PCH_SPLIT(dev)) { |
2120 | /* FDI link clock is fixed at 2.7G */ | 2120 | /* FDI link clock is fixed at 2.7G */ |
2121 | if (mode->clock * 3 > 27000 * 4) | 2121 | if (mode->clock * 3 > 27000 * 4) |
2122 | return MODE_CLOCK_HIGH; | 2122 | return MODE_CLOCK_HIGH; |
@@ -2983,7 +2983,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
2983 | refclk / 1000); | 2983 | refclk / 1000); |
2984 | } else if (IS_I9XX(dev)) { | 2984 | } else if (IS_I9XX(dev)) { |
2985 | refclk = 96000; | 2985 | refclk = 96000; |
2986 | if (IS_IRONLAKE(dev)) | 2986 | if (HAS_PCH_SPLIT(dev)) |
2987 | refclk = 120000; /* 120Mhz refclk */ | 2987 | refclk = 120000; /* 120Mhz refclk */ |
2988 | } else { | 2988 | } else { |
2989 | refclk = 48000; | 2989 | refclk = 48000; |
@@ -3041,7 +3041,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
3041 | } | 3041 | } |
3042 | 3042 | ||
3043 | /* FDI link */ | 3043 | /* FDI link */ |
3044 | if (IS_IRONLAKE(dev)) { | 3044 | if (HAS_PCH_SPLIT(dev)) { |
3045 | int lane, link_bw, bpp; | 3045 | int lane, link_bw, bpp; |
3046 | /* eDP doesn't require FDI link, so just set DP M/N | 3046 | /* eDP doesn't require FDI link, so just set DP M/N |
3047 | according to current link config */ | 3047 | according to current link config */ |
@@ -3118,7 +3118,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
3118 | * PCH B stepping, previous chipset stepping should be | 3118 | * PCH B stepping, previous chipset stepping should be |
3119 | * ignoring this setting. | 3119 | * ignoring this setting. |
3120 | */ | 3120 | */ |
3121 | if (IS_IRONLAKE(dev)) { | 3121 | if (HAS_PCH_SPLIT(dev)) { |
3122 | temp = I915_READ(PCH_DREF_CONTROL); | 3122 | temp = I915_READ(PCH_DREF_CONTROL); |
3123 | /* Always enable nonspread source */ | 3123 | /* Always enable nonspread source */ |
3124 | temp &= ~DREF_NONSPREAD_SOURCE_MASK; | 3124 | temp &= ~DREF_NONSPREAD_SOURCE_MASK; |
@@ -3165,7 +3165,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
3165 | reduced_clock.m2; | 3165 | reduced_clock.m2; |
3166 | } | 3166 | } |
3167 | 3167 | ||
3168 | if (!IS_IRONLAKE(dev)) | 3168 | if (!HAS_PCH_SPLIT(dev)) |
3169 | dpll = DPLL_VGA_MODE_DIS; | 3169 | dpll = DPLL_VGA_MODE_DIS; |
3170 | 3170 | ||
3171 | if (IS_I9XX(dev)) { | 3171 | if (IS_I9XX(dev)) { |
@@ -3178,7 +3178,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
3178 | sdvo_pixel_multiply = adjusted_mode->clock / mode->clock; | 3178 | sdvo_pixel_multiply = adjusted_mode->clock / mode->clock; |
3179 | if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) | 3179 | if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) |
3180 | dpll |= (sdvo_pixel_multiply - 1) << SDVO_MULTIPLIER_SHIFT_HIRES; | 3180 | dpll |= (sdvo_pixel_multiply - 1) << SDVO_MULTIPLIER_SHIFT_HIRES; |
3181 | else if (IS_IRONLAKE(dev)) | 3181 | else if (HAS_PCH_SPLIT(dev)) |
3182 | dpll |= (sdvo_pixel_multiply - 1) << PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT; | 3182 | dpll |= (sdvo_pixel_multiply - 1) << PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT; |
3183 | } | 3183 | } |
3184 | if (is_dp) | 3184 | if (is_dp) |
@@ -3190,7 +3190,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
3190 | else { | 3190 | else { |
3191 | dpll |= (1 << (clock.p1 - 1)) << DPLL_FPA01_P1_POST_DIV_SHIFT; | 3191 | dpll |= (1 << (clock.p1 - 1)) << DPLL_FPA01_P1_POST_DIV_SHIFT; |
3192 | /* also FPA1 */ | 3192 | /* also FPA1 */ |
3193 | if (IS_IRONLAKE(dev)) | 3193 | if (HAS_PCH_SPLIT(dev)) |
3194 | dpll |= (1 << (clock.p1 - 1)) << DPLL_FPA1_P1_POST_DIV_SHIFT; | 3194 | dpll |= (1 << (clock.p1 - 1)) << DPLL_FPA1_P1_POST_DIV_SHIFT; |
3195 | if (IS_G4X(dev) && has_reduced_clock) | 3195 | if (IS_G4X(dev) && has_reduced_clock) |
3196 | dpll |= (1 << (reduced_clock.p1 - 1)) << DPLL_FPA1_P1_POST_DIV_SHIFT; | 3196 | dpll |= (1 << (reduced_clock.p1 - 1)) << DPLL_FPA1_P1_POST_DIV_SHIFT; |
@@ -3209,7 +3209,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
3209 | dpll |= DPLLB_LVDS_P2_CLOCK_DIV_14; | 3209 | dpll |= DPLLB_LVDS_P2_CLOCK_DIV_14; |
3210 | break; | 3210 | break; |
3211 | } | 3211 | } |
3212 | if (IS_I965G(dev) && !IS_IRONLAKE(dev)) | 3212 | if (IS_I965G(dev) && !HAS_PCH_SPLIT(dev)) |
3213 | dpll |= (6 << PLL_LOAD_PULSE_PHASE_SHIFT); | 3213 | dpll |= (6 << PLL_LOAD_PULSE_PHASE_SHIFT); |
3214 | } else { | 3214 | } else { |
3215 | if (is_lvds) { | 3215 | if (is_lvds) { |
@@ -3243,7 +3243,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
3243 | 3243 | ||
3244 | /* Ironlake's plane is forced to pipe, bit 24 is to | 3244 | /* Ironlake's plane is forced to pipe, bit 24 is to |
3245 | enable color space conversion */ | 3245 | enable color space conversion */ |
3246 | if (!IS_IRONLAKE(dev)) { | 3246 | if (!HAS_PCH_SPLIT(dev)) { |
3247 | if (pipe == 0) | 3247 | if (pipe == 0) |
3248 | dspcntr &= ~DISPPLANE_SEL_PIPE_MASK; | 3248 | dspcntr &= ~DISPPLANE_SEL_PIPE_MASK; |
3249 | else | 3249 | else |
@@ -3270,14 +3270,14 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
3270 | 3270 | ||
3271 | 3271 | ||
3272 | /* Disable the panel fitter if it was on our pipe */ | 3272 | /* Disable the panel fitter if it was on our pipe */ |
3273 | if (!IS_IRONLAKE(dev) && intel_panel_fitter_pipe(dev) == pipe) | 3273 | if (!HAS_PCH_SPLIT(dev) && intel_panel_fitter_pipe(dev) == pipe) |
3274 | I915_WRITE(PFIT_CONTROL, 0); | 3274 | I915_WRITE(PFIT_CONTROL, 0); |
3275 | 3275 | ||
3276 | DRM_DEBUG_KMS("Mode for pipe %c:\n", pipe == 0 ? 'A' : 'B'); | 3276 | DRM_DEBUG_KMS("Mode for pipe %c:\n", pipe == 0 ? 'A' : 'B'); |
3277 | drm_mode_debug_printmodeline(mode); | 3277 | drm_mode_debug_printmodeline(mode); |
3278 | 3278 | ||
3279 | /* assign to Ironlake registers */ | 3279 | /* assign to Ironlake registers */ |
3280 | if (IS_IRONLAKE(dev)) { | 3280 | if (HAS_PCH_SPLIT(dev)) { |
3281 | fp_reg = pch_fp_reg; | 3281 | fp_reg = pch_fp_reg; |
3282 | dpll_reg = pch_dpll_reg; | 3282 | dpll_reg = pch_dpll_reg; |
3283 | } | 3283 | } |
@@ -3298,7 +3298,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
3298 | if (is_lvds) { | 3298 | if (is_lvds) { |
3299 | u32 lvds; | 3299 | u32 lvds; |
3300 | 3300 | ||
3301 | if (IS_IRONLAKE(dev)) | 3301 | if (HAS_PCH_SPLIT(dev)) |
3302 | lvds_reg = PCH_LVDS; | 3302 | lvds_reg = PCH_LVDS; |
3303 | 3303 | ||
3304 | lvds = I915_READ(lvds_reg); | 3304 | lvds = I915_READ(lvds_reg); |
@@ -3344,7 +3344,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
3344 | /* Wait for the clocks to stabilize. */ | 3344 | /* Wait for the clocks to stabilize. */ |
3345 | udelay(150); | 3345 | udelay(150); |
3346 | 3346 | ||
3347 | if (IS_I965G(dev) && !IS_IRONLAKE(dev)) { | 3347 | if (IS_I965G(dev) && !HAS_PCH_SPLIT(dev)) { |
3348 | if (is_sdvo) { | 3348 | if (is_sdvo) { |
3349 | sdvo_pixel_multiply = adjusted_mode->clock / mode->clock; | 3349 | sdvo_pixel_multiply = adjusted_mode->clock / mode->clock; |
3350 | I915_WRITE(dpll_md_reg, (0 << DPLL_MD_UDI_DIVIDER_SHIFT) | | 3350 | I915_WRITE(dpll_md_reg, (0 << DPLL_MD_UDI_DIVIDER_SHIFT) | |
@@ -3391,14 +3391,14 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
3391 | /* pipesrc and dspsize control the size that is scaled from, which should | 3391 | /* pipesrc and dspsize control the size that is scaled from, which should |
3392 | * always be the user's requested size. | 3392 | * always be the user's requested size. |
3393 | */ | 3393 | */ |
3394 | if (!IS_IRONLAKE(dev)) { | 3394 | if (!HAS_PCH_SPLIT(dev)) { |
3395 | I915_WRITE(dspsize_reg, ((mode->vdisplay - 1) << 16) | | 3395 | I915_WRITE(dspsize_reg, ((mode->vdisplay - 1) << 16) | |
3396 | (mode->hdisplay - 1)); | 3396 | (mode->hdisplay - 1)); |
3397 | I915_WRITE(dsppos_reg, 0); | 3397 | I915_WRITE(dsppos_reg, 0); |
3398 | } | 3398 | } |
3399 | I915_WRITE(pipesrc_reg, ((mode->hdisplay - 1) << 16) | (mode->vdisplay - 1)); | 3399 | I915_WRITE(pipesrc_reg, ((mode->hdisplay - 1) << 16) | (mode->vdisplay - 1)); |
3400 | 3400 | ||
3401 | if (IS_IRONLAKE(dev)) { | 3401 | if (HAS_PCH_SPLIT(dev)) { |
3402 | I915_WRITE(data_m1_reg, TU_SIZE(m_n.tu) | m_n.gmch_m); | 3402 | I915_WRITE(data_m1_reg, TU_SIZE(m_n.tu) | m_n.gmch_m); |
3403 | I915_WRITE(data_n1_reg, TU_SIZE(m_n.tu) | m_n.gmch_n); | 3403 | I915_WRITE(data_n1_reg, TU_SIZE(m_n.tu) | m_n.gmch_n); |
3404 | I915_WRITE(link_m1_reg, m_n.link_m); | 3404 | I915_WRITE(link_m1_reg, m_n.link_m); |
@@ -3419,7 +3419,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
3419 | 3419 | ||
3420 | intel_wait_for_vblank(dev); | 3420 | intel_wait_for_vblank(dev); |
3421 | 3421 | ||
3422 | if (IS_IRONLAKE(dev)) { | 3422 | if (HAS_PCH_SPLIT(dev)) { |
3423 | /* enable address swizzle for tiling buffer */ | 3423 | /* enable address swizzle for tiling buffer */ |
3424 | temp = I915_READ(DISP_ARB_CTL); | 3424 | temp = I915_READ(DISP_ARB_CTL); |
3425 | I915_WRITE(DISP_ARB_CTL, temp | DISP_TILE_SURFACE_SWIZZLING); | 3425 | I915_WRITE(DISP_ARB_CTL, temp | DISP_TILE_SURFACE_SWIZZLING); |
@@ -3454,7 +3454,7 @@ void intel_crtc_load_lut(struct drm_crtc *crtc) | |||
3454 | return; | 3454 | return; |
3455 | 3455 | ||
3456 | /* use legacy palette for Ironlake */ | 3456 | /* use legacy palette for Ironlake */ |
3457 | if (IS_IRONLAKE(dev)) | 3457 | if (HAS_PCH_SPLIT(dev)) |
3458 | palreg = (intel_crtc->pipe == 0) ? LGC_PALETTE_A : | 3458 | palreg = (intel_crtc->pipe == 0) ? LGC_PALETTE_A : |
3459 | LGC_PALETTE_B; | 3459 | LGC_PALETTE_B; |
3460 | 3460 | ||
@@ -3937,7 +3937,7 @@ static void intel_increase_pllclock(struct drm_crtc *crtc, bool schedule) | |||
3937 | int dpll_reg = (pipe == 0) ? DPLL_A : DPLL_B; | 3937 | int dpll_reg = (pipe == 0) ? DPLL_A : DPLL_B; |
3938 | int dpll = I915_READ(dpll_reg); | 3938 | int dpll = I915_READ(dpll_reg); |
3939 | 3939 | ||
3940 | if (IS_IRONLAKE(dev)) | 3940 | if (HAS_PCH_SPLIT(dev)) |
3941 | return; | 3941 | return; |
3942 | 3942 | ||
3943 | if (!dev_priv->lvds_downclock_avail) | 3943 | if (!dev_priv->lvds_downclock_avail) |
@@ -3976,7 +3976,7 @@ static void intel_decrease_pllclock(struct drm_crtc *crtc) | |||
3976 | int dpll_reg = (pipe == 0) ? DPLL_A : DPLL_B; | 3976 | int dpll_reg = (pipe == 0) ? DPLL_A : DPLL_B; |
3977 | int dpll = I915_READ(dpll_reg); | 3977 | int dpll = I915_READ(dpll_reg); |
3978 | 3978 | ||
3979 | if (IS_IRONLAKE(dev)) | 3979 | if (HAS_PCH_SPLIT(dev)) |
3980 | return; | 3980 | return; |
3981 | 3981 | ||
3982 | if (!dev_priv->lvds_downclock_avail) | 3982 | if (!dev_priv->lvds_downclock_avail) |
@@ -4418,7 +4418,7 @@ static void intel_setup_outputs(struct drm_device *dev) | |||
4418 | if (IS_MOBILE(dev) && !IS_I830(dev)) | 4418 | if (IS_MOBILE(dev) && !IS_I830(dev)) |
4419 | intel_lvds_init(dev); | 4419 | intel_lvds_init(dev); |
4420 | 4420 | ||
4421 | if (IS_IRONLAKE(dev)) { | 4421 | if (HAS_PCH_SPLIT(dev)) { |
4422 | int found; | 4422 | int found; |
4423 | 4423 | ||
4424 | if (IS_MOBILE(dev) && (I915_READ(DP_A) & DP_DETECTED)) | 4424 | if (IS_MOBILE(dev) && (I915_READ(DP_A) & DP_DETECTED)) |
@@ -4487,7 +4487,7 @@ static void intel_setup_outputs(struct drm_device *dev) | |||
4487 | DRM_DEBUG_KMS("probing DP_D\n"); | 4487 | DRM_DEBUG_KMS("probing DP_D\n"); |
4488 | intel_dp_init(dev, DP_D); | 4488 | intel_dp_init(dev, DP_D); |
4489 | } | 4489 | } |
4490 | } else if (IS_I8XX(dev)) | 4490 | } else if (IS_GEN2(dev)) |
4491 | intel_dvo_init(dev); | 4491 | intel_dvo_init(dev); |
4492 | 4492 | ||
4493 | if (SUPPORTS_TV(dev)) | 4493 | if (SUPPORTS_TV(dev)) |
@@ -4716,7 +4716,7 @@ void intel_init_clock_gating(struct drm_device *dev) | |||
4716 | * Disable clock gating reported to work incorrectly according to the | 4716 | * Disable clock gating reported to work incorrectly according to the |
4717 | * specs, but enable as much else as we can. | 4717 | * specs, but enable as much else as we can. |
4718 | */ | 4718 | */ |
4719 | if (IS_IRONLAKE(dev)) { | 4719 | if (HAS_PCH_SPLIT(dev)) { |
4720 | return; | 4720 | return; |
4721 | } else if (IS_G4X(dev)) { | 4721 | } else if (IS_G4X(dev)) { |
4722 | uint32_t dspclk_gate; | 4722 | uint32_t dspclk_gate; |
@@ -4789,7 +4789,7 @@ static void intel_init_display(struct drm_device *dev) | |||
4789 | struct drm_i915_private *dev_priv = dev->dev_private; | 4789 | struct drm_i915_private *dev_priv = dev->dev_private; |
4790 | 4790 | ||
4791 | /* We always want a DPMS function */ | 4791 | /* We always want a DPMS function */ |
4792 | if (IS_IRONLAKE(dev)) | 4792 | if (HAS_PCH_SPLIT(dev)) |
4793 | dev_priv->display.dpms = ironlake_crtc_dpms; | 4793 | dev_priv->display.dpms = ironlake_crtc_dpms; |
4794 | else | 4794 | else |
4795 | dev_priv->display.dpms = i9xx_crtc_dpms; | 4795 | dev_priv->display.dpms = i9xx_crtc_dpms; |
@@ -4832,7 +4832,7 @@ static void intel_init_display(struct drm_device *dev) | |||
4832 | i830_get_display_clock_speed; | 4832 | i830_get_display_clock_speed; |
4833 | 4833 | ||
4834 | /* For FIFO watermark updates */ | 4834 | /* For FIFO watermark updates */ |
4835 | if (IS_IRONLAKE(dev)) | 4835 | if (HAS_PCH_SPLIT(dev)) |
4836 | dev_priv->display.update_wm = NULL; | 4836 | dev_priv->display.update_wm = NULL; |
4837 | else if (IS_G4X(dev)) | 4837 | else if (IS_G4X(dev)) |
4838 | dev_priv->display.update_wm = g4x_update_wm; | 4838 | dev_priv->display.update_wm = g4x_update_wm; |