From 28bb7848e02ce46972cdaad6cab076cf4bc253fe 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: I64bd84406ebb02ecc33f53eee65e2b3032a69880 Reviewed-on: http://git-master/r/43463 Tested-by: Donghan Ryu Reviewed-by: Jonathan Mayo Reviewed-by: Donghan Ryu Reviewed-by: Bharat Nihalani --- 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 eb77b3729fbf..4ef44c05cc6b 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