14 #include <linux/module.h>
15 #include <linux/kernel.h>
16 #include <linux/errno.h>
17 #include <linux/string.h>
24 #include <asm/machvec.h>
25 #include <asm/uaccess.h>
26 #include <asm/pgtable.h>
41 .id =
"Hitachi HD64461",
46 static inline void hitfb_accel_wait(
void)
51 static inline void hitfb_accel_start(
int truecolor)
60 static inline void hitfb_accel_set_dest(
int truecolor,
u16 dx,
u16 dy,
75 static inline void hitfb_accel_bitblt(
int truecolor,
u16 sx,
u16 sy,
u16 dx,
85 if ((sy < dy) || ((sy == dy) && (sx <= dx))) {
90 maddr = ((width >> 3) + 1) * (height + 1) - 1;
93 (((width >> 4) + 1) * (height + 1) - 1) * 2;
100 daddr =
WIDTH * dy + dx;
122 hitfb_accel_start(truecolor);
134 if (p->
var.bits_per_pixel == 16) {
137 hitfb_accel_set_dest(1, rect->
dx, rect->
dy, rect->
width,
139 hitfb_accel_start(1);
142 hitfb_accel_set_dest(0, rect->
dx, rect->
dy, rect->
width,
144 hitfb_accel_start(0);
152 hitfb_accel_bitblt(p->
var.bits_per_pixel == 16, area->
sx, area->
sy,
207 static int hitfb_setcolreg(
unsigned regno,
unsigned red,
unsigned green,
213 switch (info->
var.bits_per_pixel) {
225 ((green & 0xfc00) >> 5) | ((blue & 0xf800) >> 11);
231 static int hitfb_sync(
struct fb_info *info)
252 maxy = info->
fix.smem_len / var->
xres;
267 var->
green.offset = 0;
268 var->
green.length = 8;
269 var->
blue.offset = 0;
270 var->
blue.length = 8;
275 var->
red.offset = 11;
277 var->
green.offset = 5;
278 var->
green.length = 6;
279 var->
blue.offset = 0;
280 var->
blue.length = 5;
289 static int hitfb_set_par(
struct fb_info *info)
293 switch (info->
var.bits_per_pixel) {
295 info->
fix.line_length = info->
var.xres;
297 info->
fix.ypanstep = 16;
300 info->
fix.line_length = info->
var.xres*2;
302 info->
fix.ypanstep = 8;
309 ldr3 |= (info->
var.bits_per_pixel == 8) ? 4 : 8;
314 static struct fb_ops hitfb_ops = {
316 .fb_check_var = hitfb_check_var,
317 .fb_set_par = hitfb_set_par,
318 .fb_setcolreg = hitfb_setcolreg,
320 .fb_sync = hitfb_sync,
321 .fb_pan_display = hitfb_pan_display,
322 .fb_fillrect = hitfb_fillrect,
323 .fb_copyarea = hitfb_copyarea,
329 unsigned short lcdclor, ldr3, ldvndr;
337 hitfb_fix.mmio_len = 0x1000;
339 hitfb_fix.smem_len = 512 * 1024;
348 hitfb_var.bits_per_pixel = 8;
349 hitfb_var.xres = lcdclor;
352 hitfb_var.bits_per_pixel = 16;
353 hitfb_var.xres = lcdclor / 2;
356 hitfb_fix.line_length = lcdclor;
357 hitfb_fix.visual = (hitfb_var.bits_per_pixel == 8) ?
359 hitfb_var.yres = ldvndr + 1;
360 hitfb_var.xres_virtual = hitfb_var.xres;
361 hitfb_var.yres_virtual = hitfb_fix.smem_len / lcdclor;
362 switch (hitfb_var.bits_per_pixel) {
364 hitfb_var.red.offset = 0;
365 hitfb_var.red.length = 8;
366 hitfb_var.green.offset = 0;
367 hitfb_var.green.length = 8;
368 hitfb_var.blue.offset = 0;
369 hitfb_var.blue.length = 8;
370 hitfb_var.transp.offset = 0;
371 hitfb_var.transp.length = 0;
374 hitfb_var.red.offset = 11;
375 hitfb_var.red.length = 5;
376 hitfb_var.green.offset = 5;
377 hitfb_var.green.length = 6;
378 hitfb_var.blue.offset = 0;
379 hitfb_var.blue.length = 5;
380 hitfb_var.transp.offset = 0;
381 hitfb_var.transp.length = 0;
389 info->
fbops = &hitfb_ops;
390 info->
var = hitfb_var;
391 info->
fix = hitfb_fix;
406 platform_set_drvdata(dev, info);
422 struct fb_info *info = platform_get_drvdata(dev);
431 static int hitfb_suspend(
struct device *dev)
443 static int hitfb_resume(
struct device *dev)
458 static const struct dev_pm_ops hitfb_dev_pm_ops = {
459 .suspend = hitfb_suspend,
460 .resume = hitfb_resume,
464 .probe = hitfb_probe,
469 .pm = &hitfb_dev_pm_ops,
478 static int __init hitfb_init(
void)
492 static void __exit hitfb_exit(
void)