diff options
| -rw-r--r-- | drivers/video/macfb.c | 577 |
1 files changed, 295 insertions, 282 deletions
diff --git a/drivers/video/macfb.c b/drivers/video/macfb.c index a92322558ec0..8b246ee7c069 100644 --- a/drivers/video/macfb.c +++ b/drivers/video/macfb.c | |||
| @@ -1,29 +1,33 @@ | |||
| 1 | /* macfb.c: Generic framebuffer for Macs whose colourmaps/modes we | 1 | /* |
| 2 | don't know how to set */ | 2 | * macfb.c: Generic framebuffer for Macs whose colourmaps/modes we |
| 3 | 3 | * don't know how to set. | |
| 4 | /* (c) 1999 David Huggins-Daines <dhd@debian.org> | 4 | * |
| 5 | 5 | * (c) 1999 David Huggins-Daines <dhd@debian.org> | |
| 6 | Primarily based on vesafb.c, by Gerd Knorr | 6 | * |
| 7 | (c) 1998 Gerd Knorr <kraxel@cs.tu-berlin.de> | 7 | * Primarily based on vesafb.c, by Gerd Knorr |
| 8 | 8 | * (c) 1998 Gerd Knorr <kraxel@cs.tu-berlin.de> | |
| 9 | Also uses information and code from: | 9 | * |
| 10 | 10 | * Also uses information and code from: | |
| 11 | The original macfb.c from Linux/mac68k 2.0, by Alan Cox, Juergen | 11 | * |
| 12 | Mellinger, Mikael Forselius, Michael Schmitz, and others. | 12 | * The original macfb.c from Linux/mac68k 2.0, by Alan Cox, Juergen |
| 13 | 13 | * Mellinger, Mikael Forselius, Michael Schmitz, and others. | |
| 14 | valkyriefb.c, by Martin Costabel, Kevin Schoedel, Barry Nathan, Dan | 14 | * |
| 15 | Jacobowitz, Paul Mackerras, Fabio Riccardi, and Geert Uytterhoeven. | 15 | * valkyriefb.c, by Martin Costabel, Kevin Schoedel, Barry Nathan, Dan |
| 16 | 16 | * Jacobowitz, Paul Mackerras, Fabio Riccardi, and Geert Uytterhoeven. | |
| 17 | This code is free software. You may copy, modify, and distribute | 17 | * |
| 18 | it subject to the terms and conditions of the GNU General Public | 18 | * The VideoToolbox "Bugs" web page at |
| 19 | License, version 2, or any later version, at your convenience. */ | 19 | * http://rajsky.psych.nyu.edu/Tips/VideoBugs.html |
| 20 | * | ||
| 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. | ||
| 24 | */ | ||
| 20 | 25 | ||
| 21 | #include <linux/module.h> | 26 | #include <linux/module.h> |
| 22 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
| 23 | #include <linux/errno.h> | 28 | #include <linux/errno.h> |
| 24 | #include <linux/string.h> | 29 | #include <linux/string.h> |
| 25 | #include <linux/mm.h> | 30 | #include <linux/mm.h> |
| 26 | #include <linux/slab.h> | ||
| 27 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
| 28 | #include <linux/nubus.h> | 32 | #include <linux/nubus.h> |
| 29 | #include <linux/init.h> | 33 | #include <linux/init.h> |
| @@ -31,9 +35,6 @@ | |||
| 31 | 35 | ||
| 32 | #include <asm/setup.h> | 36 | #include <asm/setup.h> |
| 33 | #include <asm/bootinfo.h> | 37 | #include <asm/bootinfo.h> |
| 34 | #include <asm/uaccess.h> | ||
| 35 | #include <asm/pgtable.h> | ||
| 36 | #include <asm/irq.h> | ||
| 37 | #include <asm/macintosh.h> | 38 | #include <asm/macintosh.h> |
| 38 | #include <asm/io.h> | 39 | #include <asm/io.h> |
| 39 | 40 | ||
| @@ -44,7 +45,7 @@ | |||
| 44 | #define DAFB_BASE 0xf9800200 | 45 | #define DAFB_BASE 0xf9800200 |
| 45 | 46 | ||
| 46 | /* Address for the built-in Civic framebuffer in Quadra AVs */ | 47 | /* Address for the built-in Civic framebuffer in Quadra AVs */ |
| 47 | #define CIVIC_BASE 0x50f30800 /* Only tested on 660AV! */ | 48 | #define CIVIC_BASE 0x50f30800 |
| 48 | 49 | ||
| 49 | /* GSC (Gray Scale Controller) base address */ | 50 | /* GSC (Gray Scale Controller) base address */ |
| 50 | #define GSC_BASE 0x50F20000 | 51 | #define GSC_BASE 0x50F20000 |
| @@ -52,27 +53,9 @@ | |||
| 52 | /* CSC (Color Screen Controller) base address */ | 53 | /* CSC (Color Screen Controller) base address */ |
| 53 | #define CSC_BASE 0x50F20000 | 54 | #define CSC_BASE 0x50F20000 |
| 54 | 55 | ||
| 55 | static int (*macfb_setpalette) (unsigned int regno, unsigned int red, | 56 | static int (*macfb_setpalette)(unsigned int regno, unsigned int red, |
| 56 | unsigned int green, unsigned int blue, | 57 | unsigned int green, unsigned int blue, |
| 57 | struct fb_info *info) = NULL; | 58 | struct fb_info *info); |
| 58 | static int dafb_setpalette (unsigned int regno, unsigned int red, | ||
| 59 | unsigned int green, unsigned int blue, | ||
| 60 | struct fb_info *fb_info); | ||
| 61 | static int rbv_setpalette (unsigned int regno, unsigned int red, | ||
| 62 | unsigned int green, unsigned int blue, | ||
| 63 | struct fb_info *fb_info); | ||
| 64 | static int mdc_setpalette (unsigned int regno, unsigned int red, | ||
| 65 | unsigned int green, unsigned int blue, | ||
| 66 | struct fb_info *fb_info); | ||
| 67 | static int toby_setpalette (unsigned int regno, unsigned int red, | ||
| 68 | unsigned int green, unsigned int blue, | ||
| 69 | struct fb_info *fb_info); | ||
| 70 | static int civic_setpalette (unsigned int regno, unsigned int red, | ||
| 71 | unsigned int green, unsigned int blue, | ||
| 72 | struct fb_info *fb_info); | ||
| 73 | static int csc_setpalette (unsigned int regno, unsigned int red, | ||
| 74 | unsigned int green, unsigned int blue, | ||
| 75 | struct fb_info *fb_info); | ||
| 76 | 59 | ||
| 77 | static struct { | 60 | static struct { |
| 78 | unsigned char addr; | 61 | unsigned char addr; |
| @@ -106,15 +89,15 @@ static struct { | |||
| 106 | } __iomem *civic_cmap_regs; | 89 | } __iomem *civic_cmap_regs; |
| 107 | 90 | ||
| 108 | static struct { | 91 | static struct { |
| 109 | char pad1[0x40]; | 92 | char pad1[0x40]; |
| 110 | unsigned char clut_waddr; /* 0x40 */ | 93 | unsigned char clut_waddr; /* 0x40 */ |
| 111 | char pad2; | 94 | char pad2; |
| 112 | unsigned char clut_data; /* 0x42 */ | 95 | unsigned char clut_data; /* 0x42 */ |
| 113 | char pad3[0x3]; | 96 | char pad3[0x3]; |
| 114 | unsigned char clut_raddr; /* 0x46 */ | 97 | unsigned char clut_raddr; /* 0x46 */ |
| 115 | } __iomem *csc_cmap_regs; | 98 | } __iomem *csc_cmap_regs; |
| 116 | 99 | ||
| 117 | /* We will leave these the way they are for the time being */ | 100 | /* The registers in these structs are in NuBus slot space */ |
| 118 | struct mdc_cmap_regs { | 101 | struct mdc_cmap_regs { |
| 119 | char pad1[0x200200]; | 102 | char pad1[0x200200]; |
| 120 | unsigned char addr; | 103 | unsigned char addr; |
| @@ -135,13 +118,12 @@ struct jet_cmap_regs { | |||
| 135 | unsigned char lut; | 118 | unsigned char lut; |
| 136 | }; | 119 | }; |
| 137 | 120 | ||
| 138 | #define PIXEL_TO_MM(a) (((a)*10)/28) /* width in mm at 72 dpi */ | 121 | #define PIXEL_TO_MM(a) (((a)*10)/28) /* width in mm at 72 dpi */ |
| 139 | 122 | ||
| 140 | /* mode */ | ||
| 141 | static int video_slot = 0; | 123 | static int video_slot = 0; |
| 142 | 124 | ||
| 143 | static struct fb_var_screeninfo macfb_defined = { | 125 | static struct fb_var_screeninfo macfb_defined = { |
| 144 | .bits_per_pixel = 8, | 126 | .bits_per_pixel = 8, |
| 145 | .activate = FB_ACTIVATE_NOW, | 127 | .activate = FB_ACTIVATE_NOW, |
| 146 | .width = -1, | 128 | .width = -1, |
| 147 | .height = -1, | 129 | .height = -1, |
| @@ -159,19 +141,19 @@ static struct fb_fix_screeninfo macfb_fix = { | |||
| 159 | 141 | ||
| 160 | static struct fb_info fb_info; | 142 | static struct fb_info fb_info; |
| 161 | static u32 pseudo_palette[16]; | 143 | static u32 pseudo_palette[16]; |
| 162 | static int inverse = 0; | 144 | static int inverse; |
| 163 | static int vidtest = 0; | 145 | static int vidtest; |
| 164 | 146 | ||
| 165 | /* Unlike the Valkyrie, the DAFB cannot set individual colormap | 147 | /* |
| 166 | registers. Therefore, we do what the MacOS driver does (no | 148 | * Unlike the Valkyrie, the DAFB cannot set individual colormap |
| 167 | kidding!) and simply set them one by one until we hit the one we | 149 | * registers. Therefore, we do what the MacOS driver does (no |
| 168 | want. */ | 150 | * kidding!) and simply set them one by one until we hit the one we |
| 169 | static int dafb_setpalette (unsigned int regno, unsigned int red, | 151 | * want. |
| 170 | unsigned int green, unsigned int blue, | 152 | */ |
| 171 | struct fb_info *info) | 153 | static int dafb_setpalette(unsigned int regno, unsigned int red, |
| 154 | unsigned int green, unsigned int blue, | ||
| 155 | struct fb_info *info) | ||
| 172 | { | 156 | { |
| 173 | /* FIXME: really, really need to use ioremap() here, | ||
| 174 | phys_to_virt() doesn't work anymore */ | ||
| 175 | static int lastreg = -1; | 157 | static int lastreg = -1; |
| 176 | unsigned long flags; | 158 | unsigned long flags; |
| 177 | 159 | ||
| @@ -180,42 +162,47 @@ static int dafb_setpalette (unsigned int regno, unsigned int red, | |||
| 180 | blue >>= 8; | 162 | blue >>= 8; |
| 181 | 163 | ||
| 182 | local_irq_save(flags); | 164 | local_irq_save(flags); |
| 183 | 165 | ||
| 184 | /* fbdev will set an entire colourmap, but X won't. Hopefully | 166 | /* |
| 185 | this should accommodate both of them */ | 167 | * fbdev will set an entire colourmap, but X won't. Hopefully |
| 186 | if (regno != lastreg+1) { | 168 | * this should accommodate both of them |
| 169 | */ | ||
| 170 | if (regno != lastreg + 1) { | ||
| 187 | int i; | 171 | int i; |
| 188 | 172 | ||
| 189 | /* Stab in the dark trying to reset the CLUT pointer */ | 173 | /* Stab in the dark trying to reset the CLUT pointer */ |
| 190 | nubus_writel(0, &dafb_cmap_regs->reset); | 174 | nubus_writel(0, &dafb_cmap_regs->reset); |
| 191 | nop(); | 175 | nop(); |
| 192 | 176 | ||
| 193 | /* Loop until we get to the register we want */ | 177 | /* Loop until we get to the register we want */ |
| 194 | for (i = 0; i < regno; i++) { | 178 | for (i = 0; i < regno; i++) { |
| 195 | nubus_writeb(info->cmap.red[i] >> 8, &dafb_cmap_regs->lut); | 179 | nubus_writeb(info->cmap.red[i] >> 8, |
| 180 | &dafb_cmap_regs->lut); | ||
| 196 | nop(); | 181 | nop(); |
| 197 | nubus_writeb(info->cmap.green[i] >> 8, &dafb_cmap_regs->lut); | 182 | nubus_writeb(info->cmap.green[i] >> 8, |
| 183 | &dafb_cmap_regs->lut); | ||
| 198 | nop(); | 184 | nop(); |
| 199 | nubus_writeb(info->cmap.blue[i] >> 8, &dafb_cmap_regs->lut); | 185 | nubus_writeb(info->cmap.blue[i] >> 8, |
| 186 | &dafb_cmap_regs->lut); | ||
| 200 | nop(); | 187 | nop(); |
| 201 | } | 188 | } |
| 202 | } | 189 | } |
| 203 | 190 | ||
| 204 | nubus_writeb(red, &dafb_cmap_regs->lut); | 191 | nubus_writeb(red, &dafb_cmap_regs->lut); |
| 205 | nop(); | 192 | nop(); |
| 206 | nubus_writeb(green, &dafb_cmap_regs->lut); | 193 | nubus_writeb(green, &dafb_cmap_regs->lut); |
| 207 | nop(); | 194 | nop(); |
| 208 | nubus_writeb(blue, &dafb_cmap_regs->lut); | 195 | nubus_writeb(blue, &dafb_cmap_regs->lut); |
| 209 | 196 | ||
| 210 | local_irq_restore(flags); | 197 | local_irq_restore(flags); |
| 211 | lastreg = regno; | 198 | lastreg = regno; |
| 212 | return 0; | 199 | return 0; |
| 213 | } | 200 | } |
| 214 | 201 | ||
| 215 | /* V8 and Brazil seem to use the same DAC. Sonora does as well. */ | 202 | /* V8 and Brazil seem to use the same DAC. Sonora does as well. */ |
| 216 | static int v8_brazil_setpalette (unsigned int regno, unsigned int red, | 203 | static int v8_brazil_setpalette(unsigned int regno, unsigned int red, |
| 217 | unsigned int green, unsigned int blue, | 204 | unsigned int green, unsigned int blue, |
| 218 | struct fb_info *info) | 205 | struct fb_info *info) |
| 219 | { | 206 | { |
| 220 | unsigned int bpp = info->var.bits_per_pixel; | 207 | unsigned int bpp = info->var.bits_per_pixel; |
| 221 | unsigned char _red =red>>8; | 208 | unsigned char _red =red>>8; |
| @@ -224,33 +211,36 @@ static int v8_brazil_setpalette (unsigned int regno, unsigned int red, | |||
| 224 | unsigned char _regno; | 211 | unsigned char _regno; |
| 225 | unsigned long flags; | 212 | unsigned long flags; |
| 226 | 213 | ||
| 227 | if (bpp > 8) return 1; /* failsafe */ | 214 | if (bpp > 8) |
| 215 | return 1; /* failsafe */ | ||
| 228 | 216 | ||
| 229 | local_irq_save(flags); | 217 | local_irq_save(flags); |
| 230 | 218 | ||
| 231 | /* On these chips, the CLUT register numbers are spread out | 219 | /* On these chips, the CLUT register numbers are spread out |
| 232 | across the register space. Thus: | 220 | * across the register space. Thus: |
| 233 | 221 | * In 8bpp, all regnos are valid. | |
| 234 | In 8bpp, all regnos are valid. | 222 | * In 4bpp, the regnos are 0x0f, 0x1f, 0x2f, etc, etc |
| 235 | 223 | * In 2bpp, the regnos are 0x3f, 0x7f, 0xbf, 0xff | |
| 236 | In 4bpp, the regnos are 0x0f, 0x1f, 0x2f, etc, etc | 224 | */ |
| 237 | 225 | _regno = (regno << (8 - bpp)) | (0xFF >> bpp); | |
| 238 | In 2bpp, the regnos are 0x3f, 0x7f, 0xbf, 0xff */ | 226 | nubus_writeb(_regno, &v8_brazil_cmap_regs->addr); |
| 239 | _regno = (regno << (8 - bpp)) | (0xFF >> bpp); | 227 | nop(); |
| 240 | nubus_writeb(_regno, &v8_brazil_cmap_regs->addr); nop(); | ||
| 241 | 228 | ||
| 242 | /* send one color channel at a time */ | 229 | /* send one color channel at a time */ |
| 243 | nubus_writeb(_red, &v8_brazil_cmap_regs->lut); nop(); | 230 | nubus_writeb(_red, &v8_brazil_cmap_regs->lut); |
| 244 | nubus_writeb(_green, &v8_brazil_cmap_regs->lut); nop(); | 231 | nop(); |
| 232 | nubus_writeb(_green, &v8_brazil_cmap_regs->lut); | ||
| 233 | nop(); | ||
| 245 | nubus_writeb(_blue, &v8_brazil_cmap_regs->lut); | 234 | nubus_writeb(_blue, &v8_brazil_cmap_regs->lut); |
| 246 | 235 | ||
| 247 | local_irq_restore(flags); | 236 | local_irq_restore(flags); |
| 248 | return 0; | 237 | return 0; |
| 249 | } | 238 | } |
| 250 | 239 | ||
| 251 | static int rbv_setpalette (unsigned int regno, unsigned int red, | 240 | /* RAM-Based Video */ |
| 252 | unsigned int green, unsigned int blue, | 241 | static int rbv_setpalette(unsigned int regno, unsigned int red, |
| 253 | struct fb_info *info) | 242 | unsigned int green, unsigned int blue, |
| 243 | struct fb_info *info) | ||
| 254 | { | 244 | { |
| 255 | /* use MSBs */ | 245 | /* use MSBs */ |
| 256 | unsigned char _red =red>>8; | 246 | unsigned char _red =red>>8; |
| @@ -259,10 +249,11 @@ static int rbv_setpalette (unsigned int regno, unsigned int red, | |||
| 259 | unsigned char _regno; | 249 | unsigned char _regno; |
| 260 | unsigned long flags; | 250 | unsigned long flags; |
| 261 | 251 | ||
| 262 | if (info->var.bits_per_pixel > 8) return 1; /* failsafe */ | 252 | if (info->var.bits_per_pixel > 8) |
| 253 | return 1; /* failsafe */ | ||
| 263 | 254 | ||
| 264 | local_irq_save(flags); | 255 | local_irq_save(flags); |
| 265 | 256 | ||
| 266 | /* From the VideoToolbox driver. Seems to be saying that | 257 | /* From the VideoToolbox driver. Seems to be saying that |
| 267 | * regno #254 and #255 are the important ones for 1-bit color, | 258 | * regno #254 and #255 are the important ones for 1-bit color, |
| 268 | * regno #252-255 are the important ones for 2-bit color, etc. | 259 | * regno #252-255 are the important ones for 2-bit color, etc. |
| @@ -270,21 +261,25 @@ static int rbv_setpalette (unsigned int regno, unsigned int red, | |||
| 270 | _regno = regno + (256-(1 << info->var.bits_per_pixel)); | 261 | _regno = regno + (256-(1 << info->var.bits_per_pixel)); |
| 271 | 262 | ||
| 272 | /* reset clut? (VideoToolbox sez "not necessary") */ | 263 | /* reset clut? (VideoToolbox sez "not necessary") */ |
| 273 | nubus_writeb(0xFF, &rbv_cmap_regs->cntl); nop(); | 264 | nubus_writeb(0xFF, &rbv_cmap_regs->cntl); |
| 274 | 265 | nop(); | |
| 266 | |||
| 275 | /* tell clut which address to use. */ | 267 | /* tell clut which address to use. */ |
| 276 | nubus_writeb(_regno, &rbv_cmap_regs->addr); nop(); | 268 | nubus_writeb(_regno, &rbv_cmap_regs->addr); |
| 277 | 269 | nop(); | |
| 270 | |||
| 278 | /* send one color channel at a time. */ | 271 | /* send one color channel at a time. */ |
| 279 | nubus_writeb(_red, &rbv_cmap_regs->lut); nop(); | 272 | nubus_writeb(_red, &rbv_cmap_regs->lut); |
| 280 | nubus_writeb(_green, &rbv_cmap_regs->lut); nop(); | 273 | nop(); |
| 281 | nubus_writeb(_blue, &rbv_cmap_regs->lut); | 274 | nubus_writeb(_green, &rbv_cmap_regs->lut); |
| 282 | 275 | nop(); | |
| 283 | local_irq_restore(flags); /* done. */ | 276 | nubus_writeb(_blue, &rbv_cmap_regs->lut); |
| 277 | |||
| 278 | local_irq_restore(flags); | ||
| 284 | return 0; | 279 | return 0; |
| 285 | } | 280 | } |
| 286 | 281 | ||
| 287 | /* Macintosh Display Card (8x24) */ | 282 | /* Macintosh Display Card (8*24) */ |
| 288 | static int mdc_setpalette(unsigned int regno, unsigned int red, | 283 | static int mdc_setpalette(unsigned int regno, unsigned int red, |
| 289 | unsigned int green, unsigned int blue, | 284 | unsigned int green, unsigned int blue, |
| 290 | struct fb_info *info) | 285 | struct fb_info *info) |
| @@ -299,11 +294,14 @@ static int mdc_setpalette(unsigned int regno, unsigned int red, | |||
| 299 | unsigned long flags; | 294 | unsigned long flags; |
| 300 | 295 | ||
| 301 | local_irq_save(flags); | 296 | local_irq_save(flags); |
| 302 | 297 | ||
| 303 | /* the nop's are there to order writes. */ | 298 | /* the nop's are there to order writes. */ |
| 304 | nubus_writeb(_regno, &cmap_regs->addr); nop(); | 299 | nubus_writeb(_regno, &cmap_regs->addr); |
| 305 | nubus_writeb(_red, &cmap_regs->lut); nop(); | 300 | nop(); |
| 306 | nubus_writeb(_green, &cmap_regs->lut); nop(); | 301 | nubus_writeb(_red, &cmap_regs->lut); |
| 302 | nop(); | ||
| 303 | nubus_writeb(_green, &cmap_regs->lut); | ||
| 304 | nop(); | ||
| 307 | nubus_writeb(_blue, &cmap_regs->lut); | 305 | nubus_writeb(_blue, &cmap_regs->lut); |
| 308 | 306 | ||
| 309 | local_irq_restore(flags); | 307 | local_irq_restore(flags); |
| @@ -313,7 +311,7 @@ static int mdc_setpalette(unsigned int regno, unsigned int red, | |||
| 313 | /* Toby frame buffer */ | 311 | /* Toby frame buffer */ |
| 314 | static int toby_setpalette(unsigned int regno, unsigned int red, | 312 | static int toby_setpalette(unsigned int regno, unsigned int red, |
| 315 | unsigned int green, unsigned int blue, | 313 | unsigned int green, unsigned int blue, |
| 316 | struct fb_info *info) | 314 | struct fb_info *info) |
| 317 | { | 315 | { |
| 318 | volatile struct toby_cmap_regs *cmap_regs = | 316 | volatile struct toby_cmap_regs *cmap_regs = |
| 319 | nubus_slot_addr(video_slot); | 317 | nubus_slot_addr(video_slot); |
| @@ -326,10 +324,13 @@ static int toby_setpalette(unsigned int regno, unsigned int red, | |||
| 326 | unsigned long flags; | 324 | unsigned long flags; |
| 327 | 325 | ||
| 328 | local_irq_save(flags); | 326 | local_irq_save(flags); |
| 329 | 327 | ||
| 330 | nubus_writeb(_regno, &cmap_regs->addr); nop(); | 328 | nubus_writeb(_regno, &cmap_regs->addr); |
| 331 | nubus_writeb(_red, &cmap_regs->lut); nop(); | 329 | nop(); |
| 332 | nubus_writeb(_green, &cmap_regs->lut); nop(); | 330 | nubus_writeb(_red, &cmap_regs->lut); |
| 331 | nop(); | ||
| 332 | nubus_writeb(_green, &cmap_regs->lut); | ||
| 333 | nop(); | ||
| 333 | nubus_writeb(_blue, &cmap_regs->lut); | 334 | nubus_writeb(_blue, &cmap_regs->lut); |
| 334 | 335 | ||
| 335 | local_irq_restore(flags); | 336 | local_irq_restore(flags); |
| @@ -350,10 +351,13 @@ static int jet_setpalette(unsigned int regno, unsigned int red, | |||
| 350 | unsigned long flags; | 351 | unsigned long flags; |
| 351 | 352 | ||
| 352 | local_irq_save(flags); | 353 | local_irq_save(flags); |
| 353 | 354 | ||
| 354 | nubus_writeb(regno, &cmap_regs->addr); nop(); | 355 | nubus_writeb(regno, &cmap_regs->addr); |
| 355 | nubus_writeb(_red, &cmap_regs->lut); nop(); | 356 | nop(); |
| 356 | nubus_writeb(_green, &cmap_regs->lut); nop(); | 357 | nubus_writeb(_red, &cmap_regs->lut); |
| 358 | nop(); | ||
| 359 | nubus_writeb(_green, &cmap_regs->lut); | ||
| 360 | nop(); | ||
| 357 | nubus_writeb(_blue, &cmap_regs->lut); | 361 | nubus_writeb(_blue, &cmap_regs->lut); |
| 358 | 362 | ||
| 359 | local_irq_restore(flags); | 363 | local_irq_restore(flags); |
| @@ -363,53 +367,31 @@ static int jet_setpalette(unsigned int regno, unsigned int red, | |||
| 363 | /* | 367 | /* |
| 364 | * Civic framebuffer -- Quadra AV built-in video. A chip | 368 | * Civic framebuffer -- Quadra AV built-in video. A chip |
| 365 | * called Sebastian holds the actual color palettes, and | 369 | * called Sebastian holds the actual color palettes, and |
| 366 | * apparently, there are two different banks of 512K RAM | 370 | * apparently, there are two different banks of 512K RAM |
| 367 | * which can act as separate framebuffers for doing video | 371 | * which can act as separate framebuffers for doing video |
| 368 | * input and viewing the screen at the same time! The 840AV | 372 | * input and viewing the screen at the same time! The 840AV |
| 369 | * Can add another 1MB RAM to give the two framebuffers | 373 | * Can add another 1MB RAM to give the two framebuffers |
| 370 | * 1MB RAM apiece. | 374 | * 1MB RAM apiece. |
| 371 | * | ||
| 372 | * FIXME: this doesn't seem to work anymore. | ||
| 373 | */ | 375 | */ |
| 374 | static int civic_setpalette (unsigned int regno, unsigned int red, | 376 | static int civic_setpalette(unsigned int regno, unsigned int red, |
| 375 | unsigned int green, unsigned int blue, | 377 | unsigned int green, unsigned int blue, |
| 376 | struct fb_info *info) | 378 | struct fb_info *info) |
| 377 | { | 379 | { |
| 378 | static int lastreg = -1; | ||
| 379 | unsigned long flags; | 380 | unsigned long flags; |
| 380 | int clut_status; | 381 | int clut_status; |
| 381 | 382 | ||
| 382 | if (info->var.bits_per_pixel > 8) return 1; /* failsafe */ | 383 | if (info->var.bits_per_pixel > 8) |
| 384 | return 1; /* failsafe */ | ||
| 383 | 385 | ||
| 384 | red >>= 8; | 386 | red >>= 8; |
| 385 | green >>= 8; | 387 | green >>= 8; |
| 386 | blue >>= 8; | 388 | blue >>= 8; |
| 387 | 389 | ||
| 388 | local_irq_save(flags); | 390 | local_irq_save(flags); |
| 389 | |||
| 390 | /* | ||
| 391 | * Set the register address | ||
| 392 | */ | ||
| 393 | nubus_writeb(regno, &civic_cmap_regs->addr); nop(); | ||
| 394 | 391 | ||
| 395 | /* | 392 | /* Set the register address */ |
| 396 | * Wait for VBL interrupt here; | 393 | nubus_writeb(regno, &civic_cmap_regs->addr); |
| 397 | * They're usually not enabled from Penguin, so we won't check | 394 | nop(); |
| 398 | */ | ||
| 399 | #if 0 | ||
| 400 | { | ||
| 401 | #define CIVIC_VBL_OFFSET 0x120 | ||
| 402 | volatile unsigned long *vbl = nubus_readl(civic_cmap_regs->vbl_addr + CIVIC_VBL_OFFSET); | ||
| 403 | /* do interrupt setup stuff here? */ | ||
| 404 | *vbl = 0L; nop(); /* clear */ | ||
| 405 | *vbl = 1L; nop(); /* set */ | ||
| 406 | while (*vbl != 0L) /* wait for next vbl */ | ||
| 407 | { | ||
| 408 | usleep(10); /* needed? */ | ||
| 409 | } | ||
| 410 | /* do interrupt shutdown stuff here? */ | ||
| 411 | } | ||
| 412 | #endif | ||
| 413 | 395 | ||
| 414 | /* | 396 | /* |
| 415 | * Grab a status word and do some checking; | 397 | * Grab a status word and do some checking; |
| @@ -422,39 +404,52 @@ static int civic_setpalette (unsigned int regno, unsigned int red, | |||
| 422 | #if 0 | 404 | #if 0 |
| 423 | if ((clut_status & 0x000D) != 0) | 405 | if ((clut_status & 0x000D) != 0) |
| 424 | { | 406 | { |
| 425 | nubus_writeb(0x00, &civic_cmap_regs->lut); nop(); | 407 | nubus_writeb(0x00, &civic_cmap_regs->lut); |
| 426 | nubus_writeb(0x00, &civic_cmap_regs->lut); nop(); | 408 | nop(); |
| 409 | nubus_writeb(0x00, &civic_cmap_regs->lut); | ||
| 410 | nop(); | ||
| 427 | } | 411 | } |
| 428 | #endif | 412 | #endif |
| 429 | 413 | ||
| 430 | nubus_writeb( red, &civic_cmap_regs->lut); nop(); | 414 | nubus_writeb(red, &civic_cmap_regs->lut); |
| 431 | nubus_writeb(green, &civic_cmap_regs->lut); nop(); | 415 | nop(); |
| 432 | nubus_writeb( blue, &civic_cmap_regs->lut); nop(); | 416 | nubus_writeb(green, &civic_cmap_regs->lut); |
| 433 | nubus_writeb( 0x00, &civic_cmap_regs->lut); nop(); | 417 | nop(); |
| 418 | nubus_writeb(blue, &civic_cmap_regs->lut); | ||
| 419 | nop(); | ||
| 420 | nubus_writeb(0x00, &civic_cmap_regs->lut); | ||
| 434 | } | 421 | } |
| 435 | else | 422 | else |
| 436 | { | 423 | { |
| 437 | unsigned char junk; | 424 | unsigned char junk; |
| 438 | 425 | ||
| 439 | junk = nubus_readb(&civic_cmap_regs->lut); nop(); | 426 | junk = nubus_readb(&civic_cmap_regs->lut); |
| 440 | junk = nubus_readb(&civic_cmap_regs->lut); nop(); | 427 | nop(); |
| 441 | junk = nubus_readb(&civic_cmap_regs->lut); nop(); | 428 | junk = nubus_readb(&civic_cmap_regs->lut); |
| 442 | junk = nubus_readb(&civic_cmap_regs->lut); nop(); | 429 | nop(); |
| 430 | junk = nubus_readb(&civic_cmap_regs->lut); | ||
| 431 | nop(); | ||
| 432 | junk = nubus_readb(&civic_cmap_regs->lut); | ||
| 433 | nop(); | ||
| 443 | 434 | ||
| 444 | if ((clut_status & 0x000D) != 0) | 435 | if ((clut_status & 0x000D) != 0) |
| 445 | { | 436 | { |
| 446 | nubus_writeb(0x00, &civic_cmap_regs->lut); nop(); | 437 | nubus_writeb(0x00, &civic_cmap_regs->lut); |
| 447 | nubus_writeb(0x00, &civic_cmap_regs->lut); nop(); | 438 | nop(); |
| 439 | nubus_writeb(0x00, &civic_cmap_regs->lut); | ||
| 440 | nop(); | ||
| 448 | } | 441 | } |
| 449 | 442 | ||
| 450 | nubus_writeb( red, &civic_cmap_regs->lut); nop(); | 443 | nubus_writeb(red, &civic_cmap_regs->lut); |
| 451 | nubus_writeb(green, &civic_cmap_regs->lut); nop(); | 444 | nop(); |
| 452 | nubus_writeb( blue, &civic_cmap_regs->lut); nop(); | 445 | nubus_writeb(green, &civic_cmap_regs->lut); |
| 453 | nubus_writeb( junk, &civic_cmap_regs->lut); nop(); | 446 | nop(); |
| 447 | nubus_writeb(blue, &civic_cmap_regs->lut); | ||
| 448 | nop(); | ||
| 449 | nubus_writeb(junk, &civic_cmap_regs->lut); | ||
| 454 | } | 450 | } |
| 455 | 451 | ||
| 456 | local_irq_restore(flags); | 452 | local_irq_restore(flags); |
| 457 | lastreg = regno; | ||
| 458 | return 0; | 453 | return 0; |
| 459 | } | 454 | } |
| 460 | 455 | ||
| @@ -463,10 +458,9 @@ static int civic_setpalette (unsigned int regno, unsigned int red, | |||
| 463 | * (and the 5300 too, but that's a PowerMac). This function | 458 | * (and the 5300 too, but that's a PowerMac). This function |
| 464 | * brought to you in part by the ECSC driver for MkLinux. | 459 | * brought to you in part by the ECSC driver for MkLinux. |
| 465 | */ | 460 | */ |
| 466 | 461 | static int csc_setpalette(unsigned int regno, unsigned int red, | |
| 467 | static int csc_setpalette (unsigned int regno, unsigned int red, | 462 | unsigned int green, unsigned int blue, |
| 468 | unsigned int green, unsigned int blue, | 463 | struct fb_info *info) |
| 469 | struct fb_info *info) | ||
| 470 | { | 464 | { |
| 471 | mdelay(1); | 465 | mdelay(1); |
| 472 | nubus_writeb(regno, &csc_cmap_regs->clut_waddr); | 466 | nubus_writeb(regno, &csc_cmap_regs->clut_waddr); |
| @@ -481,10 +475,10 @@ static int macfb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
| 481 | struct fb_info *fb_info) | 475 | struct fb_info *fb_info) |
| 482 | { | 476 | { |
| 483 | /* | 477 | /* |
| 484 | * Set a single color register. The values supplied are | 478 | * Set a single color register. The values supplied are |
| 485 | * already rounded down to the hardware's capabilities | 479 | * already rounded down to the hardware's capabilities |
| 486 | * (according to the entries in the `var' structure). Return | 480 | * (according to the entries in the `var' structure). |
| 487 | * != 0 for invalid regno. | 481 | * Return non-zero for invalid regno. |
| 488 | */ | 482 | */ |
| 489 | 483 | ||
| 490 | if (regno >= fb_info->cmap.len) | 484 | if (regno >= fb_info->cmap.len) |
| @@ -518,28 +512,22 @@ static int macfb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
| 518 | } else { | 512 | } else { |
| 519 | /* 0:5:6:5 */ | 513 | /* 0:5:6:5 */ |
| 520 | ((u32*) (fb_info->pseudo_palette))[regno] = | 514 | ((u32*) (fb_info->pseudo_palette))[regno] = |
| 521 | ((red & 0xf800) ) | | 515 | ((red & 0xf800) >> 0) | |
| 522 | ((green & 0xfc00) >> 5) | | 516 | ((green & 0xfc00) >> 5) | |
| 523 | ((blue & 0xf800) >> 11); | 517 | ((blue & 0xf800) >> 11); |
| 524 | } | 518 | } |
| 525 | break; | 519 | break; |
| 526 | /* I'm pretty sure that one or the other of these | 520 | /* |
| 527 | doesn't exist on 68k Macs */ | 521 | * 24-bit colour almost doesn't exist on 68k Macs -- |
| 522 | * http://support.apple.com/kb/TA28634 (Old Article: 10992) | ||
| 523 | */ | ||
| 528 | case 24: | 524 | case 24: |
| 529 | red >>= 8; | ||
| 530 | green >>= 8; | ||
| 531 | blue >>= 8; | ||
| 532 | ((u32 *)(fb_info->pseudo_palette))[regno] = | ||
| 533 | (red << fb_info->var.red.offset) | | ||
| 534 | (green << fb_info->var.green.offset) | | ||
| 535 | (blue << fb_info->var.blue.offset); | ||
| 536 | break; | ||
| 537 | case 32: | 525 | case 32: |
| 538 | red >>= 8; | 526 | red >>= 8; |
| 539 | green >>= 8; | 527 | green >>= 8; |
| 540 | blue >>= 8; | 528 | blue >>= 8; |
| 541 | ((u32 *)(fb_info->pseudo_palette))[regno] = | 529 | ((u32 *)(fb_info->pseudo_palette))[regno] = |
| 542 | (red << fb_info->var.red.offset) | | 530 | (red << fb_info->var.red.offset) | |
| 543 | (green << fb_info->var.green.offset) | | 531 | (green << fb_info->var.green.offset) | |
| 544 | (blue << fb_info->var.blue.offset); | 532 | (blue << fb_info->var.blue.offset); |
| 545 | break; | 533 | break; |
| @@ -560,18 +548,19 @@ static struct fb_ops macfb_ops = { | |||
| 560 | static void __init macfb_setup(char *options) | 548 | static void __init macfb_setup(char *options) |
| 561 | { | 549 | { |
| 562 | char *this_opt; | 550 | char *this_opt; |
| 563 | 551 | ||
| 564 | if (!options || !*options) | 552 | if (!options || !*options) |
| 565 | return; | 553 | return; |
| 566 | 554 | ||
| 567 | while ((this_opt = strsep(&options, ",")) != NULL) { | 555 | while ((this_opt = strsep(&options, ",")) != NULL) { |
| 568 | if (!*this_opt) continue; | 556 | if (!*this_opt) |
| 569 | 557 | continue; | |
| 570 | if (! strcmp(this_opt, "inverse")) | 558 | |
| 571 | inverse=1; | 559 | if (!strcmp(this_opt, "inverse")) |
| 572 | /* This means "turn on experimental CLUT code" */ | 560 | inverse = 1; |
| 573 | else if (!strcmp(this_opt, "vidtest")) | 561 | else |
| 574 | vidtest=1; | 562 | if (!strcmp(this_opt, "vidtest")) |
| 563 | vidtest = 1; /* enable experimental CLUT code */ | ||
| 575 | } | 564 | } |
| 576 | } | 565 | } |
| 577 | 566 | ||
| @@ -607,48 +596,52 @@ static int __init macfb_init(void) | |||
| 607 | mac_bi_data.id == MAC_MODEL_P588) | 596 | mac_bi_data.id == MAC_MODEL_P588) |
| 608 | return -ENODEV; /* See valkyriefb.c */ | 597 | return -ENODEV; /* See valkyriefb.c */ |
| 609 | 598 | ||
| 610 | /* There can only be one internal video controller anyway so | ||
| 611 | we're not too worried about this */ | ||
| 612 | macfb_defined.xres = mac_bi_data.dimensions & 0xFFFF; | 599 | macfb_defined.xres = mac_bi_data.dimensions & 0xFFFF; |
| 613 | macfb_defined.yres = mac_bi_data.dimensions >> 16; | 600 | macfb_defined.yres = mac_bi_data.dimensions >> 16; |
| 614 | macfb_defined.bits_per_pixel = mac_bi_data.videodepth; | 601 | macfb_defined.bits_per_pixel = mac_bi_data.videodepth; |
| 602 | |||
| 615 | macfb_fix.line_length = mac_bi_data.videorow; | 603 | macfb_fix.line_length = mac_bi_data.videorow; |
| 616 | macfb_fix.smem_len = macfb_fix.line_length * macfb_defined.yres; | 604 | macfb_fix.smem_len = macfb_fix.line_length * macfb_defined.yres; |
| 617 | /* Note: physical address (since 2.1.127) */ | 605 | /* Note: physical address (since 2.1.127) */ |
| 618 | macfb_fix.smem_start = mac_bi_data.videoaddr; | 606 | macfb_fix.smem_start = mac_bi_data.videoaddr; |
| 619 | /* This is actually redundant with the initial mappings. | 607 | |
| 620 | However, there are some non-obvious aspects to the way | 608 | /* |
| 621 | those mappings are set up, so this is in fact the safest | 609 | * This is actually redundant with the initial mappings. |
| 622 | way to ensure that this driver will work on every possible | 610 | * However, there are some non-obvious aspects to the way |
| 623 | Mac */ | 611 | * those mappings are set up, so this is in fact the safest |
| 612 | * way to ensure that this driver will work on every possible Mac | ||
| 613 | */ | ||
| 624 | fb_info.screen_base = ioremap(mac_bi_data.videoaddr, macfb_fix.smem_len); | 614 | fb_info.screen_base = ioremap(mac_bi_data.videoaddr, macfb_fix.smem_len); |
| 625 | 615 | ||
| 626 | printk("macfb: framebuffer at 0x%08lx, mapped to 0x%p, size %dk\n", | 616 | printk("macfb: framebuffer at 0x%08lx, mapped to 0x%p, size %dk\n", |
| 627 | macfb_fix.smem_start, fb_info.screen_base, macfb_fix.smem_len/1024); | 617 | macfb_fix.smem_start, fb_info.screen_base, |
| 618 | macfb_fix.smem_len / 1024); | ||
| 628 | printk("macfb: mode is %dx%dx%d, linelength=%d\n", | 619 | printk("macfb: mode is %dx%dx%d, linelength=%d\n", |
| 629 | macfb_defined.xres, macfb_defined.yres, macfb_defined.bits_per_pixel, macfb_fix.line_length); | 620 | macfb_defined.xres, macfb_defined.yres, |
| 630 | 621 | macfb_defined.bits_per_pixel, macfb_fix.line_length); | |
| 622 | |||
| 631 | /* | 623 | /* |
| 632 | * Fill in the available video resolution | 624 | * Fill in the available video resolution |
| 633 | */ | 625 | */ |
| 634 | 626 | macfb_defined.xres_virtual = macfb_defined.xres; | |
| 635 | macfb_defined.xres_virtual = macfb_defined.xres; | 627 | macfb_defined.yres_virtual = macfb_defined.yres; |
| 636 | macfb_defined.yres_virtual = macfb_defined.yres; | 628 | macfb_defined.height = PIXEL_TO_MM(macfb_defined.yres); |
| 637 | macfb_defined.height = PIXEL_TO_MM(macfb_defined.yres); | 629 | macfb_defined.width = PIXEL_TO_MM(macfb_defined.xres); |
| 638 | macfb_defined.width = PIXEL_TO_MM(macfb_defined.xres); | ||
| 639 | 630 | ||
| 640 | printk("macfb: scrolling: redraw\n"); | 631 | printk("macfb: scrolling: redraw\n"); |
| 641 | macfb_defined.yres_virtual = macfb_defined.yres; | ||
| 642 | 632 | ||
| 643 | /* some dummy values for timing to make fbset happy */ | 633 | /* some dummy values for timing to make fbset happy */ |
| 644 | macfb_defined.pixclock = 10000000 / macfb_defined.xres * 1000 / macfb_defined.yres; | 634 | macfb_defined.pixclock = 10000000 / macfb_defined.xres * |
| 635 | 1000 / macfb_defined.yres; | ||
| 645 | macfb_defined.left_margin = (macfb_defined.xres / 8) & 0xf8; | 636 | macfb_defined.left_margin = (macfb_defined.xres / 8) & 0xf8; |
| 646 | macfb_defined.hsync_len = (macfb_defined.xres / 8) & 0xf8; | 637 | macfb_defined.hsync_len = (macfb_defined.xres / 8) & 0xf8; |
| 647 | 638 | ||
| 648 | switch (macfb_defined.bits_per_pixel) { | 639 | switch (macfb_defined.bits_per_pixel) { |
| 649 | case 1: | 640 | case 1: |
| 650 | /* XXX: I think this will catch any program that tries | 641 | /* |
| 651 | to do FBIO_PUTCMAP when the visual is monochrome */ | 642 | * XXX: I think this will catch any program that tries |
| 643 | * to do FBIO_PUTCMAP when the visual is monochrome. | ||
| 644 | */ | ||
| 652 | macfb_defined.red.length = macfb_defined.bits_per_pixel; | 645 | macfb_defined.red.length = macfb_defined.bits_per_pixel; |
| 653 | macfb_defined.green.length = macfb_defined.bits_per_pixel; | 646 | macfb_defined.green.length = macfb_defined.bits_per_pixel; |
| 654 | macfb_defined.blue.length = macfb_defined.bits_per_pixel; | 647 | macfb_defined.blue.length = macfb_defined.bits_per_pixel; |
| @@ -676,14 +669,14 @@ static int __init macfb_init(void) | |||
| 676 | printk("macfb: directcolor: " | 669 | printk("macfb: directcolor: " |
| 677 | "size=1:5:5:5, shift=15:10:5:0\n"); | 670 | "size=1:5:5:5, shift=15:10:5:0\n"); |
| 678 | video_cmap_len = 16; | 671 | video_cmap_len = 16; |
| 679 | /* Should actually be FB_VISUAL_DIRECTCOLOR, but this | 672 | /* |
| 680 | works too */ | 673 | * Should actually be FB_VISUAL_DIRECTCOLOR, but this |
| 674 | * works too | ||
| 675 | */ | ||
| 681 | macfb_fix.visual = FB_VISUAL_TRUECOLOR; | 676 | macfb_fix.visual = FB_VISUAL_TRUECOLOR; |
| 682 | break; | 677 | break; |
| 683 | case 24: | 678 | case 24: |
| 684 | case 32: | 679 | case 32: |
| 685 | /* XXX: have to test these... can any 68k Macs | ||
| 686 | actually do this on internal video? */ | ||
| 687 | macfb_defined.red.offset = 16; | 680 | macfb_defined.red.offset = 16; |
| 688 | macfb_defined.red.length = 8; | 681 | macfb_defined.red.length = 8; |
| 689 | macfb_defined.green.offset = 8; | 682 | macfb_defined.green.offset = 8; |
| @@ -697,18 +690,19 @@ static int __init macfb_init(void) | |||
| 697 | default: | 690 | default: |
| 698 | video_cmap_len = 0; | 691 | video_cmap_len = 0; |
| 699 | macfb_fix.visual = FB_VISUAL_MONO01; | 692 | macfb_fix.visual = FB_VISUAL_MONO01; |
| 700 | printk("macfb: unknown or unsupported bit depth: %d\n", macfb_defined.bits_per_pixel); | 693 | printk("macfb: unknown or unsupported bit depth: %d\n", |
| 694 | macfb_defined.bits_per_pixel); | ||
| 701 | break; | 695 | break; |
| 702 | } | 696 | } |
| 703 | 697 | ||
| 704 | /* Hardware dependent stuff */ | 698 | /* |
| 705 | /* We take a wild guess that if the video physical address is | 699 | * We take a wild guess that if the video physical address is |
| 706 | * in nubus slot space, that the nubus card is driving video. | 700 | * in nubus slot space, that the nubus card is driving video. |
| 707 | * Penguin really ought to tell us whether we are using internal | 701 | * Penguin really ought to tell us whether we are using internal |
| 708 | * video or not. | 702 | * video or not. |
| 703 | * Hopefully we only find one of them. Otherwise our NuBus | ||
| 704 | * code is really broken :-) | ||
| 709 | */ | 705 | */ |
| 710 | /* Hopefully we only find one of them. Otherwise our NuBus | ||
| 711 | code is really broken :-) */ | ||
| 712 | 706 | ||
| 713 | while ((ndev = nubus_find_type(NUBUS_CAT_DISPLAY, NUBUS_TYPE_VIDEO, ndev)) | 707 | while ((ndev = nubus_find_type(NUBUS_CAT_DISPLAY, NUBUS_TYPE_VIDEO, ndev)) |
| 714 | != NULL) | 708 | != NULL) |
| @@ -736,7 +730,7 @@ static int __init macfb_init(void) | |||
| 736 | strcpy(macfb_fix.id, "Jet"); | 730 | strcpy(macfb_fix.id, "Jet"); |
| 737 | macfb_setpalette = jet_setpalette; | 731 | macfb_setpalette = jet_setpalette; |
| 738 | macfb_defined.activate = FB_ACTIVATE_NOW; | 732 | macfb_defined.activate = FB_ACTIVATE_NOW; |
| 739 | break; | 733 | break; |
| 740 | default: | 734 | default: |
| 741 | strcpy(macfb_fix.id, "Generic NuBus"); | 735 | strcpy(macfb_fix.id, "Generic NuBus"); |
| 742 | break; | 736 | break; |
| @@ -744,20 +738,19 @@ static int __init macfb_init(void) | |||
| 744 | } | 738 | } |
| 745 | 739 | ||
| 746 | /* If it's not a NuBus card, it must be internal video */ | 740 | /* If it's not a NuBus card, it must be internal video */ |
| 747 | /* FIXME: this function is getting way too big. (this driver | ||
| 748 | is too...) */ | ||
| 749 | if (!video_is_nubus) | 741 | if (!video_is_nubus) |
| 750 | switch( mac_bi_data.id ) | 742 | switch (mac_bi_data.id) { |
| 751 | { | 743 | /* |
| 752 | /* DAFB Quadras */ | 744 | * DAFB Quadras |
| 753 | /* Note: these first four have the v7 DAFB, which is | 745 | * Note: these first four have the v7 DAFB, which is |
| 754 | known to be rather unlike the ones used in the | 746 | * known to be rather unlike the ones used in the |
| 755 | other models */ | 747 | * other models |
| 748 | */ | ||
| 756 | case MAC_MODEL_P475: | 749 | case MAC_MODEL_P475: |
| 757 | case MAC_MODEL_P475F: | 750 | case MAC_MODEL_P475F: |
| 758 | case MAC_MODEL_P575: | 751 | case MAC_MODEL_P575: |
| 759 | case MAC_MODEL_Q605: | 752 | case MAC_MODEL_Q605: |
| 760 | 753 | ||
| 761 | case MAC_MODEL_Q800: | 754 | case MAC_MODEL_Q800: |
| 762 | case MAC_MODEL_Q650: | 755 | case MAC_MODEL_Q650: |
| 763 | case MAC_MODEL_Q610: | 756 | case MAC_MODEL_Q610: |
| @@ -772,17 +765,21 @@ static int __init macfb_init(void) | |||
| 772 | dafb_cmap_regs = ioremap(DAFB_BASE, 0x1000); | 765 | dafb_cmap_regs = ioremap(DAFB_BASE, 0x1000); |
| 773 | break; | 766 | break; |
| 774 | 767 | ||
| 775 | /* LC II uses the V8 framebuffer */ | 768 | /* |
| 769 | * LC II uses the V8 framebuffer | ||
| 770 | */ | ||
| 776 | case MAC_MODEL_LCII: | 771 | case MAC_MODEL_LCII: |
| 777 | strcpy(macfb_fix.id, "V8"); | 772 | strcpy(macfb_fix.id, "V8"); |
| 778 | macfb_setpalette = v8_brazil_setpalette; | 773 | macfb_setpalette = v8_brazil_setpalette; |
| 779 | macfb_defined.activate = FB_ACTIVATE_NOW; | 774 | macfb_defined.activate = FB_ACTIVATE_NOW; |
| 780 | v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000); | 775 | v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000); |
| 781 | break; | 776 | break; |
| 782 | 777 | ||
| 783 | /* IIvi, IIvx use the "Brazil" framebuffer (which is | 778 | /* |
| 784 | very much like the V8, it seems, and probably uses | 779 | * IIvi, IIvx use the "Brazil" framebuffer (which is |
| 785 | the same DAC) */ | 780 | * very much like the V8, it seems, and probably uses |
| 781 | * the same DAC) | ||
| 782 | */ | ||
| 786 | case MAC_MODEL_IIVI: | 783 | case MAC_MODEL_IIVI: |
| 787 | case MAC_MODEL_IIVX: | 784 | case MAC_MODEL_IIVX: |
| 788 | case MAC_MODEL_P600: | 785 | case MAC_MODEL_P600: |
| @@ -791,12 +788,14 @@ static int __init macfb_init(void) | |||
| 791 | macfb_defined.activate = FB_ACTIVATE_NOW; | 788 | macfb_defined.activate = FB_ACTIVATE_NOW; |
| 792 | v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000); | 789 | v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000); |
| 793 | break; | 790 | break; |
| 794 | 791 | ||
| 795 | /* LC III (and friends) use the Sonora framebuffer */ | 792 | /* |
| 796 | /* Incidentally this is also used in the non-AV models | 793 | * LC III (and friends) use the Sonora framebuffer |
| 797 | of the x100 PowerMacs */ | 794 | * Incidentally this is also used in the non-AV models |
| 798 | /* These do in fact seem to use the same DAC interface | 795 | * of the x100 PowerMacs |
| 799 | as the LC II. */ | 796 | * These do in fact seem to use the same DAC interface |
| 797 | * as the LC II. | ||
| 798 | */ | ||
| 800 | case MAC_MODEL_LCIII: | 799 | case MAC_MODEL_LCIII: |
| 801 | case MAC_MODEL_P520: | 800 | case MAC_MODEL_P520: |
| 802 | case MAC_MODEL_P550: | 801 | case MAC_MODEL_P550: |
| @@ -807,9 +806,11 @@ static int __init macfb_init(void) | |||
| 807 | v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000); | 806 | v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000); |
| 808 | break; | 807 | break; |
| 809 | 808 | ||
| 810 | /* IIci and IIsi use the infamous RBV chip | 809 | /* |
| 811 | (the IIsi is just a rebadged and crippled | 810 | * IIci and IIsi use the infamous RBV chip |
| 812 | IIci in a different case, BTW) */ | 811 | * (the IIsi is just a rebadged and crippled |
| 812 | * IIci in a different case, BTW) | ||
| 813 | */ | ||
| 813 | case MAC_MODEL_IICI: | 814 | case MAC_MODEL_IICI: |
| 814 | case MAC_MODEL_IISI: | 815 | case MAC_MODEL_IISI: |
| 815 | macfb_setpalette = rbv_setpalette; | 816 | macfb_setpalette = rbv_setpalette; |
| @@ -818,7 +819,9 @@ static int __init macfb_init(void) | |||
| 818 | rbv_cmap_regs = ioremap(DAC_BASE, 0x1000); | 819 | rbv_cmap_regs = ioremap(DAC_BASE, 0x1000); |
| 819 | break; | 820 | break; |
| 820 | 821 | ||
| 821 | /* AVs use the Civic framebuffer */ | 822 | /* |
| 823 | * AVs use the Civic framebuffer | ||
| 824 | */ | ||
| 822 | case MAC_MODEL_Q840: | 825 | case MAC_MODEL_Q840: |
| 823 | case MAC_MODEL_C660: | 826 | case MAC_MODEL_C660: |
| 824 | macfb_setpalette = civic_setpalette; | 827 | macfb_setpalette = civic_setpalette; |
| @@ -828,15 +831,10 @@ static int __init macfb_init(void) | |||
| 828 | break; | 831 | break; |
| 829 | 832 | ||
| 830 | 833 | ||
| 831 | /* Write a setpalette function for your machine, then | 834 | /* |
| 832 | you can add something similar here. These are | 835 | * Assorted weirdos |
| 833 | grouped by classes of video chipsets. Some of this | 836 | * We think this may be like the LC II |
| 834 | information is from the VideoToolbox "Bugs" web | 837 | */ |
| 835 | page at | ||
| 836 | http://rajsky.psych.nyu.edu/Tips/VideoBugs.html */ | ||
| 837 | |||
| 838 | /* Assorted weirdos */ | ||
| 839 | /* We think this may be like the LC II */ | ||
| 840 | case MAC_MODEL_LC: | 838 | case MAC_MODEL_LC: |
| 841 | if (vidtest) { | 839 | if (vidtest) { |
| 842 | macfb_setpalette = v8_brazil_setpalette; | 840 | macfb_setpalette = v8_brazil_setpalette; |
| @@ -846,7 +844,10 @@ static int __init macfb_init(void) | |||
| 846 | } | 844 | } |
| 847 | strcpy(macfb_fix.id, "LC"); | 845 | strcpy(macfb_fix.id, "LC"); |
| 848 | break; | 846 | break; |
| 849 | /* We think this may be like the LC II */ | 847 | |
| 848 | /* | ||
| 849 | * We think this may be like the LC II | ||
| 850 | */ | ||
| 850 | case MAC_MODEL_CCL: | 851 | case MAC_MODEL_CCL: |
| 851 | if (vidtest) { | 852 | if (vidtest) { |
| 852 | macfb_setpalette = v8_brazil_setpalette; | 853 | macfb_setpalette = v8_brazil_setpalette; |
| @@ -857,23 +858,29 @@ static int __init macfb_init(void) | |||
| 857 | strcpy(macfb_fix.id, "Color Classic"); | 858 | strcpy(macfb_fix.id, "Color Classic"); |
| 858 | break; | 859 | break; |
| 859 | 860 | ||
| 860 | /* And we *do* mean "weirdos" */ | 861 | /* |
| 862 | * And we *do* mean "weirdos" | ||
| 863 | */ | ||
| 861 | case MAC_MODEL_TV: | 864 | case MAC_MODEL_TV: |
| 862 | strcpy(macfb_fix.id, "Mac TV"); | 865 | strcpy(macfb_fix.id, "Mac TV"); |
| 863 | break; | 866 | break; |
| 864 | 867 | ||
| 865 | /* These don't have colour, so no need to worry */ | 868 | /* |
| 869 | * These don't have colour, so no need to worry | ||
| 870 | */ | ||
| 866 | case MAC_MODEL_SE30: | 871 | case MAC_MODEL_SE30: |
| 867 | case MAC_MODEL_CLII: | 872 | case MAC_MODEL_CLII: |
| 868 | strcpy(macfb_fix.id, "Monochrome"); | 873 | strcpy(macfb_fix.id, "Monochrome"); |
| 869 | break; | 874 | break; |
| 870 | 875 | ||
| 871 | /* Powerbooks are particularly difficult. Many of | 876 | /* |
| 872 | them have separate framebuffers for external and | 877 | * Powerbooks are particularly difficult. Many of |
| 873 | internal video, which is admittedly pretty cool, | 878 | * them have separate framebuffers for external and |
| 874 | but will be a bit of a headache to support here. | 879 | * internal video, which is admittedly pretty cool, |
| 875 | Also, many of them are grayscale, and we don't | 880 | * but will be a bit of a headache to support here. |
| 876 | really support that. */ | 881 | * Also, many of them are grayscale, and we don't |
| 882 | * really support that. | ||
| 883 | */ | ||
| 877 | 884 | ||
| 878 | case MAC_MODEL_PB140: | 885 | case MAC_MODEL_PB140: |
| 879 | case MAC_MODEL_PB145: | 886 | case MAC_MODEL_PB145: |
| @@ -881,7 +888,9 @@ static int __init macfb_init(void) | |||
| 881 | strcpy(macfb_fix.id, "DDC"); | 888 | strcpy(macfb_fix.id, "DDC"); |
| 882 | break; | 889 | break; |
| 883 | 890 | ||
| 884 | /* Internal is GSC, External (if present) is ViSC */ | 891 | /* |
| 892 | * Internal is GSC, External (if present) is ViSC | ||
| 893 | */ | ||
| 885 | case MAC_MODEL_PB150: /* no external video */ | 894 | case MAC_MODEL_PB150: /* no external video */ |
| 886 | case MAC_MODEL_PB160: | 895 | case MAC_MODEL_PB160: |
| 887 | case MAC_MODEL_PB165: | 896 | case MAC_MODEL_PB165: |
| @@ -891,13 +900,17 @@ static int __init macfb_init(void) | |||
| 891 | strcpy(macfb_fix.id, "GSC"); | 900 | strcpy(macfb_fix.id, "GSC"); |
| 892 | break; | 901 | break; |
| 893 | 902 | ||
| 894 | /* Internal is TIM, External is ViSC */ | 903 | /* |
| 904 | * Internal is TIM, External is ViSC | ||
| 905 | */ | ||
| 895 | case MAC_MODEL_PB165C: | 906 | case MAC_MODEL_PB165C: |
| 896 | case MAC_MODEL_PB180C: | 907 | case MAC_MODEL_PB180C: |
| 897 | strcpy(macfb_fix.id, "TIM"); | 908 | strcpy(macfb_fix.id, "TIM"); |
| 898 | break; | 909 | break; |
| 899 | 910 | ||
| 900 | /* Internal is CSC, External is Keystone+Ariel. */ | 911 | /* |
| 912 | * Internal is CSC, External is Keystone+Ariel. | ||
| 913 | */ | ||
| 901 | case MAC_MODEL_PB190: /* external video is optional */ | 914 | case MAC_MODEL_PB190: /* external video is optional */ |
| 902 | case MAC_MODEL_PB520: | 915 | case MAC_MODEL_PB520: |
| 903 | case MAC_MODEL_PB250: | 916 | case MAC_MODEL_PB250: |
| @@ -909,7 +922,7 @@ static int __init macfb_init(void) | |||
| 909 | strcpy(macfb_fix.id, "CSC"); | 922 | strcpy(macfb_fix.id, "CSC"); |
| 910 | csc_cmap_regs = ioremap(CSC_BASE, 0x1000); | 923 | csc_cmap_regs = ioremap(CSC_BASE, 0x1000); |
| 911 | break; | 924 | break; |
| 912 | 925 | ||
| 913 | default: | 926 | default: |
| 914 | strcpy(macfb_fix.id, "Unknown"); | 927 | strcpy(macfb_fix.id, "Unknown"); |
| 915 | break; | 928 | break; |
| @@ -924,7 +937,7 @@ static int __init macfb_init(void) | |||
| 924 | err = fb_alloc_cmap(&fb_info.cmap, video_cmap_len, 0); | 937 | err = fb_alloc_cmap(&fb_info.cmap, video_cmap_len, 0); |
| 925 | if (err) | 938 | if (err) |
| 926 | goto fail_unmap; | 939 | goto fail_unmap; |
| 927 | 940 | ||
| 928 | err = register_framebuffer(&fb_info); | 941 | err = register_framebuffer(&fb_info); |
| 929 | if (err) | 942 | if (err) |
| 930 | goto fail_dealloc; | 943 | goto fail_dealloc; |
