dc: enabled recovery from resetting
Adam Jiang [Thu, 8 Mar 2012 12:34:53 +0000 (21:34 +0900)]
Enabled recovery of DC from resetting. When underflow triggered serveral
times(current > 4 for tegra2), DC driver will reset itself to prevent
data corruption. Reopend nvhost connection when resetting finished. That
helps system to show frames instead of a blank screen again.

Fixed Bug 936613

Change-Id: I314c37258a4a446dc07167ac60d0420e79a5fb2d
Signed-off-by: Adam Jiang <chaoj@nvidia.com>
Reviewed-on: http://git-master/r/89406
Reviewed-by: Rohan Somvanshi <rsomvanshi@nvidia.com>
Tested-by: Rohan Somvanshi <rsomvanshi@nvidia.com>

drivers/video/tegra/dc/dc.c

index 8b3bf04..113e64c 100644 (file)
@@ -2101,8 +2101,11 @@ static void tegra_dc_underflow_handler(struct tegra_dc *dc)
                        dc->windows[i].underflows++;
 
 #ifdef CONFIG_ARCH_TEGRA_2x_SOC
-                       if (dc->windows[i].underflows > 4)
+                       if (dc->windows[i].underflows > 4) {
                                schedule_work(&dc->reset_work);
+                               /* reset counter */
+                               dc->windows[i].underflows = 0;
+                       }
 #endif
                } else {
                        dc->windows[i].underflows = 0;
@@ -2734,6 +2737,13 @@ static void tegra_dc_reset_worker(struct work_struct *work)
        _tegra_dc_controller_reset_enable(dc);
 
        dc->enabled = true;
+
+       /* reopen host read bus */
+       val = tegra_dc_readl(dc, DC_CMD_CONT_SYNCPT_VSYNC);
+       val &= ~(0x00000100);
+       val |= 0x100;
+       tegra_dc_writel(dc, val, DC_CMD_CONT_SYNCPT_VSYNC);
+
 unlock:
        mutex_unlock(&dc->lock);
        mutex_unlock(&shared_lock);