2 * macfb.c: Generic framebuffer for Macs whose colourmaps/modes we
3 * don't know how to set.
5 * (c) 1999 David Huggins-Daines <dhd@debian.org>
7 * Primarily based on vesafb.c, by Gerd Knorr
8 * (c) 1998 Gerd Knorr <kraxel@cs.tu-berlin.de>
10 * Also uses information and code from:
12 * The original macfb.c from Linux/mac68k 2.0, by Alan Cox, Juergen
13 * Mellinger, Mikael Forselius, Michael Schmitz, and others.
15 * valkyriefb.c, by Martin Costabel, Kevin Schoedel, Barry Nathan, Dan
16 * Jacobowitz, Paul Mackerras, Fabio Riccardi, and Geert Uytterhoeven.
18 * The VideoToolbox "Bugs" web page at
19 * http://rajsky.psych.nyu.edu/Tips/VideoBugs.html
21 * This code is free software. You may copy, modify, and distribute
22 * it subject to the terms and conditions of the GNU General Public
23 * License, version 2, or any later version, at your convenience.
26 #include <linux/module.h>
27 #include <linux/kernel.h>
28 #include <linux/errno.h>
29 #include <linux/string.h>
31 #include <linux/delay.h>
32 #include <linux/nubus.h>
33 #include <linux/init.h>
36 #include <asm/setup.h>
37 #include <asm/macintosh.h>
40 /* Common DAC base address for the LC, RBV, Valkyrie, and IIvx */
41 #define DAC_BASE 0x50f24000
43 /* Some addresses for the DAFB */
44 #define DAFB_BASE 0xf9800200
46 /* Address for the built-in Civic framebuffer in Quadra AVs */
47 #define CIVIC_BASE 0x50f30800
49 /* GSC (Gray Scale Controller) base address */
50 #define GSC_BASE 0x50F20000
52 /* CSC (Color Screen Controller) base address */
53 #define CSC_BASE 0x50F20000
55 static int (*macfb_setpalette
)(unsigned int regno
, unsigned int red
,
56 unsigned int green
, unsigned int blue
,
57 struct fb_info
*info
);
62 } __iomem
*v8_brazil_cmap_regs
;
66 char pad1
[3]; /* word aligned */
68 char pad2
[3]; /* word aligned */
69 unsigned char cntl
; /* a guess as to purpose */
70 } __iomem
*rbv_cmap_regs
;
74 unsigned long pad1
[3];
75 unsigned char pad2
[3];
77 } __iomem
*dafb_cmap_regs
;
80 unsigned char addr
; /* OFFSET: 0x00 */
81 unsigned char pad1
[15];
82 unsigned char lut
; /* OFFSET: 0x10 */
83 unsigned char pad2
[15];
84 unsigned char status
; /* OFFSET: 0x20 */
85 unsigned char pad3
[7];
86 unsigned long vbl_addr
; /* OFFSET: 0x28 */
87 unsigned int status2
; /* OFFSET: 0x2C */
88 } __iomem
*civic_cmap_regs
;
92 unsigned char clut_waddr
; /* 0x40 */
94 unsigned char clut_data
; /* 0x42 */
96 unsigned char clut_raddr
; /* 0x46 */
97 } __iomem
*csc_cmap_regs
;
99 /* The registers in these structs are in NuBus slot space */
100 struct mdc_cmap_regs
{
107 struct toby_cmap_regs
{
109 unsigned char lut
; /* TFBClutWDataReg, offset 0x90018 */
111 unsigned char addr
; /* TFBClutAddrReg, offset 0x9001C */
114 struct jet_cmap_regs
{
120 #define PIXEL_TO_MM(a) (((a)*10)/28) /* width in mm at 72 dpi */
122 static struct fb_var_screeninfo macfb_defined
= {
124 .activate
= FB_ACTIVATE_NOW
,
131 .vmode
= FB_VMODE_NONINTERLACED
,
134 static struct fb_fix_screeninfo macfb_fix
= {
135 .type
= FB_TYPE_PACKED_PIXELS
,
136 .accel
= FB_ACCEL_NONE
,
139 static void *slot_addr
;
140 static struct fb_info fb_info
;
141 static u32 pseudo_palette
[16];
146 * Unlike the Valkyrie, the DAFB cannot set individual colormap
147 * registers. Therefore, we do what the MacOS driver does (no
148 * kidding!) and simply set them one by one until we hit the one we
151 static int dafb_setpalette(unsigned int regno
, unsigned int red
,
152 unsigned int green
, unsigned int blue
,
153 struct fb_info
*info
)
155 static int lastreg
= -1;
158 local_irq_save(flags
);
161 * fbdev will set an entire colourmap, but X won't. Hopefully
162 * this should accommodate both of them
164 if (regno
!= lastreg
+ 1) {
167 /* Stab in the dark trying to reset the CLUT pointer */
168 nubus_writel(0, &dafb_cmap_regs
->reset
);
171 /* Loop until we get to the register we want */
172 for (i
= 0; i
< regno
; i
++) {
173 nubus_writeb(info
->cmap
.red
[i
] >> 8,
174 &dafb_cmap_regs
->lut
);
176 nubus_writeb(info
->cmap
.green
[i
] >> 8,
177 &dafb_cmap_regs
->lut
);
179 nubus_writeb(info
->cmap
.blue
[i
] >> 8,
180 &dafb_cmap_regs
->lut
);
185 nubus_writeb(red
, &dafb_cmap_regs
->lut
);
187 nubus_writeb(green
, &dafb_cmap_regs
->lut
);
189 nubus_writeb(blue
, &dafb_cmap_regs
->lut
);
191 local_irq_restore(flags
);
196 /* V8 and Brazil seem to use the same DAC. Sonora does as well. */
197 static int v8_brazil_setpalette(unsigned int regno
, unsigned int red
,
198 unsigned int green
, unsigned int blue
,
199 struct fb_info
*info
)
201 unsigned int bpp
= info
->var
.bits_per_pixel
;
205 return 1; /* failsafe */
207 local_irq_save(flags
);
209 /* On these chips, the CLUT register numbers are spread out
210 * across the register space. Thus:
211 * In 8bpp, all regnos are valid.
212 * In 4bpp, the regnos are 0x0f, 0x1f, 0x2f, etc, etc
213 * In 2bpp, the regnos are 0x3f, 0x7f, 0xbf, 0xff
215 regno
= (regno
<< (8 - bpp
)) | (0xFF >> bpp
);
216 nubus_writeb(regno
, &v8_brazil_cmap_regs
->addr
);
219 /* send one color channel at a time */
220 nubus_writeb(red
, &v8_brazil_cmap_regs
->lut
);
222 nubus_writeb(green
, &v8_brazil_cmap_regs
->lut
);
224 nubus_writeb(blue
, &v8_brazil_cmap_regs
->lut
);
226 local_irq_restore(flags
);
230 /* RAM-Based Video */
231 static int rbv_setpalette(unsigned int regno
, unsigned int red
,
232 unsigned int green
, unsigned int blue
,
233 struct fb_info
*info
)
237 if (info
->var
.bits_per_pixel
> 8)
238 return 1; /* failsafe */
240 local_irq_save(flags
);
242 /* From the VideoToolbox driver. Seems to be saying that
243 * regno #254 and #255 are the important ones for 1-bit color,
244 * regno #252-255 are the important ones for 2-bit color, etc.
246 regno
+= 256 - (1 << info
->var
.bits_per_pixel
);
248 /* reset clut? (VideoToolbox sez "not necessary") */
249 nubus_writeb(0xFF, &rbv_cmap_regs
->cntl
);
252 /* tell clut which address to use. */
253 nubus_writeb(regno
, &rbv_cmap_regs
->addr
);
256 /* send one color channel at a time. */
257 nubus_writeb(red
, &rbv_cmap_regs
->lut
);
259 nubus_writeb(green
, &rbv_cmap_regs
->lut
);
261 nubus_writeb(blue
, &rbv_cmap_regs
->lut
);
263 local_irq_restore(flags
);
267 /* Macintosh Display Card (8*24) */
268 static int mdc_setpalette(unsigned int regno
, unsigned int red
,
269 unsigned int green
, unsigned int blue
,
270 struct fb_info
*info
)
272 struct mdc_cmap_regs
*cmap_regs
= slot_addr
;
275 local_irq_save(flags
);
277 /* the nop's are there to order writes. */
278 nubus_writeb(regno
, &cmap_regs
->addr
);
280 nubus_writeb(red
, &cmap_regs
->lut
);
282 nubus_writeb(green
, &cmap_regs
->lut
);
284 nubus_writeb(blue
, &cmap_regs
->lut
);
286 local_irq_restore(flags
);
290 /* Toby frame buffer */
291 static int toby_setpalette(unsigned int regno
, unsigned int red
,
292 unsigned int green
, unsigned int blue
,
293 struct fb_info
*info
)
295 struct toby_cmap_regs
*cmap_regs
= slot_addr
;
296 unsigned int bpp
= info
->var
.bits_per_pixel
;
302 regno
= (regno
<< (8 - bpp
)) | (0xFF >> bpp
);
304 local_irq_save(flags
);
306 nubus_writeb(regno
, &cmap_regs
->addr
);
308 nubus_writeb(red
, &cmap_regs
->lut
);
310 nubus_writeb(green
, &cmap_regs
->lut
);
312 nubus_writeb(blue
, &cmap_regs
->lut
);
314 local_irq_restore(flags
);
318 /* Jet frame buffer */
319 static int jet_setpalette(unsigned int regno
, unsigned int red
,
320 unsigned int green
, unsigned int blue
,
321 struct fb_info
*info
)
323 struct jet_cmap_regs
*cmap_regs
= slot_addr
;
326 local_irq_save(flags
);
328 nubus_writeb(regno
, &cmap_regs
->addr
);
330 nubus_writeb(red
, &cmap_regs
->lut
);
332 nubus_writeb(green
, &cmap_regs
->lut
);
334 nubus_writeb(blue
, &cmap_regs
->lut
);
336 local_irq_restore(flags
);
341 * Civic framebuffer -- Quadra AV built-in video. A chip
342 * called Sebastian holds the actual color palettes, and
343 * apparently, there are two different banks of 512K RAM
344 * which can act as separate framebuffers for doing video
345 * input and viewing the screen at the same time! The 840AV
346 * Can add another 1MB RAM to give the two framebuffers
349 static int civic_setpalette(unsigned int regno
, unsigned int red
,
350 unsigned int green
, unsigned int blue
,
351 struct fb_info
*info
)
356 if (info
->var
.bits_per_pixel
> 8)
357 return 1; /* failsafe */
359 local_irq_save(flags
);
361 /* Set the register address */
362 nubus_writeb(regno
, &civic_cmap_regs
->addr
);
366 * Grab a status word and do some checking;
367 * Then finally write the clut!
369 clut_status
= nubus_readb(&civic_cmap_regs
->status2
);
371 if ((clut_status
& 0x0008) == 0)
374 if ((clut_status
& 0x000D) != 0)
376 nubus_writeb(0x00, &civic_cmap_regs
->lut
);
378 nubus_writeb(0x00, &civic_cmap_regs
->lut
);
383 nubus_writeb(red
, &civic_cmap_regs
->lut
);
385 nubus_writeb(green
, &civic_cmap_regs
->lut
);
387 nubus_writeb(blue
, &civic_cmap_regs
->lut
);
389 nubus_writeb(0x00, &civic_cmap_regs
->lut
);
395 junk
= nubus_readb(&civic_cmap_regs
->lut
);
397 junk
= nubus_readb(&civic_cmap_regs
->lut
);
399 junk
= nubus_readb(&civic_cmap_regs
->lut
);
401 junk
= nubus_readb(&civic_cmap_regs
->lut
);
404 if ((clut_status
& 0x000D) != 0)
406 nubus_writeb(0x00, &civic_cmap_regs
->lut
);
408 nubus_writeb(0x00, &civic_cmap_regs
->lut
);
412 nubus_writeb(red
, &civic_cmap_regs
->lut
);
414 nubus_writeb(green
, &civic_cmap_regs
->lut
);
416 nubus_writeb(blue
, &civic_cmap_regs
->lut
);
418 nubus_writeb(junk
, &civic_cmap_regs
->lut
);
421 local_irq_restore(flags
);
426 * The CSC is the framebuffer on the PowerBook 190 series
427 * (and the 5300 too, but that's a PowerMac). This function
428 * brought to you in part by the ECSC driver for MkLinux.
430 static int csc_setpalette(unsigned int regno
, unsigned int red
,
431 unsigned int green
, unsigned int blue
,
432 struct fb_info
*info
)
436 local_irq_save(flags
);
438 udelay(1); /* mklinux on PB 5300 waits for 260 ns */
439 nubus_writeb(regno
, &csc_cmap_regs
->clut_waddr
);
440 nubus_writeb(red
, &csc_cmap_regs
->clut_data
);
441 nubus_writeb(green
, &csc_cmap_regs
->clut_data
);
442 nubus_writeb(blue
, &csc_cmap_regs
->clut_data
);
444 local_irq_restore(flags
);
448 static int macfb_setcolreg(unsigned regno
, unsigned red
, unsigned green
,
449 unsigned blue
, unsigned transp
,
450 struct fb_info
*fb_info
)
453 * Set a single color register. The values supplied are
454 * already rounded down to the hardware's capabilities
455 * (according to the entries in the `var' structure).
456 * Return non-zero for invalid regno.
459 if (regno
>= fb_info
->cmap
.len
)
462 if (fb_info
->var
.bits_per_pixel
<= 8) {
463 switch (fb_info
->var
.bits_per_pixel
) {
465 /* We shouldn't get here */
470 if (macfb_setpalette
)
471 macfb_setpalette(regno
, red
>> 8, green
>> 8,
477 } else if (regno
< 16) {
478 switch (fb_info
->var
.bits_per_pixel
) {
480 if (fb_info
->var
.red
.offset
== 10) {
482 ((u32
*) (fb_info
->pseudo_palette
))[regno
] =
483 ((red
& 0xf800) >> 1) |
484 ((green
& 0xf800) >> 6) |
485 ((blue
& 0xf800) >> 11) |
486 ((transp
!= 0) << 15);
489 ((u32
*) (fb_info
->pseudo_palette
))[regno
] =
490 ((red
& 0xf800) >> 0) |
491 ((green
& 0xfc00) >> 5) |
492 ((blue
& 0xf800) >> 11);
496 * 24-bit colour almost doesn't exist on 68k Macs --
497 * http://support.apple.com/kb/TA28634 (Old Article: 10992)
504 ((u32
*)(fb_info
->pseudo_palette
))[regno
] =
505 (red
<< fb_info
->var
.red
.offset
) |
506 (green
<< fb_info
->var
.green
.offset
) |
507 (blue
<< fb_info
->var
.blue
.offset
);
515 static struct fb_ops macfb_ops
= {
516 .owner
= THIS_MODULE
,
517 .fb_setcolreg
= macfb_setcolreg
,
518 .fb_fillrect
= cfb_fillrect
,
519 .fb_copyarea
= cfb_copyarea
,
520 .fb_imageblit
= cfb_imageblit
,
523 static void __init
macfb_setup(char *options
)
527 if (!options
|| !*options
)
530 while ((this_opt
= strsep(&options
, ",")) != NULL
) {
534 if (!strcmp(this_opt
, "inverse"))
537 if (!strcmp(this_opt
, "vidtest"))
538 vidtest
= 1; /* enable experimental CLUT code */
542 static void __init
iounmap_macfb(void)
545 iounmap(dafb_cmap_regs
);
546 if (v8_brazil_cmap_regs
)
547 iounmap(v8_brazil_cmap_regs
);
549 iounmap(rbv_cmap_regs
);
551 iounmap(civic_cmap_regs
);
553 iounmap(csc_cmap_regs
);
556 static int __init
macfb_init(void)
558 int video_cmap_len
, video_is_nubus
= 0;
559 struct nubus_rsrc
*ndev
= NULL
;
563 if (fb_get_options("macfb", &option
))
570 if (mac_bi_data
.id
== MAC_MODEL_Q630
||
571 mac_bi_data
.id
== MAC_MODEL_P588
)
572 return -ENODEV
; /* See valkyriefb.c */
574 macfb_defined
.xres
= mac_bi_data
.dimensions
& 0xFFFF;
575 macfb_defined
.yres
= mac_bi_data
.dimensions
>> 16;
576 macfb_defined
.bits_per_pixel
= mac_bi_data
.videodepth
;
578 macfb_fix
.line_length
= mac_bi_data
.videorow
;
579 macfb_fix
.smem_len
= macfb_fix
.line_length
* macfb_defined
.yres
;
580 /* Note: physical address (since 2.1.127) */
581 macfb_fix
.smem_start
= mac_bi_data
.videoaddr
;
584 * This is actually redundant with the initial mappings.
585 * However, there are some non-obvious aspects to the way
586 * those mappings are set up, so this is in fact the safest
587 * way to ensure that this driver will work on every possible Mac
589 fb_info
.screen_base
= ioremap(mac_bi_data
.videoaddr
,
591 if (!fb_info
.screen_base
)
594 pr_info("macfb: framebuffer at 0x%08lx, mapped to 0x%p, size %dk\n",
595 macfb_fix
.smem_start
, fb_info
.screen_base
,
596 macfb_fix
.smem_len
/ 1024);
597 pr_info("macfb: mode is %dx%dx%d, linelength=%d\n",
598 macfb_defined
.xres
, macfb_defined
.yres
,
599 macfb_defined
.bits_per_pixel
, macfb_fix
.line_length
);
601 /* Fill in the available video resolution */
602 macfb_defined
.xres_virtual
= macfb_defined
.xres
;
603 macfb_defined
.yres_virtual
= macfb_defined
.yres
;
604 macfb_defined
.height
= PIXEL_TO_MM(macfb_defined
.yres
);
605 macfb_defined
.width
= PIXEL_TO_MM(macfb_defined
.xres
);
607 /* Some dummy values for timing to make fbset happy */
608 macfb_defined
.pixclock
= 10000000 / macfb_defined
.xres
*
609 1000 / macfb_defined
.yres
;
610 macfb_defined
.left_margin
= (macfb_defined
.xres
/ 8) & 0xf8;
611 macfb_defined
.hsync_len
= (macfb_defined
.xres
/ 8) & 0xf8;
613 switch (macfb_defined
.bits_per_pixel
) {
615 macfb_defined
.red
.length
= macfb_defined
.bits_per_pixel
;
616 macfb_defined
.green
.length
= macfb_defined
.bits_per_pixel
;
617 macfb_defined
.blue
.length
= macfb_defined
.bits_per_pixel
;
619 macfb_fix
.visual
= FB_VISUAL_MONO01
;
624 macfb_defined
.red
.length
= macfb_defined
.bits_per_pixel
;
625 macfb_defined
.green
.length
= macfb_defined
.bits_per_pixel
;
626 macfb_defined
.blue
.length
= macfb_defined
.bits_per_pixel
;
627 video_cmap_len
= 1 << macfb_defined
.bits_per_pixel
;
628 macfb_fix
.visual
= FB_VISUAL_PSEUDOCOLOR
;
631 macfb_defined
.transp
.offset
= 15;
632 macfb_defined
.transp
.length
= 1;
633 macfb_defined
.red
.offset
= 10;
634 macfb_defined
.red
.length
= 5;
635 macfb_defined
.green
.offset
= 5;
636 macfb_defined
.green
.length
= 5;
637 macfb_defined
.blue
.offset
= 0;
638 macfb_defined
.blue
.length
= 5;
641 * Should actually be FB_VISUAL_DIRECTCOLOR, but this
644 macfb_fix
.visual
= FB_VISUAL_TRUECOLOR
;
648 macfb_defined
.red
.offset
= 16;
649 macfb_defined
.red
.length
= 8;
650 macfb_defined
.green
.offset
= 8;
651 macfb_defined
.green
.length
= 8;
652 macfb_defined
.blue
.offset
= 0;
653 macfb_defined
.blue
.length
= 8;
655 macfb_fix
.visual
= FB_VISUAL_TRUECOLOR
;
658 pr_err("macfb: unknown or unsupported bit depth: %d\n",
659 macfb_defined
.bits_per_pixel
);
665 * We take a wild guess that if the video physical address is
666 * in nubus slot space, that the nubus card is driving video.
667 * Penguin really ought to tell us whether we are using internal
669 * Hopefully we only find one of them. Otherwise our NuBus
670 * code is really broken :-)
673 for_each_func_rsrc(ndev
) {
674 unsigned long base
= ndev
->board
->slot_addr
;
676 if (mac_bi_data
.videoaddr
< base
||
677 mac_bi_data
.videoaddr
- base
> 0xFFFFFF)
680 if (ndev
->category
!= NUBUS_CAT_DISPLAY
||
681 ndev
->type
!= NUBUS_TYPE_VIDEO
)
685 slot_addr
= (unsigned char *)base
;
687 switch(ndev
->dr_hw
) {
688 case NUBUS_DRHW_APPLE_MDC
:
689 strcpy(macfb_fix
.id
, "Mac Disp. Card");
690 macfb_setpalette
= mdc_setpalette
;
691 macfb_defined
.activate
= FB_ACTIVATE_NOW
;
693 case NUBUS_DRHW_APPLE_TFB
:
694 strcpy(macfb_fix
.id
, "Toby");
695 macfb_setpalette
= toby_setpalette
;
696 macfb_defined
.activate
= FB_ACTIVATE_NOW
;
698 case NUBUS_DRHW_APPLE_JET
:
699 strcpy(macfb_fix
.id
, "Jet");
700 macfb_setpalette
= jet_setpalette
;
701 macfb_defined
.activate
= FB_ACTIVATE_NOW
;
704 strcpy(macfb_fix
.id
, "Generic NuBus");
709 /* If it's not a NuBus card, it must be internal video */
711 switch (mac_bi_data
.id
) {
714 * Note: these first four have the v7 DAFB, which is
715 * known to be rather unlike the ones used in the
719 case MAC_MODEL_P475F
:
731 strcpy(macfb_fix
.id
, "DAFB");
732 macfb_setpalette
= dafb_setpalette
;
733 dafb_cmap_regs
= ioremap(DAFB_BASE
, 0x1000);
734 macfb_defined
.activate
= FB_ACTIVATE_NOW
;
738 * LC II uses the V8 framebuffer
741 strcpy(macfb_fix
.id
, "V8");
742 macfb_setpalette
= v8_brazil_setpalette
;
743 v8_brazil_cmap_regs
= ioremap(DAC_BASE
, 0x1000);
744 macfb_defined
.activate
= FB_ACTIVATE_NOW
;
748 * IIvi, IIvx use the "Brazil" framebuffer (which is
749 * very much like the V8, it seems, and probably uses
755 strcpy(macfb_fix
.id
, "Brazil");
756 macfb_setpalette
= v8_brazil_setpalette
;
757 v8_brazil_cmap_regs
= ioremap(DAC_BASE
, 0x1000);
758 macfb_defined
.activate
= FB_ACTIVATE_NOW
;
762 * LC III (and friends) use the Sonora framebuffer
763 * Incidentally this is also used in the non-AV models
764 * of the x100 PowerMacs
765 * These do in fact seem to use the same DAC interface
768 case MAC_MODEL_LCIII
:
772 strcpy(macfb_fix
.id
, "Sonora");
773 macfb_setpalette
= v8_brazil_setpalette
;
774 v8_brazil_cmap_regs
= ioremap(DAC_BASE
, 0x1000);
775 macfb_defined
.activate
= FB_ACTIVATE_NOW
;
779 * IIci and IIsi use the infamous RBV chip
780 * (the IIsi is just a rebadged and crippled
781 * IIci in a different case, BTW)
785 strcpy(macfb_fix
.id
, "RBV");
786 macfb_setpalette
= rbv_setpalette
;
787 rbv_cmap_regs
= ioremap(DAC_BASE
, 0x1000);
788 macfb_defined
.activate
= FB_ACTIVATE_NOW
;
792 * AVs use the Civic framebuffer
796 strcpy(macfb_fix
.id
, "Civic");
797 macfb_setpalette
= civic_setpalette
;
798 civic_cmap_regs
= ioremap(CIVIC_BASE
, 0x1000);
799 macfb_defined
.activate
= FB_ACTIVATE_NOW
;
805 * We think this may be like the LC II
808 strcpy(macfb_fix
.id
, "LC");
810 macfb_setpalette
= v8_brazil_setpalette
;
811 v8_brazil_cmap_regs
=
812 ioremap(DAC_BASE
, 0x1000);
813 macfb_defined
.activate
= FB_ACTIVATE_NOW
;
818 * We think this may be like the LC II
821 strcpy(macfb_fix
.id
, "Color Classic");
823 macfb_setpalette
= v8_brazil_setpalette
;
824 v8_brazil_cmap_regs
=
825 ioremap(DAC_BASE
, 0x1000);
826 macfb_defined
.activate
= FB_ACTIVATE_NOW
;
831 * And we *do* mean "weirdos"
834 strcpy(macfb_fix
.id
, "Mac TV");
838 * These don't have colour, so no need to worry
842 strcpy(macfb_fix
.id
, "Monochrome");
846 * Powerbooks are particularly difficult. Many of
847 * them have separate framebuffers for external and
848 * internal video, which is admittedly pretty cool,
849 * but will be a bit of a headache to support here.
850 * Also, many of them are grayscale, and we don't
851 * really support that.
855 * Slot 0 ROM says TIM. No external video. B&W.
857 case MAC_MODEL_PB140
:
858 case MAC_MODEL_PB145
:
859 case MAC_MODEL_PB170
:
860 strcpy(macfb_fix
.id
, "DDC");
864 * Internal is GSC, External (if present) is ViSC
866 case MAC_MODEL_PB150
: /* no external video */
867 case MAC_MODEL_PB160
:
868 case MAC_MODEL_PB165
:
869 case MAC_MODEL_PB180
:
870 case MAC_MODEL_PB210
:
871 case MAC_MODEL_PB230
:
872 strcpy(macfb_fix
.id
, "GSC");
876 * Internal is TIM, External is ViSC
878 case MAC_MODEL_PB165C
:
879 case MAC_MODEL_PB180C
:
880 strcpy(macfb_fix
.id
, "TIM");
884 * Internal is CSC, External is Keystone+Ariel.
886 case MAC_MODEL_PB190
: /* external video is optional */
887 case MAC_MODEL_PB520
:
888 case MAC_MODEL_PB250
:
889 case MAC_MODEL_PB270C
:
890 case MAC_MODEL_PB280
:
891 case MAC_MODEL_PB280C
:
892 strcpy(macfb_fix
.id
, "CSC");
893 macfb_setpalette
= csc_setpalette
;
894 csc_cmap_regs
= ioremap(CSC_BASE
, 0x1000);
895 macfb_defined
.activate
= FB_ACTIVATE_NOW
;
899 strcpy(macfb_fix
.id
, "Unknown");
903 fb_info
.fbops
= &macfb_ops
;
904 fb_info
.var
= macfb_defined
;
905 fb_info
.fix
= macfb_fix
;
906 fb_info
.pseudo_palette
= pseudo_palette
;
907 fb_info
.flags
= FBINFO_DEFAULT
;
909 err
= fb_alloc_cmap(&fb_info
.cmap
, video_cmap_len
, 0);
913 err
= register_framebuffer(&fb_info
);
917 fb_info(&fb_info
, "%s frame buffer device\n", fb_info
.fix
.id
);
922 fb_dealloc_cmap(&fb_info
.cmap
);
924 iounmap(fb_info
.screen_base
);
929 module_init(macfb_init
);
930 MODULE_LICENSE("GPL");