video: tegra: dc: Fix several problems
authorAndrei Warkentin <andreiw@motorola.com>
Thu, 21 Apr 2011 16:57:57 +0000 (11:57 -0500)
committerRebecca Schultz Zavin <rebecca@android.com>
Fri, 22 Apr 2011 00:24:57 +0000 (17:24 -0700)
Resolve potential race between resume and reset
Fix wmb after return

Change-Id: I98ad1e713b9781d780bf93561496011bf62b86d1
Signed-off-by: Andrei Warkentin <andreiw@motorola.com>
drivers/video/tegra/dc/dc.c
drivers/video/tegra/dc/nvhdcp.c

index a61e86fb5dd7a7d7bd712b39c68c7d52caf5b81e..f39fb40e3ccd74531faf7597599f36e48f676ee9 100644 (file)
@@ -1044,7 +1044,7 @@ static bool _tegra_dc_enable(struct tegra_dc *dc)
                dc->out->enable();
 
        tegra_dc_setup_clk(dc, dc->clk);
-
+       tegra_periph_reset_assert(dc->clk);
        clk_enable(dc->clk);
        clk_enable(dc->emc_clk);
        tegra_periph_reset_deassert(dc->clk);
@@ -1119,14 +1119,12 @@ static void tegra_dc_reset_worker(struct work_struct *work)
        dev_warn(&dc->ndev->dev, "overlay stuck in underflow state.  resetting.\n");
 
        mutex_lock(&dc->lock);
-       _tegra_dc_disable(dc);
-
-       msleep(100);
-       tegra_periph_reset_assert(dc->clk);
-
-       /* _tegra_dc_enable deasserts reset */
-       _tegra_dc_enable(dc);
+       if (dc->enabled && !dc->suspended) {
+               _tegra_dc_disable(dc);
 
+               /* _tegra_dc_enable deasserts reset */
+               _tegra_dc_enable(dc);
+       }
        mutex_unlock(&dc->lock);
 }
 
index 5c2d9050a14b92128d28ec1b50a996b2d258b19b..69c13c4110ce60e9d641552657531d88569c1404 100644 (file)
@@ -108,8 +108,9 @@ static inline bool nvhdcp_is_plugged(struct tegra_nvhdcp *nvhdcp)
 
 static inline bool nvhdcp_set_plugged(struct tegra_nvhdcp *nvhdcp, bool plugged)
 {
-       return nvhdcp->plugged = plugged;
+       nvhdcp->plugged = plugged;
        wmb();
+       return plugged;
 }
 
 static int nvhdcp_i2c_read(struct tegra_nvhdcp *nvhdcp, u8 reg,