Commit a4a759b2 authored by Dave Airlie's avatar Dave Airlie

Merge branch 'linux-5.3' of git://github.com/skeggsb/linux into drm-fixes

Fixes i2c on DP with some docks.
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
From: Ben Skeggs <skeggsb@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/CACAvsv713t2_BQ44gVV7Lqic6Vwmhq0r4FB5v-t0kD1jzFrbmQ@mail.gmail.com
parents 75710f08 c358ebf5
...@@ -40,8 +40,7 @@ nvkm_i2c_aux_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) ...@@ -40,8 +40,7 @@ nvkm_i2c_aux_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
u8 *ptr = msg->buf; u8 *ptr = msg->buf;
while (remaining) { while (remaining) {
u8 cnt = (remaining > 16) ? 16 : remaining; u8 cnt, retries, cmd;
u8 cmd;
if (msg->flags & I2C_M_RD) if (msg->flags & I2C_M_RD)
cmd = 1; cmd = 1;
...@@ -51,10 +50,19 @@ nvkm_i2c_aux_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) ...@@ -51,10 +50,19 @@ nvkm_i2c_aux_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
if (mcnt || remaining > 16) if (mcnt || remaining > 16)
cmd |= 4; /* MOT */ cmd |= 4; /* MOT */
ret = aux->func->xfer(aux, true, cmd, msg->addr, ptr, &cnt); for (retries = 0, cnt = 0;
if (ret < 0) { retries < 32 && !cnt;
nvkm_i2c_aux_release(aux); retries++) {
return ret; cnt = min_t(u8, remaining, 16);
ret = aux->func->xfer(aux, true, cmd,
msg->addr, ptr, &cnt);
if (ret < 0)
goto out;
}
if (!cnt) {
AUX_TRACE(aux, "no data after 32 retries");
ret = -EIO;
goto out;
} }
ptr += cnt; ptr += cnt;
...@@ -64,8 +72,10 @@ nvkm_i2c_aux_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) ...@@ -64,8 +72,10 @@ nvkm_i2c_aux_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
msg++; msg++;
} }
ret = num;
out:
nvkm_i2c_aux_release(aux); nvkm_i2c_aux_release(aux);
return num; return ret;
} }
static u32 static u32
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment