size_t len, void *data)
{
int status;
+ int retries = 15;
struct i2c_msg msg[] = {
{
.addr = 0x74 >> 1, /* primary link */
},
};
- status = i2c_transfer(nvhdcp->client->adapter, msg, ARRAY_SIZE(msg));
+ do {
+ if (!nvhdcp_is_plugged(nvhdcp)) {
+ nvhdcp_err("disconnect during i2c xfer\n");
+ return -EIO;
+ }
+ status = i2c_transfer(nvhdcp->client->adapter,
+ msg, ARRAY_SIZE(msg));
+ if (retries > 1)
+ msleep(250);
+ } while ((status < 0) && retries--);
if (status < 0) {
nvhdcp_err("i2c xfer error %d\n", status);
.buf = buf,
},
};
+ int retries = 15;
buf[0] = reg;
memcpy(buf + 1, data, len);
- status = i2c_transfer(nvhdcp->client->adapter, msg, ARRAY_SIZE(msg));
+ do {
+ if (!nvhdcp_is_plugged(nvhdcp)) {
+ nvhdcp_err("disconnect during i2c xfer\n");
+ return -EIO;
+ }
+ status = i2c_transfer(nvhdcp->client->adapter,
+ msg, ARRAY_SIZE(msg));
+ if (retries > 1)
+ msleep(250);
+ } while ((status < 0) && retries--);
if (status < 0) {
nvhdcp_err("i2c xfer error %d\n", status);
static int get_bcaps(struct tegra_nvhdcp *nvhdcp, u8 *b_caps)
{
- int e, retries = 4;
- do {
- e = nvhdcp_i2c_read8(nvhdcp, 0x40, b_caps);
- if (!e)
- return 0;
- if (retries > 1)
- msleep(100);
- } while (--retries);
-
- return -EIO;
+ return nvhdcp_i2c_read8(nvhdcp, 0x40, b_caps);
}
static int get_ksvfifo(struct tegra_nvhdcp *nvhdcp,