From b729b919baed250313caf3f0bbd4044e084de8bf Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Tue, 17 Apr 2007 16:11:00 +0100 Subject: Fix a register read that was swapped SDVOB/SDVOC Check for the PENDING message when reading the attached displays. Ensures the command has completed before continuing. (probably need to check PENDING in other SDVO calls too) --- linux-core/intel_sdvo.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/linux-core/intel_sdvo.c b/linux-core/intel_sdvo.c index 1b45afdb..6f592f8a 100644 --- a/linux-core/intel_sdvo.c +++ b/linux-core/intel_sdvo.c @@ -29,6 +29,7 @@ */ #include +#include #include "drmP.h" #include "drm.h" #include "drm_crtc.h" @@ -69,9 +70,9 @@ static void intel_sdvo_write_sdvox(struct drm_output *output, u32 val) int i; if (sdvo_priv->output_device == SDVOB) - cval = I915_READ(SDVOC); - else bval = I915_READ(SDVOB); + else + cval = I915_READ(SDVOC); /* * Write the registers twice for luck. Sometimes, @@ -869,12 +870,21 @@ static enum drm_output_status intel_sdvo_detect(struct drm_output *output) { u8 response[2]; u8 status; + u8 retry = 50; intel_sdvo_write_cmd(output, SDVO_CMD_GET_ATTACHED_DISPLAYS, NULL, 0); - status = intel_sdvo_read_response(output, &response, 2); - if (status != SDVO_CMD_STATUS_SUCCESS) - return output_status_unknown; + while (retry--) { + status = intel_sdvo_read_response(output, &response, 2); + + if (status == SDVO_CMD_STATUS_SUCCESS) + break; + + if (status != SDVO_CMD_STATUS_PENDING) + return output_status_unknown; + + mdelay(50); + } DRM_DEBUG("SDVO response %d %d\n", response[0], response[1]); if ((response[0] != 0) || (response[1] != 0)) -- cgit v1.2.3