Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 218007
b: refs/heads/master
c: b5c616a
h: refs/heads/master
i:
  218005: 67214c8
  218003: 1b779af
  217999: f36d543
v: v3
  • Loading branch information
Chris Wilson committed Sep 12, 2010
1 parent 2a27b58 commit 27509dc
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 36 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ec5da01e23eec303dd313aa62b8ed4712c488437
refs/heads/master: b5c616a75428d85f92407e4509553f937b720630
71 changes: 36 additions & 35 deletions trunk/drivers/gpu/drm/i915/intel_sdvo.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,54 +462,55 @@ static const char *cmd_status_names[] = {
"Scaling not supported"
};

static void intel_sdvo_debug_response(struct intel_sdvo *intel_sdvo,
void *response, int response_len,
u8 status)
static bool intel_sdvo_read_response(struct intel_sdvo *intel_sdvo,
void *response, int response_len)
{
u8 retry = 5;
u8 status;
int i;

/*
* The documentation states that all commands will be
* processed within 15µs, and that we need only poll
* the status byte a maximum of 3 times in order for the
* command to be complete.
*
* Check 5 times in case the hardware failed to read the docs.
*/
do {
if (!intel_sdvo_read_byte(intel_sdvo,
SDVO_I2C_CMD_STATUS,
&status))
return false;
} while (status == SDVO_CMD_STATUS_PENDING && --retry);

DRM_DEBUG_KMS("%s: R: ", SDVO_NAME(intel_sdvo));
for (i = 0; i < response_len; i++)
DRM_LOG_KMS("%02X ", ((u8 *)response)[i]);
for (; i < 8; i++)
DRM_LOG_KMS(" ");
if (status <= SDVO_CMD_STATUS_SCALING_NOT_SUPP)
DRM_LOG_KMS("(%s)", cmd_status_names[status]);
else
DRM_LOG_KMS("(??? %d)", status);
DRM_LOG_KMS("\n");
}

static bool intel_sdvo_read_response(struct intel_sdvo *intel_sdvo,
void *response, int response_len)
{
int i;
u8 status;
u8 retry = 50;

while (retry--) {
/* Read the command response */
for (i = 0; i < response_len; i++) {
if (!intel_sdvo_read_byte(intel_sdvo,
SDVO_I2C_RETURN_0 + i,
&((u8 *)response)[i]))
return false;
}
if (status != SDVO_CMD_STATUS_SUCCESS)
goto log_fail;

/* read the return status */
if (!intel_sdvo_read_byte(intel_sdvo, SDVO_I2C_CMD_STATUS,
&status))
return false;
/* Read the command response */
for (i = 0; i < response_len; i++) {
if (!intel_sdvo_read_byte(intel_sdvo,
SDVO_I2C_RETURN_0 + i,
&((u8 *)response)[i]))
goto log_fail;
DRM_LOG_KMS("%02X ", ((u8 *)response)[i]);
}

intel_sdvo_debug_response(intel_sdvo, response, response_len,
status);
if (status != SDVO_CMD_STATUS_PENDING)
break;
for (; i < 8; i++)
DRM_LOG_KMS(" ");
DRM_LOG_KMS("\n");

mdelay(50);
}
return true;

return status == SDVO_CMD_STATUS_SUCCESS;
log_fail:
DRM_LOG_KMS("\n");
return false;
}

static int intel_sdvo_get_pixel_multiplier(struct drm_display_mode *mode)
Expand Down

0 comments on commit 27509dc

Please sign in to comment.