Skip to contentSkip to conversation

drm/radeon/kms: retry auxch on 0x20 timeout value.

PATCH In review Dave Airlie 2 participants 2 messages Feb 10, 2010

Subsystems (2)
lore
Share & tools
lore

Dave Airlie

author maintainer
#0 lore raw

PATCH 1/1 drm/radeon/kms: retry auxch on 0x20 timeout value.

From: Dave Airlie <[email protected]>

ATOM appears to return 0x20 which seems to mean some sort of timeout.

retry the transaction up to 10 times before failing, this makes DP->VGA convertor we bought work at least a bit more predictably.

---
 drivers/gpu/drm/radeon/atombios_dp.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/atombios_dp.c +6 -2
index 0b6f2ce..a85069e 100644
@@ -336,11 +336,13 @@ bool radeon_process_aux_ch(struct radeon_i2c_chan *chan, u8 *req_bytes,
 	union aux_channel_transaction args;
 	int index = GetIndexIntoMasterTable(COMMAND, ProcessAuxChannelTransaction);
 	unsigned char *base;
+	int retry_count = 0;
 
 	memset(&args, 0, sizeof(args));
 
 	base = (unsigned char *)rdev->mode_info.atom_context->scratch;
 
+retry:
 	memcpy(base, req_bytes, num_bytes);
 
 	args.v1.lpAuxRequest = 0;
@@ -354,9 +356,11 @@ bool radeon_process_aux_ch(struct radeon_i2c_chan *chan, u8 *req_bytes,
 	atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args);
 
 	if (args.v1.ucReplyStatus) {
-		DRM_DEBUG("failed to get auxch %02x%02x %02x %02x 0x%02x %02x\n",
+		if (args.v1.ucReplyStatus == 0x20 && retry_count++ < 10)
+			goto retry;
+		DRM_DEBUG("failed to get auxch %02x%02x %02x %02x 0x%02x %02x after %d\n",
 			  req_bytes[1], req_bytes[0], req_bytes[2], req_bytes[3],
-			  chan->rec.i2c_id, args.v1.ucReplyStatus);
+			  chan->rec.i2c_id, args.v1.ucReplyStatus, retry_count);
 		return false;
 	}
 
Signature · 8 lines
1.6.5.2


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
--
#1 lore raw
Quoted 31 lines · Dave Airlie

From: Dave Airlie <[email protected]>

ATOM appears to return 0x20 which seems to mean some sort of timeout.

retry the transaction up to 10 times before failing, this makes DP->VGA convertor we bought work at least a bit more predictably.

---
 drivers/gpu/drm/radeon/atombios_dp.c |    8 ++++++--

 1 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/atombios_dp.c +2 -0
index 0b6f2ce..a85069e 100644
@@ -336,11 +336,13 @@ bool radeon_process_aux_ch(struct radeon_i2c_chan *chan, u8 *req_bytes,
        union aux_channel_transaction args;
        int index = GetIndexIntoMasterTable(COMMAND, ProcessAuxChannelTransaction);
        unsigned char *base;
+       int retry_count = 0;
 
        memset(&args, 0, sizeof(args));
 
        base = (unsigned char *)rdev->mode_info.atom_context->scratch;
 
+retry:
        memcpy(base, req_bytes, num_bytes);
 
        args.v1.lpAuxRequest = 0;

drivers/gpu/drm/radeon/atombios_dp.c bool radeon_process_aux_ch(struct radeon_i2c_chan *chan, u8 *req_bytes, · line 359

Quoted 5 lines
drivers/gpu/drm/radeon/atombios_dp.c +1 -1
@@ -354,9 +356,11 @@ bool radeon_process_aux_ch(struct radeon_i2c_chan *chan, u8 *req_bytes,
        atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args);
 
        if (args.v1.ucReplyStatus) {
-               DRM_DEBUG("failed to get auxch %02x%02x %02x %02x 0x%02x %02x\n",
+               if (args.v1.ucReplyStatus == 0x20 && retry_count++ < 10)

If ucDataOutLen is 0, the ucReplyStatus codes are as follows:
0 - success
1 - timeout
2 - status flags not zero
3 - fail (no ack)

if ucDataOutLen is non-zero (reply byte count), ucReplyStatus is the current value in the aux transaction buffer.

So, the retry logic should be something like:
if (ucDataOutLen || (ucReplyStatus != 3))

    goto retry;

Alex

Quoted 12 lines
drivers/gpu/drm/radeon/atombios_dp.c +3 -2
+                       goto retry;
+               DRM_DEBUG("failed to get auxch %02x%02x %02x %02x 0x%02x %02x after %d\n",
                          req_bytes[1], req_bytes[0], req_bytes[2], req_bytes[3],
-                         chan->rec.i2c_id, args.v1.ucReplyStatus);
+                         chan->rec.i2c_id, args.v1.ucReplyStatus, retry_count);
                return false;
        }
 
--

1.6.5.2

Quoted 10 lines

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
--