diff options
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 413 |
1 files changed, 245 insertions, 168 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 8c239f2d6bcd..6b4139064f9c 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -384,28 +384,6 @@ out_unlock: | |||
384 | return val; | 384 | return val; |
385 | } | 385 | } |
386 | 386 | ||
387 | static void intel_dpio_write(struct drm_i915_private *dev_priv, int reg, | ||
388 | u32 val) | ||
389 | { | ||
390 | unsigned long flags; | ||
391 | |||
392 | spin_lock_irqsave(&dev_priv->dpio_lock, flags); | ||
393 | if (wait_for_atomic_us((I915_READ(DPIO_PKT) & DPIO_BUSY) == 0, 100)) { | ||
394 | DRM_ERROR("DPIO idle wait timed out\n"); | ||
395 | goto out_unlock; | ||
396 | } | ||
397 | |||
398 | I915_WRITE(DPIO_DATA, val); | ||
399 | I915_WRITE(DPIO_REG, reg); | ||
400 | I915_WRITE(DPIO_PKT, DPIO_RID | DPIO_OP_WRITE | DPIO_PORTID | | ||
401 | DPIO_BYTE); | ||
402 | if (wait_for_atomic_us((I915_READ(DPIO_PKT) & DPIO_BUSY) == 0, 100)) | ||
403 | DRM_ERROR("DPIO write wait timed out\n"); | ||
404 | |||
405 | out_unlock: | ||
406 | spin_unlock_irqrestore(&dev_priv->dpio_lock, flags); | ||
407 | } | ||
408 | |||
409 | static void vlv_init_dpio(struct drm_device *dev) | 387 | static void vlv_init_dpio(struct drm_device *dev) |
410 | { | 388 | { |
411 | struct drm_i915_private *dev_priv = dev->dev_private; | 389 | struct drm_i915_private *dev_priv = dev->dev_private; |
@@ -911,26 +889,28 @@ static void assert_pll(struct drm_i915_private *dev_priv, | |||
911 | 889 | ||
912 | /* For ILK+ */ | 890 | /* For ILK+ */ |
913 | static void assert_pch_pll(struct drm_i915_private *dev_priv, | 891 | static void assert_pch_pll(struct drm_i915_private *dev_priv, |
914 | enum pipe pipe, bool state) | 892 | struct intel_crtc *intel_crtc, bool state) |
915 | { | 893 | { |
916 | int reg; | 894 | int reg; |
917 | u32 val; | 895 | u32 val; |
918 | bool cur_state; | 896 | bool cur_state; |
919 | 897 | ||
898 | if (!intel_crtc->pch_pll) { | ||
899 | WARN(1, "asserting PCH PLL enabled with no PLL\n"); | ||
900 | return; | ||
901 | } | ||
902 | |||
920 | if (HAS_PCH_CPT(dev_priv->dev)) { | 903 | if (HAS_PCH_CPT(dev_priv->dev)) { |
921 | u32 pch_dpll; | 904 | u32 pch_dpll; |
922 | 905 | ||
923 | pch_dpll = I915_READ(PCH_DPLL_SEL); | 906 | pch_dpll = I915_READ(PCH_DPLL_SEL); |
924 | 907 | ||
925 | /* Make sure the selected PLL is enabled to the transcoder */ | 908 | /* Make sure the selected PLL is enabled to the transcoder */ |
926 | WARN(!((pch_dpll >> (4 * pipe)) & 8), | 909 | WARN(!((pch_dpll >> (4 * intel_crtc->pipe)) & 8), |
927 | "transcoder %d PLL not enabled\n", pipe); | 910 | "transcoder %d PLL not enabled\n", intel_crtc->pipe); |
928 | |||
929 | /* Convert the transcoder pipe number to a pll pipe number */ | ||
930 | pipe = (pch_dpll >> (4 * pipe)) & 1; | ||
931 | } | 911 | } |
932 | 912 | ||
933 | reg = PCH_DPLL(pipe); | 913 | reg = intel_crtc->pch_pll->pll_reg; |
934 | val = I915_READ(reg); | 914 | val = I915_READ(reg); |
935 | cur_state = !!(val & DPLL_VCO_ENABLE); | 915 | cur_state = !!(val & DPLL_VCO_ENABLE); |
936 | WARN(cur_state != state, | 916 | WARN(cur_state != state, |
@@ -1306,60 +1286,79 @@ static void intel_disable_pll(struct drm_i915_private *dev_priv, enum pipe pipe) | |||
1306 | * The PCH PLL needs to be enabled before the PCH transcoder, since it | 1286 | * The PCH PLL needs to be enabled before the PCH transcoder, since it |
1307 | * drives the transcoder clock. | 1287 | * drives the transcoder clock. |
1308 | */ | 1288 | */ |
1309 | static void intel_enable_pch_pll(struct drm_i915_private *dev_priv, | 1289 | static void intel_enable_pch_pll(struct intel_crtc *intel_crtc) |
1310 | enum pipe pipe) | ||
1311 | { | 1290 | { |
1291 | struct drm_i915_private *dev_priv = intel_crtc->base.dev->dev_private; | ||
1292 | struct intel_pch_pll *pll = intel_crtc->pch_pll; | ||
1312 | int reg; | 1293 | int reg; |
1313 | u32 val; | 1294 | u32 val; |
1314 | 1295 | ||
1315 | if (pipe > 1) | ||
1316 | return; | ||
1317 | |||
1318 | /* PCH only available on ILK+ */ | 1296 | /* PCH only available on ILK+ */ |
1319 | BUG_ON(dev_priv->info->gen < 5); | 1297 | BUG_ON(dev_priv->info->gen < 5); |
1298 | BUG_ON(pll == NULL); | ||
1299 | BUG_ON(pll->refcount == 0); | ||
1300 | |||
1301 | DRM_DEBUG_KMS("enable PCH PLL %x (active %d, on? %d)for crtc %d\n", | ||
1302 | pll->pll_reg, pll->active, pll->on, | ||
1303 | intel_crtc->base.base.id); | ||
1320 | 1304 | ||
1321 | /* PCH refclock must be enabled first */ | 1305 | /* PCH refclock must be enabled first */ |
1322 | assert_pch_refclk_enabled(dev_priv); | 1306 | assert_pch_refclk_enabled(dev_priv); |
1323 | 1307 | ||
1324 | reg = PCH_DPLL(pipe); | 1308 | if (pll->active++ && pll->on) { |
1309 | assert_pch_pll_enabled(dev_priv, intel_crtc); | ||
1310 | return; | ||
1311 | } | ||
1312 | |||
1313 | DRM_DEBUG_KMS("enabling PCH PLL %x\n", pll->pll_reg); | ||
1314 | |||
1315 | reg = pll->pll_reg; | ||
1325 | val = I915_READ(reg); | 1316 | val = I915_READ(reg); |
1326 | val |= DPLL_VCO_ENABLE; | 1317 | val |= DPLL_VCO_ENABLE; |
1327 | I915_WRITE(reg, val); | 1318 | I915_WRITE(reg, val); |
1328 | POSTING_READ(reg); | 1319 | POSTING_READ(reg); |
1329 | udelay(200); | 1320 | udelay(200); |
1321 | |||
1322 | pll->on = true; | ||
1330 | } | 1323 | } |
1331 | 1324 | ||
1332 | static void intel_disable_pch_pll(struct drm_i915_private *dev_priv, | 1325 | static void intel_disable_pch_pll(struct intel_crtc *intel_crtc) |
1333 | enum pipe pipe) | ||
1334 | { | 1326 | { |
1327 | struct drm_i915_private *dev_priv = intel_crtc->base.dev->dev_private; | ||
1328 | struct intel_pch_pll *pll = intel_crtc->pch_pll; | ||
1335 | int reg; | 1329 | int reg; |
1336 | u32 val, pll_mask = TRANSC_DPLL_ENABLE | TRANSC_DPLLB_SEL, | 1330 | u32 val; |
1337 | pll_sel = TRANSC_DPLL_ENABLE; | ||
1338 | |||
1339 | if (pipe > 1) | ||
1340 | return; | ||
1341 | 1331 | ||
1342 | /* PCH only available on ILK+ */ | 1332 | /* PCH only available on ILK+ */ |
1343 | BUG_ON(dev_priv->info->gen < 5); | 1333 | BUG_ON(dev_priv->info->gen < 5); |
1334 | if (pll == NULL) | ||
1335 | return; | ||
1344 | 1336 | ||
1345 | /* Make sure transcoder isn't still depending on us */ | 1337 | BUG_ON(pll->refcount == 0); |
1346 | assert_transcoder_disabled(dev_priv, pipe); | ||
1347 | 1338 | ||
1348 | if (pipe == 0) | 1339 | DRM_DEBUG_KMS("disable PCH PLL %x (active %d, on? %d) for crtc %d\n", |
1349 | pll_sel |= TRANSC_DPLLA_SEL; | 1340 | pll->pll_reg, pll->active, pll->on, |
1350 | else if (pipe == 1) | 1341 | intel_crtc->base.base.id); |
1351 | pll_sel |= TRANSC_DPLLB_SEL; | ||
1352 | 1342 | ||
1353 | 1343 | BUG_ON(pll->active == 0); | |
1354 | if ((I915_READ(PCH_DPLL_SEL) & pll_mask) == pll_sel) | 1344 | if (--pll->active) { |
1345 | assert_pch_pll_enabled(dev_priv, intel_crtc); | ||
1355 | return; | 1346 | return; |
1347 | } | ||
1348 | |||
1349 | DRM_DEBUG_KMS("disabling PCH PLL %x\n", pll->pll_reg); | ||
1350 | |||
1351 | /* Make sure transcoder isn't still depending on us */ | ||
1352 | assert_transcoder_disabled(dev_priv, intel_crtc->pipe); | ||
1356 | 1353 | ||
1357 | reg = PCH_DPLL(pipe); | 1354 | reg = pll->pll_reg; |
1358 | val = I915_READ(reg); | 1355 | val = I915_READ(reg); |
1359 | val &= ~DPLL_VCO_ENABLE; | 1356 | val &= ~DPLL_VCO_ENABLE; |
1360 | I915_WRITE(reg, val); | 1357 | I915_WRITE(reg, val); |
1361 | POSTING_READ(reg); | 1358 | POSTING_READ(reg); |
1362 | udelay(200); | 1359 | udelay(200); |
1360 | |||
1361 | pll->on = false; | ||
1363 | } | 1362 | } |
1364 | 1363 | ||
1365 | static void intel_enable_transcoder(struct drm_i915_private *dev_priv, | 1364 | static void intel_enable_transcoder(struct drm_i915_private *dev_priv, |
@@ -1373,7 +1372,7 @@ static void intel_enable_transcoder(struct drm_i915_private *dev_priv, | |||
1373 | BUG_ON(dev_priv->info->gen < 5); | 1372 | BUG_ON(dev_priv->info->gen < 5); |
1374 | 1373 | ||
1375 | /* Make sure PCH DPLL is enabled */ | 1374 | /* Make sure PCH DPLL is enabled */ |
1376 | assert_pch_pll_enabled(dev_priv, pipe); | 1375 | assert_pch_pll_enabled(dev_priv, to_intel_crtc(crtc)); |
1377 | 1376 | ||
1378 | /* FDI must be feeding us bits for PCH ports */ | 1377 | /* FDI must be feeding us bits for PCH ports */ |
1379 | assert_fdi_tx_enabled(dev_priv, pipe); | 1378 | assert_fdi_tx_enabled(dev_priv, pipe); |
@@ -2507,26 +2506,6 @@ static void ironlake_fdi_disable(struct drm_crtc *crtc) | |||
2507 | udelay(100); | 2506 | udelay(100); |
2508 | } | 2507 | } |
2509 | 2508 | ||
2510 | /* | ||
2511 | * When we disable a pipe, we need to clear any pending scanline wait events | ||
2512 | * to avoid hanging the ring, which we assume we are waiting on. | ||
2513 | */ | ||
2514 | static void intel_clear_scanline_wait(struct drm_device *dev) | ||
2515 | { | ||
2516 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
2517 | struct intel_ring_buffer *ring; | ||
2518 | u32 tmp; | ||
2519 | |||
2520 | if (IS_GEN2(dev)) | ||
2521 | /* Can't break the hang on i8xx */ | ||
2522 | return; | ||
2523 | |||
2524 | ring = LP_RING(dev_priv); | ||
2525 | tmp = I915_READ_CTL(ring); | ||
2526 | if (tmp & RING_WAIT) | ||
2527 | I915_WRITE_CTL(ring, tmp); | ||
2528 | } | ||
2529 | |||
2530 | static void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc) | 2509 | static void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc) |
2531 | { | 2510 | { |
2532 | struct drm_device *dev = crtc->dev; | 2511 | struct drm_device *dev = crtc->dev; |
@@ -2578,29 +2557,36 @@ static void ironlake_pch_enable(struct drm_crtc *crtc) | |||
2578 | struct drm_i915_private *dev_priv = dev->dev_private; | 2557 | struct drm_i915_private *dev_priv = dev->dev_private; |
2579 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 2558 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
2580 | int pipe = intel_crtc->pipe; | 2559 | int pipe = intel_crtc->pipe; |
2581 | u32 reg, temp, transc_sel; | 2560 | u32 reg, temp; |
2582 | 2561 | ||
2583 | /* For PCH output, training FDI link */ | 2562 | /* For PCH output, training FDI link */ |
2584 | dev_priv->display.fdi_link_train(crtc); | 2563 | dev_priv->display.fdi_link_train(crtc); |
2585 | 2564 | ||
2586 | intel_enable_pch_pll(dev_priv, pipe); | 2565 | intel_enable_pch_pll(intel_crtc); |
2587 | 2566 | ||
2588 | if (HAS_PCH_CPT(dev)) { | 2567 | if (HAS_PCH_CPT(dev)) { |
2589 | transc_sel = intel_crtc->use_pll_a ? TRANSC_DPLLA_SEL : | 2568 | u32 sel; |
2590 | TRANSC_DPLLB_SEL; | ||
2591 | 2569 | ||
2592 | /* Be sure PCH DPLL SEL is set */ | ||
2593 | temp = I915_READ(PCH_DPLL_SEL); | 2570 | temp = I915_READ(PCH_DPLL_SEL); |
2594 | if (pipe == 0) { | 2571 | switch (pipe) { |
2595 | temp &= ~(TRANSA_DPLLB_SEL); | 2572 | default: |
2596 | temp |= (TRANSA_DPLL_ENABLE | TRANSA_DPLLA_SEL); | 2573 | case 0: |
2597 | } else if (pipe == 1) { | 2574 | temp |= TRANSA_DPLL_ENABLE; |
2598 | temp &= ~(TRANSB_DPLLB_SEL); | 2575 | sel = TRANSA_DPLLB_SEL; |
2599 | temp |= (TRANSB_DPLL_ENABLE | TRANSB_DPLLB_SEL); | 2576 | break; |
2600 | } else if (pipe == 2) { | 2577 | case 1: |
2601 | temp &= ~(TRANSC_DPLLB_SEL); | 2578 | temp |= TRANSB_DPLL_ENABLE; |
2602 | temp |= (TRANSC_DPLL_ENABLE | transc_sel); | 2579 | sel = TRANSB_DPLLB_SEL; |
2580 | break; | ||
2581 | case 2: | ||
2582 | temp |= TRANSC_DPLL_ENABLE; | ||
2583 | sel = TRANSC_DPLLB_SEL; | ||
2584 | break; | ||
2603 | } | 2585 | } |
2586 | if (intel_crtc->pch_pll->pll_reg == _PCH_DPLL_B) | ||
2587 | temp |= sel; | ||
2588 | else | ||
2589 | temp &= ~sel; | ||
2604 | I915_WRITE(PCH_DPLL_SEL, temp); | 2590 | I915_WRITE(PCH_DPLL_SEL, temp); |
2605 | } | 2591 | } |
2606 | 2592 | ||
@@ -2658,6 +2644,82 @@ static void ironlake_pch_enable(struct drm_crtc *crtc) | |||
2658 | intel_enable_transcoder(dev_priv, pipe); | 2644 | intel_enable_transcoder(dev_priv, pipe); |
2659 | } | 2645 | } |
2660 | 2646 | ||
2647 | static void intel_put_pch_pll(struct intel_crtc *intel_crtc) | ||
2648 | { | ||
2649 | struct intel_pch_pll *pll = intel_crtc->pch_pll; | ||
2650 | |||
2651 | if (pll == NULL) | ||
2652 | return; | ||
2653 | |||
2654 | if (pll->refcount == 0) { | ||
2655 | WARN(1, "bad PCH PLL refcount\n"); | ||
2656 | return; | ||
2657 | } | ||
2658 | |||
2659 | --pll->refcount; | ||
2660 | intel_crtc->pch_pll = NULL; | ||
2661 | } | ||
2662 | |||
2663 | static struct intel_pch_pll *intel_get_pch_pll(struct intel_crtc *intel_crtc, u32 dpll, u32 fp) | ||
2664 | { | ||
2665 | struct drm_i915_private *dev_priv = intel_crtc->base.dev->dev_private; | ||
2666 | struct intel_pch_pll *pll; | ||
2667 | int i; | ||
2668 | |||
2669 | pll = intel_crtc->pch_pll; | ||
2670 | if (pll) { | ||
2671 | DRM_DEBUG_KMS("CRTC:%d reusing existing PCH PLL %x\n", | ||
2672 | intel_crtc->base.base.id, pll->pll_reg); | ||
2673 | goto prepare; | ||
2674 | } | ||
2675 | |||
2676 | for (i = 0; i < dev_priv->num_pch_pll; i++) { | ||
2677 | pll = &dev_priv->pch_plls[i]; | ||
2678 | |||
2679 | /* Only want to check enabled timings first */ | ||
2680 | if (pll->refcount == 0) | ||
2681 | continue; | ||
2682 | |||
2683 | if (dpll == (I915_READ(pll->pll_reg) & 0x7fffffff) && | ||
2684 | fp == I915_READ(pll->fp0_reg)) { | ||
2685 | DRM_DEBUG_KMS("CRTC:%d sharing existing PCH PLL %x (refcount %d, ative %d)\n", | ||
2686 | intel_crtc->base.base.id, | ||
2687 | pll->pll_reg, pll->refcount, pll->active); | ||
2688 | |||
2689 | goto found; | ||
2690 | } | ||
2691 | } | ||
2692 | |||
2693 | /* Ok no matching timings, maybe there's a free one? */ | ||
2694 | for (i = 0; i < dev_priv->num_pch_pll; i++) { | ||
2695 | pll = &dev_priv->pch_plls[i]; | ||
2696 | if (pll->refcount == 0) { | ||
2697 | DRM_DEBUG_KMS("CRTC:%d allocated PCH PLL %x\n", | ||
2698 | intel_crtc->base.base.id, pll->pll_reg); | ||
2699 | goto found; | ||
2700 | } | ||
2701 | } | ||
2702 | |||
2703 | return NULL; | ||
2704 | |||
2705 | found: | ||
2706 | intel_crtc->pch_pll = pll; | ||
2707 | pll->refcount++; | ||
2708 | DRM_DEBUG_DRIVER("using pll %d for pipe %d\n", i, intel_crtc->pipe); | ||
2709 | prepare: /* separate function? */ | ||
2710 | DRM_DEBUG_DRIVER("switching PLL %x off\n", pll->pll_reg); | ||
2711 | |||
2712 | /* Wait for the clocks to stabilize before rewriting the regs */ | ||
2713 | I915_WRITE(pll->pll_reg, dpll & ~DPLL_VCO_ENABLE); | ||
2714 | POSTING_READ(pll->pll_reg); | ||
2715 | udelay(150); | ||
2716 | |||
2717 | I915_WRITE(pll->fp0_reg, fp); | ||
2718 | I915_WRITE(pll->pll_reg, dpll & ~DPLL_VCO_ENABLE); | ||
2719 | pll->on = false; | ||
2720 | return pll; | ||
2721 | } | ||
2722 | |||
2661 | void intel_cpt_verify_modeset(struct drm_device *dev, int pipe) | 2723 | void intel_cpt_verify_modeset(struct drm_device *dev, int pipe) |
2662 | { | 2724 | { |
2663 | struct drm_i915_private *dev_priv = dev->dev_private; | 2725 | struct drm_i915_private *dev_priv = dev->dev_private; |
@@ -2802,8 +2864,7 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc) | |||
2802 | } | 2864 | } |
2803 | 2865 | ||
2804 | /* disable PCH DPLL */ | 2866 | /* disable PCH DPLL */ |
2805 | if (!intel_crtc->no_pll) | 2867 | intel_disable_pch_pll(intel_crtc); |
2806 | intel_disable_pch_pll(dev_priv, pipe); | ||
2807 | 2868 | ||
2808 | /* Switch from PCDclk to Rawclk */ | 2869 | /* Switch from PCDclk to Rawclk */ |
2809 | reg = FDI_RX_CTL(pipe); | 2870 | reg = FDI_RX_CTL(pipe); |
@@ -2831,7 +2892,6 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc) | |||
2831 | 2892 | ||
2832 | mutex_lock(&dev->struct_mutex); | 2893 | mutex_lock(&dev->struct_mutex); |
2833 | intel_update_fbc(dev); | 2894 | intel_update_fbc(dev); |
2834 | intel_clear_scanline_wait(dev); | ||
2835 | mutex_unlock(&dev->struct_mutex); | 2895 | mutex_unlock(&dev->struct_mutex); |
2836 | } | 2896 | } |
2837 | 2897 | ||
@@ -2859,6 +2919,12 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
2859 | } | 2919 | } |
2860 | } | 2920 | } |
2861 | 2921 | ||
2922 | static void ironlake_crtc_off(struct drm_crtc *crtc) | ||
2923 | { | ||
2924 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
2925 | intel_put_pch_pll(intel_crtc); | ||
2926 | } | ||
2927 | |||
2862 | static void intel_crtc_dpms_overlay(struct intel_crtc *intel_crtc, bool enable) | 2928 | static void intel_crtc_dpms_overlay(struct intel_crtc *intel_crtc, bool enable) |
2863 | { | 2929 | { |
2864 | if (!enable && intel_crtc->overlay) { | 2930 | if (!enable && intel_crtc->overlay) { |
@@ -2930,7 +2996,6 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc) | |||
2930 | intel_crtc->active = false; | 2996 | intel_crtc->active = false; |
2931 | intel_update_fbc(dev); | 2997 | intel_update_fbc(dev); |
2932 | intel_update_watermarks(dev); | 2998 | intel_update_watermarks(dev); |
2933 | intel_clear_scanline_wait(dev); | ||
2934 | } | 2999 | } |
2935 | 3000 | ||
2936 | static void i9xx_crtc_dpms(struct drm_crtc *crtc, int mode) | 3001 | static void i9xx_crtc_dpms(struct drm_crtc *crtc, int mode) |
@@ -2950,6 +3015,10 @@ static void i9xx_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
2950 | } | 3015 | } |
2951 | } | 3016 | } |
2952 | 3017 | ||
3018 | static void i9xx_crtc_off(struct drm_crtc *crtc) | ||
3019 | { | ||
3020 | } | ||
3021 | |||
2953 | /** | 3022 | /** |
2954 | * Sets the power management mode of the pipe and plane. | 3023 | * Sets the power management mode of the pipe and plane. |
2955 | */ | 3024 | */ |
@@ -2997,8 +3066,11 @@ static void intel_crtc_disable(struct drm_crtc *crtc) | |||
2997 | { | 3066 | { |
2998 | struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; | 3067 | struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; |
2999 | struct drm_device *dev = crtc->dev; | 3068 | struct drm_device *dev = crtc->dev; |
3069 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
3000 | 3070 | ||
3001 | crtc_funcs->dpms(crtc, DRM_MODE_DPMS_OFF); | 3071 | crtc_funcs->dpms(crtc, DRM_MODE_DPMS_OFF); |
3072 | dev_priv->display.off(crtc); | ||
3073 | |||
3002 | assert_plane_disabled(dev->dev_private, to_intel_crtc(crtc)->plane); | 3074 | assert_plane_disabled(dev->dev_private, to_intel_crtc(crtc)->plane); |
3003 | assert_pipe_disabled(dev->dev_private, to_intel_crtc(crtc)->pipe); | 3075 | assert_pipe_disabled(dev->dev_private, to_intel_crtc(crtc)->pipe); |
3004 | 3076 | ||
@@ -3822,7 +3894,6 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc, | |||
3822 | 3894 | ||
3823 | I915_WRITE(DSPCNTR(plane), dspcntr); | 3895 | I915_WRITE(DSPCNTR(plane), dspcntr); |
3824 | POSTING_READ(DSPCNTR(plane)); | 3896 | POSTING_READ(DSPCNTR(plane)); |
3825 | intel_enable_plane(dev_priv, plane, pipe); | ||
3826 | 3897 | ||
3827 | ret = intel_pipe_set_base(crtc, x, y, old_fb); | 3898 | ret = intel_pipe_set_base(crtc, x, y, old_fb); |
3828 | 3899 | ||
@@ -4241,29 +4312,18 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
4241 | DRM_DEBUG_KMS("Mode for pipe %d:\n", pipe); | 4312 | DRM_DEBUG_KMS("Mode for pipe %d:\n", pipe); |
4242 | drm_mode_debug_printmodeline(mode); | 4313 | drm_mode_debug_printmodeline(mode); |
4243 | 4314 | ||
4244 | /* PCH eDP needs FDI, but CPU eDP does not */ | 4315 | /* CPU eDP is the only output that doesn't need a PCH PLL of its own */ |
4245 | if (!intel_crtc->no_pll) { | 4316 | if (!is_cpu_edp) { |
4246 | if (!is_cpu_edp) { | 4317 | struct intel_pch_pll *pll; |
4247 | I915_WRITE(PCH_FP0(pipe), fp); | ||
4248 | I915_WRITE(PCH_DPLL(pipe), dpll & ~DPLL_VCO_ENABLE); | ||
4249 | 4318 | ||
4250 | POSTING_READ(PCH_DPLL(pipe)); | 4319 | pll = intel_get_pch_pll(intel_crtc, dpll, fp); |
4251 | udelay(150); | 4320 | if (pll == NULL) { |
4252 | } | 4321 | DRM_DEBUG_DRIVER("failed to find PLL for pipe %d\n", |
4253 | } else { | 4322 | pipe); |
4254 | if (dpll == (I915_READ(PCH_DPLL(0)) & 0x7fffffff) && | ||
4255 | fp == I915_READ(PCH_FP0(0))) { | ||
4256 | intel_crtc->use_pll_a = true; | ||
4257 | DRM_DEBUG_KMS("using pipe a dpll\n"); | ||
4258 | } else if (dpll == (I915_READ(PCH_DPLL(1)) & 0x7fffffff) && | ||
4259 | fp == I915_READ(PCH_FP0(1))) { | ||
4260 | intel_crtc->use_pll_a = false; | ||
4261 | DRM_DEBUG_KMS("using pipe b dpll\n"); | ||
4262 | } else { | ||
4263 | DRM_DEBUG_KMS("no matching PLL configuration for pipe 2\n"); | ||
4264 | return -EINVAL; | 4323 | return -EINVAL; |
4265 | } | 4324 | } |
4266 | } | 4325 | } else |
4326 | intel_put_pch_pll(intel_crtc); | ||
4267 | 4327 | ||
4268 | /* The LVDS pin pair needs to be on before the DPLLs are enabled. | 4328 | /* The LVDS pin pair needs to be on before the DPLLs are enabled. |
4269 | * This is an exception to the general rule that mode_set doesn't turn | 4329 | * This is an exception to the general rule that mode_set doesn't turn |
@@ -4320,11 +4380,11 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
4320 | I915_WRITE(TRANSDPLINK_N1(pipe), 0); | 4380 | I915_WRITE(TRANSDPLINK_N1(pipe), 0); |
4321 | } | 4381 | } |
4322 | 4382 | ||
4323 | if (!intel_crtc->no_pll && (!edp_encoder || is_pch_edp)) { | 4383 | if (intel_crtc->pch_pll) { |
4324 | I915_WRITE(PCH_DPLL(pipe), dpll); | 4384 | I915_WRITE(intel_crtc->pch_pll->pll_reg, dpll); |
4325 | 4385 | ||
4326 | /* Wait for the clocks to stabilize. */ | 4386 | /* Wait for the clocks to stabilize. */ |
4327 | POSTING_READ(PCH_DPLL(pipe)); | 4387 | POSTING_READ(intel_crtc->pch_pll->pll_reg); |
4328 | udelay(150); | 4388 | udelay(150); |
4329 | 4389 | ||
4330 | /* The pixel multiplier can only be updated once the | 4390 | /* The pixel multiplier can only be updated once the |
@@ -4332,20 +4392,20 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
4332 | * | 4392 | * |
4333 | * So write it again. | 4393 | * So write it again. |
4334 | */ | 4394 | */ |
4335 | I915_WRITE(PCH_DPLL(pipe), dpll); | 4395 | I915_WRITE(intel_crtc->pch_pll->pll_reg, dpll); |
4336 | } | 4396 | } |
4337 | 4397 | ||
4338 | intel_crtc->lowfreq_avail = false; | 4398 | intel_crtc->lowfreq_avail = false; |
4339 | if (!intel_crtc->no_pll) { | 4399 | if (intel_crtc->pch_pll) { |
4340 | if (is_lvds && has_reduced_clock && i915_powersave) { | 4400 | if (is_lvds && has_reduced_clock && i915_powersave) { |
4341 | I915_WRITE(PCH_FP1(pipe), fp2); | 4401 | I915_WRITE(intel_crtc->pch_pll->fp1_reg, fp2); |
4342 | intel_crtc->lowfreq_avail = true; | 4402 | intel_crtc->lowfreq_avail = true; |
4343 | if (HAS_PIPE_CXSR(dev)) { | 4403 | if (HAS_PIPE_CXSR(dev)) { |
4344 | DRM_DEBUG_KMS("enabling CxSR downclocking\n"); | 4404 | DRM_DEBUG_KMS("enabling CxSR downclocking\n"); |
4345 | pipeconf |= PIPECONF_CXSR_DOWNCLOCK; | 4405 | pipeconf |= PIPECONF_CXSR_DOWNCLOCK; |
4346 | } | 4406 | } |
4347 | } else { | 4407 | } else { |
4348 | I915_WRITE(PCH_FP1(pipe), fp); | 4408 | I915_WRITE(intel_crtc->pch_pll->fp1_reg, fp); |
4349 | if (HAS_PIPE_CXSR(dev)) { | 4409 | if (HAS_PIPE_CXSR(dev)) { |
4350 | DRM_DEBUG_KMS("disabling CxSR downclocking\n"); | 4410 | DRM_DEBUG_KMS("disabling CxSR downclocking\n"); |
4351 | pipeconf &= ~PIPECONF_CXSR_DOWNCLOCK; | 4411 | pipeconf &= ~PIPECONF_CXSR_DOWNCLOCK; |
@@ -4777,9 +4837,6 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc, | |||
4777 | else | 4837 | else |
4778 | i9xx_update_cursor(crtc, base); | 4838 | i9xx_update_cursor(crtc, base); |
4779 | } | 4839 | } |
4780 | |||
4781 | if (visible) | ||
4782 | intel_mark_busy(dev, to_intel_framebuffer(crtc->fb)->obj); | ||
4783 | } | 4840 | } |
4784 | 4841 | ||
4785 | static int intel_crtc_cursor_set(struct drm_crtc *crtc, | 4842 | static int intel_crtc_cursor_set(struct drm_crtc *crtc, |
@@ -5303,7 +5360,6 @@ struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev, | |||
5303 | mode->vsync_end = ((vsync & 0xffff0000) >> 16) + 1; | 5360 | mode->vsync_end = ((vsync & 0xffff0000) >> 16) + 1; |
5304 | 5361 | ||
5305 | drm_mode_set_name(mode); | 5362 | drm_mode_set_name(mode); |
5306 | drm_mode_set_crtcinfo(mode, 0); | ||
5307 | 5363 | ||
5308 | return mode; | 5364 | return mode; |
5309 | } | 5365 | } |
@@ -5475,9 +5531,10 @@ void intel_mark_busy(struct drm_device *dev, struct drm_i915_gem_object *obj) | |||
5475 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) | 5531 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
5476 | return; | 5532 | return; |
5477 | 5533 | ||
5478 | if (!dev_priv->busy) | 5534 | if (!dev_priv->busy) { |
5535 | intel_sanitize_pm(dev); | ||
5479 | dev_priv->busy = true; | 5536 | dev_priv->busy = true; |
5480 | else | 5537 | } else |
5481 | mod_timer(&dev_priv->idle_timer, jiffies + | 5538 | mod_timer(&dev_priv->idle_timer, jiffies + |
5482 | msecs_to_jiffies(GPU_IDLE_TIMEOUT)); | 5539 | msecs_to_jiffies(GPU_IDLE_TIMEOUT)); |
5483 | 5540 | ||
@@ -5653,16 +5710,17 @@ static int intel_gen2_queue_flip(struct drm_device *dev, | |||
5653 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 5710 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
5654 | unsigned long offset; | 5711 | unsigned long offset; |
5655 | u32 flip_mask; | 5712 | u32 flip_mask; |
5713 | struct intel_ring_buffer *ring = &dev_priv->ring[RCS]; | ||
5656 | int ret; | 5714 | int ret; |
5657 | 5715 | ||
5658 | ret = intel_pin_and_fence_fb_obj(dev, obj, LP_RING(dev_priv)); | 5716 | ret = intel_pin_and_fence_fb_obj(dev, obj, ring); |
5659 | if (ret) | 5717 | if (ret) |
5660 | goto err; | 5718 | goto err; |
5661 | 5719 | ||
5662 | /* Offset into the new buffer for cases of shared fbs between CRTCs */ | 5720 | /* Offset into the new buffer for cases of shared fbs between CRTCs */ |
5663 | offset = crtc->y * fb->pitches[0] + crtc->x * fb->bits_per_pixel/8; | 5721 | offset = crtc->y * fb->pitches[0] + crtc->x * fb->bits_per_pixel/8; |
5664 | 5722 | ||
5665 | ret = BEGIN_LP_RING(6); | 5723 | ret = intel_ring_begin(ring, 6); |
5666 | if (ret) | 5724 | if (ret) |
5667 | goto err_unpin; | 5725 | goto err_unpin; |
5668 | 5726 | ||
@@ -5673,14 +5731,14 @@ static int intel_gen2_queue_flip(struct drm_device *dev, | |||
5673 | flip_mask = MI_WAIT_FOR_PLANE_B_FLIP; | 5731 | flip_mask = MI_WAIT_FOR_PLANE_B_FLIP; |
5674 | else | 5732 | else |
5675 | flip_mask = MI_WAIT_FOR_PLANE_A_FLIP; | 5733 | flip_mask = MI_WAIT_FOR_PLANE_A_FLIP; |
5676 | OUT_RING(MI_WAIT_FOR_EVENT | flip_mask); | 5734 | intel_ring_emit(ring, MI_WAIT_FOR_EVENT | flip_mask); |
5677 | OUT_RING(MI_NOOP); | 5735 | intel_ring_emit(ring, MI_NOOP); |
5678 | OUT_RING(MI_DISPLAY_FLIP | | 5736 | intel_ring_emit(ring, MI_DISPLAY_FLIP | |
5679 | MI_DISPLAY_FLIP_PLANE(intel_crtc->plane)); | 5737 | MI_DISPLAY_FLIP_PLANE(intel_crtc->plane)); |
5680 | OUT_RING(fb->pitches[0]); | 5738 | intel_ring_emit(ring, fb->pitches[0]); |
5681 | OUT_RING(obj->gtt_offset + offset); | 5739 | intel_ring_emit(ring, obj->gtt_offset + offset); |
5682 | OUT_RING(0); /* aux display base address, unused */ | 5740 | intel_ring_emit(ring, 0); /* aux display base address, unused */ |
5683 | ADVANCE_LP_RING(); | 5741 | intel_ring_advance(ring); |
5684 | return 0; | 5742 | return 0; |
5685 | 5743 | ||
5686 | err_unpin: | 5744 | err_unpin: |
@@ -5698,16 +5756,17 @@ static int intel_gen3_queue_flip(struct drm_device *dev, | |||
5698 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 5756 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
5699 | unsigned long offset; | 5757 | unsigned long offset; |
5700 | u32 flip_mask; | 5758 | u32 flip_mask; |
5759 | struct intel_ring_buffer *ring = &dev_priv->ring[RCS]; | ||
5701 | int ret; | 5760 | int ret; |
5702 | 5761 | ||
5703 | ret = intel_pin_and_fence_fb_obj(dev, obj, LP_RING(dev_priv)); | 5762 | ret = intel_pin_and_fence_fb_obj(dev, obj, ring); |
5704 | if (ret) | 5763 | if (ret) |
5705 | goto err; | 5764 | goto err; |
5706 | 5765 | ||
5707 | /* Offset into the new buffer for cases of shared fbs between CRTCs */ | 5766 | /* Offset into the new buffer for cases of shared fbs between CRTCs */ |
5708 | offset = crtc->y * fb->pitches[0] + crtc->x * fb->bits_per_pixel/8; | 5767 | offset = crtc->y * fb->pitches[0] + crtc->x * fb->bits_per_pixel/8; |
5709 | 5768 | ||
5710 | ret = BEGIN_LP_RING(6); | 5769 | ret = intel_ring_begin(ring, 6); |
5711 | if (ret) | 5770 | if (ret) |
5712 | goto err_unpin; | 5771 | goto err_unpin; |
5713 | 5772 | ||
@@ -5715,15 +5774,15 @@ static int intel_gen3_queue_flip(struct drm_device *dev, | |||
5715 | flip_mask = MI_WAIT_FOR_PLANE_B_FLIP; | 5774 | flip_mask = MI_WAIT_FOR_PLANE_B_FLIP; |
5716 | else | 5775 | else |
5717 | flip_mask = MI_WAIT_FOR_PLANE_A_FLIP; | 5776 | flip_mask = MI_WAIT_FOR_PLANE_A_FLIP; |
5718 | OUT_RING(MI_WAIT_FOR_EVENT | flip_mask); | 5777 | intel_ring_emit(ring, MI_WAIT_FOR_EVENT | flip_mask); |
5719 | OUT_RING(MI_NOOP); | 5778 | intel_ring_emit(ring, MI_NOOP); |
5720 | OUT_RING(MI_DISPLAY_FLIP_I915 | | 5779 | intel_ring_emit(ring, MI_DISPLAY_FLIP_I915 | |
5721 | MI_DISPLAY_FLIP_PLANE(intel_crtc->plane)); | 5780 | MI_DISPLAY_FLIP_PLANE(intel_crtc->plane)); |
5722 | OUT_RING(fb->pitches[0]); | 5781 | intel_ring_emit(ring, fb->pitches[0]); |
5723 | OUT_RING(obj->gtt_offset + offset); | 5782 | intel_ring_emit(ring, obj->gtt_offset + offset); |
5724 | OUT_RING(MI_NOOP); | 5783 | intel_ring_emit(ring, MI_NOOP); |
5725 | 5784 | ||
5726 | ADVANCE_LP_RING(); | 5785 | intel_ring_advance(ring); |
5727 | return 0; | 5786 | return 0; |
5728 | 5787 | ||
5729 | err_unpin: | 5788 | err_unpin: |
@@ -5740,13 +5799,14 @@ static int intel_gen4_queue_flip(struct drm_device *dev, | |||
5740 | struct drm_i915_private *dev_priv = dev->dev_private; | 5799 | struct drm_i915_private *dev_priv = dev->dev_private; |
5741 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 5800 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
5742 | uint32_t pf, pipesrc; | 5801 | uint32_t pf, pipesrc; |
5802 | struct intel_ring_buffer *ring = &dev_priv->ring[RCS]; | ||
5743 | int ret; | 5803 | int ret; |
5744 | 5804 | ||
5745 | ret = intel_pin_and_fence_fb_obj(dev, obj, LP_RING(dev_priv)); | 5805 | ret = intel_pin_and_fence_fb_obj(dev, obj, ring); |
5746 | if (ret) | 5806 | if (ret) |
5747 | goto err; | 5807 | goto err; |
5748 | 5808 | ||
5749 | ret = BEGIN_LP_RING(4); | 5809 | ret = intel_ring_begin(ring, 4); |
5750 | if (ret) | 5810 | if (ret) |
5751 | goto err_unpin; | 5811 | goto err_unpin; |
5752 | 5812 | ||
@@ -5754,10 +5814,10 @@ static int intel_gen4_queue_flip(struct drm_device *dev, | |||
5754 | * Display Registers (which do not change across a page-flip) | 5814 | * Display Registers (which do not change across a page-flip) |
5755 | * so we need only reprogram the base address. | 5815 | * so we need only reprogram the base address. |
5756 | */ | 5816 | */ |
5757 | OUT_RING(MI_DISPLAY_FLIP | | 5817 | intel_ring_emit(ring, MI_DISPLAY_FLIP | |
5758 | MI_DISPLAY_FLIP_PLANE(intel_crtc->plane)); | 5818 | MI_DISPLAY_FLIP_PLANE(intel_crtc->plane)); |
5759 | OUT_RING(fb->pitches[0]); | 5819 | intel_ring_emit(ring, fb->pitches[0]); |
5760 | OUT_RING(obj->gtt_offset | obj->tiling_mode); | 5820 | intel_ring_emit(ring, obj->gtt_offset | obj->tiling_mode); |
5761 | 5821 | ||
5762 | /* XXX Enabling the panel-fitter across page-flip is so far | 5822 | /* XXX Enabling the panel-fitter across page-flip is so far |
5763 | * untested on non-native modes, so ignore it for now. | 5823 | * untested on non-native modes, so ignore it for now. |
@@ -5765,8 +5825,8 @@ static int intel_gen4_queue_flip(struct drm_device *dev, | |||
5765 | */ | 5825 | */ |
5766 | pf = 0; | 5826 | pf = 0; |
5767 | pipesrc = I915_READ(PIPESRC(intel_crtc->pipe)) & 0x0fff0fff; | 5827 | pipesrc = I915_READ(PIPESRC(intel_crtc->pipe)) & 0x0fff0fff; |
5768 | OUT_RING(pf | pipesrc); | 5828 | intel_ring_emit(ring, pf | pipesrc); |
5769 | ADVANCE_LP_RING(); | 5829 | intel_ring_advance(ring); |
5770 | return 0; | 5830 | return 0; |
5771 | 5831 | ||
5772 | err_unpin: | 5832 | err_unpin: |
@@ -5782,21 +5842,22 @@ static int intel_gen6_queue_flip(struct drm_device *dev, | |||
5782 | { | 5842 | { |
5783 | struct drm_i915_private *dev_priv = dev->dev_private; | 5843 | struct drm_i915_private *dev_priv = dev->dev_private; |
5784 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 5844 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
5845 | struct intel_ring_buffer *ring = &dev_priv->ring[RCS]; | ||
5785 | uint32_t pf, pipesrc; | 5846 | uint32_t pf, pipesrc; |
5786 | int ret; | 5847 | int ret; |
5787 | 5848 | ||
5788 | ret = intel_pin_and_fence_fb_obj(dev, obj, LP_RING(dev_priv)); | 5849 | ret = intel_pin_and_fence_fb_obj(dev, obj, ring); |
5789 | if (ret) | 5850 | if (ret) |
5790 | goto err; | 5851 | goto err; |
5791 | 5852 | ||
5792 | ret = BEGIN_LP_RING(4); | 5853 | ret = intel_ring_begin(ring, 4); |
5793 | if (ret) | 5854 | if (ret) |
5794 | goto err_unpin; | 5855 | goto err_unpin; |
5795 | 5856 | ||
5796 | OUT_RING(MI_DISPLAY_FLIP | | 5857 | intel_ring_emit(ring, MI_DISPLAY_FLIP | |
5797 | MI_DISPLAY_FLIP_PLANE(intel_crtc->plane)); | 5858 | MI_DISPLAY_FLIP_PLANE(intel_crtc->plane)); |
5798 | OUT_RING(fb->pitches[0] | obj->tiling_mode); | 5859 | intel_ring_emit(ring, fb->pitches[0] | obj->tiling_mode); |
5799 | OUT_RING(obj->gtt_offset); | 5860 | intel_ring_emit(ring, obj->gtt_offset); |
5800 | 5861 | ||
5801 | /* Contrary to the suggestions in the documentation, | 5862 | /* Contrary to the suggestions in the documentation, |
5802 | * "Enable Panel Fitter" does not seem to be required when page | 5863 | * "Enable Panel Fitter" does not seem to be required when page |
@@ -5806,8 +5867,8 @@ static int intel_gen6_queue_flip(struct drm_device *dev, | |||
5806 | */ | 5867 | */ |
5807 | pf = 0; | 5868 | pf = 0; |
5808 | pipesrc = I915_READ(PIPESRC(intel_crtc->pipe)) & 0x0fff0fff; | 5869 | pipesrc = I915_READ(PIPESRC(intel_crtc->pipe)) & 0x0fff0fff; |
5809 | OUT_RING(pf | pipesrc); | 5870 | intel_ring_emit(ring, pf | pipesrc); |
5810 | ADVANCE_LP_RING(); | 5871 | intel_ring_advance(ring); |
5811 | return 0; | 5872 | return 0; |
5812 | 5873 | ||
5813 | err_unpin: | 5874 | err_unpin: |
@@ -6027,6 +6088,23 @@ static const struct drm_crtc_funcs intel_crtc_funcs = { | |||
6027 | .page_flip = intel_crtc_page_flip, | 6088 | .page_flip = intel_crtc_page_flip, |
6028 | }; | 6089 | }; |
6029 | 6090 | ||
6091 | static void intel_pch_pll_init(struct drm_device *dev) | ||
6092 | { | ||
6093 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
6094 | int i; | ||
6095 | |||
6096 | if (dev_priv->num_pch_pll == 0) { | ||
6097 | DRM_DEBUG_KMS("No PCH PLLs on this hardware, skipping initialisation\n"); | ||
6098 | return; | ||
6099 | } | ||
6100 | |||
6101 | for (i = 0; i < dev_priv->num_pch_pll; i++) { | ||
6102 | dev_priv->pch_plls[i].pll_reg = _PCH_DPLL(i); | ||
6103 | dev_priv->pch_plls[i].fp0_reg = _PCH_FP0(i); | ||
6104 | dev_priv->pch_plls[i].fp1_reg = _PCH_FP1(i); | ||
6105 | } | ||
6106 | } | ||
6107 | |||
6030 | static void intel_crtc_init(struct drm_device *dev, int pipe) | 6108 | static void intel_crtc_init(struct drm_device *dev, int pipe) |
6031 | { | 6109 | { |
6032 | drm_i915_private_t *dev_priv = dev->dev_private; | 6110 | drm_i915_private_t *dev_priv = dev->dev_private; |
@@ -6064,8 +6142,6 @@ static void intel_crtc_init(struct drm_device *dev, int pipe) | |||
6064 | intel_crtc->bpp = 24; /* default for pre-Ironlake */ | 6142 | intel_crtc->bpp = 24; /* default for pre-Ironlake */ |
6065 | 6143 | ||
6066 | if (HAS_PCH_SPLIT(dev)) { | 6144 | if (HAS_PCH_SPLIT(dev)) { |
6067 | if (pipe == 2 && IS_IVYBRIDGE(dev)) | ||
6068 | intel_crtc->no_pll = true; | ||
6069 | intel_helper_funcs.prepare = ironlake_crtc_prepare; | 6145 | intel_helper_funcs.prepare = ironlake_crtc_prepare; |
6070 | intel_helper_funcs.commit = ironlake_crtc_commit; | 6146 | intel_helper_funcs.commit = ironlake_crtc_commit; |
6071 | } else { | 6147 | } else { |
@@ -6084,15 +6160,12 @@ static void intel_crtc_init(struct drm_device *dev, int pipe) | |||
6084 | int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, | 6160 | int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, |
6085 | struct drm_file *file) | 6161 | struct drm_file *file) |
6086 | { | 6162 | { |
6087 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
6088 | struct drm_i915_get_pipe_from_crtc_id *pipe_from_crtc_id = data; | 6163 | struct drm_i915_get_pipe_from_crtc_id *pipe_from_crtc_id = data; |
6089 | struct drm_mode_object *drmmode_obj; | 6164 | struct drm_mode_object *drmmode_obj; |
6090 | struct intel_crtc *crtc; | 6165 | struct intel_crtc *crtc; |
6091 | 6166 | ||
6092 | if (!dev_priv) { | 6167 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
6093 | DRM_ERROR("called with no initialization\n"); | 6168 | return -ENODEV; |
6094 | return -EINVAL; | ||
6095 | } | ||
6096 | 6169 | ||
6097 | drmmode_obj = drm_mode_object_find(dev, pipe_from_crtc_id->crtc_id, | 6170 | drmmode_obj = drm_mode_object_find(dev, pipe_from_crtc_id->crtc_id, |
6098 | DRM_MODE_OBJECT_CRTC); | 6171 | DRM_MODE_OBJECT_CRTC); |
@@ -6348,10 +6421,12 @@ static void intel_init_display(struct drm_device *dev) | |||
6348 | if (HAS_PCH_SPLIT(dev)) { | 6421 | if (HAS_PCH_SPLIT(dev)) { |
6349 | dev_priv->display.dpms = ironlake_crtc_dpms; | 6422 | dev_priv->display.dpms = ironlake_crtc_dpms; |
6350 | dev_priv->display.crtc_mode_set = ironlake_crtc_mode_set; | 6423 | dev_priv->display.crtc_mode_set = ironlake_crtc_mode_set; |
6424 | dev_priv->display.off = ironlake_crtc_off; | ||
6351 | dev_priv->display.update_plane = ironlake_update_plane; | 6425 | dev_priv->display.update_plane = ironlake_update_plane; |
6352 | } else { | 6426 | } else { |
6353 | dev_priv->display.dpms = i9xx_crtc_dpms; | 6427 | dev_priv->display.dpms = i9xx_crtc_dpms; |
6354 | dev_priv->display.crtc_mode_set = i9xx_crtc_mode_set; | 6428 | dev_priv->display.crtc_mode_set = i9xx_crtc_mode_set; |
6429 | dev_priv->display.off = i9xx_crtc_off; | ||
6355 | dev_priv->display.update_plane = i9xx_update_plane; | 6430 | dev_priv->display.update_plane = i9xx_update_plane; |
6356 | } | 6431 | } |
6357 | 6432 | ||
@@ -6614,6 +6689,8 @@ void intel_modeset_init(struct drm_device *dev) | |||
6614 | DRM_DEBUG_KMS("plane %d init failed: %d\n", i, ret); | 6689 | DRM_DEBUG_KMS("plane %d init failed: %d\n", i, ret); |
6615 | } | 6690 | } |
6616 | 6691 | ||
6692 | intel_pch_pll_init(dev); | ||
6693 | |||
6617 | /* Just disable it once at startup */ | 6694 | /* Just disable it once at startup */ |
6618 | i915_disable_vga(dev); | 6695 | i915_disable_vga(dev); |
6619 | intel_setup_outputs(dev); | 6696 | intel_setup_outputs(dev); |