video: tegra: dc: Make framebuffer console init OK
Mark Zhang [Fri, 17 Aug 2012 05:31:37 +0000 (13:31 +0800)]
Update framebuffer's modelist after we changed it's fb_var_screeninfo.
This makes sure the framebuffer console can be inited successfully.
During framebuffer console init, it'll check whether the var info of
the framebuffer is consistent with the modelist.
Unsuccessful init of framebuffer console driver makes VT driver
doesn't work in right way.

Bug 996992

Signed-off-by: Mark Zhang <markz@nvidia.com>
Change-Id: I96a1db1f389be75dcba48b20447cf1510ad3768b
Reviewed-on: http://git-master/r/107866
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Shashank Sharma <shashanks@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Jon Mayo <jmayo@nvidia.com>

drivers/video/tegra/fb.c

index f1cd652..007d713 100644 (file)
@@ -592,6 +592,7 @@ struct tegra_fb_info *tegra_fb_register(struct nvhost_device *ndev,
 
        if (dc->mode.pclk > 1000) {
                struct tegra_dc_mode *mode = &dc->mode;
+               struct fb_videomode vmode;
 
                if (dc->out->flags & TEGRA_DC_OUT_ONE_SHOT_MODE)
                        info->var.pixclock = KHZ2PICOS(mode->rated_pclk / 1000);
@@ -603,6 +604,10 @@ struct tegra_fb_info *tegra_fb_register(struct nvhost_device *ndev,
                info->var.lower_margin = mode->v_front_porch;
                info->var.hsync_len = mode->h_sync_width;
                info->var.vsync_len = mode->v_sync_width;
+
+               /* Keep info->var consistent with info->modelist. */
+               fb_var_to_videomode(&vmode, &info->var);
+               fb_add_videomode(&vmode, &info->modelist);
        }
 
        return tegra_fb;