Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 362924
b: refs/heads/master
c: 76de404
h: refs/heads/master
v: v3
  • Loading branch information
Heiko Stübner authored and Tomi Valkeinen committed Apr 4, 2013
1 parent 7c14a66 commit 94ac748
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4ea80d35b4e0cdb23c42d2664fb745f0afe397d1
refs/heads/master: 76de404b452305409182748568444994df765d9d
79 changes: 65 additions & 14 deletions trunk/drivers/video/auo_k190x.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ static void auok190x_issue_cmd(struct auok190xfb_par *par, u16 data)
par->board->set_ctl(par, AUOK190X_I80_DC, 1);
}

static int auok190x_issue_pixels(struct auok190xfb_par *par, int size,
u16 *data)
static int auok190x_issue_pixels_gray8(struct auok190xfb_par *par, int size,
u16 *data)
{
struct device *dev = par->info->device;
int i;
Expand Down Expand Up @@ -91,6 +91,21 @@ static int auok190x_issue_pixels(struct auok190xfb_par *par, int size,
return 0;
}

static int auok190x_issue_pixels(struct auok190xfb_par *par, int size,
u16 *data)
{
struct fb_info *info = par->info;
struct device *dev = par->info->device;

if (info->var.bits_per_pixel == 8 && info->var.grayscale)
auok190x_issue_pixels_gray8(par, size, data);
else
dev_err(dev, "unsupported color mode (bits: %d, gray: %d)\n",
info->var.bits_per_pixel, info->var.grayscale);

return 0;
}

static u16 auok190x_read_data(struct auok190xfb_par *par)
{
u16 data;
Expand Down Expand Up @@ -381,6 +396,35 @@ static int auok190xfb_check_var(struct fb_var_screeninfo *var,
struct panel_info *panel = &panel_table[par->resolution];
int size;

/*
* Color depth
*/

if (var->bits_per_pixel == 8 && var->grayscale == 1) {
/*
* For 8-bit grayscale, R, G, and B offset are equal.
*/
var->red.length = 8;
var->red.offset = 0;
var->red.msb_right = 0;

var->green.length = 8;
var->green.offset = 0;
var->green.msb_right = 0;

var->blue.length = 8;
var->blue.offset = 0;
var->blue.msb_right = 0;

var->transp.length = 0;
var->transp.offset = 0;
var->transp.msb_right = 0;
} else {
dev_warn(dev, "unsupported color mode (bits: %d, grayscale: %d)\n",
info->var.bits_per_pixel, info->var.grayscale);
return -EINVAL;
}

/*
* Dimensions
*/
Expand Down Expand Up @@ -410,6 +454,24 @@ static int auok190xfb_check_var(struct fb_var_screeninfo *var,
return 0;
}

static int auok190xfb_set_fix(struct fb_info *info)
{
struct fb_fix_screeninfo *fix = &info->fix;
struct fb_var_screeninfo *var = &info->var;

fix->line_length = var->xres_virtual * var->bits_per_pixel / 8;

fix->type = FB_TYPE_PACKED_PIXELS;
fix->accel = FB_ACCEL_NONE;
fix->visual = (var->grayscale) ? FB_VISUAL_STATIC_PSEUDOCOLOR
: FB_VISUAL_TRUECOLOR;
fix->xpanstep = 0;
fix->ypanstep = 0;
fix->ywrapstep = 0;

return 0;
}

static struct fb_ops auok190xfb_ops = {
.owner = THIS_MODULE,
.fb_read = fb_sys_read,
Expand Down Expand Up @@ -894,18 +956,8 @@ int auok190x_common_probe(struct platform_device *pdev,
/* initialise fix, var, resolution and rotation */

strlcpy(info->fix.id, init->id, 16);
info->fix.type = FB_TYPE_PACKED_PIXELS;
info->fix.visual = FB_VISUAL_STATIC_PSEUDOCOLOR;
info->fix.xpanstep = 0;
info->fix.ypanstep = 0;
info->fix.ywrapstep = 0;
info->fix.accel = FB_ACCEL_NONE;

info->var.bits_per_pixel = 8;
info->var.grayscale = 1;
info->var.red.length = 8;
info->var.green.length = 8;
info->var.blue.length = 8;

panel = &panel_table[board->resolution];

Expand Down Expand Up @@ -933,8 +985,7 @@ int auok190x_common_probe(struct platform_device *pdev,
if (ret)
goto err_defio;

info->fix.line_length = info->var.xres_virtual *
info->var.bits_per_pixel / 8;
auok190xfb_set_fix(info);

/* deferred io init */

Expand Down

0 comments on commit 94ac748

Please sign in to comment.