Commit a1655100 authored by Heiko Stübner's avatar Heiko Stübner Committed by Tomi Valkeinen

AUO-K190x: Use correct line length

Previously all functions that used the line length used xres directly,
thus hardcoding a 8bits per pixel value.

This patch calculates the correct line length according to the actual
bits per pixel value and changes all line length users to use the
calculated line length value.
Signed-off-by: default avatarHeiko Stübner <heiko@sntech.de>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent 07961ac7
...@@ -82,6 +82,7 @@ static void auok1900_update_region(struct auok190xfb_par *par, int mode, ...@@ -82,6 +82,7 @@ static void auok1900_update_region(struct auok190xfb_par *par, int mode,
struct device *dev = par->info->device; struct device *dev = par->info->device;
unsigned char *buf = (unsigned char *)par->info->screen_base; unsigned char *buf = (unsigned char *)par->info->screen_base;
int xres = par->info->var.xres; int xres = par->info->var.xres;
int line_length = par->info->fix.line_length;
u16 args[4]; u16 args[4];
pm_runtime_get_sync(dev); pm_runtime_get_sync(dev);
...@@ -100,9 +101,9 @@ static void auok1900_update_region(struct auok190xfb_par *par, int mode, ...@@ -100,9 +101,9 @@ static void auok1900_update_region(struct auok190xfb_par *par, int mode,
args[1] = y1 + 1; args[1] = y1 + 1;
args[2] = xres; args[2] = xres;
args[3] = y2 - y1; args[3] = y2 - y1;
buf += y1 * xres; buf += y1 * line_length;
auok190x_send_cmdargs_pixels(par, AUOK1900_CMD_PARTIALDISP, 4, args, auok190x_send_cmdargs_pixels(par, AUOK1900_CMD_PARTIALDISP, 4, args,
((y2 - y1) * xres)/2, (u16 *) buf); ((y2 - y1) * line_length)/2, (u16 *) buf);
auok190x_send_command(par, AUOK190X_CMD_DATA_STOP); auok190x_send_command(par, AUOK190X_CMD_DATA_STOP);
par->update_cnt++; par->update_cnt++;
......
...@@ -121,6 +121,7 @@ static void auok1901_update_region(struct auok190xfb_par *par, int mode, ...@@ -121,6 +121,7 @@ static void auok1901_update_region(struct auok190xfb_par *par, int mode,
struct device *dev = par->info->device; struct device *dev = par->info->device;
unsigned char *buf = (unsigned char *)par->info->screen_base; unsigned char *buf = (unsigned char *)par->info->screen_base;
int xres = par->info->var.xres; int xres = par->info->var.xres;
int line_length = par->info->fix.line_length;
u16 args[5]; u16 args[5];
pm_runtime_get_sync(dev); pm_runtime_get_sync(dev);
...@@ -139,9 +140,9 @@ static void auok1901_update_region(struct auok190xfb_par *par, int mode, ...@@ -139,9 +140,9 @@ static void auok1901_update_region(struct auok190xfb_par *par, int mode,
args[1] = y1 + 1; args[1] = y1 + 1;
args[2] = xres; args[2] = xres;
args[3] = y2 - y1; args[3] = y2 - y1;
buf += y1 * xres; buf += y1 * line_length;
auok190x_send_cmdargs_pixels_nowait(par, AUOK1901_CMD_DMA_START, 4, auok190x_send_cmdargs_pixels_nowait(par, AUOK1901_CMD_DMA_START, 4,
args, ((y2 - y1) * xres)/2, args, ((y2 - y1) * line_length)/2,
(u16 *) buf); (u16 *) buf);
auok190x_send_command_nowait(par, AUOK190X_CMD_DATA_STOP); auok190x_send_command_nowait(par, AUOK190X_CMD_DATA_STOP);
......
...@@ -224,8 +224,8 @@ static void auok190xfb_dpy_deferred_io(struct fb_info *info, ...@@ -224,8 +224,8 @@ static void auok190xfb_dpy_deferred_io(struct fb_info *info,
{ {
struct fb_deferred_io *fbdefio = info->fbdefio; struct fb_deferred_io *fbdefio = info->fbdefio;
struct auok190xfb_par *par = info->par; struct auok190xfb_par *par = info->par;
u16 line_length = info->fix.line_length;
u16 yres = info->var.yres; u16 yres = info->var.yres;
u16 xres = info->var.xres;
u16 y1 = 0, h = 0; u16 y1 = 0, h = 0;
int prev_index = -1; int prev_index = -1;
struct page *cur; struct page *cur;
...@@ -254,7 +254,7 @@ static void auok190xfb_dpy_deferred_io(struct fb_info *info, ...@@ -254,7 +254,7 @@ static void auok190xfb_dpy_deferred_io(struct fb_info *info,
} }
/* height increment is fixed per page */ /* height increment is fixed per page */
h_inc = DIV_ROUND_UP(PAGE_SIZE , xres); h_inc = DIV_ROUND_UP(PAGE_SIZE , line_length);
/* calculate number of pages from pixel height */ /* calculate number of pages from pixel height */
threshold = par->consecutive_threshold / h_inc; threshold = par->consecutive_threshold / h_inc;
...@@ -265,7 +265,7 @@ static void auok190xfb_dpy_deferred_io(struct fb_info *info, ...@@ -265,7 +265,7 @@ static void auok190xfb_dpy_deferred_io(struct fb_info *info,
list_for_each_entry(cur, &fbdefio->pagelist, lru) { list_for_each_entry(cur, &fbdefio->pagelist, lru) {
if (prev_index < 0) { if (prev_index < 0) {
/* just starting so assign first page */ /* just starting so assign first page */
y1 = (cur->index << PAGE_SHIFT) / xres; y1 = (cur->index << PAGE_SHIFT) / line_length;
h = h_inc; h = h_inc;
} else if ((cur->index - prev_index) <= threshold) { } else if ((cur->index - prev_index) <= threshold) {
/* page is within our threshold for single updates */ /* page is within our threshold for single updates */
...@@ -275,7 +275,7 @@ static void auok190xfb_dpy_deferred_io(struct fb_info *info, ...@@ -275,7 +275,7 @@ static void auok190xfb_dpy_deferred_io(struct fb_info *info,
par->update_partial(par, y1, y1 + h); par->update_partial(par, y1, y1 + h);
/* start over with our non consecutive page */ /* start over with our non consecutive page */
y1 = (cur->index << PAGE_SHIFT) / xres; y1 = (cur->index << PAGE_SHIFT) / line_length;
h = h_inc; h = h_inc;
} }
prev_index = cur->index; prev_index = cur->index;
...@@ -896,13 +896,13 @@ int auok190x_common_probe(struct platform_device *pdev, ...@@ -896,13 +896,13 @@ int auok190x_common_probe(struct platform_device *pdev,
info->var.yres = panel->w; info->var.yres = panel->w;
info->var.xres_virtual = panel->h; info->var.xres_virtual = panel->h;
info->var.yres_virtual = panel->w; info->var.yres_virtual = panel->w;
info->fix.line_length = panel->h; info->fix.line_length = panel->h * info->var.bits_per_pixel / 8;
} else { } else {
info->var.xres = panel->w; info->var.xres = panel->w;
info->var.yres = panel->h; info->var.yres = panel->h;
info->var.xres_virtual = panel->w; info->var.xres_virtual = panel->w;
info->var.yres_virtual = panel->h; info->var.yres_virtual = panel->h;
info->fix.line_length = panel->w; info->fix.line_length = panel->w * info->var.bits_per_pixel / 8;
} }
par->resolution = board->resolution; par->resolution = board->resolution;
...@@ -910,7 +910,8 @@ int auok190x_common_probe(struct platform_device *pdev, ...@@ -910,7 +910,8 @@ int auok190x_common_probe(struct platform_device *pdev,
/* videomemory handling */ /* videomemory handling */
videomemorysize = roundup((panel->w * panel->h), PAGE_SIZE); videomemorysize = roundup((panel->w * panel->h) *
info->var.bits_per_pixel / 8, PAGE_SIZE);
videomemory = vmalloc(videomemorysize); videomemory = vmalloc(videomemorysize);
if (!videomemory) { if (!videomemory) {
ret = -ENOMEM; ret = -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment