diff mbox

[6/6] drm/i915: fix VGA detect on IGDNG

Message ID 20090728071159.GA19204@zhen-devel.sh.intel.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Zhenyu Wang July 28, 2009, 7:11 a.m. UTC
On 2009.07.24 01:00:33 +0800, Zhenyu Wang wrote:
> Check FORCE_DETECT bit to be clear for the finish
> of hotplug detect process. Also check possible mono
> monitor which should also be marked as connected.
> 
> Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_crt.c |   12 ++++++++----
>  1 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
> index d6a1a6e..4cf8e2e 100644
> --- a/drivers/gpu/drm/i915/intel_crt.c
> +++ b/drivers/gpu/drm/i915/intel_crt.c
> @@ -156,6 +156,9 @@ static bool intel_igdng_crt_detect_hotplug(struct drm_connector *connector)
>  
>  	temp = adpa = I915_READ(PCH_ADPA);
>  
> +	adpa &= ~ADPA_DAC_ENABLE;
> +	I915_WRITE(PCH_ADPA, adpa);
> +
>  	adpa &= ~ADPA_CRT_HOTPLUG_MASK;
>  
>  	adpa |= (ADPA_CRT_HOTPLUG_PERIOD_128 |

This introduces screen flicker which is bad, more testing takes
me to below patch. Force detection on IGDNG desktop chip seems
doesn't require disable DAC first, but mobile chip has trouble
with that, so I just fallback to DDC probe instead. Any comment?

From e8c8ea7822a2fe64328192e0ea025a7b88025d61 Mon Sep 17 00:00:00 2001
From: Zhenyu Wang <zhenyuw@linux.intel.com>
Date: Tue, 28 Jul 2009 22:59:11 +0800
Subject: [PATCH] drm/i915: fix VGA detect on IGDNG

Testing on IGDNG mobile chip showed that disable DAC
is required before VGA force detection, which will cause
screen flicker, so just use DDC probe in that case.

Check FORCE_DETECT bit to be clear for the finish
of hotplug detect process. Also check possible mono
monitor which should also be marked as connected.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_crt.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

Comments

Keith Packard July 28, 2009, 4:40 p.m. UTC | #1
On Tue, 2009-07-28 at 15:11 +0800, Zhenyu Wang wrote:

> This introduces screen flicker which is bad, more testing takes
> me to below patch. Force detection on IGDNG desktop chip seems
> doesn't require disable DAC first, but mobile chip has trouble
> with that, so I just fallback to DDC probe instead. Any comment?

We can't require DDC on VGA; monitor switches often do not pass DDC
along. The only reliable way to detect VGA monitors is load detection.

Does the IGDNG have a reliable interrupt for VGA hotplug?
Barry Scott July 28, 2009, 4:51 p.m. UTC | #2
Keith Packard wrote:
> On Tue, 2009-07-28 at 15:11 +0800, Zhenyu Wang wrote:
>
>   
>> This introduces screen flicker which is bad, more testing takes
>> me to below patch. Force detection on IGDNG desktop chip seems
>> doesn't require disable DAC first, but mobile chip has trouble
>> with that, so I just fallback to DDC probe instead. Any comment?
>>     
>
> We can't require DDC on VGA; monitor switches often do not pass DDC
> along. The only reliable way to detect VGA monitors is load detection.
>
>   
Also you do not get DDC with a screen connected with a VGA-over-CAT5
solution.

Barry
Zhenyu Wang July 30, 2009, 1:48 a.m. UTC | #3
On 2009.07.28 09:40:15 -0700, Keith Packard wrote:
> On Tue, 2009-07-28 at 15:11 +0800, Zhenyu Wang wrote:
> 
> > This introduces screen flicker which is bad, more testing takes
> > me to below patch. Force detection on IGDNG desktop chip seems
> > doesn't require disable DAC first, but mobile chip has trouble
> > with that, so I just fallback to DDC probe instead. Any comment?
> 
> We can't require DDC on VGA; monitor switches often do not pass DDC
> along. The only reliable way to detect VGA monitors is load detection.

Ok.

> 
> Does the IGDNG have a reliable interrupt for VGA hotplug?
> 

Force detection for VGA is reliable after DAC is disabled first.
I haven't added display hotplug interrupts handling on IGDNG yet, 
so will check out this later.
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index d6a1a6e..6bc9500 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -156,6 +156,13 @@  static bool intel_igdng_crt_detect_hotplug(struct drm_connector *connector)
 
 	temp = adpa = I915_READ(PCH_ADPA);
 
+	if (IS_IGDNG_M(dev)) {
+		/* mobile chip seems sensible to disable dac first for
+		   force detect, which causes flicker, so just fall to
+		   ddc probe. */
+		return intel_ddc_probe(to_intel_output(connector));
+	}
+
 	adpa &= ~ADPA_CRT_HOTPLUG_MASK;
 
 	adpa |= (ADPA_CRT_HOTPLUG_PERIOD_128 |
@@ -169,13 +176,13 @@  static bool intel_igdng_crt_detect_hotplug(struct drm_connector *connector)
 	DRM_DEBUG("pch crt adpa 0x%x", adpa);
 	I915_WRITE(PCH_ADPA, adpa);
 
-	/* This might not be needed as not specified in spec...*/
-	udelay(1000);
+	while ((I915_READ(PCH_ADPA) & ADPA_CRT_HOTPLUG_FORCE_TRIGGER) != 0)
+		;
 
 	/* Check the status to see if both blue and green are on now */
 	adpa = I915_READ(PCH_ADPA);
-	if ((adpa & ADPA_CRT_HOTPLUG_MONITOR_MASK) ==
-			ADPA_CRT_HOTPLUG_MONITOR_COLOR)
+	adpa &= ADPA_CRT_HOTPLUG_MONITOR_MASK;
+	if (adpa != ADPA_CRT_HOTPLUG_MONITOR_NONE)
 		ret = true;
 	else
 		ret = false;