From 2d9eefa67b15a3a6fbee37d4c31282ecad216569 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 7 Jan 2014 11:23:06 +0100 Subject: tegra: video: use new modedb based settings Use new modedb based framebuffer settings by defining default_mode in the display controllers platform data. Also impelmented the fallback logic to this default_mode in case no kernel cmd line parameter was set. --- drivers/video/tegra/dc/mode.c | 4 ++-- drivers/video/tegra/fb.c | 42 ++++++++++++++++++++++++++---------------- 2 files changed, 28 insertions(+), 18 deletions(-) (limited to 'drivers/video/tegra') diff --git a/drivers/video/tegra/dc/mode.c b/drivers/video/tegra/dc/mode.c index 78d569825c61..6de02200e188 100644 --- a/drivers/video/tegra/dc/mode.c +++ b/drivers/video/tegra/dc/mode.c @@ -272,9 +272,9 @@ int tegra_dc_set_mode(struct tegra_dc *dc, const struct tegra_dc_mode *mode) { memcpy(&dc->mode, mode, sizeof(dc->mode)); - dev_info(&dc->ndev->dev, "using mode %dx%d pclk=%d href=%d vref=%d ref=%p\n", + dev_info(&dc->ndev->dev, "using mode %dx%d pclk=%d href=%d vref=%d\n", mode->h_active, mode->v_active, mode->pclk, - mode->h_ref_to_sync, mode->v_ref_to_sync, dc + mode->h_ref_to_sync, mode->v_ref_to_sync ); if (dc->out->type == TEGRA_DC_OUT_RGB) diff --git a/drivers/video/tegra/fb.c b/drivers/video/tegra/fb.c index cd640bda8e31..cd39a9266d3a 100644 --- a/drivers/video/tegra/fb.c +++ b/drivers/video/tegra/fb.c @@ -577,7 +577,8 @@ struct tegra_fb_info *tegra_fb_register(struct nvhost_device *ndev, unsigned long fb_phys = 0; int ret = 0; unsigned stride; - char *option = NULL; + char *param_option = NULL; + const char *option = NULL; char driver[10]; win = tegra_dc_get_window(dc, fb_data->win); @@ -648,25 +649,11 @@ struct tegra_fb_info *tegra_fb_register(struct nvhost_device *ndev, info->var.vsync_len = 0; info->var.vmode = FB_VMODE_NONINTERLACED; - sprintf(driver, "tegrafb%d", ndev->id); - fb_get_options(driver, &option); - - if (option != NULL) { - dev_info(&ndev->dev, "parsed cmd options for %s: %s\n", driver, option); - - if (!fb_find_mode(&info->var, info, - option, vesa_modes, VESA_MODEDB_SIZE, NULL, 16)) { - ret = -EINVAL; - goto err_iounmap_fb; - } - } - + /* window settings */ win->x.full = dfixed_const(0); win->y.full = dfixed_const(0); win->w.full = dfixed_const(fb_data->xres); win->h.full = dfixed_const(fb_data->yres); - - /* TODO: set to output res dc */ win->out_x = 0; win->out_y = 0; win->out_w = fb_data->xres; @@ -680,6 +667,29 @@ struct tegra_fb_info *tegra_fb_register(struct nvhost_device *ndev, win->stride_uv = 0; win->flags = TEGRA_WIN_FLAG_ENABLED; + /* try to use kernel cmd line specified mode */ + sprintf(driver, "tegrafb%d", ndev->id); + fb_get_options(driver, ¶m_option); + if (param_option != NULL) { + option = param_option; + dev_info(&ndev->dev, "parse cmd options for %s: %s\n", + driver, option); + } else { + option = dc->out->default_mode; + dev_info(&ndev->dev, "use default mode for %s: %s\n", + driver, option); + } + + if (option != NULL) + { + if (!fb_find_mode(&info->var, info, option, + vesa_modes, VESA_MODEDB_SIZE, NULL, 16)) { + ret = -EINVAL; + goto err_iounmap_fb; + } + } + + /* activate current settings.. */ if (fb_mem) tegra_fb_set_par(info); -- cgit v1.2.3