summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNitin Kumbhar <nkumbhar@nvidia.com>2011-04-11 11:52:29 +0530
committerNitin Kumbhar <nkumbhar@nvidia.com>2011-04-11 11:52:29 +0530
commit655dc7ad8cede7d669ac1e9ece5f4e95bb5ddda9 (patch)
treef14a00a2531f0d95d1d6a86042a8a6aa234f05a3
parent4568d00bd2fd07a1202869980479e43cfe6cae82 (diff)
parent30ff24c355ab4cc4f4794f285e1486e90a771d26 (diff)
merging android-tegra-2.6.36 into git-master/linux-2.6/android-tegra-2.6.36
Change-Id: I1f85b4ed49128a261b29bb7c3ffe8c5d511a44f9
-rw-r--r--drivers/video/tegra/dc/hdmi.c3
-rw-r--r--drivers/video/tegra/dc/nvhdcp.c61
2 files changed, 36 insertions, 28 deletions
diff --git a/drivers/video/tegra/dc/hdmi.c b/drivers/video/tegra/dc/hdmi.c
index a880ae103135..5cf8041f3c46 100644
--- a/drivers/video/tegra/dc/hdmi.c
+++ b/drivers/video/tegra/dc/hdmi.c
@@ -1206,8 +1206,7 @@ static void tegra_dc_hdmi_enable(struct tegra_dc *dc)
tegra_dc_writel(dc, GENERAL_ACT_REQ << 8, DC_CMD_STATE_CONTROL);
tegra_dc_writel(dc, GENERAL_ACT_REQ, DC_CMD_STATE_CONTROL);
- if (!hdmi->dvi)
- tegra_nvhdcp_set_plug(hdmi->nvhdcp, 1);
+ tegra_nvhdcp_set_plug(hdmi->nvhdcp, 1);
}
static void tegra_dc_hdmi_disable(struct tegra_dc *dc)
diff --git a/drivers/video/tegra/dc/nvhdcp.c b/drivers/video/tegra/dc/nvhdcp.c
index 07655ae01f7e..215f44538dcc 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,
@@ -1005,20 +1016,6 @@ err:
return;
}
-void tegra_nvhdcp_set_plug(struct tegra_nvhdcp *nvhdcp, bool hpd)
-{
- nvhdcp_debug("hdmi hotplug detected (hpd = %d)\n", hpd);
-
- nvhdcp_set_plugged(nvhdcp, hpd);
-
- if (hpd) {
- nvhdcp->fail_count = 0;
- queue_work(nvhdcp->downstream_wq, &nvhdcp->work);
- } else {
- flush_workqueue(nvhdcp->downstream_wq);
- }
-}
-
static int tegra_nvhdcp_on(struct tegra_nvhdcp *nvhdcp)
{
nvhdcp->state = STATE_UNAUTHENTICATED;
@@ -1039,6 +1036,18 @@ static int tegra_nvhdcp_off(struct tegra_nvhdcp *nvhdcp)
return 0;
}
+void tegra_nvhdcp_set_plug(struct tegra_nvhdcp *nvhdcp, bool hpd)
+{
+ nvhdcp_debug("hdmi hotplug detected (hpd = %d)\n", hpd);
+
+ if (hpd) {
+ nvhdcp_set_plugged(nvhdcp, true);
+ tegra_nvhdcp_on(nvhdcp);
+ } else {
+ tegra_nvhdcp_off(nvhdcp);
+ }
+}
+
int tegra_nvhdcp_set_policy(struct tegra_nvhdcp *nvhdcp, int pol)
{
if (pol == TEGRA_NVHDCP_POLICY_ALWAYS_ON) {