11 #include <linux/module.h>
12 #include <linux/kernel.h>
13 #include <linux/errno.h>
14 #include <linux/string.h>
30 static int cg3_setcolreg(
unsigned,
unsigned,
unsigned,
unsigned,
32 static int cg3_blank(
int,
struct fb_info *);
35 static int cg3_ioctl(
struct fb_info *,
unsigned int,
unsigned long);
41 static struct fb_ops cg3_ops = {
43 .fb_setcolreg = cg3_setcolreg,
44 .fb_blank = cg3_blank,
49 .fb_ioctl = cg3_ioctl,
57 #define CG3_CR_ENABLE_INTS 0x80
58 #define CG3_CR_ENABLE_VIDEO 0x40
59 #define CG3_CR_ENABLE_TIMING 0x20
60 #define CG3_CR_ENABLE_CURCMP 0x10
61 #define CG3_CR_XTAL_MASK 0x0c
62 #define CG3_CR_DIVISOR_MASK 0x03
65 #define CG3_SR_PENDING_INT 0x80
66 #define CG3_SR_RES_MASK 0x70
67 #define CG3_SR_1152_900_76_A 0x40
68 #define CG3_SR_1152_900_76_B 0x60
69 #define CG3_SR_ID_MASK 0x0f
70 #define CG3_SR_ID_COLOR 0x01
71 #define CG3_SR_ID_MONO 0x02
72 #define CG3_SR_ID_MONO_ECL 0x03
108 #define CG3_REGS_OFFSET 0x400000UL
109 #define CG3_RAM_OFFSET 0x800000UL
117 #define CG3_FLAG_BLANKED 0x00000001
118 #define CG3_FLAG_RDI 0x00000002
137 static int cg3_setcolreg(
unsigned regno,
162 #define D4M3(x) ((((x)>>2)<<1) + ((x)>>2))
163 #define D4M4(x) ((x)&~0x3)
174 spin_unlock_irqrestore(&par->
lock,
flags);
184 static int cg3_blank(
int blank,
struct fb_info *
info)
212 spin_unlock_irqrestore(&par->
lock,
flags);
231 info->
fix.smem_start, info->
fix.smem_len,
236 static int cg3_ioctl(
struct fb_info *info,
unsigned int cmd,
unsigned long arg)
254 info->
fix.line_length = linebytes;
269 if (ww && *p ==
'x') {
271 if (hh && *p ==
'-') {
272 if (var->
xres != ww ||
283 0x14, 0xbb, 0x15, 0x2b, 0x16, 0x04, 0x17, 0x14,
284 0x18, 0xae, 0x19, 0x03, 0x1a, 0xa8, 0x1b, 0x24,
285 0x1c, 0x01, 0x1d, 0x05, 0x1e, 0xff, 0x1f, 0x01,
289 static u8 cg3regvals_76hz[] __devinitdata = {
290 0x14, 0xb7, 0x15, 0x27, 0x16, 0x03, 0x17, 0x0f,
291 0x18, 0xae, 0x19, 0x03, 0x1a, 0xae, 0x1b, 0x2a,
292 0x1c, 0x01, 0x1d, 0x09, 0x1e, 0xff, 0x1f, 0x01,
296 static u8 cg3regvals_rdi[] __devinitdata = {
297 0x14, 0x70, 0x15, 0x20, 0x16, 0x08, 0x17, 0x10,
298 0x18, 0x06, 0x19, 0x02, 0x1a, 0x31, 0x1b, 0x51,
299 0x1c, 0x06, 0x1d, 0x0c, 0x1e, 0xff, 0x1f, 0x01,
303 static u8 *cg3_regvals[] __devinitdata = {
304 cg3regvals_66hz, cg3regvals_76hz, cg3regvals_rdi
307 static u_char cg3_dacvals[] __devinitdata = {
308 4, 0xff, 5, 0x00, 6, 0x70, 7, 0x00, 0
334 for (p = cg3_regvals[type]; *
p; p += 2) {
338 for (p = cg3_dacvals; *
p; p += 2) {
369 info->
var.red.length = 8;
370 info->
var.green.length = 8;
371 info->
var.blue.length = 8;
375 cg3_rdi_maybe_fixup_var(&info->
var, dp);
382 sizeof(
struct cg3_regs),
"cg3 regs");
387 info->
fbops = &cg3_ops;
389 info->
fix.smem_len,
"cg3 ram");
396 err = cg3_do_default_mode(par);
398 goto out_unmap_screen;
403 goto out_unmap_screen;
407 cg3_init_fix(info, linebytes, dp);
411 goto out_dealloc_cmap;
469 .of_match_table = cg3_match,
475 static int __init cg3_init(
void)
483 static void __exit cg3_exit(
void)