All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Knut Petersen <Knut_Petersen@t-online.de>
Cc: linux-kernel@vger.kernel.org, Chris Wilson <chris@chris-wilson.co.uk>
Subject: [PATCH] drm/i915/sdvo: If at first we don't succeed in reading the response, wait
Date: Tue, 25 Jan 2011 15:06:07 +0000	[thread overview]
Message-ID: <1295967967-26041-1-git-send-email-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <4D3EB90C.9020901@t-online.de>

We were not pausing after detecting the response was pending and so did
not allow the hardware sufficient time to complete before aborting. This
lead to transient failures whilst probing SDVO devices.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---

Knut, this should fix one of the failures in the log:

[  680.371855] [drm:intel_sdvo_debug_write], SDVOC: W: 0B (SDVO_CMD_GET_ATTACHED_DISPLAYS)
[  680.417190] [drm:intel_sdvo_write_cmd], command returns response Pending [4]

which caused the detect routine to return connector_status_unknown.

However, there is still immediately following that:

[  680.419880] [drm:intel_sdvo_debug_write], SDVOC: W: 11 00 00 (SDVO_CMD_SET_TARGET_OUTPUT)
[  680.450190] [drm:intel_sdvo_write_cmd], command returns response Invalid arg 
[3]

which implies that we are mishandling that odd VGA-2 connector.
-Chris

---
 drivers/gpu/drm/i915/intel_sdvo.c |   23 +++++++----------------
 1 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 45cd376..f52df3a 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -473,20 +473,6 @@ static bool intel_sdvo_write_cmd(struct intel_sdvo *intel_sdvo, u8 cmd,
 		return false;
 	}
 
-	i = 3;
-	while (status == SDVO_CMD_STATUS_PENDING && i--) {
-		if (!intel_sdvo_read_byte(intel_sdvo,
-					  SDVO_I2C_CMD_STATUS,
-					  &status))
-			return false;
-	}
-	if (status != SDVO_CMD_STATUS_SUCCESS) {
-		DRM_DEBUG_KMS("command returns response %s [%d]\n",
-			      status <= SDVO_CMD_STATUS_SCALING_NOT_SUPP ? cmd_status_names[status] : "???",
-			      status);
-		return false;
-	}
-
 	return true;
 }
 
@@ -505,12 +491,17 @@ static bool intel_sdvo_read_response(struct intel_sdvo *intel_sdvo,
 	 *
 	 * 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--) {
+		udelay(15);
 		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));
 	if (status <= SDVO_CMD_STATUS_SCALING_NOT_SUPP)
-- 
1.7.2.3


  parent reply	other threads:[~2011-01-25 15:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-24 18:48 [BUG/REGRESSION] DRM / i915 / 2.6.37 and 2.6.38-rc*: DVI output gets disabled/reenabled under load Knut Petersen
2011-01-24 19:13 ` Chris Wilson
2011-01-25 11:50   ` Knut Petersen
2011-01-25 12:11     ` Chris Wilson
2011-01-25 12:35       ` Knut Petersen
2011-01-25 13:50         ` Chris Wilson
2011-01-25 14:14       ` Knut Petersen
2011-01-25 14:44         ` Chris Wilson
2011-01-25 15:06     ` Chris Wilson [this message]
2011-01-25 22:01       ` [PATCH] drm/i915/sdvo: If at first we don't succeed in reading the response, wait Knut Petersen
2011-01-25 22:11         ` [PATCH] drm/i915/sdvo: If at first we dont " Chris Wilson
2011-01-25 22:32           ` Knut Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1295967967-26041-1-git-send-email-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=Knut_Petersen@t-online.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.