diff options
author | Jesse Barnes <jbarnes@virtuousgeek.org> | 2011-01-04 18:09:37 -0500 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-01-19 07:37:33 -0500 |
commit | 0fc932b8ec36116bb759105ce910b0475e63112a (patch) | |
tree | c784f43555ffbe56b8cce98d4e21b6e242ae2e20 /drivers/gpu/drm/i915/intel_display.c | |
parent | 040484af3a4efa65786b6e107fbe74747679e17c (diff) |
drm/i915: factor out FDI disable and add FDI assertions
Factor out the FDI disable function (make it a mirror of
ironlake_fdi_enable) and add some FDI related assertions to the FDI
training code (we need an active pipe & plane before we start
transmitting bits).
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 104 |
1 files changed, 60 insertions, 44 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index dc5168e627e3..aee2abae81ec 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -2237,8 +2237,13 @@ static void ironlake_fdi_link_train(struct drm_crtc *crtc) | |||
2237 | struct drm_i915_private *dev_priv = dev->dev_private; | 2237 | struct drm_i915_private *dev_priv = dev->dev_private; |
2238 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 2238 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
2239 | int pipe = intel_crtc->pipe; | 2239 | int pipe = intel_crtc->pipe; |
2240 | int plane = intel_crtc->plane; | ||
2240 | u32 reg, temp, tries; | 2241 | u32 reg, temp, tries; |
2241 | 2242 | ||
2243 | /* FDI needs bits from pipe & plane first */ | ||
2244 | assert_pipe_enabled(dev_priv, pipe); | ||
2245 | assert_plane_enabled(dev_priv, plane); | ||
2246 | |||
2242 | /* Train 1: umask FDI RX Interrupt symbol_lock and bit_lock bit | 2247 | /* Train 1: umask FDI RX Interrupt symbol_lock and bit_lock bit |
2243 | for train result */ | 2248 | for train result */ |
2244 | reg = FDI_RX_IMR(pipe); | 2249 | reg = FDI_RX_IMR(pipe); |
@@ -2487,6 +2492,60 @@ static void ironlake_fdi_enable(struct drm_crtc *crtc) | |||
2487 | } | 2492 | } |
2488 | } | 2493 | } |
2489 | 2494 | ||
2495 | static void ironlake_fdi_disable(struct drm_crtc *crtc) | ||
2496 | { | ||
2497 | struct drm_device *dev = crtc->dev; | ||
2498 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
2499 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
2500 | int pipe = intel_crtc->pipe; | ||
2501 | u32 reg, temp; | ||
2502 | |||
2503 | /* disable CPU FDI tx and PCH FDI rx */ | ||
2504 | reg = FDI_TX_CTL(pipe); | ||
2505 | temp = I915_READ(reg); | ||
2506 | I915_WRITE(reg, temp & ~FDI_TX_ENABLE); | ||
2507 | POSTING_READ(reg); | ||
2508 | |||
2509 | reg = FDI_RX_CTL(pipe); | ||
2510 | temp = I915_READ(reg); | ||
2511 | temp &= ~(0x7 << 16); | ||
2512 | temp |= (I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK) << 11; | ||
2513 | I915_WRITE(reg, temp & ~FDI_RX_ENABLE); | ||
2514 | |||
2515 | POSTING_READ(reg); | ||
2516 | udelay(100); | ||
2517 | |||
2518 | /* Ironlake workaround, disable clock pointer after downing FDI */ | ||
2519 | if (HAS_PCH_IBX(dev)) | ||
2520 | I915_WRITE(FDI_RX_CHICKEN(pipe), | ||
2521 | I915_READ(FDI_RX_CHICKEN(pipe) & | ||
2522 | ~FDI_RX_PHASE_SYNC_POINTER_ENABLE)); | ||
2523 | |||
2524 | /* still set train pattern 1 */ | ||
2525 | reg = FDI_TX_CTL(pipe); | ||
2526 | temp = I915_READ(reg); | ||
2527 | temp &= ~FDI_LINK_TRAIN_NONE; | ||
2528 | temp |= FDI_LINK_TRAIN_PATTERN_1; | ||
2529 | I915_WRITE(reg, temp); | ||
2530 | |||
2531 | reg = FDI_RX_CTL(pipe); | ||
2532 | temp = I915_READ(reg); | ||
2533 | if (HAS_PCH_CPT(dev)) { | ||
2534 | temp &= ~FDI_LINK_TRAIN_PATTERN_MASK_CPT; | ||
2535 | temp |= FDI_LINK_TRAIN_PATTERN_1_CPT; | ||
2536 | } else { | ||
2537 | temp &= ~FDI_LINK_TRAIN_NONE; | ||
2538 | temp |= FDI_LINK_TRAIN_PATTERN_1; | ||
2539 | } | ||
2540 | /* BPC in FDI rx is consistent with that in PIPECONF */ | ||
2541 | temp &= ~(0x07 << 16); | ||
2542 | temp |= (I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK) << 11; | ||
2543 | I915_WRITE(reg, temp); | ||
2544 | |||
2545 | POSTING_READ(reg); | ||
2546 | udelay(100); | ||
2547 | } | ||
2548 | |||
2490 | /* | 2549 | /* |
2491 | * When we disable a pipe, we need to clear any pending scanline wait events | 2550 | * When we disable a pipe, we need to clear any pending scanline wait events |
2492 | * to avoid hanging the ring, which we assume we are waiting on. | 2551 | * to avoid hanging the ring, which we assume we are waiting on. |
@@ -2691,50 +2750,7 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc) | |||
2691 | I915_WRITE(pipe ? PFB_CTL_1 : PFA_CTL_1, 0); | 2750 | I915_WRITE(pipe ? PFB_CTL_1 : PFA_CTL_1, 0); |
2692 | I915_WRITE(pipe ? PFB_WIN_SZ : PFA_WIN_SZ, 0); | 2751 | I915_WRITE(pipe ? PFB_WIN_SZ : PFA_WIN_SZ, 0); |
2693 | 2752 | ||
2694 | /* disable CPU FDI tx and PCH FDI rx */ | 2753 | ironlake_fdi_disable(crtc); |
2695 | reg = FDI_TX_CTL(pipe); | ||
2696 | temp = I915_READ(reg); | ||
2697 | I915_WRITE(reg, temp & ~FDI_TX_ENABLE); | ||
2698 | POSTING_READ(reg); | ||
2699 | |||
2700 | reg = FDI_RX_CTL(pipe); | ||
2701 | temp = I915_READ(reg); | ||
2702 | temp &= ~(0x7 << 16); | ||
2703 | temp |= (I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK) << 11; | ||
2704 | I915_WRITE(reg, temp & ~FDI_RX_ENABLE); | ||
2705 | |||
2706 | POSTING_READ(reg); | ||
2707 | udelay(100); | ||
2708 | |||
2709 | /* Ironlake workaround, disable clock pointer after downing FDI */ | ||
2710 | if (HAS_PCH_IBX(dev)) | ||
2711 | I915_WRITE(FDI_RX_CHICKEN(pipe), | ||
2712 | I915_READ(FDI_RX_CHICKEN(pipe) & | ||
2713 | ~FDI_RX_PHASE_SYNC_POINTER_ENABLE)); | ||
2714 | |||
2715 | /* still set train pattern 1 */ | ||
2716 | reg = FDI_TX_CTL(pipe); | ||
2717 | temp = I915_READ(reg); | ||
2718 | temp &= ~FDI_LINK_TRAIN_NONE; | ||
2719 | temp |= FDI_LINK_TRAIN_PATTERN_1; | ||
2720 | I915_WRITE(reg, temp); | ||
2721 | |||
2722 | reg = FDI_RX_CTL(pipe); | ||
2723 | temp = I915_READ(reg); | ||
2724 | if (HAS_PCH_CPT(dev)) { | ||
2725 | temp &= ~FDI_LINK_TRAIN_PATTERN_MASK_CPT; | ||
2726 | temp |= FDI_LINK_TRAIN_PATTERN_1_CPT; | ||
2727 | } else { | ||
2728 | temp &= ~FDI_LINK_TRAIN_NONE; | ||
2729 | temp |= FDI_LINK_TRAIN_PATTERN_1; | ||
2730 | } | ||
2731 | /* BPC in FDI rx is consistent with that in PIPECONF */ | ||
2732 | temp &= ~(0x07 << 16); | ||
2733 | temp |= (I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK) << 11; | ||
2734 | I915_WRITE(reg, temp); | ||
2735 | |||
2736 | POSTING_READ(reg); | ||
2737 | udelay(100); | ||
2738 | 2754 | ||
2739 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { | 2755 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { |
2740 | temp = I915_READ(PCH_LVDS); | 2756 | temp = I915_READ(PCH_LVDS); |