drm/i915: fix VGA plane disable for Ironlake+

We need to use I/O port instructions to access VGA registers on
Ironlake+, and it doesn't hurt on other platforms, so switch the VGA
plane disable function over to using them. Move it to init time as well
while we're at it, no need to repeatedly disable the VGA plane with
every mode set and DPMS event.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>

+27 -28
+27 -28
drivers/gpu/drm/i915/intel_display.c
··· 29 29 #include <linux/i2c.h> 30 30 #include <linux/kernel.h> 31 31 #include <linux/slab.h> 32 + #include <linux/vgaarb.h> 32 33 #include "drmP.h" 33 34 #include "intel_drv.h" 34 35 #include "i915_drm.h" ··· 1622 1621 return 0; 1623 1622 } 1624 1623 1625 - /* Disable the VGA plane that we never use */ 1626 - static void i915_disable_vga (struct drm_device *dev) 1627 - { 1628 - struct drm_i915_private *dev_priv = dev->dev_private; 1629 - u8 sr1; 1630 - u32 vga_reg; 1631 - 1632 - if (HAS_PCH_SPLIT(dev)) 1633 - vga_reg = CPU_VGACNTRL; 1634 - else 1635 - vga_reg = VGACNTRL; 1636 - 1637 - if (I915_READ(vga_reg) & VGA_DISP_DISABLE) 1638 - return; 1639 - 1640 - I915_WRITE8(VGA_SR_INDEX, 1); 1641 - sr1 = I915_READ8(VGA_SR_DATA); 1642 - I915_WRITE8(VGA_SR_DATA, sr1 | (1 << 5)); 1643 - udelay(100); 1644 - 1645 - I915_WRITE(vga_reg, VGA_DISP_DISABLE); 1646 - } 1647 - 1648 1624 static void ironlake_disable_pll_edp (struct drm_crtc *crtc) 1649 1625 { 1650 1626 struct drm_device *dev = crtc->dev; ··· 2134 2156 dev_priv->display.disable_fbc) 2135 2157 dev_priv->display.disable_fbc(dev); 2136 2158 2137 - i915_disable_vga(dev); 2138 - 2139 2159 /* disable cpu pipe, disable after all planes disabled */ 2140 2160 temp = I915_READ(pipeconf_reg); 2141 2161 if ((temp & PIPEACONF_ENABLE) != 0) { ··· 2366 2390 if (dev_priv->cfb_plane == plane && 2367 2391 dev_priv->display.disable_fbc) 2368 2392 dev_priv->display.disable_fbc(dev); 2369 - 2370 - /* Disable the VGA plane that we never use */ 2371 - i915_disable_vga(dev); 2372 2393 2373 2394 /* Disable display plane */ 2374 2395 temp = I915_READ(dspcntr_reg); ··· 5975 6002 } 5976 6003 } 5977 6004 6005 + /* Disable the VGA plane that we never use */ 6006 + static void i915_disable_vga(struct drm_device *dev) 6007 + { 6008 + struct drm_i915_private *dev_priv = dev->dev_private; 6009 + u8 sr1; 6010 + u32 vga_reg; 6011 + 6012 + if (HAS_PCH_SPLIT(dev)) 6013 + vga_reg = CPU_VGACNTRL; 6014 + else 6015 + vga_reg = VGACNTRL; 6016 + 6017 + vga_get_uninterruptible(dev->pdev, VGA_RSRC_LEGACY_IO); 6018 + outb(1, VGA_SR_INDEX); 6019 + sr1 = inb(VGA_SR_DATA); 6020 + outb(sr1 | 1<<5, VGA_SR_DATA); 6021 + vga_put(dev->pdev, VGA_RSRC_LEGACY_IO); 6022 + udelay(300); 6023 + 6024 + I915_WRITE(vga_reg, VGA_DISP_DISABLE); 6025 + POSTING_READ(vga_reg); 6026 + } 6027 + 5978 6028 void intel_modeset_init(struct drm_device *dev) 5979 6029 { 5980 6030 struct drm_i915_private *dev_priv = dev->dev_private; ··· 6045 6049 intel_setup_outputs(dev); 6046 6050 6047 6051 intel_init_clock_gating(dev); 6052 + 6053 + /* Just disable it once at startup */ 6054 + i915_disable_vga(dev); 6048 6055 6049 6056 if (IS_IRONLAKE_M(dev)) { 6050 6057 ironlake_enable_drps(dev);