On Wed, Feb 10, 2010 at 1:45 AM, Dave Airlie <airl...@gmail.com> wrote:
> From: Dave Airlie <airl...@redhat.com>
>
> 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.
>
> Signed-off-by: Dave Airlie <airl...@redhat.com>
> ---
>  drivers/gpu/drm/radeon/atombios_dp.c |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/atombios_dp.c 
> b/drivers/gpu/drm/radeon/atombios_dp.c
> index 0b6f2ce..a85069e 100644
> --- a/drivers/gpu/drm/radeon/atombios_dp.c
> +++ b/drivers/gpu/drm/radeon/atombios_dp.c
> @@ -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)

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


> +                       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
>
>
> ------------------------------------------------------------------------------
> 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
> Dri-devel@lists.sourceforge.net
> 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
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to