video: tegra: dc: ignore mode set during probe
Jon Mayo [Wed, 28 Nov 2012 00:07:54 +0000 (16:07 -0800)]
Ignore the initialization of mode during probe to avoid multiple updates to
the current video mode.

Change-Id: Icfa158a2fe06225b0a14033a401da046203542ec
Signed-off-by: Jon Mayo <jmayo@nvidia.com>
Reviewed-on: http://git-master/r/166731
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>

drivers/video/tegra/dc/dc.c
drivers/video/tegra/dc/mode.c

index 9300bdc..20a2b17 100644 (file)
@@ -2396,6 +2396,7 @@ static int tegra_dc_probe(struct platform_device *ndev)
                tegra_dc_set_out(dc, dc->pdata->default_out);
        else
                dev_err(&ndev->dev, "No default output specified.  Leaving output disabled.\n");
+       dc->mode_dirty = false; /* ignore changes tegra_dc_set_out has done */
 
        dc->ext = tegra_dc_ext_register(ndev, dc);
        if (IS_ERR_OR_NULL(dc->ext)) {
index d271c5e..f972648 100644 (file)
@@ -153,11 +153,20 @@ static s64 calc_frametime_ns(const struct tegra_dc_mode *m)
 int tegra_dc_calc_refresh(const struct tegra_dc_mode *m)
 {
        long h_total, v_total, refresh;
+       long pclk;
+
+       if (m->rated_pclk >= 0)
+               pclk = m->rated_pclk;
+       else
+               pclk = m->pclk;
+
        h_total = m->h_active + m->h_front_porch + m->h_back_porch +
                m->h_sync_width;
        v_total = m->v_active + m->v_front_porch + m->v_back_porch +
                m->v_sync_width;
-       refresh = m->pclk / h_total;
+       if (!pclk || !h_total || !v_total)
+               return 0;
+       refresh = pclk / h_total;
        refresh *= 1000;
        refresh /= v_total;
        return refresh;
@@ -256,6 +265,8 @@ int tegra_dc_program_mode(struct tegra_dc *dc, struct tegra_dc_mode *mode)
        tegra_dc_writel(dc, GENERAL_UPDATE, DC_CMD_STATE_CONTROL);
        tegra_dc_writel(dc, GENERAL_ACT_REQ, DC_CMD_STATE_CONTROL);
 
+       dc->mode_dirty = false;
+
        trace_display_mode(dc, &dc->mode);
        return 0;
 }
@@ -324,10 +335,8 @@ int tegra_dc_to_fb_videomode(struct fb_videomode *fbmode,
 
 void tegra_dc_update_mode(struct tegra_dc *dc)
 {
-       if (dc->mode_dirty) {
+       if (dc->mode_dirty)
                tegra_dc_program_mode(dc, &dc->mode);
-               dc->mode_dirty = false;
-       }
 }
 
 int tegra_dc_set_fb_mode(struct tegra_dc *dc,