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 #include <linux/i2c.h> 30 #include <linux/kernel.h> 31 #include <linux/slab.h> 32 #include "drmP.h" 33 #include "intel_drv.h" 34 #include "i915_drm.h" ··· 1622 return 0; 1623 } 1624 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 static void ironlake_disable_pll_edp (struct drm_crtc *crtc) 1649 { 1650 struct drm_device *dev = crtc->dev; ··· 2134 dev_priv->display.disable_fbc) 2135 dev_priv->display.disable_fbc(dev); 2136 2137 - i915_disable_vga(dev); 2138 - 2139 /* disable cpu pipe, disable after all planes disabled */ 2140 temp = I915_READ(pipeconf_reg); 2141 if ((temp & PIPEACONF_ENABLE) != 0) { ··· 2366 if (dev_priv->cfb_plane == plane && 2367 dev_priv->display.disable_fbc) 2368 dev_priv->display.disable_fbc(dev); 2369 - 2370 - /* Disable the VGA plane that we never use */ 2371 - i915_disable_vga(dev); 2372 2373 /* Disable display plane */ 2374 temp = I915_READ(dspcntr_reg); ··· 5975 } 5976 } 5977 5978 void intel_modeset_init(struct drm_device *dev) 5979 { 5980 struct drm_i915_private *dev_priv = dev->dev_private; ··· 6045 intel_setup_outputs(dev); 6046 6047 intel_init_clock_gating(dev); 6048 6049 if (IS_IRONLAKE_M(dev)) { 6050 ironlake_enable_drps(dev);
··· 29 #include <linux/i2c.h> 30 #include <linux/kernel.h> 31 #include <linux/slab.h> 32 + #include <linux/vgaarb.h> 33 #include "drmP.h" 34 #include "intel_drv.h" 35 #include "i915_drm.h" ··· 1621 return 0; 1622 } 1623 1624 static void ironlake_disable_pll_edp (struct drm_crtc *crtc) 1625 { 1626 struct drm_device *dev = crtc->dev; ··· 2156 dev_priv->display.disable_fbc) 2157 dev_priv->display.disable_fbc(dev); 2158 2159 /* disable cpu pipe, disable after all planes disabled */ 2160 temp = I915_READ(pipeconf_reg); 2161 if ((temp & PIPEACONF_ENABLE) != 0) { ··· 2390 if (dev_priv->cfb_plane == plane && 2391 dev_priv->display.disable_fbc) 2392 dev_priv->display.disable_fbc(dev); 2393 2394 /* Disable display plane */ 2395 temp = I915_READ(dspcntr_reg); ··· 6002 } 6003 } 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 + 6028 void intel_modeset_init(struct drm_device *dev) 6029 { 6030 struct drm_i915_private *dev_priv = dev->dev_private; ··· 6049 intel_setup_outputs(dev); 6050 6051 intel_init_clock_gating(dev); 6052 + 6053 + /* Just disable it once at startup */ 6054 + i915_disable_vga(dev); 6055 6056 if (IS_IRONLAKE_M(dev)) { 6057 ironlake_enable_drps(dev);