diff options
Diffstat (limited to 'drivers/video/tegra/fb.c')
-rw-r--r-- | drivers/video/tegra/fb.c | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/drivers/video/tegra/fb.c b/drivers/video/tegra/fb.c index e24588bdd0b7..50aa9b383059 100644 --- a/drivers/video/tegra/fb.c +++ b/drivers/video/tegra/fb.c @@ -6,7 +6,7 @@ * Colin Cross <ccross@android.com> * Travis Geiselbrecht <travis@palm.com> * - * Copyright (C) 2010-2012 NVIDIA Corporation + * Copyright (C) 2010-2011 NVIDIA Corporation * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and @@ -37,7 +37,7 @@ #include <mach/dc.h> #include <mach/fb.h> #include <linux/nvhost.h> -#include <mach/nvmap.h> +#include <linux/nvmap.h> #include "host/dev.h" #include "nvmap/nvmap.h" @@ -64,11 +64,27 @@ static u32 pseudo_palette[16]; static int tegra_fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) { + struct tegra_fb_info *tegra_fb = info->par; + struct tegra_dc *dc = tegra_fb->win->dc; + struct tegra_dc_out_ops *ops = dc->out_ops; + struct fb_videomode mode; + if ((var->yres * var->xres * var->bits_per_pixel / 8 * 2) > info->screen_size) return -EINVAL; - /* double yres_virtual to allow double buffering through pan_display */ + /* Apply mode filter for HDMI only -LVDS supports only fix mode */ + if (ops && ops->mode_filter) { + + fb_var_to_videomode(&mode, var); + if (!ops->mode_filter(dc, &mode)) + return -EINVAL; + + /* Mode filter may have modified the mode */ + fb_videomode_to_var(var, &mode); + } + + /* Double yres_virtual to allow double buffering through pan_display */ var->yres_virtual = var->yres * 2; return 0; @@ -79,10 +95,6 @@ static int tegra_fb_set_par(struct fb_info *info) struct tegra_fb_info *tegra_fb = info->par; struct fb_var_screeninfo *var = &info->var; - BUG_ON(info == NULL); - if (!info) - return -EINVAL; - if (var->bits_per_pixel) { /* we only support RGB ordering for now */ switch (var->bits_per_pixel) { @@ -287,16 +299,6 @@ static int tegra_fb_blank(int blank, struct fb_info *info) dev_dbg(&tegra_fb->ndev->dev, "unblank\n"); tegra_fb->win->flags = TEGRA_WIN_FLAG_ENABLED; tegra_dc_enable(tegra_fb->win->dc); -#if defined(CONFIG_FRAMEBUFFER_CONSOLE) - /* - * TODO: - * This is a work around to provide an unblanking flip - * to dc driver, required to display fb-console after - * a blank event,and needs to be replaced by a proper - * unblanking mechanism - */ - tegra_fb_flip_win(tegra_fb); -#endif return 0; case FB_BLANK_NORMAL: @@ -335,7 +337,8 @@ static int tegra_fb_pan_display(struct fb_var_screeninfo *var, (var->xoffset * (var->bits_per_pixel/8)); tegra_fb->win->phys_addr = addr; - /* TODO: update virt_addr */ + tegra_fb->win->flags = TEGRA_WIN_FLAG_ENABLED; + tegra_fb->win->virt_addr = info->screen_base; tegra_dc_update_windows(&tegra_fb->win, 1); tegra_dc_sync_windows(&tegra_fb->win, 1); @@ -524,7 +527,6 @@ struct tegra_fb_info *tegra_fb_register(struct nvhost_device *ndev, unsigned long fb_size = 0; unsigned long fb_phys = 0; int ret = 0; - struct fb_videomode m; win = tegra_dc_get_window(dc, fb_data->win); if (!win) { @@ -576,15 +578,22 @@ struct tegra_fb_info *tegra_fb_register(struct nvhost_device *ndev, info->fix.line_length = round_up(info->fix.line_length, TEGRA_LINEAR_PITCH_ALIGNMENT); - INIT_LIST_HEAD(&info->modelist); - tegra_dc_to_fb_videomode(&m, &dc->mode); - fb_videomode_to_var(&info->var, &m); + info->var.xres = fb_data->xres; + info->var.yres = fb_data->yres; info->var.xres_virtual = fb_data->xres; info->var.yres_virtual = fb_data->yres * 2; info->var.bits_per_pixel = fb_data->bits_per_pixel; info->var.activate = FB_ACTIVATE_VBL; info->var.height = tegra_dc_get_out_height(dc); info->var.width = tegra_dc_get_out_width(dc); + info->var.pixclock = 0; + info->var.left_margin = 0; + info->var.right_margin = 0; + info->var.upper_margin = 0; + info->var.lower_margin = 0; + info->var.hsync_len = 0; + info->var.vsync_len = 0; + info->var.vmode = FB_VMODE_NONINTERLACED; win->x.full = dfixed_const(0); win->y.full = dfixed_const(0); |