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)
main
Alan Hourihane 2007-04-17 16:11:00 +01:00
parent ecd9801c3c
commit b729b919ba
1 changed files with 15 additions and 5 deletions

View File

@ -29,6 +29,7 @@
*/
#include <linux/i2c.h>
#include <linux/delay.h>
#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))