diff options
author | Zhao Yakui <yakui.zhao@intel.com> | 2009-03-03 05:07:52 -0500 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2009-03-27 18:12:11 -0400 |
commit | 771cb081354161eea21534ba58e5cc1a2db94a25 (patch) | |
tree | 4b69e297bafee3be46ef3059b7f79b74170dd4cf /drivers/gpu | |
parent | 6bcdcd9e3c09d133e3278edabebc314a2451b74a (diff) |
drm/i915: Sync crt hotplug detection with intel video driver
This covers:
Use long crt hotplug activation time on GM45.
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/i915/i915_reg.h | 16 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_crt.c | 45 |
2 files changed, 48 insertions, 13 deletions
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 6d567772679b..05b1894fa13d 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -633,6 +633,22 @@ | |||
633 | #define TV_HOTPLUG_INT_EN (1 << 18) | 633 | #define TV_HOTPLUG_INT_EN (1 << 18) |
634 | #define CRT_HOTPLUG_INT_EN (1 << 9) | 634 | #define CRT_HOTPLUG_INT_EN (1 << 9) |
635 | #define CRT_HOTPLUG_FORCE_DETECT (1 << 3) | 635 | #define CRT_HOTPLUG_FORCE_DETECT (1 << 3) |
636 | #define CRT_HOTPLUG_ACTIVATION_PERIOD_32 (0 << 8) | ||
637 | /* must use period 64 on GM45 according to docs */ | ||
638 | #define CRT_HOTPLUG_ACTIVATION_PERIOD_64 (1 << 8) | ||
639 | #define CRT_HOTPLUG_DAC_ON_TIME_2M (0 << 7) | ||
640 | #define CRT_HOTPLUG_DAC_ON_TIME_4M (1 << 7) | ||
641 | #define CRT_HOTPLUG_VOLTAGE_COMPARE_40 (0 << 5) | ||
642 | #define CRT_HOTPLUG_VOLTAGE_COMPARE_50 (1 << 5) | ||
643 | #define CRT_HOTPLUG_VOLTAGE_COMPARE_60 (2 << 5) | ||
644 | #define CRT_HOTPLUG_VOLTAGE_COMPARE_70 (3 << 5) | ||
645 | #define CRT_HOTPLUG_VOLTAGE_COMPARE_MASK (3 << 5) | ||
646 | #define CRT_HOTPLUG_DETECT_DELAY_1G (0 << 4) | ||
647 | #define CRT_HOTPLUG_DETECT_DELAY_2G (1 << 4) | ||
648 | #define CRT_HOTPLUG_DETECT_VOLTAGE_325MV (0 << 2) | ||
649 | #define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2) | ||
650 | #define CRT_HOTPLUG_MASK (0x3fc) /* Bits 9-2 */ | ||
651 | |||
636 | 652 | ||
637 | #define PORT_HOTPLUG_STAT 0x61114 | 653 | #define PORT_HOTPLUG_STAT 0x61114 |
638 | #define HDMIB_HOTPLUG_INT_STATUS (1 << 29) | 654 | #define HDMIB_HOTPLUG_INT_STATUS (1 << 29) |
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index e58defa247d5..2b6d44381c31 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -146,20 +146,39 @@ static bool intel_crt_detect_hotplug(struct drm_connector *connector) | |||
146 | { | 146 | { |
147 | struct drm_device *dev = connector->dev; | 147 | struct drm_device *dev = connector->dev; |
148 | struct drm_i915_private *dev_priv = dev->dev_private; | 148 | struct drm_i915_private *dev_priv = dev->dev_private; |
149 | u32 temp; | 149 | u32 hotplug_en; |
150 | 150 | int i, tries = 0; | |
151 | unsigned long timeout = jiffies + msecs_to_jiffies(1000); | 151 | /* |
152 | 152 | * On 4 series desktop, CRT detect sequence need to be done twice | |
153 | temp = I915_READ(PORT_HOTPLUG_EN); | 153 | * to get a reliable result. |
154 | 154 | */ | |
155 | I915_WRITE(PORT_HOTPLUG_EN, | ||
156 | temp | CRT_HOTPLUG_FORCE_DETECT | (1 << 5)); | ||
157 | 155 | ||
158 | do { | 156 | if (IS_G4X(dev) && !IS_GM45(dev)) |
159 | if (!(I915_READ(PORT_HOTPLUG_EN) & CRT_HOTPLUG_FORCE_DETECT)) | 157 | tries = 2; |
160 | break; | 158 | else |
161 | msleep(1); | 159 | tries = 1; |
162 | } while (time_after(timeout, jiffies)); | 160 | hotplug_en = I915_READ(PORT_HOTPLUG_EN); |
161 | hotplug_en &= ~(CRT_HOTPLUG_MASK); | ||
162 | hotplug_en |= CRT_HOTPLUG_FORCE_DETECT; | ||
163 | |||
164 | if (IS_GM45(dev)) | ||
165 | hotplug_en |= CRT_HOTPLUG_ACTIVATION_PERIOD_64; | ||
166 | |||
167 | hotplug_en |= CRT_HOTPLUG_VOLTAGE_COMPARE_50; | ||
168 | |||
169 | for (i = 0; i < tries ; i++) { | ||
170 | unsigned long timeout; | ||
171 | /* turn on the FORCE_DETECT */ | ||
172 | I915_WRITE(PORT_HOTPLUG_EN, hotplug_en); | ||
173 | timeout = jiffies + msecs_to_jiffies(1000); | ||
174 | /* wait for FORCE_DETECT to go off */ | ||
175 | do { | ||
176 | if (!(I915_READ(PORT_HOTPLUG_EN) & | ||
177 | CRT_HOTPLUG_FORCE_DETECT)) | ||
178 | break; | ||
179 | msleep(1); | ||
180 | } while (time_after(timeout, jiffies)); | ||
181 | } | ||
163 | 182 | ||
164 | if ((I915_READ(PORT_HOTPLUG_STAT) & CRT_HOTPLUG_MONITOR_MASK) == | 183 | if ((I915_READ(PORT_HOTPLUG_STAT) & CRT_HOTPLUG_MONITOR_MASK) == |
165 | CRT_HOTPLUG_MONITOR_COLOR) | 184 | CRT_HOTPLUG_MONITOR_COLOR) |