2 * linux/drivers/video/q40fb.c -- Q40 frame buffer device
6 * Richard Zidlicky <Richard.Zidlicky@stud.informatik.uni-erlangen.de>
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file COPYING in the main directory of this archive for
13 #include <linux/kernel.h>
14 #include <linux/errno.h>
15 #include <linux/string.h>
17 #include <linux/tty.h>
18 #include <linux/slab.h>
19 #include <linux/delay.h>
20 #include <linux/interrupt.h>
22 #include <asm/uaccess.h>
23 #include <asm/setup.h>
24 #include <asm/segment.h>
25 #include <asm/system.h>
26 #include <asm/q40_master.h>
28 #include <linux/module.h>
29 #include <asm/pgtable.h>
31 #define Q40_PHYS_SCREEN_ADDR 0xFE800000
33 static u32 pseudo_palette[17];
34 static struct fb_info fb_info;
36 static struct fb_fix_screeninfo q40fb_fix __initdata = {
38 .smem_len = 1024*1024,
39 .type = FB_TYPE_PACKED_PIXELS,
40 .visual = FB_VISUAL_TRUECOLOR,
41 .line_length = 1024*2,
42 .accel = FB_ACCEL_NONE,
45 static struct fb_var_screeninfo q40fb_var __initdata = {
54 .activate = FB_ACTIVATE_NOW,
57 .vmode = FB_VMODE_NONINTERLACED,
60 /* frame buffer operations */
63 static int q40fb_setcolreg(unsigned regno, unsigned red, unsigned green,
64 unsigned blue, unsigned transp,
65 struct fb_info *info);
67 static struct fb_ops q40fb_ops = {
69 .fb_setcolreg = q40fb_setcolreg,
70 .fb_fillrect = cfb_fillrect,
71 .fb_copyarea = cfb_copyarea,
72 .fb_imageblit = cfb_imageblit,
73 .fb_cursor = soft_cursor,
76 static int q40fb_setcolreg(unsigned regno, unsigned red, unsigned green,
77 unsigned blue, unsigned transp,
81 * Set a single color register. The values supplied have a 16 bit
83 * Return != 0 for invalid regno.
91 ((u16 *)info->pseudo_palette)[regno] = ((red & 31) <<6) |
92 ((green & 31) << 11) |
103 /* mapped in q40/config.c */
104 q40fb_fix.smem_start = Q40_PHYS_SCREEN_ADDR;
106 fb_info.var = q40fb_var;
107 fb_info.fix = q40fb_fix;
108 fb_info.fbops = &q40fb_ops;
109 fb_info.flags = FBINFO_FLAG_DEFAULT; /* not as module for now */
110 fb_info.pseudo_palette = pseudo_palette;
111 fb_info.screen_base = (char *) q40fb_fix.smem_start;
113 fb_alloc_cmap(&fb_info.cmap, 16, 0);
115 master_outb(3, DISPLAY_CONTROL_REG);
117 if (register_framebuffer(&fb_info) < 0) {
118 printk(KERN_ERR "Unable to register Q40 frame buffer\n");
122 printk(KERN_INFO "fb%d: Q40 frame buffer alive and kicking !\n",
127 MODULE_LICENSE("GPL");