From 6b43b35b10209985e1aad79e800c453fc6477e23 Mon Sep 17 00:00:00 2001 From: Erik Gilling Date: Thu, 7 Apr 2011 10:33:55 -0700 Subject: video: tegra: attempt HDCP on DVI Change-Id: If9efc63de3427f263b121e102cd0168883a236a3 Signed-off-by: Erik Gilling --- drivers/video/tegra/dc/hdmi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/video/tegra/dc/hdmi.c b/drivers/video/tegra/dc/hdmi.c index 1c3f55449b42..8ae17f97ab6f 100644 --- a/drivers/video/tegra/dc/hdmi.c +++ b/drivers/video/tegra/dc/hdmi.c @@ -1128,8 +1128,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) -- cgit v1.2.3 From 237d326d61bbda05e90dd531d2057efe365db498 Mon Sep 17 00:00:00 2001 From: Jon Mayo Date: Wed, 6 Apr 2011 13:15:20 -0700 Subject: 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 --- drivers/video/tegra/dc/nvhdcp.c | 35 +++++++++++++++++++++++------------ 1 file 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, -- cgit v1.2.3 From 98ed9cb6c4bc11a844edfb5d993568cbf77fe737 Mon Sep 17 00:00:00 2001 From: Jon Mayo Date: Wed, 6 Apr 2011 13:20:15 -0700 Subject: video: tegra: reset hdcp failure count on hotplug use tegra_nvhdcp_on/tegra_nvhdcp_off in hotplug handler to clean up state machine. Change-Id: I62fe503f0628ad4b49d5d7d66fe1702122179877 Signed-off-by: Erik Gilling --- drivers/video/tegra/dc/nvhdcp.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/drivers/video/tegra/dc/nvhdcp.c b/drivers/video/tegra/dc/nvhdcp.c index 2229c6b93ad3..faa15c6081fc 100644 --- a/drivers/video/tegra/dc/nvhdcp.c +++ b/drivers/video/tegra/dc/nvhdcp.c @@ -1016,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; @@ -1050,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) { -- cgit v1.2.3