Commit 766aa1c4 authored by Ville Syrjälä's avatar Ville Syrjälä Committed by Daniel Vetter

drm/i915: Introduce i915_vgacntrl_reg()

The VGACNTRL register has moved around between different platforms.
To handle the differences add i915_vgacntrl_reg() which returns the
correct offset for the VGACNTRL register.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent d93c6233
...@@ -1887,4 +1887,14 @@ __i915_write(64, q) ...@@ -1887,4 +1887,14 @@ __i915_write(64, q)
#define INTEL_BROADCAST_RGB_FULL 1 #define INTEL_BROADCAST_RGB_FULL 1
#define INTEL_BROADCAST_RGB_LIMITED 2 #define INTEL_BROADCAST_RGB_LIMITED 2
static inline uint32_t i915_vgacntrl_reg(struct drm_device *dev)
{
if (HAS_PCH_SPLIT(dev))
return CPU_VGACNTRL;
else if (IS_VALLEYVIEW(dev))
return VLV_VGACNTRL;
else
return VGACNTRL;
}
#endif #endif
...@@ -3238,6 +3238,8 @@ ...@@ -3238,6 +3238,8 @@
# define VGA_2X_MODE (1 << 30) # define VGA_2X_MODE (1 << 30)
# define VGA_PIPE_B_SELECT (1 << 29) # define VGA_PIPE_B_SELECT (1 << 29)
#define VLV_VGACNTRL (VLV_DISPLAY_BASE + 0x71400)
/* Ironlake */ /* Ironlake */
#define CPU_VGACNTRL 0x41000 #define CPU_VGACNTRL 0x41000
......
...@@ -73,10 +73,7 @@ static void i915_save_vga(struct drm_device *dev) ...@@ -73,10 +73,7 @@ static void i915_save_vga(struct drm_device *dev)
dev_priv->regfile.saveVGA0 = I915_READ(VGA0); dev_priv->regfile.saveVGA0 = I915_READ(VGA0);
dev_priv->regfile.saveVGA1 = I915_READ(VGA1); dev_priv->regfile.saveVGA1 = I915_READ(VGA1);
dev_priv->regfile.saveVGA_PD = I915_READ(VGA_PD); dev_priv->regfile.saveVGA_PD = I915_READ(VGA_PD);
if (HAS_PCH_SPLIT(dev)) dev_priv->regfile.saveVGACNTRL = I915_READ(i915_vgacntrl_reg(dev));
dev_priv->regfile.saveVGACNTRL = I915_READ(CPU_VGACNTRL);
else
dev_priv->regfile.saveVGACNTRL = I915_READ(VGACNTRL);
/* VGA color palette registers */ /* VGA color palette registers */
dev_priv->regfile.saveDACMASK = I915_READ8(VGA_DACMASK); dev_priv->regfile.saveDACMASK = I915_READ8(VGA_DACMASK);
...@@ -137,10 +134,7 @@ static void i915_restore_vga(struct drm_device *dev) ...@@ -137,10 +134,7 @@ static void i915_restore_vga(struct drm_device *dev)
u16 cr_index, cr_data, st01; u16 cr_index, cr_data, st01;
/* VGA state */ /* VGA state */
if (HAS_PCH_SPLIT(dev)) I915_WRITE(i915_vgacntrl_reg(dev), dev_priv->regfile.saveVGACNTRL);
I915_WRITE(CPU_VGACNTRL, dev_priv->regfile.saveVGACNTRL);
else
I915_WRITE(VGACNTRL, dev_priv->regfile.saveVGACNTRL);
I915_WRITE(VGA0, dev_priv->regfile.saveVGA0); I915_WRITE(VGA0, dev_priv->regfile.saveVGA0);
I915_WRITE(VGA1, dev_priv->regfile.saveVGA1); I915_WRITE(VGA1, dev_priv->regfile.saveVGA1);
......
...@@ -8670,12 +8670,7 @@ static void i915_disable_vga(struct drm_device *dev) ...@@ -8670,12 +8670,7 @@ static void i915_disable_vga(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
u8 sr1; u8 sr1;
u32 vga_reg; u32 vga_reg = i915_vgacntrl_reg(dev);
if (HAS_PCH_SPLIT(dev))
vga_reg = CPU_VGACNTRL;
else
vga_reg = VGACNTRL;
vga_get_uninterruptible(dev->pdev, VGA_RSRC_LEGACY_IO); vga_get_uninterruptible(dev->pdev, VGA_RSRC_LEGACY_IO);
outb(SR01, VGA_SR_INDEX); outb(SR01, VGA_SR_INDEX);
...@@ -8937,12 +8932,7 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder) ...@@ -8937,12 +8932,7 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder)
void i915_redisable_vga(struct drm_device *dev) void i915_redisable_vga(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
u32 vga_reg; u32 vga_reg = i915_vgacntrl_reg(dev);
if (HAS_PCH_SPLIT(dev))
vga_reg = CPU_VGACNTRL;
else
vga_reg = VGACNTRL;
if (I915_READ(vga_reg) != VGA_DISP_DISABLE) { if (I915_READ(vga_reg) != VGA_DISP_DISABLE) {
DRM_DEBUG_KMS("Something enabled VGA plane, disabling it\n"); DRM_DEBUG_KMS("Something enabled VGA plane, disabling it\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment