Skip to contentSkip to conversation

drm/i915: use register name when disabling VGA

PATCH Applied Jesse Barnes 3 participants 5 messages Apr 6, 2012 – Apr 10, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/i915: use register name when disabling VGA

Just noticed this while verifying the VGA disable code.

---
 drivers/gpu/drm/i915/intel_display.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
index 3abebb5..d13e8a4 100644
@@ -9475,7 +9475,7 @@ static void i915_disable_vga(struct drm_device *dev)
 		vga_reg = VGACNTRL;
 
 	vga_get_uninterruptible(dev->pdev, VGA_RSRC_LEGACY_IO);
-	outb(1, VGA_SR_INDEX);
+	outb(SR01, VGA_SR_INDEX);
 	sr1 = inb(VGA_SR_DATA);
 	outb(sr1 | 1<<5, VGA_SR_DATA);
 	vga_put(dev->pdev, VGA_RSRC_LEGACY_IO);
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 2/2 drm/i915: IBX+ doesn't have separate vsync/hsync controls on the VGA DAC

When the PCH split occurred, we dropped support for separate hsync and vsync disable in the VGA DAC. So add a PCH specific DPMS function that just uses the port enable bit for controlling DPMS states.

Before this fix, when anything other than a full DPMS off occurred, the VGA port would be left enabled and scanning out while all the other heads would turn off as expected.

---
 drivers/gpu/drm/i915/intel_crt.c |   42 ++++++++++++++++++++++++++++---------
 1 files changed, 32 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/intel_crt.c +32 -10
index 70b0f1a..bdaefff 100644
@@ -55,18 +55,36 @@ static struct intel_crt *intel_attached_crt(struct drm_connector *connector)
 			    struct intel_crt, base);
 }
 
-static void intel_crt_dpms(struct drm_encoder *encoder, int mode)
+static void pch_crt_dpms(struct drm_encoder *encoder, int mode)
 {
 	struct drm_device *dev = encoder->dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	u32 temp, reg;
+	u32 temp;
 
-	if (HAS_PCH_SPLIT(dev))
-		reg = PCH_ADPA;
-	else
-		reg = ADPA;
+	temp = I915_READ(PCH_ADPA);
+	temp &= ~ADPA_DAC_ENABLE;
+
+	switch (mode) {
+	case DRM_MODE_DPMS_ON:
+		temp |= ADPA_DAC_ENABLE;
+		break;
+	case DRM_MODE_DPMS_STANDBY:
+	case DRM_MODE_DPMS_SUSPEND:
+	case DRM_MODE_DPMS_OFF:
+		/* Just leave port enable cleared */
+		break;
+	}
+
+	I915_WRITE(PCH_ADPA, temp);
+}
+
+static void intel_crt_dpms(struct drm_encoder *encoder, int mode)
+{
+	struct drm_device *dev = encoder->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	u32 temp;
 
-	temp = I915_READ(reg);
+	temp = I915_READ(ADPA);
 	temp &= ~(ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE);
 	temp &= ~ADPA_DAC_ENABLE;
 
@@ -85,7 +103,7 @@ static void intel_crt_dpms(struct drm_encoder *encoder, int mode)
 		break;
 	}
 
-	I915_WRITE(reg, temp);
+	I915_WRITE(ADPA, temp);
 }
 
 static int intel_crt_mode_valid(struct drm_connector *connector,
@@ -516,8 +534,7 @@ static void intel_crt_reset(struct drm_connector *connector)
  * Routines for controlling stuff on the analog port
  */
 
-static const struct drm_encoder_helper_funcs intel_crt_helper_funcs = {
-	.dpms = intel_crt_dpms,
+static struct drm_encoder_helper_funcs intel_crt_helper_funcs = {
 	.mode_fixup = intel_crt_mode_fixup,
 	.prepare = intel_encoder_prepare,
 	.commit = intel_encoder_commit,
@@ -602,6 +619,11 @@ void intel_crt_init(struct drm_device *dev)
 		connector->interlace_allowed = 1;
 	connector->doublescan_allowed = 0;
 
+	if (HAS_PCH_SPLIT(dev))
+		intel_crt_helper_funcs.dpms = pch_crt_dpms;
+	else
+		intel_crt_helper_funcs.dpms = intel_crt_dpms;
+
 	drm_encoder_helper_add(&crt->base.base, &intel_crt_helper_funcs);
 	drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs);
 
Signature · 1 line
1.7.4.1
#2 lore raw
In reply to Jesse Barnes
Quoted 12 lines · On Fri, 6 Apr 2012 11:46:27 -0700 Jesse Barnes <[email protected]>…

Just noticed this while verifying the VGA disable code.

---
 drivers/gpu/drm/i915/intel_display.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/intel_display.c index 3abebb5..d13e8a4 100644

drivers/gpu/drm/i915/intel_display.c static void i915_disable_vga(struct drm_device · line 9481

Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -9475,7 +9475,7 @@ static void i915_disable_vga(struct drm_device
 *dev) vga_reg = VGACNTRL;
 
 	vga_get_uninterruptible(dev->pdev, VGA_RSRC_LEGACY_IO);
-	outb(1, VGA_SR_INDEX);
+	outb(SR01, VGA_SR_INDEX);
 	sr1 = inb(VGA_SR_DATA);
 	outb(sr1 | 1<<5, VGA_SR_DATA);
 	vga_put(dev->pdev, VGA_RSRC_LEGACY_IO);

Maybe in addition to this, remove the duplicated definitions SRX_INDEX
SRX_DATA

and then move the defined bits down to where VGA_SR_DATA is.

Regardless of whether or not you decide to do that.

Reviewed-by
#3 lore raw
Quoted 28 lines · On Fri, 6 Apr 2012 16:07:56 -0700 Ben Widawsky <[email protected]> wrote:
Quoted 12 lines · On Fri, 6 Apr 2012 11:46:27 -0700 Jesse Barnes <[email protected]>…

Just noticed this while verifying the VGA disable code.

---
 drivers/gpu/drm/i915/intel_display.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/intel_display.c index 3abebb5..d13e8a4 100644

drivers/gpu/drm/i915/intel_display.c static void i915_disable_vga(struct drm_device · line 9481

Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -9475,7 +9475,7 @@ static void i915_disable_vga(struct drm_device
 *dev) vga_reg = VGACNTRL;
 
 	vga_get_uninterruptible(dev->pdev, VGA_RSRC_LEGACY_IO);
-	outb(1, VGA_SR_INDEX);
+	outb(SR01, VGA_SR_INDEX);
 	sr1 = inb(VGA_SR_DATA);
 	outb(sr1 | 1<<5, VGA_SR_DATA);
 	vga_put(dev->pdev, VGA_RSRC_LEGACY_IO);

Maybe in addition to this, remove the duplicated definitions SRX_INDEX
SRX_DATA

Quoted 3 lines

and then move the defined bits down to where VGA_SR_DATA is.

Regardless of whether or not you decide to do that.

The important part got chopped off :(

#4 lore raw
Quoted 31 lines · Ben Widawsky
Quoted 28 lines · On Fri, 6 Apr 2012 16:07:56 -0700 Ben Widawsky <[email protected]> wrote:
Quoted 12 lines · On Fri, 6 Apr 2012 11:46:27 -0700 Jesse Barnes <[email protected]>…

Just noticed this while verifying the VGA disable code.

---
 drivers/gpu/drm/i915/intel_display.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/intel_display.c index 3abebb5..d13e8a4 100644

drivers/gpu/drm/i915/intel_display.c static void i915_disable_vga(struct drm_device · line 9481

Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -9475,7 +9475,7 @@ static void i915_disable_vga(struct drm_device
 *dev) vga_reg = VGACNTRL;
 
 	vga_get_uninterruptible(dev->pdev, VGA_RSRC_LEGACY_IO);
-	outb(1, VGA_SR_INDEX);
+	outb(SR01, VGA_SR_INDEX);
 	sr1 = inb(VGA_SR_DATA);
 	outb(sr1 | 1<<5, VGA_SR_DATA);
 	vga_put(dev->pdev, VGA_RSRC_LEGACY_IO);

Maybe in addition to this, remove the duplicated definitions SRX_INDEX
SRX_DATA

Quoted 5 lines
Quoted 3 lines

and then move the defined bits down to where VGA_SR_DATA is.

Regardless of whether or not you decide to do that.

The important part got chopped off :(

Queued for -next, thanks for the patch.
-Daniel

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48