From: James S. <jsi...@us...> - 2002-06-15 19:17:14
|
Update of /cvsroot/linuxconsole/ruby/linux/drivers/video In directory usw-pr-cvs1:/tmp/cvs-serv22898/linux/drivers/video Modified Files: Makefile cfbcopyarea.c cfbimgblt.c fbcmap.c fbmem.c neofb.c tx3912fb.c Added Files: cyber2000fb.c dnfb.c pmag-ba-fb.c pmagb-b-fb.c Log Message: Synced to 2.5.21 --- NEW FILE: pmag-ba-fb.c --- /* * linux/drivers/video/pmag-ba-fb.c * * PMAG-BA TurboChannel framebuffer card support ... derived from: * "HP300 Topcat framebuffer support (derived from macfb of all things) * Phil Blundell <ph...@gn...> 1998", the original code can be * found in the file hpfb.c in the same directory. * * Based on digital document: * "PMAG-BA TURBOchannel Color Frame Buffer * Functional Specification", Revision 1.2, August 27, 1990 * * DECstation related code Copyright (C) 1999, 2000, 2001 by * Michael Engel <en...@un...>, * Karsten Merker <me...@li...> and * Harald Koerfgen. * This file is subject to the terms and conditions of the GNU General * Public License. See the file COPYING in the main directory of this * archive for more details. * */ #include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/errno.h> #include <linux/string.h> #include <linux/timer.h> #include <linux/mm.h> #include <linux/tty.h> #include <linux/slab.h> #include <linux/delay.h> #include <linux/init.h> #include <linux/fb.h> #include <asm/bootinfo.h> #include <asm/dec/machtype.h> #include <asm/dec/tc.h> #include "pmag-ba-fb.h" struct pmag_ba_ramdac_regs { unsigned char addr_low; unsigned char pad0[3]; unsigned char addr_hi; unsigned char pad1[3]; unsigned char data; unsigned char pad2[3]; unsigned char cmap; }; /* * Max 3 TURBOchannel slots -> max 3 PMAG-BA :) */ static struct fb_info pmagba_fb_info[3]; static struct fb_var_screeninfo pmagbafb_defined = { xres: 1024, yres: 864, xres_virtual: 1024, yres_virtual: 864, bits_per_pixel: 8, activate: FB_ACTIVATE_NOW, height: 274, width: 195, accel: FB_ACCEL_NONE, vmode: FB_VMODE_NONINTERLACED, } static struct fb_fix_screeninfo pmagbafb_fix = { id: "PMAG-BA", smem_len: (1024 * 864), type: FB_TYPE_PACKED_PIXELS, visual: FB_VISUAL_PSEUDOCOLOR, line_length: 1024, } /* * Turn hardware cursor off */ void pmagbafb_erase_cursor(struct pmag_ba_ramdac_regs *bt459_regs) { bt459_regs->addr_low = 0; bt459_regs->addr_hi = 3; bt459_regs->data = 0; } /* * Set the palette. */ static int pmagbafb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *info) { struct pmag_ba_ramdac_regs *bt459_regs = (struct pmag_ba_ramdac_regs *) info->par; if (regno >= info->cmap.len) return 1; red >>= 8; /* The cmap fields are 16 bits */ green >>= 8; /* wide, but the harware colormap */ blue >>= 8; /* registers are only 8 bits wide */ bt459_regs->addr_low = (__u8) regno; bt459_regs->addr_hi = 0; bt459_regs->cmap = red; bt459_regs->cmap = green; bt459_regs->cmap = blue; return 0; } static struct fb_ops pmagbafb_ops = { owner: THIS_MODULE, fb_setcolreg: pmagbafb_setcolreg, fb_fillrect: cfb_fillrect, fb_copyarea: cfb_copyarea, fb_imageblit: cfb_imageblit, } int __init pmagbafb_init_one(int slot) { unsigned long base_addr = get_tc_base_addr(slot); struct fb_info *info = &pmagba_fb_info[slot]; struct display *disp = &pmagba_disp[slot]; printk("PMAG-BA framebuffer in slot %d\n", slot); /* * Framebuffer display memory base address and friends */ pmagbafb_fix.smem_start = base_addr + PMAG_BA_ONBOARD_FBMEM_OFFSET; info->par = (base_addr + PMAG_BA_BT459_OFFSET); /* * Configure the Bt459 RAM DAC */ pmagbafb_erase_cursor((struct pmag_ba_ramdac_regs *) info->par); /* * Let there be consoles.. */ info->node = NODEV; info->fbops = &pmagbafb_ops; info->var = pmagbafb_defined; info->fix = pmagbafb_fix; info->screen_base = pmagbafb_fix.smem_start; info->flags = FBINFO_FLAG_DEFAULT; if (register_framebuffer(info) < 0) return 1; return 0; } /* * Initialise the framebuffer */ int __init pmagbafb_init(void) { int sid; int found = 0; if (TURBOCHANNEL) { while ((sid = search_tc_card("PMAG-BA")) >= 0) { found = 1; claim_tc_card(sid); pmagbafb_init_one(sid); } return found ? 0 : -ENODEV; } else { return -ENODEV; } } int __init pmagbafb_setup(char *options) { return 0; } MODULE_LICENSE("GPL"); --- NEW FILE: pmagb-b-fb.c --- /* * linux/drivers/video/pmagb-b-fb.c * * PMAGB-B TurboChannel framebuffer card support ... derived from: * "HP300 Topcat framebuffer support (derived from macfb of all things) * Phil Blundell <ph...@gn...> 1998", the original code can be * found in the file hpfb.c in the same directory. * * DECstation related code Copyright (C) 1999, 2000, 2001 by * Michael Engel <en...@un...>, * Karsten Merker <me...@li...> and * Harald Koerfgen. * This file is subject to the terms and conditions of the GNU General * Public License. See the file COPYING in the main directory of this * archive for more details. * */ /* * We currently only support the PMAGB-B in high resolution mode * as I know of no way to detect low resolution mode set via jumper. * KM, 2001/01/07 */ #include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/errno.h> #include <linux/string.h> #include <linux/timer.h> #include <linux/mm.h> #include <linux/tty.h> #include <linux/slab.h> #include <linux/delay.h> #include <linux/init.h> #include <linux/fb.h> #include <asm/bootinfo.h> #include <asm/dec/machtype.h> #include <asm/dec/tc.h> #include "pmagb-b-fb.h" struct pmagb_b_ramdac_regs { unsigned char addr_low; unsigned char pad0[3]; unsigned char addr_hi; unsigned char pad1[3]; unsigned char data; unsigned char pad2[3]; unsigned char cmap; }; /* * Max 3 TURBOchannel slots -> max 3 PMAGB-B :) */ static struct fb_info pmagbb_fb_info[3]; static struct fb_var_screeninfo pmagbbfb_defined = { xres: 1280, yres: 1024, xres_virtual: 1280, yres_virtual: 1024, bits_per_pixel: 8, activate: FB_ACTIVATE_NOW, height: 274, width: 195, accel_flags: FB_ACCEL_NONE, vmode: FB_VMODE_NONINTERLACED, }; static struct fb_fix_screeninfo pmagbafb_fix = { id: "PMAGB-BA", smem_len: (1280 * 1024), type: FB_TYPE_PACKED_PIXELS, visual: FB_VISUAL_PSEUDOCOLOR, line_length: 1280, } /* * Turn hardware cursor off */ void pmagbbfb_erase_cursor(struct pmagb_b_ramdac_regs *bt459_regs) { bt459_regs->addr_low = 0; bt459_regs->addr_hi = 3; bt459_regs->data = 0; } /* * Set the palette. */ static int pmagbbfb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *info) { struct pmagb_b_ramdac_regs *bt459_regs = (struct pmagb_b_ramdac_regs *) info->par; if (regno >= info->cmap.len) return 1; red >>= 8; /* The cmap fields are 16 bits */ green >>= 8; /* wide, but the harware colormap */ blue >>= 8; /* registers are only 8 bits wide */ bt459_regs->addr_low = (__u8) regno; bt459_regs->addr_hi = 0; bt459_regs->cmap = red; bt459_regs->cmap = green; bt459_regs->cmap = blue; return 0; } static struct fb_ops pmagbbfb_ops = { owner: THIS_MODULE, fb_setcolreg: pmagbbfb_setcolreg, fb_fillrect: cfb_fillrect, fb_copyarea: cfb_copyarea, fb_imageblit: cfb_imageblit, }; int __init pmagbbfb_init_one(int slot) { unsigned long base_addr = get_tc_base_addr(slot); struct fb_info *info = &pmagbb_fb_info[slot]; printk("PMAGB-BA framebuffer in slot %d\n", slot); /* * Framebuffer display memory base address and friends */ pmagbbfb_fix.smem_start = base_addr + PMAGB_B_ONBOARD_FBMEM_OFFSET; info->par = (base_addr + PMAGB_B_BT459_OFFSET); /* * Configure the Bt459 RAM DAC */ pmagbbfb_erase_cursor((struct pmagb_b_ramdac_regs *) info->par); /* * Let there be consoles.. */ info->node = NODEV; info->fbops = &pmagbbfb_ops; info->var = pmagbbfb_defined; info->fix = pmagbbfb_fix; info->screen_base = pmagbbfb_fix.smem_start; info->flags = FBINFO_FLAG_DEFAULT; if (register_framebuffer(info) < 0) return 1; return 0; } /* * Initialise the framebuffer */ int __init pmagbbfb_init(void) { int sid; int found = 0; if (TURBOCHANNEL) { while ((sid = search_tc_card("PMAGB-BA")) >= 0) { found = 1; claim_tc_card(sid); pmagbbfb_init_one(sid); } return found ? 0 : -ENODEV; } else { return -ENODEV; } } int __init pmagbbfb_setup(char *options) { return 0; } MODULE_LICENSE("GPL"); Index: Makefile =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/video/Makefile,v retrieving revision 1.48 retrieving revision 1.49 diff -u -d -r1.48 -r1.49 --- Makefile 3 Jun 2002 22:44:58 -0000 1.48 +++ Makefile 15 Jun 2002 19:17:10 -0000 1.49 @@ -9,9 +9,7 @@ # All of the (potential) objects that export symbols. # This list comes from 'grep -l EXPORT_SYMBOL *.[hc]'. -export-objs := fbmem.o fbcmap.o fbmon.o modedb.o vga.o cyber2000fb.o sa1100fb.o - -mod-subdirs := aty fonts matrox riva sis tdfx +export-objs := fbmem.o fbgen.o fbcmap.o fbmon.o modedb.o vga.o cyber2000fb.o sa1100fb.o # Each configuration option enables a list of files. @@ -45,6 +43,7 @@ obj-$(CONFIG_FB_ATARI) += atafb.o obj-$(CONFIG_FB_ATY128) += aty128fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_RADEON) += radeonfb.o +obj-$(CONFIG_FB_NEOMAGIC) += neofb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_IGA) += igafb.o obj-$(CONFIG_FB_CONTROL) += controlfb.o obj-$(CONFIG_FB_PLATINUM) += platinumfb.o @@ -80,7 +79,7 @@ obj-$(CONFIG_FB_PMAG_BA) += pmag-ba-fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_PMAGB_B) += pmagb-b-fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_MAXINE) += maxinefb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o -obj-$(CONFIG_FB_TX3912) += tx3912fb.o +obj-$(CONFIG_FB_TX3912) += tx3912fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_MATROX) += matrox/ obj-$(CONFIG_FB_RIVA) += riva/ @@ -93,7 +92,7 @@ obj-$(CONFIG_FB_HGA) += hgafb.o obj-$(CONFIG_FB_SA1100) += sa1100fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_VIRTUAL) += vfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o -obj-$(CONFIG_FB_HIT) += hitfb.o +obj-$(CONFIG_FB_HIT) += hitfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_E1355) += epson1355fb.o obj-$(CONFIG_FB_PVR2) += pvr2fb.o obj-$(CONFIG_FB_VOODOO1) += sstfb.o @@ -109,8 +108,7 @@ clean: rm -f core *.o *.a *.s -../conmakehash: ../conmakehash.c - $(HOSTCC) $(HOSTCFLAGS) -o ../conmakehash ../conmakehash.c +host-progs := ../conmakehash promcon_tbl.c: prom.uni ../char/conmakehash ../char/conmakehash prom.uni | \ Index: cfbcopyarea.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/video/cfbcopyarea.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- cfbcopyarea.c 10 May 2002 16:27:23 -0000 1.7 +++ cfbcopyarea.c 15 Jun 2002 19:17:10 -0000 1.8 @@ -31,7 +31,7 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area) { int x2, y2, lineincr, shift, shift_right, shift_left, old_dx, old_dy; - int n, j, linesize = p->fix.line_length, bpl = sizeof(unsigned long); + int j, linesize = p->fix.line_length, bpl = sizeof(unsigned long); unsigned long start_index, end_index, start_mask, end_mask, last; unsigned long *dst = NULL, *src = NULL; char *src1, *dst1; @@ -102,7 +102,7 @@ end_mask = -1 << ((bpl - end_index) << 3); n -= end_index; } - n = n / bpl; + n /= bpl; if (n <= 0) { if (start_mask) { Index: cfbimgblt.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/video/cfbimgblt.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- cfbimgblt.c 3 Jun 2002 22:44:58 -0000 1.14 +++ cfbimgblt.c 15 Jun 2002 19:17:10 -0000 1.15 @@ -107,12 +107,11 @@ dst++; } - if (n) { + if (n) { + end_mask = 0; for (j = n; j > 0; j--) { - end_mask = 0; - if (test_bit(l, src)) - end_mask |= (tmp >> (p->var.bits_per_pixel*(k-1))); + end_mask |= (tmp >> (p->var.bits_per_pixel*(j-1))); l--; if (l < 0) { l = 7; src++; } } @@ -125,9 +124,6 @@ } else { /* Draw the penguin */ n = ((image->width * p->var.bits_per_pixel) >> 3); - //shift = ((unsigned long) dst1 & (bpl -1)); end_mask = 0; - - // n = n/bpl; } } Index: fbcmap.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/video/fbcmap.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- fbcmap.c 8 May 2002 16:35:43 -0000 1.12 +++ fbcmap.c 15 Jun 2002 19:17:10 -0000 1.13 @@ -166,7 +166,7 @@ else tooff = from->start-to->start; size = to->len-tooff; - if (size > (int) from->len-fromoff) + if (size > (int) (from->len - fromoff)) size = from->len-fromoff; if (size <= 0) return; Index: fbmem.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/video/fbmem.c,v retrieving revision 1.64 retrieving revision 1.65 diff -u -d -r1.64 -r1.65 --- fbmem.c 3 Jun 2002 22:44:58 -0000 1.64 +++ fbmem.c 15 Jun 2002 19:17:10 -0000 1.65 @@ -140,6 +140,7 @@ extern int pmagbbfb_init(void); extern void maxinefb_init(void); extern int tx3912fb_init(void); +extern int tx3912fb_setup(char*); extern int radeonfb_init(void); extern int radeonfb_setup(char*); extern int e1355fb_init(void); @@ -317,7 +318,7 @@ { "hitfb", hitfb_init, NULL }, #endif #ifdef CONFIG_FB_TX3912 - { "tx3912", tx3912fb_init, NULL }, + { "tx3912", tx3912fb_init, tx3912fb_setup }, #endif #ifdef CONFIG_FB_E1355 { "e1355fb", e1355fb_init, e1355fb_setup }, Index: neofb.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/video/neofb.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- neofb.c 24 Apr 2002 18:56:51 -0000 1.3 +++ neofb.c 15 Jun 2002 19:17:10 -0000 1.4 @@ -12,11 +12,11 @@ * archive for more details. * * 0.3.3 - * - Porting over to new fbdev api. (jsimmons) - * + * - Porting over to new fbdev api. (jsimmons) + * * 0.3.2 - * - got rid of all floating point (dok) - * + * - got rid of all floating point (dok) [...1099 lines suppressed...] - name:"neofb", - id_table:neofb_devices, - probe:neofb_probe, - remove:__devexit_p(neofb_remove) + name: "neofb", + id_table: neofb_devices, + probe: neofb_probe, + remove: __devexit_p(neofb_remove) }; /* **************************** init-time only **************************** */ @@ -2054,7 +2028,7 @@ return 0; } -static int __init initialized = 0; +static int __initdata initialized = 0; int __init neofb_init(void) { Index: tx3912fb.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/video/tx3912fb.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- tx3912fb.c 13 Nov 2001 02:09:18 -0000 1.1 +++ tx3912fb.c 15 Jun 2002 19:17:10 -0000 1.2 @@ -1,16 +1,16 @@ /* - * linux/drivers/video/tx3912fb.c + * drivers/video/tx3912fb.c * - * Copyright (C) 1999 Harald Koerfgen - * Copyright (C) 2001 Steven Hill (sj...@re...) - * Copyright (C) 2001 Dean Scott (de...@th...) + * Copyright (C) 1999 Harald Koerfgen + * Copyright (C) 2001 Steven Hill (sj...@re...) * * This file is subject to the terms and conditions of the GNU General Public * License. See the file COPYING in the main directory of this archive for * more details. * - * Framebuffer for LCD controller in TMPR3912/05 and PR31700 processors + * Framebuffer for LCD controller in TMPR3912/05 and PR31700 processors */ +#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> @@ -21,48 +21,73 @@ #include <linux/init.h> #include <linux/pm.h> #include <linux/fb.h> +#include <asm/io.h> #include <asm/bootinfo.h> #include <asm/uaccess.h> -#include <linux/config.h> -#include "tx3912fb.h" +#include <asm/tx3912.h> +#include <video/tx3912.h> /* * Frame buffer, palette and console structures */ static struct fb_info fb_info; -static u32 pseudo_palette[17]; +static u32 cfb8[16]; static struct fb_fix_screeninfo tx3912fb_fix __initdata = { - TX3912FB_NAME, (unsigned long) NULL, 0, FB_TYPE_PACKED_PIXELS, 0, - FB_VISUAL_TRUECOLOR, 0, 1, 1, 1, (unsigned long) NULL, 0, FB_ACCEL_NONE + id: "tx3912fb", +#ifdef CONFIG_NINO_16MB + smem_len: (240 * 320), +#else + smem_len: ((240 * 320)/2), +#endif + type: FB_TYPE_PACKED_PIXELS, + visual: FB_VISUAL_TRUECOLOR, + xpanstep: 1, + ypanstep: 1, + ywrapstep: 1, + accel: FB_ACCEL_NONE, }; -static int tx3912fb_setcolreg(u_int regno, u_int red, u_int green, - u_int blue, u_int transp, - struct fb_info *info) -{ - if (regno > 255) - return 1; - - red >>= 8; - green >>= 8; - blue >>= 8; +static struct fb_var_screeninfo tx3912fb_var = { + xres: 240, + yres: 320, + xres_virtual: 240, + yres_virtual: 320, +#ifdef CONFIG_NINO_16MB + bits_per_pixel: 8, + red: { 5, 3, 0 }, /* RGB 332 */ + green: { 2, 3, 0 }, + blue: { 0, 2, 0 }, +#else + bits_per_pixel: 4, +#endif + activate: FB_ACTIVATE_NOW, + width: -1, + height: -1, + pixclock: 20000, + left_margin: 64, + right_margin: 64, + upper_margin: 32, + lower_margin: 32, + hsync_len: 64, + vsync_len: 2, + vmode: FB_VMODE_NONINTERLACED, +}; - switch (info->var.bits_per_pixel) { - case 8: - red &= 0xe000; - green &= 0xe000; - blue &= 0xc000; +/* + * Interface used by the world + */ +int tx3912fb_init(void); - ((u8 *)(info->pseudo_palette))[regno] = - (red >> 8) | - (green >> 11) | - (blue >> 14); - break; - } +static int tx3912fb_setcolreg(u_int regno, u_int red, u_int green, + u_int blue, u_int transp, + struct fb_info *info); - return 0; -} +/* + * Macros + */ +#define get_line_length(xres_virtual, bpp) \ + (u_long) (((int) xres_virtual * (int) bpp + 7) >> 3) /* * Frame buffer operations structure used by console driver @@ -76,91 +101,138 @@ }; /* + * Set a single color register + */ +static int tx3912fb_setcolreg(u_int regno, u_int red, u_int green, + u_int blue, u_int transp, + struct fb_info *info) +{ + if (regno > 255) + return 1; + + if (regno < 16) + ((u32 *)(info->pseudo_palette))[regno] = ((red & 0xe000) >> 8) + | ((green & 0xe000) >> 11) + | ((blue & 0xc000) >> 14); + return 0; +} + +/* * Initialization of the framebuffer */ int __init tx3912fb_init(void) { - /* Stop the video logic when frame completes */ - VidCtrl1 |= ENFREEZEFRAME; - IntClear1 |= INT1_LCDINT; - while (!(IntStatus1 & INT1_LCDINT)); + u_long tx3912fb_paddr = 0; /* Disable the video logic */ - VidCtrl1 &= ~(ENVID | DISPON); + outl(inl(TX3912_VIDEO_CTRL1) & + ~(TX3912_VIDEO_CTRL1_ENVID | TX3912_VIDEO_CTRL1_DISPON), + TX3912_VIDEO_CTRL1); udelay(200); /* Set start address for DMA transfer */ - VidCtrl3 = tx3912fb_paddr & - (TX3912_VIDCTRL3_VIDBANK_MASK | - TX3912_VIDCTRL3_VIDBASEHI_MASK); + outl(tx3912fb_paddr, TX3912_VIDEO_CTRL3); /* Set end address for DMA transfer */ - VidCtrl4 = (tx3912fb_paddr + tx3912fb_size + 1) & - TX3912_VIDCTRL4_VIDBASELO_MASK; + outl((tx3912fb_paddr + tx3912fb_fix.smem_len + 1), TX3912_VIDEO_CTRL4); /* Set the pixel depth */ - switch (tx3912fb_info.bits_per_pixel) { - case 1: + switch (tx3912fb_var.bits_per_pixel) { + case 1: /* Monochrome */ - VidCtrl1 &= ~TX3912_VIDCTRL1_BITSEL_MASK; + outl(inl(TX3912_VIDEO_CTRL1) & + ~TX3912_VIDEO_CTRL1_BITSEL_MASK, TX3912_VIDEO_CTRL1); tx3912fb_fix.visual = FB_VISUAL_MONO10; break; - case 4: + case 4: /* 4-bit gray */ - VidCtrl1 &= ~TX3912_VIDCTRL1_BITSEL_MASK; - VidCtrl1 |= TX3912_VIDCTRL1_4BIT_GRAY; + outl(inl(TX3912_VIDEO_CTRL1) & + ~TX3912_VIDEO_CTRL1_BITSEL_MASK, TX3912_VIDEO_CTRL1); + outl(inl(TX3912_VIDEO_CTRL1) | + TX3912_VIDEO_CTRL1_BITSEL_4BIT_GRAY, + TX3912_VIDEO_CTRL1); tx3912fb_fix.visual = FB_VISUAL_TRUECOLOR; + tx3912fb_fix.grayscale = 1; break; - case 8: + case 8: /* 8-bit color */ - VidCtrl1 &= ~TX3912_VIDCTRL1_BITSEL_MASK; - VidCtrl1 |= TX3912_VIDCTRL1_8BIT_COLOR; + outl(inl(TX3912_VIDEO_CTRL1) & + ~TX3912_VIDEO_CTRL1_BITSEL_MASK, TX3912_VIDEO_CTRL1); + outl(inl(TX3912_VIDEO_CTRL1) | + TX3912_VIDEO_CTRL1_BITSEL_8BIT_COLOR, + TX3912_VIDEO_CTRL1); tx3912fb_fix.visual = FB_VISUAL_TRUECOLOR; break; - case 2: - default: + case 2: + default: /* 2-bit gray */ - VidCtrl1 &= ~TX3912_VIDCTRL1_BITSEL_MASK; - VidCtrl1 |= TX3912_VIDCTRL1_2BIT_GRAY; + outl(inl(TX3912_VIDEO_CTRL1) & + ~TX3912_VIDEO_CTRL1_BITSEL_MASK, TX3912_VIDEO_CTRL1); + outl(inl(TX3912_VIDEO_CTRL1) | + TX3912_VIDEO_CTRL1_BITSEL_2BIT_GRAY, + TX3912_VIDEO_CTRL1); tx3912fb_fix.visual = FB_VISUAL_PSEUDOCOLOR; + tx3912fb_fix.grayscale = 1; break; } + /* Enable the video clock */ + outl(inl(TX3912_CLK_CTRL) | TX3912_CLK_CTRL_ENVIDCLK, + TX3912_CLK_CTRL); + /* Unfreeze video logic and enable DF toggle */ - VidCtrl1 &= ~(ENFREEZEFRAME | DFMODE); + outl(inl(TX3912_VIDEO_CTRL1) & + ~(TX3912_VIDEO_CTRL1_ENFREEZEFRAME | TX3912_VIDEO_CTRL1_DFMODE), + TX3912_VIDEO_CTRL1); udelay(200); /* Clear the framebuffer */ - memset((void *) tx3912fb_vaddr, 0xff, tx3912fb_size); + memset((void *) tx3912fb_fix.smem_start, 0xff, tx3912fb_fix.smem_len); udelay(200); /* Enable the video logic */ - VidCtrl1 |= (DISPON | ENVID); - - tx3912fb_fix.smem_start = tx3912fb_vaddr; - tx3912fb_fix.smem_len = tx3912fb_size; + outl(inl(TX3912_VIDEO_CTRL1) | + (TX3912_VIDEO_CTRL1_ENVID | TX3912_VIDEO_CTRL1_DISPON), + TX3912_VIDEO_CTRL1); - fb_info.node = -1; + /* + * Memory limit + */ + tx3912fb_fix.line_length = + get_line_length(tx3912fb_var.xres_virtual, tx3912fb_var.bits_per_pixel); + if ((tx3912fb_fix.line_length * tx3912fb_var.yres_virtual) > tx3912fb_fix.smem_len) + return -ENOMEM; + + fb_info.node = NODEV; fb_info.fbops = &tx3912fb_ops; - fb_info.flags = FBINFO_FLAG_DEFAULT; - fb_info.var = tx3912fb_info; + fb_info.var = tx3912fb_var; fb_info.fix = tx3912fb_fix; fb_info.pseudo_palette = pseudo_palette; + fb_info.flags = FBINFO_FLAG_DEFAULT; + + /* Clear the framebuffer */ + memset((void *) fb_info.fix.smem_start, 0xff, fb_info.fix.smem_len); + udelay(200); if (register_framebuffer(&fb_info) < 0) - return -EINVAL; + return -1; + printk(KERN_INFO "fb%d: TX3912 frame buffer using %uKB.\n", + GET_FB_IDX(fb_info.node), (u_int) (fb_info.fix.smem_len >> 10)); return 0; } -static void __exit tx3912fb_exit(void) +int __init tx3912fb_setup(char *options) { - unregister_framebuffer(&fb_info); -} + char *this_opt; -#ifdef MODULE -module_init(tx3912fb_init); -module_exit(tx3912fb_exit); + if (!options || !*options) + return 0; + + while ((this_opt = strsep(&options, ","))) { + if (!strncmp(options, "bpp:", 4)) + tx3912fb_var.bits_per_pixel = simple_strtoul(options+4, NULL, 0); + } +} MODULE_LICENSE("GPL"); -#endif |