drm: Retry i2c transfer of EDID block after failure
Usually EDID retrieval is fine. However, sometimes, especially when the machine is loaded, it fails, but succeeds after a few retries. Based on a patch by Michael Buesch. Reported-by: Michael Buesch <mb@bu3sch.de> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
committed by
Dave Airlie
parent
942b0e95c3
commit
4819d2e431
@@ -230,6 +230,15 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf,
|
|||||||
int block, int len)
|
int block, int len)
|
||||||
{
|
{
|
||||||
unsigned char start = block * EDID_LENGTH;
|
unsigned char start = block * EDID_LENGTH;
|
||||||
|
int ret, retries = 5;
|
||||||
|
|
||||||
|
/* The core i2c driver will automatically retry the transfer if the
|
||||||
|
* adapter reports EAGAIN. However, we find that bit-banging transfers
|
||||||
|
* are susceptible to errors under a heavily loaded machine and
|
||||||
|
* generate spurious NAKs and timeouts. Retrying the transfer
|
||||||
|
* of the individual block a few times seems to overcome this.
|
||||||
|
*/
|
||||||
|
do {
|
||||||
struct i2c_msg msgs[] = {
|
struct i2c_msg msgs[] = {
|
||||||
{
|
{
|
||||||
.addr = DDC_ADDR,
|
.addr = DDC_ADDR,
|
||||||
@@ -243,11 +252,10 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf,
|
|||||||
.buf = buf,
|
.buf = buf,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
ret = i2c_transfer(adapter, msgs, 2);
|
||||||
|
} while (ret != 2 && --retries);
|
||||||
|
|
||||||
if (i2c_transfer(adapter, msgs, 2) == 2)
|
return ret == 2 ? 0 : -1;
|
||||||
return 0;
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 *
|
static u8 *
|
||||||
|
Reference in New Issue
Block a user