2 * linux/drivers/video/pmagb-b-fb.c
4 * PMAGB-B TurboChannel framebuffer card support ... derived from:
5 * "HP300 Topcat framebuffer support (derived from macfb of all things)
6 * Phil Blundell <philb@gnu.org> 1998", the original code can be
7 * found in the file hpfb.c in the same directory.
9 * DECstation related code Copyright (C) 1999, 2000, 2001 by
10 * Michael Engel <engel@unix-ag.org>,
11 * Karsten Merker <merker@linuxtag.org> and
13 * This file is subject to the terms and conditions of the GNU General
14 * Public License. See the file COPYING in the main directory of this
15 * archive for more details.
20 * We currently only support the PMAGB-B in high resolution mode
21 * as I know of no way to detect low resolution mode set via jumper.
25 #include <linux/module.h>
26 #include <linux/kernel.h>
27 #include <linux/sched.h>
28 #include <linux/errno.h>
29 #include <linux/string.h>
30 #include <linux/timer.h>
32 #include <linux/tty.h>
33 #include <linux/slab.h>
34 #include <linux/delay.h>
35 #include <linux/init.h>
37 #include <asm/bootinfo.h>
38 #include <asm/dec/machtype.h>
39 #include <asm/dec/tc.h>
40 #include <video/pmagb-b-fb.h>
42 struct pmagb_b_ramdac_regs
{
43 unsigned char addr_low
;
44 unsigned char pad0
[3];
45 unsigned char addr_hi
;
46 unsigned char pad1
[3];
48 unsigned char pad2
[3];
53 * Max 3 TURBOchannel slots -> max 3 PMAGB-B :)
55 static struct fb_info pmagbb_fb_info
[3];
57 static struct fb_var_screeninfo pmagbbfb_defined
= {
66 .activate
= FB_ACTIVATE_NOW
,
69 .accel_flags
= FB_ACCEL_NONE
,
70 .vmode
= FB_VMODE_NONINTERLACED
,
73 static struct fb_fix_screeninfo pmagbafb_fix
= {
75 .smem_len
= (1280 * 1024),
76 .type
= FB_TYPE_PACKED_PIXELS
,
77 .visual
= FB_VISUAL_PSEUDOCOLOR
,
82 * Turn hardware cursor off
84 void pmagbbfb_erase_cursor(struct pmagb_b_ramdac_regs
*bt459_regs
)
86 bt459_regs
->addr_low
= 0;
87 bt459_regs
->addr_hi
= 3;
94 static int pmagbbfb_setcolreg(unsigned regno
, unsigned red
, unsigned green
,
95 unsigned blue
, unsigned transp
,
98 struct pmagb_b_ramdac_regs
*bt459_regs
= (struct pmagb_b_ramdac_regs
*) info
->par
;
100 if (regno
>= info
->cmap
.len
)
103 red
>>= 8; /* The cmap fields are 16 bits */
104 green
>>= 8; /* wide, but the harware colormap */
105 blue
>>= 8; /* registers are only 8 bits wide */
107 bt459_regs
->addr_low
= (__u8
) regno
;
108 bt459_regs
->addr_hi
= 0;
109 bt459_regs
->cmap
= red
;
110 bt459_regs
->cmap
= green
;
111 bt459_regs
->cmap
= blue
;
115 static struct fb_ops pmagbbfb_ops
= {
116 .owner
= THIS_MODULE
,
117 .fb_setcolreg
= pmagbbfb_setcolreg
,
118 .fb_fillrect
= cfb_fillrect
,
119 .fb_copyarea
= cfb_copyarea
,
120 .fb_imageblit
= cfb_imageblit
,
121 .fb_cursor
= soft_cursor
,
124 int __init
pmagbbfb_init_one(int slot
)
126 unsigned long base_addr
= get_tc_base_addr(slot
);
127 struct fb_info
*info
= &pmagbb_fb_info
[slot
];
129 printk("PMAGB-BA framebuffer in slot %d\n", slot
);
131 * Framebuffer display memory base address and friends
133 pmagbbfb_fix
.smem_start
= base_addr
+ PMAGB_B_ONBOARD_FBMEM_OFFSET
;
134 info
->par
= (base_addr
+ PMAGB_B_BT459_OFFSET
);
137 * Configure the Bt459 RAM DAC
139 pmagbbfb_erase_cursor((struct pmagb_b_ramdac_regs
*) info
->par
);
142 * Let there be consoles..
144 info
->fbops
= &pmagbbfb_ops
;
145 info
->var
= pmagbbfb_defined
;
146 info
->fix
= pmagbbfb_fix
;
147 info
->screen_base
= pmagbbfb_fix
.smem_start
;
148 info
->flags
= FBINFO_DEFAULT
;
150 fb_alloc_cmap(&fb_info
.cmap
, 256, 0);
152 if (register_framebuffer(info
) < 0)
158 * Initialise the framebuffer
161 int __init
pmagbbfb_init(void)
166 if (fb_get_options("pmagbbfb", NULL
))
170 while ((sid
= search_tc_card("PMAGB-BA")) >= 0) {
173 pmagbbfb_init_one(sid
);
175 return found
? 0 : -ENODEV
;
181 module_init(pmagbbfb_init
);
182 MODULE_LICENSE("GPL");