drm/exynos: fimd: Disable all windows on power off
authorSean Paul <seanpaul@chromium.org>
Fri, 7 Sep 2012 18:14:51 +0000 (11:14 -0700)
committerGerrit <chrome-bot@google.com>
Mon, 10 Sep 2012 19:00:13 +0000 (12:00 -0700)
Make sure we disable all windows when we power off. We were seeing
crashes on HDMI hotplug, this occurred because we DPMS off on hotplug,
then resize the scanout buffer. This resize deletes the old buffer,
which calls fimd_win_disable. This function returns early and the window
is never disabled. Then when we try to delete the buffer, we get a crash
in iommu, presumably because the buffer is still being used by the
enabled window.

BUG=chrome-os-partner:13349
TEST=Tested boot with hdmi and hotplug

Change-Id: I134d510ae4abc5604606f565ce7d631d96918477
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/32568
Tested-by: Shirish S <shirish@chromium.org>
drivers/gpu/drm/exynos/exynos_drm_fimd.c

index dda2201..167d5f0 100644 (file)
@@ -781,6 +781,7 @@ static int fimd_power_on(struct fimd_context *ctx, bool enable)
        struct exynos_drm_subdrv *subdrv = &ctx->subdrv;
        struct device *dev = subdrv->dev;
        struct exynos_drm_fimd_pdata *pdata = dev->platform_data;
+       int i;
 
        DRM_DEBUG_KMS("%s\n", __FILE__);
 
@@ -808,6 +809,14 @@ static int fimd_power_on(struct fimd_context *ctx, bool enable)
                if (pdata->panel_type == DP_LCD)
                        writel(MIE_CLK_ENABLE, ctx->regs + DPCLKCON);
        } else {
+               /*
+                * We need to make sure that all windows are disabled before we
+                * suspend that connector. Otherwise we might try to scan from
+                * a destroyed buffer later.
+                */
+               for (i = 0; i < WINDOWS_NR; i++)
+                       fimd_win_disable(dev, i);
+
                clk_disable(ctx->lcd_clk);
                clk_disable(ctx->bus_clk);