Commit 4ea80d35b4e0cdb23c42d2664fb745f0afe397d1

Authored by Heiko Stübner
Committed by Tomi Valkeinen
1 parent 03fc1499f0

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>

Showing 1 changed file with 22 additions and 21 deletions Side-by-side Diff

drivers/video/auo_k190x.c
... ... @@ -377,16 +377,25 @@
377 377 struct fb_info *info)
378 378 {
379 379 struct device *dev = info->device;
  380 + struct auok190xfb_par *par = info->par;
  381 + struct panel_info *panel = &panel_table[par->resolution];
380 382 int size;
381 383  
382   - if (info->var.xres != var->xres || info->var.yres != var->yres ||
383   - info->var.xres_virtual != var->xres_virtual ||
384   - info->var.yres_virtual != var->yres_virtual) {
385   - pr_info("%s: Resolution not supported: X%u x Y%u\n",
386   - __func__, var->xres, var->yres);
387   - return -EINVAL;
  384 + /*
  385 + * Dimensions
  386 + */
  387 +
  388 + if (par->rotation & 1) {
  389 + var->xres = panel->h;
  390 + var->yres = panel->w;
  391 + } else {
  392 + var->xres = panel->w;
  393 + var->yres = panel->h;
388 394 }
389 395  
  396 + var->xres_virtual = var->xres;
  397 + var->yres_virtual = var->yres;
  398 +
390 399 /*
391 400 * Memory limit
392 401 */
... ... @@ -900,21 +909,6 @@
900 909  
901 910 panel = &panel_table[board->resolution];
902 911  
903   - /* if 90 degree rotation, switch width and height */
904   - if (board->rotation & 1) {
905   - info->var.xres = panel->h;
906   - info->var.yres = panel->w;
907   - info->var.xres_virtual = panel->h;
908   - info->var.yres_virtual = panel->w;
909   - info->fix.line_length = panel->h * info->var.bits_per_pixel / 8;
910   - } else {
911   - info->var.xres = panel->w;
912   - info->var.yres = panel->h;
913   - info->var.xres_virtual = panel->w;
914   - info->var.yres_virtual = panel->h;
915   - info->fix.line_length = panel->w * info->var.bits_per_pixel / 8;
916   - }
917   -
918 912 par->resolution = board->resolution;
919 913 par->rotation = board->rotation;
920 914  
... ... @@ -934,6 +928,13 @@
934 928  
935 929 info->flags = FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB;
936 930 info->fbops = &auok190xfb_ops;
  931 +
  932 + ret = auok190xfb_check_var(&info->var, info);
  933 + if (ret)
  934 + goto err_defio;
  935 +
  936 + info->fix.line_length = info->var.xres_virtual *
  937 + info->var.bits_per_pixel / 8;
937 938  
938 939 /* deferred io init */
939 940