Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 345637
b: refs/heads/master
c: fc37381
h: refs/heads/master
i:
  345635: ce0718d
v: v3
  • Loading branch information
Chris Wilson authored and Daniel Vetter committed Nov 29, 2012
1 parent c20908c commit b3d4c61
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 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: 9a69b885e964cf93064f1a16ddd06ebb7d46ac17
refs/heads/master: fc37381cc8ae2c24b8ece33659e69a0605ca074c
31 changes: 19 additions & 12 deletions trunk/drivers/gpu/drm/i915/intel_sdvo.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ static bool intel_sdvo_write_cmd(struct intel_sdvo *intel_sdvo, u8 cmd,
static bool intel_sdvo_read_response(struct intel_sdvo *intel_sdvo,
void *response, int response_len)
{
u8 retry = 5;
u8 retry = 15; /* 5 quick checks, followed by 10 long checks */
u8 status;
int i;

Expand All @@ -522,14 +522,27 @@ static bool intel_sdvo_read_response(struct intel_sdvo *intel_sdvo,
* command to be complete.
*
* Check 5 times in case the hardware failed to read the docs.
*
* Also beware that the first response by many devices is to
* reply PENDING and stall for time. TVs are notorious for
* requiring longer than specified to complete their replies.
* Originally (in the DDX long ago), the delay was only ever 15ms
* with an additional delay of 30ms applied for TVs added later after
* many experiments. To accommodate both sets of delays, we do a
* sequence of slow checks if the device is falling behind and fails
* to reply within 5*15µs.
*/
if (!intel_sdvo_read_byte(intel_sdvo,
SDVO_I2C_CMD_STATUS,
&status))
goto log_fail;

while (status == SDVO_CMD_STATUS_PENDING && retry--) {
udelay(15);
while (status == SDVO_CMD_STATUS_PENDING && --retry) {
if (retry < 10)
msleep(15);
else
udelay(15);

if (!intel_sdvo_read_byte(intel_sdvo,
SDVO_I2C_CMD_STATUS,
&status))
Expand Down Expand Up @@ -1535,15 +1548,9 @@ intel_sdvo_detect(struct drm_connector *connector, bool force)
struct intel_sdvo_connector *intel_sdvo_connector = to_intel_sdvo_connector(connector);
enum drm_connector_status ret;

if (!intel_sdvo_write_cmd(intel_sdvo,
SDVO_CMD_GET_ATTACHED_DISPLAYS, NULL, 0))
return connector_status_unknown;

/* add 30ms delay when the output type might be TV */
if (intel_sdvo->caps.output_flags & SDVO_TV_MASK)
msleep(30);

if (!intel_sdvo_read_response(intel_sdvo, &response, 2))
if (!intel_sdvo_get_value(intel_sdvo,
SDVO_CMD_GET_ATTACHED_DISPLAYS,
&response, 2))
return connector_status_unknown;

DRM_DEBUG_KMS("SDVO response %d %d [%x]\n",
Expand Down

0 comments on commit b3d4c61

Please sign in to comment.