10 #include <linux/module.h>
11 #include <linux/kernel.h>
12 #include <linux/errno.h>
13 #include <linux/string.h>
30 static int cg14_setcolreg(
unsigned,
unsigned,
unsigned,
unsigned,
34 static int cg14_ioctl(
struct fb_info *,
unsigned int,
unsigned long);
41 static struct fb_ops cg14_ops = {
43 .fb_setcolreg = cg14_setcolreg,
44 .fb_pan_display = cg14_pan_display,
49 .fb_ioctl = cg14_ioctl,
55 #define CG14_MCR_INTENABLE_SHIFT 7
56 #define CG14_MCR_INTENABLE_MASK 0x80
57 #define CG14_MCR_VIDENABLE_SHIFT 6
58 #define CG14_MCR_VIDENABLE_MASK 0x40
59 #define CG14_MCR_PIXMODE_SHIFT 4
60 #define CG14_MCR_PIXMODE_MASK 0x30
61 #define CG14_MCR_TMR_SHIFT 2
62 #define CG14_MCR_TMR_MASK 0x0c
63 #define CG14_MCR_TMENABLE_SHIFT 1
64 #define CG14_MCR_TMENABLE_MASK 0x02
65 #define CG14_MCR_RESET_SHIFT 0
66 #define CG14_MCR_RESET_MASK 0x01
67 #define CG14_REV_REVISION_SHIFT 4
68 #define CG14_REV_REVISION_MASK 0xf0
69 #define CG14_REV_IMPL_SHIFT 0
70 #define CG14_REV_IMPL_MASK 0x0f
71 #define CG14_VBR_FRAMEBASE_SHIFT 12
72 #define CG14_VBR_FRAMEBASE_MASK 0x00fff000
73 #define CG14_VMCR1_SETUP_SHIFT 0
74 #define CG14_VMCR1_SETUP_MASK 0x000001ff
75 #define CG14_VMCR1_VCONFIG_SHIFT 9
76 #define CG14_VMCR1_VCONFIG_MASK 0x00000e00
77 #define CG14_VMCR2_REFRESH_SHIFT 0
78 #define CG14_VMCR2_REFRESH_MASK 0x00000001
79 #define CG14_VMCR2_TESTROWCNT_SHIFT 1
80 #define CG14_VMCR2_TESTROWCNT_MASK 0x00000002
81 #define CG14_VMCR2_FBCONFIG_SHIFT 2
82 #define CG14_VMCR2_FBCONFIG_MASK 0x0000000c
83 #define CG14_VCR_REFRESHREQ_SHIFT 0
84 #define CG14_VCR_REFRESHREQ_MASK 0x000003ff
85 #define CG14_VCR1_REFRESHENA_SHIFT 10
86 #define CG14_VCR1_REFRESHENA_MASK 0x00000400
87 #define CG14_VCA_CAD_SHIFT 0
88 #define CG14_VCA_CAD_MASK 0x000003ff
89 #define CG14_VCA_VERS_SHIFT 10
90 #define CG14_VCA_VERS_MASK 0x00000c00
91 #define CG14_VCA_RAMSPEED_SHIFT 12
92 #define CG14_VCA_RAMSPEED_MASK 0x00001000
93 #define CG14_VCA_8MB_SHIFT 13
94 #define CG14_VCA_8MB_MASK 0x00002000
96 #define CG14_MCR_PIXMODE_8 0
97 #define CG14_MCR_PIXMODE_16 2
98 #define CG14_MCR_PIXMODE_32 3
135 #define CG14_CCR_ENABLE 0x04
136 #define CG14_CCR_SELECT 0x02
187 #define CG14_MMAP_ENTRIES 16
196 #define CG14_FLAG_BLANKED 0x00000001
206 static void __cg14_reset(
struct cg14_par *par)
226 spin_unlock_irqrestore(&par->
lock,
flags);
242 static int cg14_setcolreg(
unsigned regno,
257 val = (red | (green << 8) | (blue << 16));
261 spin_unlock_irqrestore(&par->
lock,
flags);
271 info->
fix.smem_start, info->
fix.smem_len,
275 static int cg14_ioctl(
struct fb_info *info,
unsigned int cmd,
unsigned long arg)
287 spin_unlock_irqrestore(&par->
lock,
flags);
291 memset(&kmdi, 0,
sizeof(kmdi));
300 spin_unlock_irqrestore(&par->
lock,
flags);
338 spin_unlock_irqrestore(&par->
lock,
flags);
365 info->
fix.line_length = linebytes;
471 int is_8mb, linebytes,
i,
err;
483 info->
var.red.length = 8;
484 info->
var.green.length = 8;
485 info->
var.blue.length = 8;
508 info->
fix.smem_len,
"cg14 ram");
525 if (map->
poff & 0x80000000)
526 map->
poff = (map->
poff & 0x7fffffff) +
530 map->
size >= 0x100000 &&
531 map->
size <= 0x400000)
536 par->
ramsize = (is_8mb ? 0x800000 : 0x400000);
539 info->
fbops = &cg14_ops;
548 cg14_init_fix(info, linebytes, dp);
552 goto out_dealloc_cmap;
567 cg14_unmap_regs(op, info, par);
582 cg14_unmap_regs(op, info, par);
593 .name =
"cgfourteen",
603 .of_match_table = cg14_match,
609 static int __init cg14_init(
void)
617 static void __exit cg14_exit(
void)