diff options
author | Jon Mayo <jmayo@nvidia.com> | 2011-04-06 13:15:20 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:37:05 -0800 |
commit | d4640a242652086bc1ceba8c2811ce10eb6a6c71 (patch) | |
tree | a4f11fa6e075c83a8ce8c37a8c48fb451a553ad8 /drivers/video/tegra/dc/nvhdcp.c | |
parent | acf73c633b65ca2a14686f34f95d7e7854a34a77 (diff) |
video: tegra: use longer retries for hdcp
use 3 seconds for i2c/ddc failures on hdcp (15 attempts at 250mS each)
Change-Id: Ia755c9b42d5a0d8467b68c9d334638bcb015eabd
Signed-off-by: Erik Gilling <konkers@android.com>
Diffstat (limited to 'drivers/video/tegra/dc/nvhdcp.c')
-rw-r--r-- | drivers/video/tegra/dc/nvhdcp.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/drivers/video/tegra/dc/nvhdcp.c b/drivers/video/tegra/dc/nvhdcp.c index fe8beb97c38a..2229c6b93ad3 100644 --- a/drivers/video/tegra/dc/nvhdcp.c +++ b/drivers/video/tegra/dc/nvhdcp.c @@ -116,6 +116,7 @@ static int nvhdcp_i2c_read(struct tegra_nvhdcp *nvhdcp, u8 reg, size_t len, void *data) { int status; + int retries = 15; struct i2c_msg msg[] = { { .addr = 0x74 >> 1, /* primary link */ @@ -131,7 +132,16 @@ static int nvhdcp_i2c_read(struct tegra_nvhdcp *nvhdcp, u8 reg, }, }; - 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); @@ -154,11 +164,21 @@ static int nvhdcp_i2c_write(struct tegra_nvhdcp *nvhdcp, u8 reg, .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); @@ -320,16 +340,7 @@ static inline int get_receiver_ri(struct tegra_nvhdcp *nvhdcp, u16 *r) 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, |