2  *  linux/drivers/video/acornfb.c
 
   4  *  Copyright (C) 1998-2001 Russell King
 
   6  * This program is free software; you can redistribute it and/or modify
 
   7  * it under the terms of the GNU General Public License version 2 as
 
   8  * published by the Free Software Foundation.
 
  10  * Frame buffer code for Acorn platforms
 
  12  * NOTE: Most of the modes with X!=640 will disappear shortly.
 
  13  * NOTE: Startup setting of HS & VS polarity not supported.
 
  14  *       (do we need to support it if we're coming up in 640x480?)
 
  16  * FIXME: (things broken by the "new improved" FBCON API)
 
  17  *  - Blanking 8bpp displays with VIDC
 
  20 #include <linux/config.h>
 
  21 #include <linux/module.h>
 
  22 #include <linux/kernel.h>
 
  23 #include <linux/errno.h>
 
  24 #include <linux/string.h>
 
  25 #include <linux/ctype.h>
 
  26 #include <linux/slab.h>
 
  27 #include <linux/init.h>
 
  29 #include <linux/platform_device.h>
 
  30 #include <linux/dma-mapping.h>
 
  32 #include <asm/hardware.h>
 
  35 #include <asm/mach-types.h>
 
  36 #include <asm/pgtable.h>
 
  41  * VIDC machines can't do 16 or 32BPP modes.
 
  44 #undef FBCON_HAS_CFB16
 
  45 #undef FBCON_HAS_CFB32
 
  50  * NOTE that it has to be supported in the table towards
 
  51  * the end of this file.
 
  53 #define DEFAULT_XRES    640
 
  54 #define DEFAULT_YRES    480
 
  58  * define this to debug the video mode selection
 
  60 #undef DEBUG_MODE_SELECTION
 
  63  * Translation from RISC OS monitor types to actual
 
  64  * HSYNC and VSYNC frequency ranges.  These are
 
  65  * probably not right, but they're the best info I
 
  66  * have.  Allow 1% either way on the nominal for TVs.
 
  69 static struct fb_monspecs monspecs[NR_MONTYPES] __initdata = {
 
  80         }, {    /* Hi-res mono  */
 
 103 static struct fb_info fb_info;
 
 104 static struct acornfb_par current_par;
 
 105 static struct vidc_timing current_vidc;
 
 107 extern unsigned int vram_size;  /* set by setup.c */
 
 111 #define MAX_SIZE        480*1024
 
 134 static struct pixclock arc_clocks[] = {
 
 135         /* we allow +/-1% on these */
 
 136         { 123750, 126250, VIDC_CTRL_DIV3,   VID_CTL_24MHz },    /*  8.000MHz */
 
 137         {  82500,  84167, VIDC_CTRL_DIV2,   VID_CTL_24MHz },    /* 12.000MHz */
 
 138         {  61875,  63125, VIDC_CTRL_DIV1_5, VID_CTL_24MHz },    /* 16.000MHz */
 
 139         {  41250,  42083, VIDC_CTRL_DIV1,   VID_CTL_24MHz },    /* 24.000MHz */
 
 142 #ifdef CONFIG_ARCH_A5K
 
 143 static struct pixclock a5k_clocks[] = {
 
 144         { 117974, 120357, VIDC_CTRL_DIV3,   VID_CTL_25MHz },    /*  8.392MHz */
 
 145         {  78649,  80238, VIDC_CTRL_DIV2,   VID_CTL_25MHz },    /* 12.588MHz */
 
 146         {  58987,  60178, VIDC_CTRL_DIV1_5, VID_CTL_25MHz },    /* 16.588MHz */
 
 147         {  55000,  56111, VIDC_CTRL_DIV2,   VID_CTL_36MHz },    /* 18.000MHz */
 
 148         {  39325,  40119, VIDC_CTRL_DIV1,   VID_CTL_25MHz },    /* 25.175MHz */
 
 149         {  27500,  28055, VIDC_CTRL_DIV1,   VID_CTL_36MHz },    /* 36.000MHz */
 
 153 static struct pixclock *
 
 154 acornfb_valid_pixrate(struct fb_var_screeninfo *var)
 
 156         u_long pixclock = var->pixclock;
 
 162         for (i = 0; i < ARRAY_SIZE(arc_clocks); i++)
 
 163                 if (pixclock > arc_clocks[i].min_clock &&
 
 164                     pixclock < arc_clocks[i].max_clock)
 
 165                         return arc_clocks + i;
 
 167 #ifdef CONFIG_ARCH_A5K
 
 168         if (machine_is_a5k()) {
 
 169                 for (i = 0; i < ARRAY_SIZE(a5k_clocks); i++)
 
 170                         if (pixclock > a5k_clocks[i].min_clock &&
 
 171                             pixclock < a5k_clocks[i].max_clock)
 
 172                                 return a5k_clocks + i;
 
 180  * hcr  : must be even (interlace, hcr/2 must be even)
 
 181  * hswr : must be even
 
 189  * if interlaced, then hcr/2 must be even
 
 192 acornfb_set_timing(struct fb_var_screeninfo *var)
 
 194         struct pixclock *pclk;
 
 195         struct vidc_timing vidc;
 
 196         u_int horiz_correction;
 
 197         u_int sync_len, display_start, display_end, cycle;
 
 199         u_int vid_ctl, vidc_ctl;
 
 202         memset(&vidc, 0, sizeof(vidc));
 
 204         pclk = acornfb_valid_pixrate(var);
 
 205         vidc_ctl = pclk->vidc_ctl;
 
 206         vid_ctl  = pclk->vid_ctl;
 
 208         bandwidth = var->pixclock * 8 / var->bits_per_pixel;
 
 209         /* 25.175, 4bpp = 79.444ns per byte, 317.776ns per word: fifo = 2,6 */
 
 210         if (bandwidth > 143500)
 
 211                 vidc_ctl |= VIDC_CTRL_FIFO_3_7;
 
 212         else if (bandwidth > 71750)
 
 213                 vidc_ctl |= VIDC_CTRL_FIFO_2_6;
 
 214         else if (bandwidth > 35875)
 
 215                 vidc_ctl |= VIDC_CTRL_FIFO_1_5;
 
 217                 vidc_ctl |= VIDC_CTRL_FIFO_0_4;
 
 219         switch (var->bits_per_pixel) {
 
 221                 horiz_correction = 19;
 
 222                 vidc_ctl |= VIDC_CTRL_1BPP;
 
 226                 horiz_correction = 11;
 
 227                 vidc_ctl |= VIDC_CTRL_2BPP;
 
 231                 horiz_correction = 7;
 
 232                 vidc_ctl |= VIDC_CTRL_4BPP;
 
 237                 horiz_correction = 5;
 
 238                 vidc_ctl |= VIDC_CTRL_8BPP;
 
 242         if (var->sync & FB_SYNC_COMP_HIGH_ACT) /* should be FB_SYNC_COMP */
 
 243                 vidc_ctl |= VIDC_CTRL_CSYNC;
 
 245                 if (!(var->sync & FB_SYNC_HOR_HIGH_ACT))
 
 246                         vid_ctl |= VID_CTL_HS_NHSYNC;
 
 248                 if (!(var->sync & FB_SYNC_VERT_HIGH_ACT))
 
 249                         vid_ctl |= VID_CTL_VS_NVSYNC;
 
 252         sync_len        = var->hsync_len;
 
 253         display_start   = sync_len + var->left_margin;
 
 254         display_end     = display_start + var->xres;
 
 255         cycle           = display_end + var->right_margin;
 
 257         /* if interlaced, then hcr/2 must be even */
 
 258         is_interlaced = (var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED;
 
 261                 vidc_ctl |= VIDC_CTRL_INTERLACE;
 
 264                         var->right_margin += 2;
 
 268         vidc.h_cycle            = (cycle - 2) / 2;
 
 269         vidc.h_sync_width       = (sync_len - 2) / 2;
 
 270         vidc.h_border_start     = (display_start - 1) / 2;
 
 271         vidc.h_display_start    = (display_start - horiz_correction) / 2;
 
 272         vidc.h_display_end      = (display_end - horiz_correction) / 2;
 
 273         vidc.h_border_end       = (display_end - 1) / 2;
 
 274         vidc.h_interlace        = (vidc.h_cycle + 1) / 2;
 
 276         sync_len        = var->vsync_len;
 
 277         display_start   = sync_len + var->upper_margin;
 
 278         display_end     = display_start + var->yres;
 
 279         cycle           = display_end + var->lower_margin;
 
 282                 cycle = (cycle - 3) / 2;
 
 286         vidc.v_cycle            = cycle;
 
 287         vidc.v_sync_width       = sync_len - 1;
 
 288         vidc.v_border_start     = display_start - 1;
 
 289         vidc.v_display_start    = vidc.v_border_start;
 
 290         vidc.v_display_end      = display_end - 1;
 
 291         vidc.v_border_end       = vidc.v_display_end;
 
 293         if (machine_is_a5k())
 
 294                 __raw_writeb(vid_ctl, IOEB_VID_CTL);
 
 296         if (memcmp(¤t_vidc, &vidc, sizeof(vidc))) {
 
 299                 vidc_writel(0xe0000000 | vidc_ctl);
 
 300                 vidc_writel(0x80000000 | (vidc.h_cycle << 14));
 
 301                 vidc_writel(0x84000000 | (vidc.h_sync_width << 14));
 
 302                 vidc_writel(0x88000000 | (vidc.h_border_start << 14));
 
 303                 vidc_writel(0x8c000000 | (vidc.h_display_start << 14));
 
 304                 vidc_writel(0x90000000 | (vidc.h_display_end << 14));
 
 305                 vidc_writel(0x94000000 | (vidc.h_border_end << 14));
 
 306                 vidc_writel(0x98000000);
 
 307                 vidc_writel(0x9c000000 | (vidc.h_interlace << 14));
 
 308                 vidc_writel(0xa0000000 | (vidc.v_cycle << 14));
 
 309                 vidc_writel(0xa4000000 | (vidc.v_sync_width << 14));
 
 310                 vidc_writel(0xa8000000 | (vidc.v_border_start << 14));
 
 311                 vidc_writel(0xac000000 | (vidc.v_display_start << 14));
 
 312                 vidc_writel(0xb0000000 | (vidc.v_display_end << 14));
 
 313                 vidc_writel(0xb4000000 | (vidc.v_border_end << 14));
 
 314                 vidc_writel(0xb8000000);
 
 315                 vidc_writel(0xbc000000);
 
 317 #ifdef DEBUG_MODE_SELECTION
 
 318         printk(KERN_DEBUG "VIDC registers for %dx%dx%d:\n", var->xres,
 
 319                var->yres, var->bits_per_pixel);
 
 320         printk(KERN_DEBUG " H-cycle          : %d\n", vidc.h_cycle);
 
 321         printk(KERN_DEBUG " H-sync-width     : %d\n", vidc.h_sync_width);
 
 322         printk(KERN_DEBUG " H-border-start   : %d\n", vidc.h_border_start);
 
 323         printk(KERN_DEBUG " H-display-start  : %d\n", vidc.h_display_start);
 
 324         printk(KERN_DEBUG " H-display-end    : %d\n", vidc.h_display_end);
 
 325         printk(KERN_DEBUG " H-border-end     : %d\n", vidc.h_border_end);
 
 326         printk(KERN_DEBUG " H-interlace      : %d\n", vidc.h_interlace);
 
 327         printk(KERN_DEBUG " V-cycle          : %d\n", vidc.v_cycle);
 
 328         printk(KERN_DEBUG " V-sync-width     : %d\n", vidc.v_sync_width);
 
 329         printk(KERN_DEBUG " V-border-start   : %d\n", vidc.v_border_start);
 
 330         printk(KERN_DEBUG " V-display-start  : %d\n", vidc.v_display_start);
 
 331         printk(KERN_DEBUG " V-display-end    : %d\n", vidc.v_display_end);
 
 332         printk(KERN_DEBUG " V-border-end     : %d\n", vidc.v_border_end);
 
 333         printk(KERN_DEBUG " VIDC Ctrl (E)    : 0x%08X\n", vidc_ctl);
 
 334         printk(KERN_DEBUG " IOEB Ctrl        : 0x%08X\n", vid_ctl);
 
 339 acornfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
 
 340                   u_int trans, struct fb_info *info)
 
 344         if (regno >= current_par.palette_size)
 
 348         pal.vidc.reg   = regno;
 
 349         pal.vidc.red   = red >> 12;
 
 350         pal.vidc.green = green >> 12;
 
 351         pal.vidc.blue  = blue >> 12;
 
 353         current_par.palette[regno] = pal;
 
 362 #include <asm/arch/acornfb.h>
 
 364 #define MAX_SIZE        2*1024*1024
 
 366 /* VIDC20 has a different set of rules from the VIDC:
 
 367  *  hcr  : must be multiple of 4
 
 368  *  hswr : must be even
 
 369  *  hdsr : must be even
 
 370  *  hder : must be even
 
 371  *  vcr  : >= 2, (interlace, must be odd)
 
 376 static void acornfb_set_timing(struct fb_info *info)
 
 378         struct fb_var_screeninfo *var = &info->var;
 
 379         struct vidc_timing vidc;
 
 381         u_int ext_ctl, dat_ctl;
 
 382         u_int words_per_line;
 
 384         memset(&vidc, 0, sizeof(vidc));
 
 386         vidc.h_sync_width       = var->hsync_len - 8;
 
 387         vidc.h_border_start     = vidc.h_sync_width + var->left_margin + 8 - 12;
 
 388         vidc.h_display_start    = vidc.h_border_start + 12 - 18;
 
 389         vidc.h_display_end      = vidc.h_display_start + var->xres;
 
 390         vidc.h_border_end       = vidc.h_display_end + 18 - 12;
 
 391         vidc.h_cycle            = vidc.h_border_end + var->right_margin + 12 - 8;
 
 392         vidc.h_interlace        = vidc.h_cycle / 2;
 
 393         vidc.v_sync_width       = var->vsync_len - 1;
 
 394         vidc.v_border_start     = vidc.v_sync_width + var->upper_margin;
 
 395         vidc.v_display_start    = vidc.v_border_start;
 
 396         vidc.v_display_end      = vidc.v_display_start + var->yres;
 
 397         vidc.v_border_end       = vidc.v_display_end;
 
 398         vidc.control            = acornfb_default_control();
 
 400         vcr = var->vsync_len + var->upper_margin + var->yres +
 
 403         if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) {
 
 404                 vidc.v_cycle = (vcr - 3) / 2;
 
 405                 vidc.control |= VIDC20_CTRL_INT;
 
 407                 vidc.v_cycle = vcr - 2;
 
 409         switch (var->bits_per_pixel) {
 
 410         case  1: vidc.control |= VIDC20_CTRL_1BPP;      break;
 
 411         case  2: vidc.control |= VIDC20_CTRL_2BPP;      break;
 
 412         case  4: vidc.control |= VIDC20_CTRL_4BPP;      break;
 
 414         case  8: vidc.control |= VIDC20_CTRL_8BPP;      break;
 
 415         case 16: vidc.control |= VIDC20_CTRL_16BPP;     break;
 
 416         case 32: vidc.control |= VIDC20_CTRL_32BPP;     break;
 
 419         acornfb_vidc20_find_rates(&vidc, var);
 
 420         fsize = var->vsync_len + var->upper_margin + var->lower_margin - 1;
 
 422         if (memcmp(¤t_vidc, &vidc, sizeof(vidc))) {
 
 425                 vidc_writel(VIDC20_CTRL| vidc.control);
 
 426                 vidc_writel(0xd0000000 | vidc.pll_ctl);
 
 427                 vidc_writel(0x80000000 | vidc.h_cycle);
 
 428                 vidc_writel(0x81000000 | vidc.h_sync_width);
 
 429                 vidc_writel(0x82000000 | vidc.h_border_start);
 
 430                 vidc_writel(0x83000000 | vidc.h_display_start);
 
 431                 vidc_writel(0x84000000 | vidc.h_display_end);
 
 432                 vidc_writel(0x85000000 | vidc.h_border_end);
 
 433                 vidc_writel(0x86000000);
 
 434                 vidc_writel(0x87000000 | vidc.h_interlace);
 
 435                 vidc_writel(0x90000000 | vidc.v_cycle);
 
 436                 vidc_writel(0x91000000 | vidc.v_sync_width);
 
 437                 vidc_writel(0x92000000 | vidc.v_border_start);
 
 438                 vidc_writel(0x93000000 | vidc.v_display_start);
 
 439                 vidc_writel(0x94000000 | vidc.v_display_end);
 
 440                 vidc_writel(0x95000000 | vidc.v_border_end);
 
 441                 vidc_writel(0x96000000);
 
 442                 vidc_writel(0x97000000);
 
 445         iomd_writel(fsize, IOMD_FSIZE);
 
 447         ext_ctl = acornfb_default_econtrol();
 
 449         if (var->sync & FB_SYNC_COMP_HIGH_ACT) /* should be FB_SYNC_COMP */
 
 450                 ext_ctl |= VIDC20_ECTL_HS_NCSYNC | VIDC20_ECTL_VS_NCSYNC;
 
 452                 if (var->sync & FB_SYNC_HOR_HIGH_ACT)
 
 453                         ext_ctl |= VIDC20_ECTL_HS_HSYNC;
 
 455                         ext_ctl |= VIDC20_ECTL_HS_NHSYNC;
 
 457                 if (var->sync & FB_SYNC_VERT_HIGH_ACT)
 
 458                         ext_ctl |= VIDC20_ECTL_VS_VSYNC;
 
 460                         ext_ctl |= VIDC20_ECTL_VS_NVSYNC;
 
 463         vidc_writel(VIDC20_ECTL | ext_ctl);
 
 465         words_per_line = var->xres * var->bits_per_pixel / 32;
 
 467         if (current_par.using_vram && info->fix.smem_len == 2048*1024)
 
 470         /* RiscPC doesn't use the VIDC's VRAM control. */
 
 471         dat_ctl = VIDC20_DCTL_VRAM_DIS | VIDC20_DCTL_SNA | words_per_line;
 
 473         /* The data bus width is dependent on both the type
 
 474          * and amount of video memory.
 
 479         if (current_par.using_vram && current_par.vram_half_sam == 2048)
 
 480                 dat_ctl |= VIDC20_DCTL_BUS_D63_0;
 
 482                 dat_ctl |= VIDC20_DCTL_BUS_D31_0;
 
 484         vidc_writel(VIDC20_DCTL | dat_ctl);
 
 486 #ifdef DEBUG_MODE_SELECTION
 
 487         printk(KERN_DEBUG "VIDC registers for %dx%dx%d:\n", var->xres,
 
 488                var->yres, var->bits_per_pixel);
 
 489         printk(KERN_DEBUG " H-cycle          : %d\n", vidc.h_cycle);
 
 490         printk(KERN_DEBUG " H-sync-width     : %d\n", vidc.h_sync_width);
 
 491         printk(KERN_DEBUG " H-border-start   : %d\n", vidc.h_border_start);
 
 492         printk(KERN_DEBUG " H-display-start  : %d\n", vidc.h_display_start);
 
 493         printk(KERN_DEBUG " H-display-end    : %d\n", vidc.h_display_end);
 
 494         printk(KERN_DEBUG " H-border-end     : %d\n", vidc.h_border_end);
 
 495         printk(KERN_DEBUG " H-interlace      : %d\n", vidc.h_interlace);
 
 496         printk(KERN_DEBUG " V-cycle          : %d\n", vidc.v_cycle);
 
 497         printk(KERN_DEBUG " V-sync-width     : %d\n", vidc.v_sync_width);
 
 498         printk(KERN_DEBUG " V-border-start   : %d\n", vidc.v_border_start);
 
 499         printk(KERN_DEBUG " V-display-start  : %d\n", vidc.v_display_start);
 
 500         printk(KERN_DEBUG " V-display-end    : %d\n", vidc.v_display_end);
 
 501         printk(KERN_DEBUG " V-border-end     : %d\n", vidc.v_border_end);
 
 502         printk(KERN_DEBUG " Ext Ctrl  (C)    : 0x%08X\n", ext_ctl);
 
 503         printk(KERN_DEBUG " PLL Ctrl  (D)    : 0x%08X\n", vidc.pll_ctl);
 
 504         printk(KERN_DEBUG " Ctrl      (E)    : 0x%08X\n", vidc.control);
 
 505         printk(KERN_DEBUG " Data Ctrl (F)    : 0x%08X\n", dat_ctl);
 
 506         printk(KERN_DEBUG " Fsize            : 0x%08X\n", fsize);
 
 511  * We have to take note of the VIDC20's 16-bit palette here.
 
 512  * The VIDC20 looks up a 16 bit pixel as follows:
 
 516  *   red            ++++++++  (8 bits,  7 to 0)
 
 517  *  green       ++++++++      (8 bits, 11 to 4)
 
 518  *   blue   ++++++++          (8 bits, 15 to 8)
 
 520  * We use a pixel which looks like:
 
 524  *   red               +++++  (5 bits,  4 to  0)
 
 525  *  green         +++++       (5 bits,  9 to  5)
 
 526  *   blue    +++++            (5 bits, 14 to 10)
 
 529 acornfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
 
 530                   u_int trans, struct fb_info *info)
 
 534         if (regno >= current_par.palette_size)
 
 537         if (regno < 16 && info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
 
 540                 pseudo_val  = regno << info->var.red.offset;
 
 541                 pseudo_val |= regno << info->var.green.offset;
 
 542                 pseudo_val |= regno << info->var.blue.offset;
 
 544                 ((u32 *)info->pseudo_palette)[regno] = pseudo_val;
 
 548         pal.vidc20.red   = red >> 8;
 
 549         pal.vidc20.green = green >> 8;
 
 550         pal.vidc20.blue  = blue >> 8;
 
 552         current_par.palette[regno] = pal;
 
 554         if (info->var.bits_per_pixel == 16) {
 
 558                 vidc_writel(0x10000000);
 
 559                 for (i = 0; i < 256; i += 1) {
 
 560                         pal.vidc20.red   = current_par.palette[ i       & 31].vidc20.red;
 
 561                         pal.vidc20.green = current_par.palette[(i >> 1) & 31].vidc20.green;
 
 562                         pal.vidc20.blue  = current_par.palette[(i >> 2) & 31].vidc20.blue;
 
 564                         /* Palette register pointer auto-increments */
 
 567                 vidc_writel(0x10000000 | regno);
 
 576  * Before selecting the timing parameters, adjust
 
 577  * the resolution to fit the rules.
 
 580 acornfb_adjust_timing(struct fb_info *info, struct fb_var_screeninfo *var, u_int fontht)
 
 582         u_int font_line_len, sam_size, min_size, size, nr_y;
 
 584         /* xres must be even */
 
 585         var->xres = (var->xres + 1) & ~1;
 
 588          * We don't allow xres_virtual to differ from xres
 
 590         var->xres_virtual = var->xres;
 
 593         if (current_par.using_vram)
 
 594                 sam_size = current_par.vram_half_sam * 2;
 
 599          * Now, find a value for yres_virtual which allows
 
 600          * us to do ywrap scrolling.  The value of
 
 601          * yres_virtual must be such that the end of the
 
 602          * displayable frame buffer must be aligned with
 
 603          * the start of a font line.
 
 605         font_line_len = var->xres * var->bits_per_pixel * fontht / 8;
 
 606         min_size = var->xres * var->yres * var->bits_per_pixel / 8;
 
 609          * If minimum screen size is greater than that we have
 
 610          * available, reject it.
 
 612         if (min_size > info->fix.smem_len)
 
 615         /* Find int 'y', such that y * fll == s * sam < maxsize
 
 616          * y = s * sam / fll; s = maxsize / sam
 
 618         for (size = info->fix.smem_len;
 
 619              nr_y = size / font_line_len, min_size <= size;
 
 621                 if (nr_y * font_line_len == size)
 
 626         if (var->accel_flags & FB_ACCELF_TEXT) {
 
 627                 if (min_size > size) {
 
 631                         size = info->fix.smem_len;
 
 632                         var->yres_virtual = size / (font_line_len / fontht);
 
 634                         var->yres_virtual = nr_y;
 
 635         } else if (var->yres_virtual > nr_y)
 
 636                 var->yres_virtual = nr_y;
 
 638         current_par.screen_end = info->fix.smem_start + size;
 
 641          * Fix yres & yoffset if needed.
 
 643         if (var->yres > var->yres_virtual)
 
 644                 var->yres = var->yres_virtual;
 
 646         if (var->vmode & FB_VMODE_YWRAP) {
 
 647                 if (var->yoffset > var->yres_virtual)
 
 648                         var->yoffset = var->yres_virtual;
 
 650                 if (var->yoffset + var->yres > var->yres_virtual)
 
 651                         var->yoffset = var->yres_virtual - var->yres;
 
 654         /* hsync_len must be even */
 
 655         var->hsync_len = (var->hsync_len + 1) & ~1;
 
 658         /* left_margin must be odd */
 
 659         if ((var->left_margin & 1) == 0) {
 
 660                 var->left_margin -= 1;
 
 661                 var->right_margin += 1;
 
 664         /* right_margin must be odd */
 
 665         var->right_margin |= 1;
 
 666 #elif defined(HAS_VIDC20)
 
 667         /* left_margin must be even */
 
 668         if (var->left_margin & 1) {
 
 669                 var->left_margin += 1;
 
 670                 var->right_margin -= 1;
 
 673         /* right_margin must be even */
 
 674         if (var->right_margin & 1)
 
 675                 var->right_margin += 1;
 
 678         if (var->vsync_len < 1)
 
 685 acornfb_validate_timing(struct fb_var_screeninfo *var,
 
 686                         struct fb_monspecs *monspecs)
 
 688         unsigned long hs, vs;
 
 691          * hs(Hz) = 10^12 / (pixclock * xtotal)
 
 692          * vs(Hz) = hs(Hz) / ytotal
 
 694          * No need to do long long divisions or anything
 
 695          * like that if you factor it correctly
 
 697         hs = 1953125000 / var->pixclock;
 
 699              (var->xres + var->left_margin + var->right_margin + var->hsync_len);
 
 701              (var->yres + var->upper_margin + var->lower_margin + var->vsync_len);
 
 703         return (vs >= monspecs->vfmin && vs <= monspecs->vfmax &&
 
 704                 hs >= monspecs->hfmin && hs <= monspecs->hfmax) ? 0 : -EINVAL;
 
 708 acornfb_update_dma(struct fb_info *info, struct fb_var_screeninfo *var)
 
 710         u_int off = var->yoffset * info->fix.line_length;
 
 712 #if defined(HAS_MEMC)
 
 713         memc_write(VDMA_INIT, off >> 2);
 
 714 #elif defined(HAS_IOMD)
 
 715         iomd_writel(info->fix.smem_start + off, IOMD_VIDINIT);
 
 720 acornfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 
 726          * FIXME: Find the font height
 
 730         var->red.msb_right = 0;
 
 731         var->green.msb_right = 0;
 
 732         var->blue.msb_right = 0;
 
 733         var->transp.msb_right = 0;
 
 735         switch (var->bits_per_pixel) {
 
 736         case 1: case 2: case 4: case 8:
 
 738                 var->red.length    = var->bits_per_pixel;
 
 739                 var->green         = var->red;
 
 740                 var->blue          = var->red;
 
 741                 var->transp.offset = 0;
 
 742                 var->transp.length = 0;
 
 749                 var->green.offset  = 5;
 
 750                 var->green.length  = 5;
 
 751                 var->blue.offset   = 10;
 
 752                 var->blue.length   = 5;
 
 753                 var->transp.offset = 15;
 
 754                 var->transp.length = 1;
 
 760                 var->green.offset  = 8;
 
 761                 var->green.length  = 8;
 
 762                 var->blue.offset   = 16;
 
 763                 var->blue.length   = 8;
 
 764                 var->transp.offset = 24;
 
 765                 var->transp.length = 4;
 
 773          * Check to see if the pixel rate is valid.
 
 775         if (!acornfb_valid_pixrate(var))
 
 779          * Validate and adjust the resolution to
 
 780          * match the video generator hardware.
 
 782         err = acornfb_adjust_timing(info, var, fontht);
 
 787          * Validate the timing against the
 
 790         return acornfb_validate_timing(var, &info->monspecs);
 
 793 static int acornfb_set_par(struct fb_info *info)
 
 795         switch (info->var.bits_per_pixel) {
 
 797                 current_par.palette_size = 2;
 
 798                 info->fix.visual = FB_VISUAL_MONO10;
 
 801                 current_par.palette_size = 4;
 
 802                 info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
 
 805                 current_par.palette_size = 16;
 
 806                 info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
 
 809                 current_par.palette_size = VIDC_PALETTE_SIZE;
 
 811                 info->fix.visual = FB_VISUAL_STATIC_PSEUDOCOLOR;
 
 813                 info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
 
 818                 current_par.palette_size = 32;
 
 819                 info->fix.visual = FB_VISUAL_DIRECTCOLOR;
 
 822                 current_par.palette_size = VIDC_PALETTE_SIZE;
 
 823                 info->fix.visual = FB_VISUAL_DIRECTCOLOR;
 
 830         info->fix.line_length   = (info->var.xres * info->var.bits_per_pixel) / 8;
 
 832 #if defined(HAS_MEMC)
 
 834                 unsigned long size = info->fix.smem_len - VDMA_XFERSIZE;
 
 836                 memc_write(VDMA_START, 0);
 
 837                 memc_write(VDMA_END, size >> 2);
 
 839 #elif defined(HAS_IOMD)
 
 841                 unsigned long start, size;
 
 844                 start = info->fix.smem_start;
 
 845                 size  = current_par.screen_end;
 
 847                 if (current_par.using_vram) {
 
 848                         size -= current_par.vram_half_sam;
 
 849                         control = DMA_CR_E | (current_par.vram_half_sam / 256);
 
 852                         control = DMA_CR_E | DMA_CR_D | 16;
 
 855                 iomd_writel(start,   IOMD_VIDSTART);
 
 856                 iomd_writel(size,    IOMD_VIDEND);
 
 857                 iomd_writel(control, IOMD_VIDCR);
 
 861         acornfb_update_dma(info, &info->var);
 
 862         acornfb_set_timing(info);
 
 868 acornfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
 
 870         u_int y_bottom = var->yoffset;
 
 872         if (!(var->vmode & FB_VMODE_YWRAP))
 
 873                 y_bottom += var->yres;
 
 875         BUG_ON(y_bottom > var->yres_virtual);
 
 877         acornfb_update_dma(info, var);
 
 883  * Note that we are entered with the kernel locked.
 
 886 acornfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
 
 888         unsigned long off, start;
 
 891         off = vma->vm_pgoff << PAGE_SHIFT;
 
 893         start = info->fix.smem_start;
 
 894         len = PAGE_ALIGN(start & ~PAGE_MASK) + info->fix.smem_len;
 
 896         if ((vma->vm_end - vma->vm_start + off) > len)
 
 899         vma->vm_pgoff = off >> PAGE_SHIFT;
 
 901         /* This is an IO map - tell maydump to skip this VMA */
 
 902         vma->vm_flags |= VM_IO;
 
 904         vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
 
 907          * Don't alter the page protection flags; we want to keep the area
 
 908          * cached for better performance.  This does mean that we may miss
 
 909          * some updates to the screen occasionally, but process switches
 
 910          * should cause the caches and buffers to be flushed often enough.
 
 912         if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT,
 
 913                                 vma->vm_end - vma->vm_start,
 
 919 static struct fb_ops acornfb_ops = {
 
 920         .owner          = THIS_MODULE,
 
 921         .fb_check_var   = acornfb_check_var,
 
 922         .fb_set_par     = acornfb_set_par,
 
 923         .fb_setcolreg   = acornfb_setcolreg,
 
 924         .fb_pan_display = acornfb_pan_display,
 
 925         .fb_fillrect    = cfb_fillrect,
 
 926         .fb_copyarea    = cfb_copyarea,
 
 927         .fb_imageblit   = cfb_imageblit,
 
 928         .fb_mmap        = acornfb_mmap,
 
 932  * Everything after here is initialisation!!!
 
 934 static struct fb_videomode modedb[] __initdata = {
 
 935         {       /* 320x256 @ 50Hz */
 
 936                 NULL, 50,  320,  256, 125000,  92,  62,  35, 19,  38, 2,
 
 937                 FB_SYNC_COMP_HIGH_ACT,
 
 938                 FB_VMODE_NONINTERLACED
 
 939         }, {    /* 640x250 @ 50Hz, 15.6 kHz hsync */
 
 940                 NULL, 50,  640,  250,  62500, 185, 123,  38, 21,  76, 3,
 
 942                 FB_VMODE_NONINTERLACED
 
 943         }, {    /* 640x256 @ 50Hz, 15.6 kHz hsync */
 
 944                 NULL, 50,  640,  256,  62500, 185, 123,  35, 18,  76, 3,
 
 946                 FB_VMODE_NONINTERLACED
 
 947         }, {    /* 640x512 @ 50Hz, 26.8 kHz hsync */
 
 948                 NULL, 50,  640,  512,  41667, 113,  87,  18,  1,  56, 3,
 
 950                 FB_VMODE_NONINTERLACED
 
 951         }, {    /* 640x250 @ 70Hz, 31.5 kHz hsync */
 
 952                 NULL, 70,  640,  250,  39722,  48,  16, 109, 88,  96, 2,
 
 954                 FB_VMODE_NONINTERLACED
 
 955         }, {    /* 640x256 @ 70Hz, 31.5 kHz hsync */
 
 956                 NULL, 70,  640,  256,  39722,  48,  16, 106, 85,  96, 2,
 
 958                 FB_VMODE_NONINTERLACED
 
 959         }, {    /* 640x352 @ 70Hz, 31.5 kHz hsync */
 
 960                 NULL, 70,  640,  352,  39722,  48,  16,  58, 37,  96, 2,
 
 962                 FB_VMODE_NONINTERLACED
 
 963         }, {    /* 640x480 @ 60Hz, 31.5 kHz hsync */
 
 964                 NULL, 60,  640,  480,  39722,  48,  16,  32, 11,  96, 2,
 
 966                 FB_VMODE_NONINTERLACED
 
 967         }, {    /* 800x600 @ 56Hz, 35.2 kHz hsync */
 
 968                 NULL, 56,  800,  600,  27778, 101,  23,  22,  1, 100, 2,
 
 970                 FB_VMODE_NONINTERLACED
 
 971         }, {    /* 896x352 @ 60Hz, 21.8 kHz hsync */
 
 972                 NULL, 60,  896,  352,  41667,  59,  27,   9,  0, 118, 3,
 
 974                 FB_VMODE_NONINTERLACED
 
 975         }, {    /* 1024x 768 @ 60Hz, 48.4 kHz hsync */
 
 976                 NULL, 60, 1024,  768,  15385, 160,  24,  29,  3, 136, 6,
 
 978                 FB_VMODE_NONINTERLACED
 
 979         }, {    /* 1280x1024 @ 60Hz, 63.8 kHz hsync */
 
 980                 NULL, 60, 1280, 1024,   9090, 186,  96,  38,  1, 160, 3,
 
 982                 FB_VMODE_NONINTERLACED
 
 986 static struct fb_videomode __initdata
 
 987 acornfb_default_mode = {
 
1000         .vmode =        FB_VMODE_NONINTERLACED
 
1003 static void __init acornfb_init_fbinfo(void)
 
1005         static int first = 1;
 
1011         fb_info.fbops           = &acornfb_ops;
 
1012         fb_info.flags           = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
 
1013         fb_info.pseudo_palette  = current_par.pseudo_palette;
 
1015         strcpy(fb_info.fix.id, "Acorn");
 
1016         fb_info.fix.type        = FB_TYPE_PACKED_PIXELS;
 
1017         fb_info.fix.type_aux    = 0;
 
1018         fb_info.fix.xpanstep    = 0;
 
1019         fb_info.fix.ypanstep    = 1;
 
1020         fb_info.fix.ywrapstep   = 1;
 
1021         fb_info.fix.line_length = 0;
 
1022         fb_info.fix.accel       = FB_ACCEL_NONE;
 
1025          * setup initial parameters
 
1027         memset(&fb_info.var, 0, sizeof(fb_info.var));
 
1029 #if defined(HAS_VIDC20)
 
1030         fb_info.var.red.length     = 8;
 
1031         fb_info.var.transp.length  = 4;
 
1032 #elif defined(HAS_VIDC)
 
1033         fb_info.var.red.length     = 4;
 
1034         fb_info.var.transp.length  = 1;
 
1036         fb_info.var.green          = fb_info.var.red;
 
1037         fb_info.var.blue           = fb_info.var.red;
 
1038         fb_info.var.nonstd         = 0;
 
1039         fb_info.var.activate       = FB_ACTIVATE_NOW;
 
1040         fb_info.var.height         = -1;
 
1041         fb_info.var.width          = -1;
 
1042         fb_info.var.vmode          = FB_VMODE_NONINTERLACED;
 
1043         fb_info.var.accel_flags    = FB_ACCELF_TEXT;
 
1045         current_par.dram_size      = 0;
 
1046         current_par.montype        = -1;
 
1047         current_par.dpms           = 0;
 
1051  * setup acornfb options:
 
1053  *  mon:hmin-hmax:vmin-vmax:dpms:width:height
 
1054  *      Set monitor parameters:
 
1055  *              hmin   = horizontal minimum frequency (Hz)
 
1056  *              hmax   = horizontal maximum frequency (Hz)      (optional)
 
1057  *              vmin   = vertical minimum frequency (Hz)
 
1058  *              vmax   = vertical maximum frequency (Hz)        (optional)
 
1059  *              dpms   = DPMS supported?                        (optional)
 
1060  *              width  = width of picture in mm.                (optional)
 
1061  *              height = height of picture in mm.               (optional)
 
1064  *      Set RISC-OS style monitor type:
 
1065  *              0 (or tv)       - TV frequency
 
1066  *              1 (or multi)    - Multi frequency
 
1067  *              2 (or hires)    - Hi-res monochrome
 
1069  *              4 (or svga)     - SVGA
 
1070  *              auto, or option missing
 
1071  *                              - try hardware detect
 
1074  *      Set the amount of DRAM to use for the frame buffer
 
1075  *      (even if you have VRAM).
 
1076  *      size can optionally be followed by 'M' or 'K' for
 
1077  *      MB or KB respectively.
 
1080 acornfb_parse_mon(char *opt)
 
1084         current_par.montype = -2;
 
1086         fb_info.monspecs.hfmin = simple_strtoul(p, &p, 0);
 
1088                 fb_info.monspecs.hfmax = simple_strtoul(p + 1, &p, 0);
 
1090                 fb_info.monspecs.hfmax = fb_info.monspecs.hfmin;
 
1095         fb_info.monspecs.vfmin = simple_strtoul(p + 1, &p, 0);
 
1097                 fb_info.monspecs.vfmax = simple_strtoul(p + 1, &p, 0);
 
1099                 fb_info.monspecs.vfmax = fb_info.monspecs.vfmin;
 
1104         fb_info.monspecs.dpms = simple_strtoul(p + 1, &p, 0);
 
1109         fb_info.var.width = simple_strtoul(p + 1, &p, 0);
 
1114         fb_info.var.height = simple_strtoul(p + 1, NULL, 0);
 
1117         if (fb_info.monspecs.hfmax < fb_info.monspecs.hfmin ||
 
1118             fb_info.monspecs.vfmax < fb_info.monspecs.vfmin)
 
1123         printk(KERN_ERR "Acornfb: bad monitor settings: %s\n", opt);
 
1124         current_par.montype = -1;
 
1128 acornfb_parse_montype(char *opt)
 
1130         current_par.montype = -2;
 
1132         if (strncmp(opt, "tv", 2) == 0) {
 
1134                 current_par.montype = 0;
 
1135         } else if (strncmp(opt, "multi", 5) == 0) {
 
1137                 current_par.montype = 1;
 
1138         } else if (strncmp(opt, "hires", 5) == 0) {
 
1140                 current_par.montype = 2;
 
1141         } else if (strncmp(opt, "vga", 3) == 0) {
 
1143                 current_par.montype = 3;
 
1144         } else if (strncmp(opt, "svga", 4) == 0) {
 
1146                 current_par.montype = 4;
 
1147         } else if (strncmp(opt, "auto", 4) == 0) {
 
1149                 current_par.montype = -1;
 
1150         } else if (isdigit(*opt))
 
1151                 current_par.montype = simple_strtoul(opt, &opt, 0);
 
1153         if (current_par.montype == -2 ||
 
1154             current_par.montype > NR_MONTYPES) {
 
1155                 printk(KERN_ERR "acornfb: unknown monitor type: %s\n",
 
1157                 current_par.montype = -1;
 
1160                 if (strcmp(opt, ",dpms") == 0)
 
1161                         current_par.dpms = 1;
 
1164                                "acornfb: unknown monitor option: %s\n",
 
1170 acornfb_parse_dram(char *opt)
 
1174         size = simple_strtoul(opt, &opt, 0);
 
1189         current_par.dram_size = size;
 
1192 static struct options {
 
1194         void (*parse)(char *opt);
 
1195 } opt_table[] __initdata = {
 
1196         { "mon",     acornfb_parse_mon     },
 
1197         { "montype", acornfb_parse_montype },
 
1198         { "dram",    acornfb_parse_dram    },
 
1203 acornfb_setup(char *options)
 
1205         struct options *optp;
 
1208         if (!options || !*options)
 
1211         acornfb_init_fbinfo();
 
1213         while ((opt = strsep(&options, ",")) != NULL) {
 
1217                 for (optp = opt_table; optp->name; optp++) {
 
1220                         optlen = strlen(optp->name);
 
1222                         if (strncmp(opt, optp->name, optlen) == 0 &&
 
1223                             opt[optlen] == ':') {
 
1224                                 optp->parse(opt + optlen + 1);
 
1230                         printk(KERN_ERR "acornfb: unknown parameter: %s\n",
 
1237  * Detect type of monitor connected
 
1238  *  For now, we just assume SVGA
 
1241 acornfb_detect_monitortype(void)
 
1247  * This enables the unused memory to be freed on older Acorn machines.
 
1248  * We are freeing memory on behalf of the architecture initialisation
 
1252 free_unused_pages(unsigned int virtual_start, unsigned int virtual_end)
 
1259         virtual_start = PAGE_ALIGN(virtual_start);
 
1260         virtual_end = PAGE_ALIGN(virtual_end);
 
1262         while (virtual_start < virtual_end) {
 
1266                  * Clear page reserved bit,
 
1267                  * set count to 1, and free
 
1270                 page = virt_to_page(virtual_start);
 
1271                 ClearPageReserved(page);
 
1272                 init_page_count(page);
 
1273                 free_page(virtual_start);
 
1275                 virtual_start += PAGE_SIZE;
 
1276                 mb_freed += PAGE_SIZE / 1024;
 
1279         printk("acornfb: freed %dK memory\n", mb_freed);
 
1282 static int __init acornfb_probe(struct platform_device *dev)
 
1285         u_int h_sync, v_sync;
 
1287         char *option = NULL;
 
1289         if (fb_get_options("acornfb", &option))
 
1291         acornfb_setup(option);
 
1293         acornfb_init_fbinfo();
 
1295         current_par.dev = &dev->dev;
 
1297         if (current_par.montype == -1)
 
1298                 current_par.montype = acornfb_detect_monitortype();
 
1300         if (current_par.montype == -1 || current_par.montype > NR_MONTYPES)
 
1301                 current_par.montype = 4;
 
1303         if (current_par.montype >= 0) {
 
1304                 fb_info.monspecs = monspecs[current_par.montype];
 
1305                 fb_info.monspecs.dpms = current_par.dpms;
 
1309          * Try to select a suitable default mode
 
1311         for (i = 0; i < ARRAY_SIZE(modedb); i++) {
 
1314                 hs = modedb[i].refresh *
 
1315                      (modedb[i].yres + modedb[i].upper_margin +
 
1316                       modedb[i].lower_margin + modedb[i].vsync_len);
 
1317                 if (modedb[i].xres == DEFAULT_XRES &&
 
1318                     modedb[i].yres == DEFAULT_YRES &&
 
1319                     modedb[i].refresh >= fb_info.monspecs.vfmin &&
 
1320                     modedb[i].refresh <= fb_info.monspecs.vfmax &&
 
1321                     hs                >= fb_info.monspecs.hfmin &&
 
1322                     hs                <= fb_info.monspecs.hfmax) {
 
1323                         acornfb_default_mode = modedb[i];
 
1328         fb_info.screen_base    = (char *)SCREEN_BASE;
 
1329         fb_info.fix.smem_start = SCREEN_START;
 
1330         current_par.using_vram = 0;
 
1333          * If vram_size is set, we are using VRAM in
 
1334          * a Risc PC.  However, if the user has specified
 
1335          * an amount of DRAM then use that instead.
 
1337         if (vram_size && !current_par.dram_size) {
 
1339                 current_par.vram_half_sam = vram_size / 1024;
 
1340                 current_par.using_vram = 1;
 
1341         } else if (current_par.dram_size)
 
1342                 size = current_par.dram_size;
 
1347          * Limit maximum screen size.
 
1349         if (size > MAX_SIZE)
 
1352         size = PAGE_ALIGN(size);
 
1354 #if defined(HAS_VIDC20)
 
1355         if (!current_par.using_vram) {
 
1360                  * RiscPC needs to allocate the DRAM memory
 
1361                  * for the framebuffer if we are not using
 
1364                 base = dma_alloc_writecombine(current_par.dev, size, &handle,
 
1367                         printk(KERN_ERR "acornfb: unable to allocate screen "
 
1372                 fb_info.screen_base = base;
 
1373                 fb_info.fix.smem_start = handle;
 
1376 #if defined(HAS_VIDC)
 
1378          * Archimedes/A5000 machines use a fixed address for their
 
1379          * framebuffers.  Free unused pages
 
1381         free_unused_pages(PAGE_OFFSET + size, PAGE_OFFSET + MAX_SIZE);
 
1384         fb_info.fix.smem_len = size;
 
1385         current_par.palette_size   = VIDC_PALETTE_SIZE;
 
1388          * Lookup the timing for this resolution.  If we can't
 
1389          * find it, then we can't restore it if we change
 
1390          * the resolution, so we disable this feature.
 
1393                 rc = fb_find_mode(&fb_info.var, &fb_info, NULL, modedb,
 
1395                                  &acornfb_default_mode, DEFAULT_BPP);
 
1397                  * If we found an exact match, all ok.
 
1402                 rc = fb_find_mode(&fb_info.var, &fb_info, NULL, NULL, 0,
 
1403                                   &acornfb_default_mode, DEFAULT_BPP);
 
1405                  * If we found an exact match, all ok.
 
1410                 rc = fb_find_mode(&fb_info.var, &fb_info, NULL, modedb,
 
1412                                  &acornfb_default_mode, DEFAULT_BPP);
 
1416                 rc = fb_find_mode(&fb_info.var, &fb_info, NULL, NULL, 0,
 
1417                                   &acornfb_default_mode, DEFAULT_BPP);
 
1421          * If we didn't find an exact match, try the
 
1425                 printk("Acornfb: no valid mode found\n");
 
1429         h_sync = 1953125000 / fb_info.var.pixclock;
 
1430         h_sync = h_sync * 512 / (fb_info.var.xres + fb_info.var.left_margin +
 
1431                  fb_info.var.right_margin + fb_info.var.hsync_len);
 
1432         v_sync = h_sync / (fb_info.var.yres + fb_info.var.upper_margin +
 
1433                  fb_info.var.lower_margin + fb_info.var.vsync_len);
 
1435         printk(KERN_INFO "Acornfb: %dkB %cRAM, %s, using %dx%d, "
 
1436                 "%d.%03dkHz, %dHz\n",
 
1437                 fb_info.fix.smem_len / 1024,
 
1438                 current_par.using_vram ? 'V' : 'D',
 
1439                 VIDC_NAME, fb_info.var.xres, fb_info.var.yres,
 
1440                 h_sync / 1000, h_sync % 1000, v_sync);
 
1442         printk(KERN_INFO "Acornfb: Monitor: %d.%03d-%d.%03dkHz, %d-%dHz%s\n",
 
1443                 fb_info.monspecs.hfmin / 1000, fb_info.monspecs.hfmin % 1000,
 
1444                 fb_info.monspecs.hfmax / 1000, fb_info.monspecs.hfmax % 1000,
 
1445                 fb_info.monspecs.vfmin, fb_info.monspecs.vfmax,
 
1446                 fb_info.monspecs.dpms ? ", DPMS" : "");
 
1448         if (fb_set_var(&fb_info, &fb_info.var))
 
1449                 printk(KERN_ERR "Acornfb: unable to set display parameters\n");
 
1451         if (register_framebuffer(&fb_info) < 0)
 
1456 static struct platform_driver acornfb_driver = {
 
1457         .probe  = acornfb_probe,
 
1463 static int __init acornfb_init(void)
 
1465         return platform_driver_register(&acornfb_driver);
 
1468 module_init(acornfb_init);
 
1470 MODULE_AUTHOR("Russell King");
 
1471 MODULE_DESCRIPTION("VIDC 1/1a/20 framebuffer driver");
 
1472 MODULE_LICENSE("GPL");