summaryrefslogtreecommitdiffstats
path: root/drivers/video/auo_k190x.c
diff options
context:
space:
mode:
authorHeiko Stübner <heiko@sntech.de>2013-03-22 15:15:27 +0100
committerTomi Valkeinen <tomi.valkeinen@ti.com>2013-04-04 12:08:07 +0200
commit4ea80d35b4e0cdb23c42d2664fb745f0afe397d1 (patch)
treeb4c9a7835cd701c1f0ba9c2fccb339f3b46249cf /drivers/video/auo_k190x.c
parentAUO-K190x: make memory check in check_var more flexible (diff)
downloadlinux-4ea80d35b4e0cdb23c42d2664fb745f0afe397d1.tar.xz
linux-4ea80d35b4e0cdb23c42d2664fb745f0afe397d1.zip
AUO-K190x: move var resolution-handling into check_var
Provides a central place for this, which will be helpful for the following changes. Signed-off-by: Heiko Stübner <heiko@sntech.de> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video/auo_k190x.c')
-rw-r--r--drivers/video/auo_k190x.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/drivers/video/auo_k190x.c b/drivers/video/auo_k190x.c
index e078e20d4ad6..a77513b0e18c 100644
--- a/drivers/video/auo_k190x.c
+++ b/drivers/video/auo_k190x.c
@@ -377,16 +377,25 @@ static int auok190xfb_check_var(struct fb_var_screeninfo *var,
struct fb_info *info)
{
struct device *dev = info->device;
+ struct auok190xfb_par *par = info->par;
+ struct panel_info *panel = &panel_table[par->resolution];
int size;
- if (info->var.xres != var->xres || info->var.yres != var->yres ||
- info->var.xres_virtual != var->xres_virtual ||
- info->var.yres_virtual != var->yres_virtual) {
- pr_info("%s: Resolution not supported: X%u x Y%u\n",
- __func__, var->xres, var->yres);
- return -EINVAL;
+ /*
+ * Dimensions
+ */
+
+ if (par->rotation & 1) {
+ var->xres = panel->h;
+ var->yres = panel->w;
+ } else {
+ var->xres = panel->w;
+ var->yres = panel->h;
}
+ var->xres_virtual = var->xres;
+ var->yres_virtual = var->yres;
+
/*
* Memory limit
*/
@@ -900,21 +909,6 @@ int auok190x_common_probe(struct platform_device *pdev,
panel = &panel_table[board->resolution];
- /* if 90 degree rotation, switch width and height */
- if (board->rotation & 1) {
- info->var.xres = panel->h;
- info->var.yres = panel->w;
- info->var.xres_virtual = panel->h;
- info->var.yres_virtual = panel->w;
- info->fix.line_length = panel->h * info->var.bits_per_pixel / 8;
- } else {
- info->var.xres = panel->w;
- info->var.yres = panel->h;
- info->var.xres_virtual = panel->w;
- info->var.yres_virtual = panel->h;
- info->fix.line_length = panel->w * info->var.bits_per_pixel / 8;
- }
-
par->resolution = board->resolution;
par->rotation = board->rotation;
@@ -935,6 +929,13 @@ int auok190x_common_probe(struct platform_device *pdev,
info->flags = FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB;
info->fbops = &auok190xfb_ops;
+ ret = auok190xfb_check_var(&info->var, info);
+ if (ret)
+ goto err_defio;
+
+ info->fix.line_length = info->var.xres_virtual *
+ info->var.bits_per_pixel / 8;
+
/* deferred io init */
info->fbdefio = devm_kzalloc(info->device,