diff options
author | Krzysztof Helt <krzysztof.h1@wp.pl> | 2007-10-16 01:29:08 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 09:43:18 -0700 |
commit | 8503df65976d0f845f49e8debff55c031635754e (patch) | |
tree | 8c593d909f1325da9327a207bb398eb7ef5264a6 | |
parent | e7076389f48128b00dd3f33767fb60bd3f5a06a8 (diff) |
cirrusfb: checkpatch.pl cleanup
This patch fixes over 850 errors and warnings pointed out by the checkpatch.pl
script.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Antonino Daplas <adaplas@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/video/cirrusfb.c | 1788 |
1 files changed, 983 insertions, 805 deletions
diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c index 8269d704ab2..0b9fe74630f 100644 --- a/drivers/video/cirrusfb.c +++ b/drivers/video/cirrusfb.c @@ -59,7 +59,7 @@ #endif #ifdef CONFIG_PPC_PREP #include <asm/machdep.h> -#define isPReP (machine_is(prep)) +#define isPReP machine_is(prep) #else #define isPReP 0 #endif @@ -67,7 +67,6 @@ #include "video/vga.h" #include "video/cirrus.h" - /***************************************************************** * * debugging and utility macros @@ -82,7 +81,8 @@ /* debug output */ #ifdef CIRRUSFB_DEBUG -#define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args) +#define DPRINTK(fmt, args...) \ + printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args) #else #define DPRINTK(fmt, args...) #endif @@ -90,20 +90,19 @@ /* debugging assertions */ #ifndef CIRRUSFB_NDEBUG #define assert(expr) \ - if(!(expr)) { \ - printk( "Assertion failed! %s,%s,%s,line=%d\n",\ - #expr,__FILE__,__FUNCTION__,__LINE__); \ - } + if (!(expr)) { \ + printk("Assertion failed! %s,%s,%s,line=%d\n", \ + #expr, __FILE__, __FUNCTION__, __LINE__); \ + } #else #define assert(expr) #endif -#define MB_ (1024*1024) +#define MB_ (1024 * 1024) #define KB_ (1024) #define MAX_NUM_BOARDS 7 - /***************************************************************** * * chipset information @@ -123,7 +122,6 @@ typedef enum { BT_LAGUNA, /* GD546x */ } cirrusfb_board_t; - /* * per-board-type information, used for enumerating and abstracting * chip-specific information @@ -139,7 +137,8 @@ static const struct cirrusfb_board_info_rec { /* for 1/4bpp, 8bpp 15/16bpp, 24bpp, 32bpp - numbers from xorg code */ bool init_sr07 : 1; /* init SR07 during init_vgachip() */ bool init_sr1f : 1; /* write SR1F during init_vgachip() */ - bool scrn_start_bit19 : 1; /* construct bit 19 of screen start address */ + /* construct bit 19 of screen start address */ + bool scrn_start_bit19 : 1; /* initial SR07 value, then for each mode */ unsigned char sr07; @@ -261,30 +260,28 @@ static const struct cirrusfb_board_info_rec { } }; - #ifdef CONFIG_PCI #define CHIP(id, btype) \ { PCI_VENDOR_ID_CIRRUS, id, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (btype) } static struct pci_device_id cirrusfb_pci_table[] = { - CHIP( PCI_DEVICE_ID_CIRRUS_5436, BT_ALPINE ), - CHIP( PCI_DEVICE_ID_CIRRUS_5434_8, BT_ALPINE ), - CHIP( PCI_DEVICE_ID_CIRRUS_5434_4, BT_ALPINE ), - CHIP( PCI_DEVICE_ID_CIRRUS_5430, BT_ALPINE ), /* GD-5440 is same id */ - CHIP( PCI_DEVICE_ID_CIRRUS_7543, BT_ALPINE ), - CHIP( PCI_DEVICE_ID_CIRRUS_7548, BT_ALPINE ), - CHIP( PCI_DEVICE_ID_CIRRUS_5480, BT_GD5480 ), /* MacPicasso likely */ - CHIP( PCI_DEVICE_ID_CIRRUS_5446, BT_PICASSO4 ), /* Picasso 4 is 5446 */ - CHIP( PCI_DEVICE_ID_CIRRUS_5462, BT_LAGUNA ), /* CL Laguna */ - CHIP( PCI_DEVICE_ID_CIRRUS_5464, BT_LAGUNA ), /* CL Laguna 3D */ - CHIP( PCI_DEVICE_ID_CIRRUS_5465, BT_LAGUNA ), /* CL Laguna 3DA*/ + CHIP(PCI_DEVICE_ID_CIRRUS_5436, BT_ALPINE), + CHIP(PCI_DEVICE_ID_CIRRUS_5434_8, BT_ALPINE), + CHIP(PCI_DEVICE_ID_CIRRUS_5434_4, BT_ALPINE), + CHIP(PCI_DEVICE_ID_CIRRUS_5430, BT_ALPINE), /* GD-5440 is same id */ + CHIP(PCI_DEVICE_ID_CIRRUS_7543, BT_ALPINE), + CHIP(PCI_DEVICE_ID_CIRRUS_7548, BT_ALPINE), + CHIP(PCI_DEVICE_ID_CIRRUS_5480, BT_GD5480), /* MacPicasso likely */ + CHIP(PCI_DEVICE_ID_CIRRUS_5446, BT_PICASSO4), /* Picasso 4 is 5446 */ + CHIP(PCI_DEVICE_ID_CIRRUS_5462, BT_LAGUNA), /* CL Laguna */ + CHIP(PCI_DEVICE_ID_CIRRUS_5464, BT_LAGUNA), /* CL Laguna 3D */ + CHIP(PCI_DEVICE_ID_CIRRUS_5465, BT_LAGUNA), /* CL Laguna 3DA*/ { 0, } }; MODULE_DEVICE_TABLE(pci, cirrusfb_pci_table); #undef CHIP #endif /* CONFIG_PCI */ - #ifdef CONFIG_ZORRO static const struct zorro_device_id cirrusfb_zorro_table[] = { { @@ -294,7 +291,7 @@ static const struct zorro_device_id cirrusfb_zorro_table[] = { .id = ZORRO_PROD_HELFRICH_PICCOLO_RAM, .driver_data = BT_PICCOLO, }, { - .id = ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_RAM, + .id = ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_RAM, .driver_data = BT_PICASSO, }, { .id = ZORRO_PROD_GVP_EGS_28_24_SPECTRUM_RAM, @@ -333,7 +330,6 @@ static const struct { }; #endif /* CONFIG_ZORRO */ - struct cirrusfb_regs { __u32 line_length; /* in BYTES! */ __u32 visual; @@ -364,17 +360,12 @@ struct cirrusfb_regs { long VertBlankEnd; }; - - #ifdef CIRRUSFB_DEBUG typedef enum { - CRT, - SEQ + CRT, + SEQ } cirrusfb_dbg_reg_class_t; -#endif /* CIRRUSFB_DEBUG */ - - - +#endif /* CIRRUSFB_DEBUG */ /* info about board */ struct cirrusfb_info { @@ -405,9 +396,8 @@ struct cirrusfb_info { void (*unmap)(struct cirrusfb_info *cinfo); }; - static unsigned cirrusfb_def_mode = 1; -static int noaccel = 0; +static int noaccel; /* * Predefined Video Modes @@ -441,7 +431,7 @@ static const struct { .lower_margin = 8, .hsync_len = 96, .vsync_len = 4, - .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, + .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, .vmode = FB_VMODE_NONINTERLACED } }, { @@ -502,27 +492,29 @@ static const struct { /****************************************************************************/ /**** BEGIN PROTOTYPES ******************************************************/ - /*--- Interface used by the world ------------------------------------------*/ -static int cirrusfb_init (void); +static int cirrusfb_init(void); #ifndef MODULE -static int cirrusfb_setup (char *options); +static int cirrusfb_setup(char *options); #endif -static int cirrusfb_open (struct fb_info *info, int user); -static int cirrusfb_release (struct fb_info *info, int user); -static int cirrusfb_setcolreg (unsigned regno, unsigned red, unsigned green, - unsigned blue, unsigned transp, - struct fb_info *info); -static int cirrusfb_check_var (struct fb_var_screeninfo *var, - struct fb_info *info); -static int cirrusfb_set_par (struct fb_info *info); -static int cirrusfb_pan_display (struct fb_var_screeninfo *var, - struct fb_info *info); -static int cirrusfb_blank (int blank_mode, struct fb_info *info); -static void cirrusfb_fillrect (struct fb_info *info, const struct fb_fillrect *region); -static void cirrusfb_copyarea(struct fb_info *info, const struct fb_copyarea *area); -static void cirrusfb_imageblit(struct fb_info *info, const struct fb_image *image); +static int cirrusfb_open(struct fb_info *info, int user); +static int cirrusfb_release(struct fb_info *info, int user); +static int cirrusfb_setcolreg(unsigned regno, unsigned red, unsigned green, + unsigned blue, unsigned transp, + struct fb_info *info); +static int cirrusfb_check_var(struct fb_var_screeninfo *var, + struct fb_info *info); +static int cirrusfb_set_par(struct fb_info *info); +static int cirrusfb_pan_display(struct fb_var_screeninfo *var, + struct fb_info *info); +static int cirrusfb_blank(int blank_mode, struct fb_info *info); +static void cirrusfb_fillrect(struct fb_info *info, + const struct fb_fillrect *region); +static void cirrusfb_copyarea(struct fb_info *info, + const struct fb_copyarea *area); +static void cirrusfb_imageblit(struct fb_info *info, + const struct fb_image *image); /* function table of the above functions */ static struct fb_ops cirrusfb_ops = { @@ -540,68 +532,68 @@ static struct fb_ops cirrusfb_ops = { }; /*--- Hardware Specific Routines -------------------------------------------*/ -static int cirrusfb_decode_var (const struct fb_var_screeninfo *var, +static int cirrusfb_decode_var(const struct fb_var_screeninfo *var, struct cirrusfb_regs *regs, const struct fb_info *info); /*--- Internal routines ----------------------------------------------------*/ -static void init_vgachip (struct cirrusfb_info *cinfo); -static void switch_monitor (struct cirrusfb_info *cinfo, int on); -static void WGen (const struct cirrusfb_info *cinfo, - int regnum, unsigned char val); -static unsigned char RGen (const struct cirrusfb_info *cinfo, int regnum); -static void AttrOn (const struct cirrusfb_info *cinfo); -static void WHDR (const struct cirrusfb_info *cinfo, unsigned char val); -static void WSFR (struct cirrusfb_info *cinfo, unsigned char val); -static void WSFR2 (struct cirrusfb_info *cinfo, unsigned char val); -static void WClut (struct cirrusfb_info *cinfo, unsigned char regnum, unsigned char red, - unsigned char green, - unsigned char blue); +static void init_vgachip(struct cirrusfb_info *cinfo); +static void switch_monitor(struct cirrusfb_info *cinfo, int on); +static void WGen(const struct cirrusfb_info *cinfo, + int regnum, unsigned char val); +static unsigned char RGen(const struct cirrusfb_info *cinfo, int regnum); +static void AttrOn(const struct cirrusfb_info *cinfo); +static void WHDR(const struct cirrusfb_info *cinfo, unsigned char val); +static void WSFR(struct cirrusfb_info *cinfo, unsigned char val); +static void WSFR2(struct cirrusfb_info *cinfo, unsigned char val); +static void WClut(struct cirrusfb_info *cinfo, unsigned char regnum, + unsigned char red, unsigned char green, unsigned char blue); #if 0 -static void RClut (struct cirrusfb_info *cinfo, unsigned char regnum, unsigned char *red, - unsigned char *green, - unsigned char *blue); +static void RClut(struct cirrusfb_info *cinfo, unsigned char regnum, + unsigned char *red, unsigned char *green, + unsigned char *blue); #endif -static void cirrusfb_WaitBLT (u8 __iomem *regbase); -static void cirrusfb_BitBLT (u8 __iomem *regbase, int bits_per_pixel, - u_short curx, u_short cury, - u_short destx, u_short desty, - u_short width, u_short height, - u_short line_length); -static void cirrusfb_RectFill (u8 __iomem *regbase, int bits_per_pixel, - u_short x, u_short y, - u_short width, u_short height, - u_char color, u_short line_length); - -static void bestclock (long freq, long *best, - long *nom, long *den, - long *div, long maxfreq); +static void cirrusfb_WaitBLT(u8 __iomem *regbase); +static void cirrusfb_BitBLT(u8 __iomem *regbase, int bits_per_pixel, + u_short curx, u_short cury, + u_short destx, u_short desty, + u_short width, u_short height, + u_short line_length); +static void cirrusfb_RectFill(u8 __iomem *regbase, int bits_per_pixel, + u_short x, u_short y, + u_short width, u_short height, + u_char color, u_short line_length); + +static void bestclock(long freq, long *best, + long *nom, long *den, + long *div, long maxfreq); #ifdef CIRRUSFB_DEBUG -static void cirrusfb_dump (void); -static void cirrusfb_dbg_reg_dump (caddr_t regbase); -static void cirrusfb_dbg_print_regs (caddr_t regbase, cirrusfb_dbg_reg_class_t reg_class,...); -static void cirrusfb_dbg_print_byte (const char *name, unsigned char val); +static void cirrusfb_dump(void); +static void cirrusfb_dbg_reg_dump(caddr_t regbase); +static void cirrusfb_dbg_print_regs(caddr_t regbase, + cirrusfb_dbg_reg_class_t reg_class, ...); +static void cirrusfb_dbg_print_byte(const char *name, unsigned char val); #endif /* CIRRUSFB_DEBUG */ /*** END PROTOTYPES ********************************************************/ /*****************************************************************************/ /*** BEGIN Interface Used by the World ***************************************/ -static int opencount = 0; +static int opencount; /*--- Open /dev/fbx ---------------------------------------------------------*/ -static int cirrusfb_open (struct fb_info *info, int user) +static int cirrusfb_open(struct fb_info *info, int user) { if (opencount++ == 0) - switch_monitor (info->par, 1); + switch_monitor(info->par, 1); return 0; } /*--- Close /dev/fbx --------------------------------------------------------*/ -static int cirrusfb_release (struct fb_info *info, int user) +static int cirrusfb_release(struct fb_info *info, int user) { if (--opencount == 0) - switch_monitor (info->par, 0); + switch_monitor(info->par, 0); return 0; } @@ -610,11 +602,11 @@ static int cirrusfb_release (struct fb_info *info, int user) /**** BEGIN Hardware specific Routines **************************************/ /* Get a good MCLK value */ -static long cirrusfb_get_mclk (long freq, int bpp, long *div) +static long cirrusfb_get_mclk(long freq, int bpp, long *div) { long mclk; - assert (div != NULL); + assert(div != NULL); /* Calculate MCLK, in case VCLK is high enough to require > 50MHz. * Assume a 64-bit data path for now. The formula is: @@ -624,23 +616,23 @@ static long cirrusfb_get_mclk (long freq, int bpp, long *div) mclk = (mclk * 12) / 10; if (mclk < 50000) mclk = 50000; - DPRINTK ("Use MCLK of %ld kHz\n", mclk); + DPRINTK("Use MCLK of %ld kHz\n", mclk); /* Calculate value for SR1F. Multiply by 2 so we can round up. */ mclk = ((mclk * 16) / 14318); mclk = (mclk + 1) / 2; - DPRINTK ("Set SR1F[5:0] to 0x%lx\n", mclk); + DPRINTK("Set SR1F[5:0] to 0x%lx\n", mclk); /* Determine if we should use MCLK instead of VCLK, and if so, what we * should divide it by to get VCLK */ switch (freq) { case 24751 ... 25249: *div = 2; - DPRINTK ("Using VCLK = MCLK/2\n"); + DPRINTK("Using VCLK = MCLK/2\n"); break; case 49501 ... 50499: *div = 1; - DPRINTK ("Using VCLK = MCLK\n"); + DPRINTK("Using VCLK = MCLK\n"); break; default: *div = 0; @@ -691,37 +683,42 @@ static int cirrusfb_check_var(struct fb_var_screeninfo *var, den = 1; break; /* 4 bytes per pixel */ default: - printk ("cirrusfb: mode %dx%dx%d rejected...color depth not supported.\n", + printk(KERN_ERR "cirrusfb: mode %dx%dx%d rejected..." + "color depth not supported.\n", var->xres, var->yres, var->bits_per_pixel); - DPRINTK ("EXIT - EINVAL error\n"); + DPRINTK("EXIT - EINVAL error\n"); return -EINVAL; } if (var->xres * nom / den * var->yres > cinfo->size) { - printk ("cirrusfb: mode %dx%dx%d rejected...resolution too high to fit into video memory!\n", + printk(KERN_ERR "cirrusfb: mode %dx%dx%d rejected..." + "resolution too high to fit into video memory!\n", var->xres, var->yres, var->bits_per_pixel); - DPRINTK ("EXIT - EINVAL error\n"); + DPRINTK("EXIT - EINVAL error\n"); return -EINVAL; } /* use highest possible virtual resolution */ if (var->xres_virtual == -1 && var->yres_virtual == -1) { - printk ("cirrusfb: using maximum available virtual resolution\n"); + printk(KERN_INFO + "cirrusfb: using maximum available virtual resolution\n"); for (i = 0; modes[i].xres != -1; i++) { if (modes[i].xres * nom / den * modes[i].yres < cinfo->size / 2) break; } if (modes[i].xres == -1) { - printk ("cirrusfb: could not find a virtual resolution that fits into video memory!!\n"); - DPRINTK ("EXIT - EINVAL error\n"); + printk(KERN_ERR "cirrusfb: could not find a virtual " + "resolution that fits into video memory!!\n"); + DPRINTK("EXIT - EINVAL error\n"); return -EINVAL; } var->xres_virtual = modes[i].xres; var->yres_virtual = modes[i].yres; - printk ("cirrusfb: virtual resolution set to maximum of %dx%d\n", - var->xres_virtual, var->yres_virtual); + printk(KERN_INFO "cirrusfb: virtual resolution set to " + "maximum of %dx%d\n", var->xres_virtual, + var->yres_virtual); } if (var->xres_virtual < var->xres) @@ -760,7 +757,7 @@ static int cirrusfb_check_var(struct fb_var_screeninfo *var, break; case 16: - if(isPReP) { + if (isPReP) { var->red.offset = 2; var->green.offset = -3; var->blue.offset = 8; @@ -775,7 +772,7 @@ static int cirrusfb_check_var(struct fb_var_screeninfo *var, break; case 24: - if(isPReP) { + if (isPReP) { var->red.offset = 8; var->green.offset = 16; var->blue.offset = 24; @@ -790,7 +787,7 @@ static int cirrusfb_check_var(struct fb_var_screeninfo *var, break; case 32: - if(isPReP) { + if (isPReP) { var->red.offset = 8; var->green.offset = 16; var->blue.offset = 24; @@ -825,15 +822,16 @@ static int cirrusfb_check_var(struct fb_var_screeninfo *var, yres = (yres + 1) / 2; if (yres >= 1280) { - printk (KERN_WARNING "cirrusfb: ERROR: VerticalTotal >= 1280; special treatment required! (TODO)\n"); - DPRINTK ("EXIT - EINVAL error\n"); + printk(KERN_ERR "cirrusfb: ERROR: VerticalTotal >= 1280; " + "special treatment required! (TODO)\n"); + DPRINTK("EXIT - EINVAL error\n"); return -EINVAL; } return 0; } -static int cirrusfb_decode_var (const struct fb_var_screeninfo *var, +static int cirrusfb_decode_var(const struct fb_var_screeninfo *var, struct cirrusfb_regs *regs, const struct fb_info *info) { @@ -844,7 +842,7 @@ static int cirrusfb_decode_var (const struct fb_var_screeninfo *var, int xres, hfront, hsync, hback; int yres, vfront, vsync, vback; - switch(var->bits_per_pixel) { + switch (var->bits_per_pixel) { case 1: regs->line_length = var->xres_virtual / 8; regs->visual = FB_VISUAL_MONO10; @@ -887,7 +885,7 @@ static int cirrusfb_decode_var (const struct fb_var_screeninfo *var, /* convert from ps to kHz */ freq = 1000000000 / var->pixclock; - DPRINTK ("desired pixclock: %ld kHz\n", freq); + DPRINTK("desired pixclock: %ld kHz\n", freq); maxclock = cirrusfb_board_info[cinfo->btype].maxclock[maxclockidx]; regs->multiplexing = 0; @@ -902,8 +900,9 @@ static int cirrusfb_decode_var (const struct fb_var_screeninfo *var, break; default: - printk (KERN_WARNING "cirrusfb: ERROR: Frequency greater than maxclock (%ld kHz)\n", maxclock); - DPRINTK ("EXIT - return -EINVAL\n"); + printk(KERN_ERR "cirrusfb: Frequency greater " + "than maxclock (%ld kHz)\n", maxclock); + DPRINTK("EXIT - return -EINVAL\n"); return -EINVAL; } } @@ -914,14 +913,16 @@ static int cirrusfb_decode_var (const struct fb_var_screeninfo *var, case 16: case 32: if (regs->HorizRes <= 800) - freq /= 2; /* Xbh has this type of clock for 32-bit */ + /* Xbh has this type of clock for 32-bit */ + freq /= 2; break; } #endif - bestclock (freq, ®s->freq, ®s->nom, ®s->den, ®s->div, - maxclock); - regs->mclk = cirrusfb_get_mclk (freq, var->bits_per_pixel, ®s->divMCLK); + bestclock(freq, ®s->freq, ®s->nom, ®s->den, ®s->div, + maxclock); + regs->mclk = cirrusfb_get_mclk(freq, var->bits_per_pixel, + ®s->divMCLK); xres = var->xres; hfront = var->right_margin; @@ -948,7 +949,8 @@ static int cirrusfb_decode_var (const struct fb_var_screeninfo *var, regs->HorizTotal = (xres + hfront + hsync + hback) / 8 - 5; regs->HorizDispEnd = xres / 8 - 1; regs->HorizBlankStart = xres / 8; - regs->HorizBlankEnd = regs->HorizTotal + 5; /* does not count with "-5" */ + /* does not count with "-5" */ + regs->HorizBlankEnd = regs->HorizTotal + 5; regs->HorizSyncStart = (xres + hfront) / 8 + 1; regs->HorizSyncEnd = (xres + hfront + hsync) / 8 + 1; @@ -976,23 +978,23 @@ static int cirrusfb_decode_var (const struct fb_var_screeninfo *var, return 0; } - -static void cirrusfb_set_mclk (const struct cirrusfb_info *cinfo, int val, int div) +static void cirrusfb_set_mclk(const struct cirrusfb_info *cinfo, int val, + int div) { - assert (cinfo != NULL); + assert(cinfo != NULL); if (div == 2) { /* VCLK = MCLK/2 */ - unsigned char old = vga_rseq (cinfo->regbase, CL_SEQR1E); - vga_wseq (cinfo->regbase, CL_SEQR1E, old | 0x1); - vga_wseq (cinfo->regbase, CL_SEQR1F, 0x40 | (val & 0x3f)); + unsigned char old = vga_rseq(cinfo->regbase, CL_SEQR1E); + vga_wseq(cinfo->regbase, CL_SEQR1E, old | 0x1); + vga_wseq(cinfo->regbase, CL_SEQR1F, 0x40 | (val & 0x3f)); } else if (div == 1) { /* VCLK = MCLK */ - unsigned char old = vga_rseq (cinfo->regbase, CL_SEQR1E); - vga_wseq (cinfo->regbase, CL_SEQR1E, old & ~0x1); - vga_wseq (cinfo->regbase, CL_SEQR1F, 0x40 | (val & 0x3f)); + unsigned char old = vga_rseq(cinfo->regbase, CL_SEQR1E); + vga_wseq(cinfo->regbase, CL_SEQR1E, old & ~0x1); + vga_wseq(cinfo->regbase, CL_SEQR1F, 0x40 | (val & 0x3f)); } else { - vga_wseq (cinfo->regbase, CL_SEQR1F, val & 0x3f); + vga_wseq(cinfo->regbase, CL_SEQR1F, val & 0x3f); } } @@ -1001,7 +1003,7 @@ static void cirrusfb_set_mclk (const struct cirrusfb_info *cinfo, int val, int d actually writes the values for a new video mode into the hardware, **************************************************************************/ -static int cirrusfb_set_par_foo (struct fb_info *info) +static int cirrusfb_set_par_foo(struct fb_info *info) { struct cirrusfb_info *cinfo = info->par; struct fb_var_screeninfo *var = &info->var; @@ -1011,15 +1013,15 @@ static int cirrusfb_set_par_foo (struct fb_info *info) int offset = 0, err; const struct cirrusfb_board_info_rec *bi; - DPRINTK ("ENTER\n"); - DPRINTK ("Requested mode: %dx%dx%d\n", + DPRINTK("ENTER\n"); + DPRINTK("Requested mode: %dx%dx%d\n", var->xres, var->yres, var->bits_per_pixel); - DPRINTK ("pixclock: %d\n", var->pixclock); + DPRINTK("pixclock: %d\n", var->pixclock); - init_vgachip (cinfo); + init_vgachip(cinfo); err = cirrusfb_decode_var(var, ®s, info); - if(err) { + if (err) { /* should never happen */ DPRINTK("mode change aborted. invalid var.\n"); return -EINVAL; @@ -1027,34 +1029,35 @@ static int cirrusfb_set_par_foo (struct fb_info *info) bi = &cirrusfb_board_info[cinfo->btype]; - /* unlock register VGA_CRTC_H_TOTAL..CRT7 */ - vga_wcrt (regbase, VGA_CRTC_V_SYNC_END, 0x20); /* previously: 0x00) */ + vga_wcrt(regbase, VGA_CRTC_V_SYNC_END, 0x20); /* previously: 0x00) */ /* if debugging is enabled, all parameters get output before writing */ - DPRINTK ("CRT0: %ld\n", regs.HorizTotal); - vga_wcrt (regbase, VGA_CRTC_H_TOTAL, regs.HorizTotal); + DPRINTK("CRT0: %ld\n", regs.HorizTotal); + vga_wcrt(regbase, VGA_CRTC_H_TOTAL, regs.HorizTotal); - DPRINTK ("CRT1: %ld\n", regs.HorizDispEnd); - vga_wcrt (regbase, VGA_CRTC_H_DISP, regs.HorizDispEnd); + DPRINTK("CRT1: %ld\n", regs.HorizDispEnd); + vga_wcrt(regbase, VGA_CRTC_H_DISP, regs.HorizDispEnd); - DPRINTK ("CRT2: %ld\n", regs.HorizBlankStart); - vga_wcrt (regbase, VGA_CRTC_H_BLANK_START, regs.HorizBlankStart); + DPRINTK("CRT2: %ld\n", regs.HorizBlankStart); + vga_wcrt(regbase, VGA_CRTC_H_BLANK_START, regs.HorizBlankStart); - DPRINTK ("CRT3: 128+%ld\n", regs.HorizBlankEnd % 32); /* + 128: Compatible read */ - vga_wcrt (regbase, VGA_CRTC_H_BLANK_END, 128 + (regs.HorizBlankEnd % 32)); + /* + 128: Compatible read */ + DPRINTK("CRT3: 128+%ld\n", regs.HorizBlankEnd % 32); + vga_wcrt(regbase, VGA_CRTC_H_BLANK_END, + 128 + (regs.HorizBlankEnd % 32)); - DPRINTK ("CRT4: %ld\n", regs.HorizSyncStart); - vga_wcrt (regbase, VGA_CRTC_H_SYNC_START, regs.HorizSyncStart); + DPRINTK("CRT4: %ld\n", regs.HorizSyncStart); + vga_wcrt(regbase, VGA_CRTC_H_SYNC_START, regs.HorizSyncStart); tmp = regs.HorizSyncEnd % 32; if (regs.HorizBlankEnd & 32) tmp += 128; - DPRINTK ("CRT5: %d\n", tmp); - vga_wcrt (regbase, VGA_CRTC_H_SYNC_END, tmp); + DPRINTK("CRT5: %d\n", tmp); + vga_wcrt(regbase, VGA_CRTC_H_SYNC_END, tmp); - DPRINTK ("CRT6: %ld\n", regs.VertTotal & 0xff); - vga_wcrt (regbase, VGA_CRTC_V_TOTAL, (regs.VertTotal & 0xff)); + DPRINTK("CRT6: %ld\n", regs.VertTotal & 0xff); + vga_wcrt(regbase, VGA_CRTC_V_TOTAL, (regs.VertTotal & 0xff)); tmp = 16; /* LineCompare bit #9 */ if (regs.VertTotal & 256) @@ -1071,34 +1074,34 @@ static int cirrusfb_set_par_foo (struct fb_info *info) tmp |= 64; if (regs.VertSyncStart & 512) tmp |= 128; - DPRINTK ("CRT7: %d\n", tmp); - vga_wcrt (regbase, VGA_CRTC_OVERFLOW, tmp); + DPRINTK("CRT7: %d\n", tmp); + vga_wcrt(regbase, VGA_CRTC_OVERFLOW, tmp); tmp = 0x40; /* LineCompare bit #8 */ if (regs.VertBlankStart & 512) tmp |= 0x20; if (var->vmode & FB_VMODE_DOUBLE) tmp |= 0x80; - DPRINTK ("CRT9: %d\n", tmp); - vga_wcrt (regbase, VGA_CRTC_MAX_SCAN, tmp); + DPRINTK("CRT9: %d\n", tmp); + vga_wcrt(regbase, VGA_CRTC_MAX_SCAN, tmp); - DPRINTK ("CRT10: %ld\n", regs.VertSyncStart & 0xff); - vga_wcrt (regbase, VGA_CRTC_V_SYNC_START, (regs.VertSyncStart & 0xff)); + DPRINTK("CRT10: %ld\n", regs.VertSyncStart & 0xff); + vga_wcrt(regbase, VGA_CRTC_V_SYNC_START, regs.VertSyncStart & 0xff); - DPRINTK ("CRT11: 64+32+%ld\n", regs.VertSyncEnd % 16); - vga_wcrt (regbase, VGA_CRTC_V_SYNC_END, (regs.VertSyncEnd % 16 + 64 + 32)); + DPRINTK("CRT11: 64+32+%ld\n", regs.VertSyncEnd % 16); + vga_wcrt(regbase, VGA_CRTC_V_SYNC_END, regs.VertSyncEnd % 16 + 64 + 32); - DPRINTK ("CRT12: %ld\n", regs.VertDispEnd & 0xff); - vga_wcrt (regbase, VGA_CRTC_V_DISP_END, (regs.VertDispEnd & 0xff)); + DPRINTK("CRT12: %ld\n", regs.VertDispEnd & 0xff); + vga_wcrt(regbase, VGA_CRTC_V_DISP_END, regs.VertDispEnd & 0xff); - DPRINTK ("CRT15: %ld\n", regs.VertBlankStart & 0xff); - vga_wcrt (regbase, VGA_CRTC_V_BLANK_START, (regs.VertBlankStart & 0xff)); + DPRINTK("CRT15: %ld\n", regs.VertBlankStart & 0xff); + vga_wcrt(regbase, VGA_CRTC_V_BLANK_START, regs.VertBlankStart & 0xff); - DPRINTK ("CRT16: %ld\n", regs.VertBlankEnd & 0xff); - vga_wcrt (regbase, VGA_CRTC_V_BLANK_END, (regs.VertBlankEnd & 0xff)); + DPRINTK("CRT16: %ld\n", regs.VertBlankEnd & 0xff); + vga_wcrt(regbase, VGA_CRTC_V_BLANK_END, regs.VertBlankEnd & 0xff); - DPRINTK ("CRT18: 0xff\n"); - vga_wcrt (regbase, VGA_CRTC_LINE_COMPARE, 0xff); + DPRINTK("CRT18: 0xff\n"); + vga_wcrt(regbase, VGA_CRTC_LINE_COMPARE, 0xff); tmp = 0; if (var->vmode & FB_VMODE_INTERLACED) @@ -1112,57 +1115,63 @@ static int cirrusfb_set_par_foo (struct fb_info *info) if (regs.VertBlankEnd & 512) tmp |= 128; - DPRINTK ("CRT1a: %d\n", tmp); - vga_wcrt (regbase, CL_CRT1A, tmp); + DPRINTK("CRT1a: %d\n", tmp); + vga_wcrt(regbase, CL_CRT1A, tmp); /* set VCLK0 */ /* hardware RefClock: 14.31818 MHz */ /* formula: VClk = (OSC * N) / (D * (1+P)) */ /* Example: VClk = (14.31818 * 91) / (23 * (1+1)) = 28.325 MHz */ - vga_wseq (regbase, CL_SEQRB, regs.nom); + vga_wseq(regbase, CL_SEQRB, regs.nom); tmp = regs.den << 1; if (regs.div != 0) tmp |= 1; + /* 6 bit denom; ONLY 5434!!! (bugged me 10 days) */ if ((cinfo->btype == BT_SD64) || (cinfo->btype == BT_ALPINE) || (cinfo->btype == BT_GD5480)) - tmp |= 0x80; /* 6 bit denom; ONLY 5434!!! (bugged me 10 days) */ + tmp |= 0x80; - DPRINTK ("CL_SEQR1B: %ld\n", (long) tmp); - vga_wseq (regbase, CL_SEQR1B, tmp); + DPRINTK("CL_SEQR1B: %ld\n", (long) tmp); + vga_wseq(regbase, CL_SEQR1B, tmp); if (regs.VertRes >= 1024) /* 1280x1024 */ - vga_wcrt (regbase, VGA_CRTC_MODE, 0xc7); + vga_wcrt(regbase, VGA_CRTC_MODE, 0xc7); else /* mode control: VGA_CRTC_START_HI enable, ROTATE(?), 16bit * address wrap, no compat. */ - vga_wcrt (regbase, VGA_CRTC_MODE, 0xc3); + vga_wcrt(regbase, VGA_CRTC_MODE, 0xc3); -/* HAEH? vga_wcrt (regbase, VGA_CRTC_V_SYNC_END, 0x20); * previously: 0x00 unlock VGA_CRTC_H_TOTAL..CRT7 */ +/* HAEH? vga_wcrt(regbase, VGA_CRTC_V_SYNC_END, 0x20); + * previously: 0x00 unlock VGA_CRTC_H_TOTAL..CRT7 */ /* don't know if it would hurt to also program this if no interlaced */ /* mode is used, but I feel better this way.. :-) */ if (var->vmode & FB_VMODE_INTERLACED) - vga_wcrt (regbase, VGA_CRTC_REGS, regs.HorizTotal / 2); + vga_wcrt(regbase, VGA_CRTC_REGS, regs.HorizTotal / 2); else - vga_wcrt (regbase, VGA_CRTC_REGS, 0x00); /* interlace control */ + vga_wcrt(regbase, VGA_CRTC_REGS, 0x00); /* interlace control */ - vga_wseq (regbase, VGA_SEQ_CHARACTER_MAP, 0); + vga_wseq(regbase, VGA_SEQ_CHARACTER_MAP, 0); /* adjust horizontal/vertical sync type (low/high) */ - tmp = 0x03; /* enable display memory & CRTC I/O address for color mode */ + /* enable display memory & CRTC I/O address for color mode */ + tmp = 0x03; if (var->sync & FB_SYNC_HOR_HIGH_ACT) tmp |= 0x40; if (var->sync & FB_SYNC_VERT_HIGH_ACT) tmp |= 0x80; - WGen (cinfo, VGA_MIS_W, tmp); + WGen(cinfo, VGA_MIS_W, tmp); - vga_wcrt (regbase, VGA_CRTC_PRESET_ROW, 0); /* Screen A Preset Row-Scan register */ - vga_wcrt (regbase, VGA_CRTC_CURSOR_START, 0); /* text cursor on and start line */ - vga_wcrt (regbase, VGA_CRTC_CURSOR_END, 31); /* text cursor end line */ + /* Screen A Preset Row-Scan register */ + vga_wcrt(regbase, VGA_CRTC_PRESET_ROW, 0); + /* text cursor on and start line */ + vga_wcrt(regbase, VGA_CRTC_CURSOR_START, 0); + /* text cursor end line */ + vga_wcrt(regbase, VGA_CRTC_CURSOR_END, 31); /****************************************************** * @@ -1172,8 +1181,8 @@ static int cirrusfb_set_par_foo (struct fb_info *info) /* programming for different color depths */ if (var->bits_per_pixel == 1) { - DPRINTK ("cirrusfb: preparing for 1 bit deep display\n"); - vga_wgfx (regbase, VGA_GFX_MODE, 0); /* mode register */ + DPRINTK("cirrusfb: preparing for 1 bit deep display\n"); + vga_wgfx(regbase, VGA_GFX_MODE, 0); /* mode register */ /* SR07 */ switch (cinfo->btype) { @@ -1184,71 +1193,85 @@ static int cirrusfb_set_par_foo (struct fb_info *info) case BT_PICASSO4: case BT_ALPINE: case BT_GD5480: - DPRINTK (" (for GD54xx)\n"); - vga_wseq (regbase, CL_SEQR7, + DPRINTK(" (for GD54xx)\n"); + vga_wseq(regbase, CL_SEQR7, regs.multiplexing ? bi->sr07_1bpp_mux : bi->sr07_1bpp); break; case BT_LAGUNA: - DPRINTK (" (for GD546x)\n"); - vga_wseq (regbase, CL_SEQR7, - vga_rseq (regbase, CL_SEQR7) & ~0x01); + DPRINTK(" (for GD546x)\n"); + vga_wseq(regbase, CL_SEQR7, + vga_rseq(regbase, CL_SEQR7) & ~0x01); break; default: - printk (KERN_WARNING "cirrusfb: unknown Board\n"); + printk(KERN_WARNING "cirrusfb: unknown Board\n"); break; } /* Extended Sequencer Mode */ switch (cinfo->btype) { case BT_SD64: - /* setting the SEQRF on SD64 is not necessary (only during init) */ - DPRINTK ("(for SD64)\n"); - vga_wseq (regbase, CL_SEQR1F, 0x1a); /* MCLK select */ + /* setting the SEQRF on SD64 is not necessary + * (only during init) + */ + DPRINTK("(for SD64)\n"); + /* MCLK select */ + vga_wseq(regbase, CL_SEQR1F, 0x1a); break; case BT_PICCOLO: - DPRINTK ("(for Piccolo)\n"); -/* ### ueberall 0x22? */ - vga_wseq (regbase, CL_SEQR1F, 0x22); /* ##vorher 1c MCLK select */ - vga_wseq (regbase, CL_SEQRF, 0xb0); /* evtl d0 bei 1 bit? avoid FIFO underruns..? */ + DPRINTK("(for Piccolo)\n"); + /* ### ueberall 0x22? */ + /* ##vorher 1c MCLK select */ + vga_wseq(regbase, CL_SEQR1F, 0x22); + /* evtl d0 bei 1 bit? avoid FIFO underruns..? */ + vga_wseq(regbase, CL_SEQRF, 0xb0); break; case BT_PICASSO: - DPRINTK ("(for Picasso)\n"); - vga_wseq (regbase, CL_SEQR1F, 0x22); /* ##vorher 22 MCLK select */ - vga_wseq (regbase, CL_SEQRF, 0xd0); /* ## vorher d0 avoid FIFO underruns..? */ + DPRINTK("(for Picasso)\n"); + /* ##vorher 22 MCLK select */ + vga_wseq(regbase, CL_SEQR1F, 0x22); + /* ## vorher d0 avoid FIFO underruns..? */ + vga_wseq(regbase, CL_SEQRF, 0xd0); break; case BT_SPECTRUM: - DPRINTK ("(for Spectrum)\n"); -/* ### ueberall 0x22? */ - vga_wseq (regbase, CL_SEQR1F, 0x22); /* ##vorher 1c MCLK select */ - vga_wseq (regbase, CL_SEQRF, 0xb0); /* evtl d0? avoid FIFO underruns..? */ + DPRINTK("(for Spectrum)\n"); + /* ### ueberall 0x22? */ + /* ##vorher 1c MCLK select */ + vga_wseq(regbase, CL_SEQR1F, 0x22); + /* evtl d0? avoid FIFO underruns..? */ + vga_wseq(regbase, CL_SEQRF, 0xb0); break; case BT_PICASSO4: case BT_ALPINE: case BT_GD5480: case BT_LAGUNA: - DPRINTK (" (for GD54xx)\n"); + DPRINTK(" (for GD54xx)\n"); /* do nothing */ break; default: - printk (KERN_WARNING "cirrusfb: unknown Board\n"); + printk(KERN_WARNING "cirrusfb: unknown Board\n"); break; } - WGen (cinfo, VGA_PEL_MSK, 0x01); /* pixel mask: pass-through for first plane */ + /* pixel mask: pass-through for first plane */ + WGen(cinfo, VGA_PEL_MSK, 0x01); if (regs.multiplexing) - WHDR (cinfo, 0x4a); /* hidden dac reg: 1280x1024 */ + /* hidden dac reg: 1280x1024 */ + WHDR(cinfo, 0x4a); else - WHDR (cinfo, 0); /* hidden dac: nothing */ - vga_wseq (regbase, VGA_SEQ_MEMORY_MODE, 0x06); /* memory mode: odd/even, ext. memory */ - vga_wseq (regbase, VGA_SEQ_PLANE_WRITE, 0x01); /* plane mask: only write to first plane */ + /* hidden dac: nothing */ + WHDR(cinfo, 0); + /* memory mode: odd/even, ext. memory */ + vga_wseq(regbase, VGA_SEQ_MEMORY_MODE, 0x06); + /* plane mask: only write to first plane */ + vga_wseq(regbase, VGA_SEQ_PLANE_WRITE, 0x01); offset = var->xres_virtual / 16; } @@ -1259,7 +1282,7 @@ static int cirrusfb_set_par_foo (struct fb_info *info) */ else if (var->bits_per_pixel == 8) { - DPRINTK ("cirrusfb: preparing for 8 bit deep display\n"); + DPRINTK("cirrusfb: preparing for 8 bit deep display\n"); switch (cinfo->btype) { case BT_SD64: case BT_PICCOLO: @@ -1268,75 +1291,89 @@ static int cirrusfb_set_par_foo (struct fb_info *info) case BT_PICASSO4: case BT_ALPINE: case BT_GD5480: - DPRINTK (" (for GD54xx)\n"); - vga_wseq (regbase, CL_SEQR7, + DPRINTK(" (for GD54xx)\n"); + vga_wseq(regbase, CL_SEQR7, regs.multiplexing ? bi->sr07_8bpp_mux : bi->sr07_8bpp); break; case BT_LAGUNA: - DPRINTK (" (for GD546x)\n"); - vga_wseq (regbase, CL_SEQR7, - vga_rseq (regbase, CL_SEQR7) | 0x01); + DPRINTK(" (for GD546x)\n"); + vga_wseq(regbase, CL_SEQR7, + vga_rseq(regbase, CL_SEQR7) | 0x01); break; default: - printk (KERN_WARNING "cirrusfb: unknown Board\n"); + printk(KERN_WARNING "cirrusfb: unknown Board\n"); break; } switch (cinfo->btype) { case BT_SD64: - vga_wseq (regbase, CL_SEQR1F, 0x1d); /* MCLK select */ + /* MCLK select */ + vga_wseq(regbase, CL_SEQR1F, 0x1d); break; case BT_PICCOLO: - vga_wseq (regbase, CL_SEQR1F, 0x22); /* ### vorher 1c MCLK select */ - vga_wseq (regbase, CL_SEQRF, 0xb0); /* Fast Page-Mode writes */ + /* ### vorher 1c MCLK select */ + vga_wseq(regbase, CL_SEQR1F, 0x22); + /* Fast Page-Mode writes */ + vga_wseq(regbase, CL_SEQRF, 0xb0); break; case BT_PICASSO: - vga_wseq (regbase, CL_SEQR1F, 0x22); /* ### vorher 1c MCLK select */ - vga_wseq (regbase, CL_SEQRF, 0xb0); /* Fast Page-Mode writes */ + /* ### vorher 1c MCLK select */ + vga_wseq(regbase, CL_SEQR1F, 0x22); + /* Fast Page-Mode writes */ + vga_wseq(regbase, CL_SEQRF, 0xb0); break; case BT_SPECTRUM: - vga_wseq (regbase, CL_SEQR1F, 0x22); /* ### vorher 1c MCLK select */ - vga_wseq (regbase, CL_SEQRF, 0xb0); /* Fast Page-Mode writes */ + /* ### vorher 1c MCLK select */ + vga_wseq(regbase, CL_SEQR1F, 0x22); + /* Fast Page-Mode writes */ + vga_wseq(regbase, CL_SEQRF, 0xb0); break; case BT_PICASSO4: #ifdef CONFIG_ZORRO - vga_wseq (regbase, CL_SEQRF, 0xb8); /* ### INCOMPLETE!! */ + /* ### INCOMPLETE!! */ + vga_wseq(regbase, CL_SEQRF, 0xb8); #endif -/* vga_wseq (regbase, CL_SEQR1F, 0x1c); */ +/* vga_wseq(regbase, CL_SEQR1F, 0x1c); */ break; case BT_ALPINE: - DPRINTK (" (for GD543x)\n"); - cirrusfb_set_mclk (cinfo, regs.mclk, regs.divMCLK); + DPRINTK(" (for GD543x)\n"); + cirrusfb_set_mclk(cinfo, regs.mclk, regs.divMCLK); /* We already set SRF and SR1F */ break; case BT_GD5480: case BT_LAGUNA: - DPRINTK (" (for GD54xx)\n"); + DPRINTK(" (for GD54xx)\n"); /* do nothing */ break; default: - printk (KERN_WARNING "cirrusfb: unknown Board\n"); + printk(KERN_WARNING "cirrusfb: unknown Board\n"); break; } - vga_wgfx (regbase, VGA_GFX_MODE, 64); /* mode register: 256 color mode */ - WGen (cinfo, VGA_PEL_MSK, 0xff); /* pixel mask: pass-through all planes */ + /* mode register: 256 color mode */ + vga_wgfx(regbase, VGA_GFX_MODE, 64); + /* pixel mask: pass-through all planes */ + WGen(cinfo, VGA_PEL_MSK, 0xff); if (regs.multiplexing) - WHDR (cinfo, 0x4a); /* hidden dac reg: 1280x1024 */ + /* hidden dac reg: 1280x1024 */ + WHDR(cinfo, 0x4a); else - WHDR (cinfo, 0); /* |