From 33a27f8e7f016a2530b85acda8d100d4139e0044 Mon Sep 17 00:00:00 2001 From: Donghan Ryu Date: Thu, 28 Jul 2011 07:43:01 +0900 Subject: video: tegra: dc: use a delayed_work on hdcp hdmi modeset triggers to re-start hdcp and trying to negotiate too early can cause HDCP failure. using delayed_work can avoid this situation by starting HDCP a little bit late Bug 855002 Change-Id: I607d31c80b57c4e76dc34d2b19d1d8e9cebe4b8f Reviewed-on: http://git-master/r/43692 Reviewed-by: Donghan Ryu Tested-by: Donghan Ryu Reviewed-by: Jonathan Mayo --- drivers/video/tegra/dc/nvhdcp.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/video/tegra/dc/nvhdcp.c b/drivers/video/tegra/dc/nvhdcp.c index c17b8f4d32c8..6ff5a79e2581 100644 --- a/drivers/video/tegra/dc/nvhdcp.c +++ b/drivers/video/tegra/dc/nvhdcp.c @@ -75,7 +75,7 @@ enum tegra_nvhdcp_state { }; struct tegra_nvhdcp { - struct work_struct work; + struct delayed_work work; struct tegra_dc_hdmi_data *hdmi; struct workqueue_struct *downstream_wq; struct mutex lock; @@ -828,7 +828,7 @@ static int get_repeater_info(struct tegra_nvhdcp *nvhdcp) static void nvhdcp_downstream_worker(struct work_struct *work) { struct tegra_nvhdcp *nvhdcp = - container_of(work, struct tegra_nvhdcp, work); + container_of(to_delayed_work(work), struct tegra_nvhdcp, work); struct tegra_dc_hdmi_data *hdmi = nvhdcp->hdmi; int e; u8 b_caps; @@ -1010,13 +1010,10 @@ failure: nvhdcp_err("nvhdcp failure - too many failures, giving up!\n"); } else { nvhdcp_err("nvhdcp failure - renegotiating in 1.75 seconds\n"); - mutex_unlock(&nvhdcp->lock); - wait_event_interruptible_timeout(wq_worker, - !nvhdcp_is_plugged(nvhdcp), msecs_to_jiffies(1750)); - mutex_lock(&nvhdcp->lock); if (!nvhdcp_is_plugged(nvhdcp)) goto lost_hdmi; - queue_work(nvhdcp->downstream_wq, &nvhdcp->work); + queue_delayed_work(nvhdcp->downstream_wq, &nvhdcp->work, + msecs_to_jiffies(1750)); } lost_hdmi: @@ -1033,7 +1030,8 @@ static int tegra_nvhdcp_on(struct tegra_nvhdcp *nvhdcp) nvhdcp->state = STATE_UNAUTHENTICATED; if (nvhdcp_is_plugged(nvhdcp)) { nvhdcp->fail_count = 0; - queue_work(nvhdcp->downstream_wq, &nvhdcp->work); + queue_delayed_work(nvhdcp->downstream_wq, &nvhdcp->work, + msecs_to_jiffies(100)); } return 0; } @@ -1226,7 +1224,7 @@ struct tegra_nvhdcp *tegra_nvhdcp_create(struct tegra_dc_hdmi_data *hdmi, nvhdcp->state = STATE_UNAUTHENTICATED; nvhdcp->downstream_wq = create_singlethread_workqueue(nvhdcp->name); - INIT_WORK(&nvhdcp->work, nvhdcp_downstream_worker); + INIT_DELAYED_WORK(&nvhdcp->work, nvhdcp_downstream_worker); nvhdcp->miscdev.minor = MISC_DYNAMIC_MINOR; nvhdcp->miscdev.name = nvhdcp->name; -- cgit v1.2.3