* FrameMasterII fbdev updates.
@ 2004-02-18 18:28 James Simmons
2004-02-18 19:13 ` Apollo framebuffer sysfs James Simmons
2004-02-23 19:54 ` FrameMasterII fbdev updates Geert Uytterhoeven
0 siblings, 2 replies; 11+ messages in thread
From: James Simmons @ 2004-02-18 18:28 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Linux Kernel Mailing List, Linux Fbdev development list
Hi!
Can you test this patch. It is a port of the driver to use sysfs.
--- linus-2.6/drivers/video/fm2fb.c 2004-02-16 23:36:11.000000000 -0800
+++ fbdev-2.6/drivers/video/fm2fb.c 2004-02-17 18:20:24.000000000 -0800
@@ -127,11 +127,6 @@
static volatile unsigned char *fm2fb_reg;
-#define arraysize(x) (sizeof(x)/sizeof(*(x)))
-
-static struct fb_info fb_info;
-static u32 pseudo_palette[17];
-
static struct fb_fix_screeninfo fb_fix __initdata = {
.smem_len = FRAMEMASTER_REG,
.type = FB_TYPE_PACKED_PIXELS,
@@ -202,7 +197,7 @@
static int fm2fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
u_int transp, struct fb_info *info)
{
- if (regno > 15)
+ if (regno > 255)
return 1;
red >>= 8;
green >>= 8;
@@ -216,66 +211,91 @@
* Initialisation
*/
-int __init fm2fb_init(void)
+static struct zorro_device_id fm2fb_devices[] = {
+ { ZORRO_PROD_BSC_FRAMEMASTER_II, NULL },
+ { ZORRO_PROD_HELFRICH_RAINBOW_II, NULL },
+ { 0, 0 }
+};
+
+static struct zorro_driver fm2fb_driver = {
+ .name = "fm2fb",
+ .id_table = fm2fb_devices,
+ .probe = fm2fb_probe,
+};
+
+static int __devint fm2fb_probe(struct zorro_dev *dev,
+ const struct zorro_device_id *id)
{
- struct zorro_dev *z = NULL;
+ struct fb_info *info;
unsigned long *ptr;
int is_fm;
int x, y;
- while ((z = zorro_find_device(ZORRO_WILDCARD, z))) {
- if (z->id == ZORRO_PROD_BSC_FRAMEMASTER_II)
- is_fm = 1;
- else if (z->id == ZORRO_PROD_HELFRICH_RAINBOW_II)
- is_fm = 0;
- else
- continue;
+ if (id->id == ZORRO_PROD_BSC_FRAMEMASTER_II)
+ is_fm = 1;
+ else if (id->id == ZORRO_PROD_HELFRICH_RAINBOW_II)
+ is_fm = 0;
- if (!request_mem_region(z->resource.start, FRAMEMASTER_SIZE, "fm2fb"))
- continue;
+ if (!zorro_request_device(z,"fm2fb"))
+ return -ENXIO;
- /* assigning memory to kernel space */
- fb_fix.smem_start = z->resource.start;
- fb_info.screen_base = ioremap(fb_fix.smem_start, FRAMEMASTER_SIZE);
- fb_fix.mmio_start = fb_fix.smem_start + FRAMEMASTER_REG;
- fm2fb_reg = (unsigned char *)(fb_info.screen_base+FRAMEMASTER_REG);
+ info = framebuffer_alloc(256 * sizeof(u32), &dev->dev);
+ if (!info) {
+ zorro_release_dev(z);
+ return -ENOMEM;
+ }
+
+ if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
+ framebuffer_release(info);
+ zorro_release_dev(z);
+ return -ENOMEM;
+ }
- strcpy(fb_fix.id, is_fm ? "FrameMaster II" : "Rainbow II");
-
- /* make EBU color bars on display */
- ptr = (unsigned long *)fb_fix.smem_start;
- for (y = 0; y < 576; y++) {
- for (x = 0; x < 96; x++) *ptr++ = 0xffffff;/* white */
- for (x = 0; x < 96; x++) *ptr++ = 0xffff00;/* yellow */
- for (x = 0; x < 96; x++) *ptr++ = 0x00ffff;/* cyan */
- for (x = 0; x < 96; x++) *ptr++ = 0x00ff00;/* green */
- for (x = 0; x < 96; x++) *ptr++ = 0xff00ff;/* magenta */
- for (x = 0; x < 96; x++) *ptr++ = 0xff0000;/* red */
- for (x = 0; x < 96; x++) *ptr++ = 0x0000ff;/* blue */
- for (x = 0; x < 96; x++) *ptr++ = 0x000000;/* black */
- }
- fm2fb_blank(0, NULL);
-
- if (fm2fb_mode == -1)
- fm2fb_mode = FM2FB_MODE_PAL;
-
- fb_info.fbops = &fm2fb_ops;
- fb_info.var = fb_var_modes[fm2fb_mode];
- fb_info.screen_base = (char *)fb_fix.smem_start;
- fb_info.pseudo_palette = pseudo_palette;
- fb_info.fix = fb_fix;
- fb_info.flags = FBINFO_FLAG_DEFAULT;
+ /* assigning memory to kernel space */
+ fb_fix.smem_start = zorro_resource_start(z);
+ info->screen_base = ioremap(fb_fix.smem_start, FRAMEMASTER_SIZE);
+ fb_fix.mmio_start = fb_fix.smem_start + FRAMEMASTER_REG;
+ fm2fb_reg = (unsigned char *)(info->screen_base+FRAMEMASTER_REG);
+
+ strcpy(fb_fix.id, is_fm ? "FrameMaster II" : "Rainbow II");
- /* The below fields will go away !!!! */
- fb_alloc_cmap(&fb_info.cmap, 16, 0);
+ /* make EBU color bars on display */
+ ptr = (unsigned long *)fb_fix.smem_start;
+ for (y = 0; y < 576; y++) {
+ for (x = 0; x < 96; x++) *ptr++ = 0xffffff;/* white */
+ for (x = 0; x < 96; x++) *ptr++ = 0xffff00;/* yellow */
+ for (x = 0; x < 96; x++) *ptr++ = 0x00ffff;/* cyan */
+ for (x = 0; x < 96; x++) *ptr++ = 0x00ff00;/* green */
+ for (x = 0; x < 96; x++) *ptr++ = 0xff00ff;/* magenta */
+ for (x = 0; x < 96; x++) *ptr++ = 0xff0000;/* red */
+ for (x = 0; x < 96; x++) *ptr++ = 0x0000ff;/* blue */
+ for (x = 0; x < 96; x++) *ptr++ = 0x000000;/* black */
+ }
+ fm2fb_blank(0, info);
- if (register_framebuffer(&fb_info) < 0)
- return -EINVAL;
+ if (fm2fb_mode == -1)
+ fm2fb_mode = FM2FB_MODE_PAL;
- printk("fb%d: %s frame buffer device\n", fb_info.node, fb_fix.id);
- return 0;
+ info->fbops = &fm2fb_ops;
+ info->var = fb_var_modes[fm2fb_mode];
+ info->pseudo_palette = info->par;
+ info->par = NULL;
+ info->fix = fb_fix;
+ info->flags = FBINFO_FLAG_DEFAULT;
+
+ if (register_framebuffer(info) < 0) {
+ fb_dealloc_cmap(&info->cmap);
+ framebuffer_release(info);
+ zorro_release_dev(z);
+ return -EINVAL;
}
- return -ENXIO;
+ printk("fb%d: %s frame buffer device\n", info->node, fb_fix.id);
+ return 0;
+}
+
+static int __init fm2fb_init(void)
+{
+ return zorro_register_driver(&fm2fb_driver);
}
int __init fm2fb_setup(char *options)
^ permalink raw reply [flat|nested] 11+ messages in thread
* Apollo framebuffer sysfs
2004-02-18 18:28 FrameMasterII fbdev updates James Simmons
@ 2004-02-18 19:13 ` James Simmons
2004-02-23 20:00 ` Geert Uytterhoeven
2004-02-23 19:54 ` FrameMasterII fbdev updates Geert Uytterhoeven
1 sibling, 1 reply; 11+ messages in thread
From: James Simmons @ 2004-02-18 19:13 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Linux Kernel Mailing List, Linux Fbdev development list
Hi!
Another driver adapted to sysfs. Please test.
--- linus-2.6/drivers/video/dnfb.c 2004-02-16 23:36:09.000000000 -0800
+++ fbdev-2.6/drivers/video/dnfb.c 2004-02-17 16:49:23.000000000 -0800
@@ -103,8 +103,6 @@
#define SWAP(A) ((A>>8) | ((A&0xff) <<8))
-static struct fb_info fb_info;
-
/* frame buffer operations */
static int dnfb_blank(int blank, struct fb_info *info);
@@ -224,22 +222,39 @@
out_8(AP_CONTROL_0, NORMAL_MODE);
}
+/*
+ * Initialization
+ */
-unsigned long __init dnfb_init(unsigned long mem_start)
+static int __init dnfb_probe(struct device *device)
{
- int err;
-
- fb_info.fbops = &dn_fb_ops;
- fb_info.fix = dnfb_fix;
- fb_info.var = dnfb_var;
- fb_info.screen_base = (u_char *) fb_info.fix.smem_start;
-
- fb_alloc_cmap(&fb_info.cmap, 2, 0);
-
- err = register_framebuffer(&fb_info);
- if (err < 0)
- panic("unable to register apollo frame buffer\n");
-
+ struct platform_device *dev = to_platform_device(device);
+ struct fb_info *info;
+ int err = 0;
+
+ info = framebuffer_alloc(0, &dev->dev);
+ if (!info)
+ return -ENOMEM;
+
+ info->fbops = &dn_fb_ops;
+ info->fix = dnfb_fix;
+ info->var = dnfb_var;
+ info->screen_base = (u_char *) info->fix.smem_start;
+
+ err = fb_alloc_cmap(&info->cmap, 2, 0)
+ if (err < 0) {
+ framebuffer_release(info);
+ return err;
+ }
+
+ err = register_framebuffer(info);
+ if (err < 0) {
+ fb_dealloc_cmap(&info->cmap);
+ framebuffer_release(info);
+ return err;
+ }
+ dev_set_drvdata(&dev->dev, info);
+
/* now we have registered we can safely setup the hardware */
out_8(AP_CONTROL_3A, RESET_CREG);
out_be16(AP_WRITE_ENABLE, 0x0);
@@ -249,7 +264,32 @@
out_be16(AP_ROP_1, SWAP(0x3));
printk("apollo frame buffer alive and kicking !\n");
- return mem_start;
+ return err;
+}
+
+static struct device_driver dnfb_driver = {
+ .name = "dnfb",
+ .bus = &platform_bus_type,
+ .probe = dnfb_probe,
+};
+
+static struct platform_device dnfb_device = {
+ .name = "dnfb",
+ .id = 0,
+};
+
+int __init dnfb_init(void)
+{
+ int ret;
+
+ ret = driver_register(&dnfb_driver);
+
+ if (!ret) {
+ ret = platform_device_register(&dnfb_device);
+ if (ret)
+ driver_unregister(&dnfb_driver);
+ }
+ return ret;
}
MODULE_LICENSE("GPL");
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: FrameMasterII fbdev updates.
2004-02-18 18:28 FrameMasterII fbdev updates James Simmons
2004-02-18 19:13 ` Apollo framebuffer sysfs James Simmons
@ 2004-02-23 19:54 ` Geert Uytterhoeven
2004-02-23 22:16 ` James Simmons
1 sibling, 1 reply; 11+ messages in thread
From: Geert Uytterhoeven @ 2004-02-23 19:54 UTC (permalink / raw)
To: James Simmons; +Cc: Linux Kernel Mailing List, Linux Fbdev development list
On Wed, 18 Feb 2004, James Simmons wrote:
> Can you test this patch. It is a port of the driver to use sysfs.
- Fix compilation (typos and warnings)
- Use __devinit* where appropriate
- Remove superfluous whitespace (hurts my eyes with let c_space_errors=1)
--- drivers/video/fm2fb.c.orig 2004-02-19 18:55:34.000000000 +0100
+++ drivers/video/fm2fb.c 2004-02-23 20:48:50.000000000 +0100
@@ -49,7 +49,7 @@
* not assembled with memory for the alpha channel. In this
* case it could be possible to add the frame buffer into the
* normal memory pool.
- *
+ *
* At relative address 0x1ffff8 of the frame buffers base address
* there exists a control register with the number of
* four control bits. They have the following meaning:
@@ -64,7 +64,7 @@
* is not very much information about the FrameMaster II in
* the world so I add these information for completeness.
*
- * JP1 interlace selection (1-2 non interlaced/2-3 interlaced)
+ * JP1 interlace selection (1-2 non interlaced/2-3 interlaced)
* JP2 wait state creation (leave as is!)
* JP3 wait state creation (leave as is!)
* JP4 modulate composite sync on green output (1-2 composite
@@ -127,7 +127,7 @@
static volatile unsigned char *fm2fb_reg;
-static struct fb_fix_screeninfo fb_fix __initdata = {
+static struct fb_fix_screeninfo fb_fix __devinitdata = {
.smem_len = FRAMEMASTER_REG,
.type = FB_TYPE_PACKED_PIXELS,
.visual = FB_VISUAL_TRUECOLOR,
@@ -136,12 +136,12 @@
.accel = FB_ACCEL_NONE,
};
-static int fm2fb_mode __initdata = -1;
+static int fm2fb_mode __devinitdata = -1;
#define FM2FB_MODE_PAL 0
#define FM2FB_MODE_NTSC 1
-static struct fb_var_screeninfo fb_var_modes[] __initdata = {
+static struct fb_var_screeninfo fb_var_modes[] __devinitdata = {
{
/* 768 x 576, 32 bpp (PAL) */
768, 576, 768, 576, 0, 0, 32, 0,
@@ -156,11 +156,10 @@
33333, 10, 102, 10, 5, 80, 34, FB_SYNC_COMP_HIGH_ACT, 0
}
};
-
+
/*
* Interface used by the world
*/
-int fm2fb_init(void);
static int fm2fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
u_int transp, struct fb_info *info);
@@ -169,7 +168,7 @@
static struct fb_ops fm2fb_ops = {
.owner = THIS_MODULE,
.fb_setcolreg = fm2fb_setcolreg,
- .fb_blank = fm2fb_blank,
+ .fb_blank = fm2fb_blank,
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
@@ -211,52 +210,52 @@
* Initialisation
*/
-static struct zorro_device_id fm2fb_devices[] = {
- { ZORRO_PROD_BSC_FRAMEMASTER_II, NULL },
- { ZORRO_PROD_HELFRICH_RAINBOW_II, NULL },
- { 0, 0 }
-};
+static int __devinit fm2fb_probe(struct zorro_dev *z,
+ const struct zorro_device_id *id);
+
+static struct zorro_device_id fm2fb_devices[] __devinitdata = {
+ { ZORRO_PROD_BSC_FRAMEMASTER_II },
+ { ZORRO_PROD_HELFRICH_RAINBOW_II },
+ { 0 }
+};
static struct zorro_driver fm2fb_driver = {
.name = "fm2fb",
.id_table = fm2fb_devices,
.probe = fm2fb_probe,
-};
+};
-static int __devint fm2fb_probe(struct zorro_dev *dev,
- const struct zorro_device_id *id)
+static int __devinit fm2fb_probe(struct zorro_dev *z,
+ const struct zorro_device_id *id)
{
struct fb_info *info;
unsigned long *ptr;
int is_fm;
int x, y;
- if (id->id == ZORRO_PROD_BSC_FRAMEMASTER_II)
- is_fm = 1;
- else if (id->id == ZORRO_PROD_HELFRICH_RAINBOW_II)
- is_fm = 0;
-
+ is_fm = z->id == ZORRO_PROD_BSC_FRAMEMASTER_II;
+
if (!zorro_request_device(z,"fm2fb"))
return -ENXIO;
- info = framebuffer_alloc(256 * sizeof(u32), &dev->dev);
+ info = framebuffer_alloc(256 * sizeof(u32), &z->dev);
if (!info) {
- zorro_release_dev(z);
+ zorro_release_device(z);
return -ENOMEM;
}
-
+
if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
framebuffer_release(info);
- zorro_release_dev(z);
+ zorro_release_device(z);
return -ENOMEM;
- }
-
+ }
+
/* assigning memory to kernel space */
fb_fix.smem_start = zorro_resource_start(z);
info->screen_base = ioremap(fb_fix.smem_start, FRAMEMASTER_SIZE);
fb_fix.mmio_start = fb_fix.smem_start + FRAMEMASTER_REG;
fm2fb_reg = (unsigned char *)(info->screen_base+FRAMEMASTER_REG);
-
+
strcpy(fb_fix.id, is_fm ? "FrameMaster II" : "Rainbow II");
/* make EBU color bars on display */
@@ -286,14 +285,14 @@
if (register_framebuffer(info) < 0) {
fb_dealloc_cmap(&info->cmap);
framebuffer_release(info);
- zorro_release_dev(z);
+ zorro_release_device(z);
return -EINVAL;
}
printk("fb%d: %s frame buffer device\n", info->node, fb_fix.id);
return 0;
}
-static int __init fm2fb_init(void)
+int __init fm2fb_init(void)
{
return zorro_register_driver(&fm2fb_driver);
}
@@ -305,7 +304,7 @@
if (!options || !*options)
return 0;
- while ((this_opt = strsep(&options, ",")) != NULL) {
+ while ((this_opt = strsep(&options, ",")) != NULL) {
if (!strncmp(this_opt, "pal", 3))
fm2fb_mode = FM2FB_MODE_PAL;
else if (!strncmp(this_opt, "ntsc", 4))
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Apollo framebuffer sysfs
2004-02-18 19:13 ` Apollo framebuffer sysfs James Simmons
@ 2004-02-23 20:00 ` Geert Uytterhoeven
2004-02-23 22:16 ` James Simmons
0 siblings, 1 reply; 11+ messages in thread
From: Geert Uytterhoeven @ 2004-02-23 20:00 UTC (permalink / raw)
To: James Simmons; +Cc: Linux Kernel Mailing List, Linux Fbdev development list
On Wed, 18 Feb 2004, James Simmons wrote:
> Another driver adapted to sysfs. Please test.
Wow, the first platform_device on m68k ;-)
- Fix compilation (missing semicolon)
- Use __devinit* where appropriate
- Remove superfluous whitespace (hurts my eyes with let c_space_errors=1)
--- drivers/video/dnfb.c.orig 2004-02-19 18:55:35.000000000 +0100
+++ drivers/video/dnfb.c 2004-02-23 20:59:20.000000000 +0100
@@ -117,7 +117,7 @@
.fb_cursor = soft_cursor,
};
-struct fb_var_screeninfo dnfb_var __initdata = {
+struct fb_var_screeninfo dnfb_var __devinitdata = {
.xres 1280,
.yres 1024,
.xres_virtual 2048,
@@ -128,7 +128,7 @@
.vmode FB_VMODE_NONINTERLACED,
};
-static struct fb_fix_screeninfo dnfb_fix __initdata = {
+static struct fb_fix_screeninfo dnfb_fix __devinitdata = {
.id "Apollo Mono",
.smem_start (FRAME_BUFFER_START + IO_BASE),
.smem_len FRAME_BUFFER_LEN,
@@ -146,7 +146,7 @@
return 0;
}
-static
+static
void dnfb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
{
@@ -226,7 +226,7 @@
* Initialization
*/
-static int __init dnfb_probe(struct device *device)
+static int __devinit dnfb_probe(struct device *device)
{
struct platform_device *dev = to_platform_device(device);
struct fb_info *info;
@@ -235,18 +235,18 @@
info = framebuffer_alloc(0, &dev->dev);
if (!info)
return -ENOMEM;
-
+
info->fbops = &dn_fb_ops;
info->fix = dnfb_fix;
info->var = dnfb_var;
info->screen_base = (u_char *) info->fix.smem_start;
- err = fb_alloc_cmap(&info->cmap, 2, 0)
- if (err < 0) {
+ err = fb_alloc_cmap(&info->cmap, 2, 0);
+ if (err < 0) {
framebuffer_release(info);
return err;
- }
-
+ }
+
err = register_framebuffer(info);
if (err < 0) {
fb_dealloc_cmap(&info->cmap);
@@ -254,7 +254,7 @@
return err;
}
dev_set_drvdata(&dev->dev, info);
-
+
/* now we have registered we can safely setup the hardware */
out_8(AP_CONTROL_3A, RESET_CREG);
out_be16(AP_WRITE_ENABLE, 0x0);
@@ -271,12 +271,11 @@
.name = "dnfb",
.bus = &platform_bus_type,
.probe = dnfb_probe,
-};
+};
static struct platform_device dnfb_device = {
.name = "dnfb",
- .id = 0,
-};
+};
int __init dnfb_init(void)
{
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: FrameMasterII fbdev updates.
2004-02-23 19:54 ` FrameMasterII fbdev updates Geert Uytterhoeven
@ 2004-02-23 22:16 ` James Simmons
2004-02-24 8:31 ` Geert Uytterhoeven
0 siblings, 1 reply; 11+ messages in thread
From: James Simmons @ 2004-02-23 22:16 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Linux Kernel Mailing List, Linux Fbdev development list
> On Wed, 18 Feb 2004, James Simmons wrote:
> > Can you test this patch. It is a port of the driver to use sysfs.
Merged your patch with mine. Here is the latest patch. Please test. The
patch is against linus tree. Thank you.
--- fbdev-2.6/drivers/video/fm2fb.c 2004-02-22 20:18:18.000000000 -0800
+++ linus-2.6/drivers/video/fm2fb.c 2004-02-18 20:59:07.000000000 -0800
@@ -49,7 +49,7 @@
* not assembled with memory for the alpha channel. In this
* case it could be possible to add the frame buffer into the
* normal memory pool.
- *
+ *
* At relative address 0x1ffff8 of the frame buffers base address
* there exists a control register with the number of
* four control bits. They have the following meaning:
@@ -64,7 +64,7 @@
* is not very much information about the FrameMaster II in
* the world so I add these information for completeness.
*
- * JP1 interlace selection (1-2 non interlaced/2-3 interlaced)
+ * JP1 interlace selection (1-2 non interlaced/2-3 interlaced)
* JP2 wait state creation (leave as is!)
* JP3 wait state creation (leave as is!)
* JP4 modulate composite sync on green output (1-2 composite
@@ -127,7 +127,12 @@
static volatile unsigned char *fm2fb_reg;
-static struct fb_fix_screeninfo fb_fix __devinitdata = {
+#define arraysize(x) (sizeof(x)/sizeof(*(x)))
+
+static struct fb_info fb_info;
+static u32 pseudo_palette[17];
+
+static struct fb_fix_screeninfo fb_fix __initdata = {
.smem_len = FRAMEMASTER_REG,
.type = FB_TYPE_PACKED_PIXELS,
.visual = FB_VISUAL_TRUECOLOR,
@@ -136,12 +141,12 @@
.accel = FB_ACCEL_NONE,
};
-static int fm2fb_mode __devinitdata = -1;
+static int fm2fb_mode __initdata = -1;
#define FM2FB_MODE_PAL 0
#define FM2FB_MODE_NTSC 1
-static struct fb_var_screeninfo fb_var_modes[] __devinitdata = {
+static struct fb_var_screeninfo fb_var_modes[] __initdata = {
{
/* 768 x 576, 32 bpp (PAL) */
768, 576, 768, 576, 0, 0, 32, 0,
@@ -156,10 +161,11 @@
33333, 10, 102, 10, 5, 80, 34, FB_SYNC_COMP_HIGH_ACT, 0
}
};
-
+
/*
* Interface used by the world
*/
+int fm2fb_init(void);
static int fm2fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
u_int transp, struct fb_info *info);
@@ -168,7 +174,7 @@
static struct fb_ops fm2fb_ops = {
.owner = THIS_MODULE,
.fb_setcolreg = fm2fb_setcolreg,
- .fb_blank = fm2fb_blank,
+ .fb_blank = fm2fb_blank,
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
@@ -196,7 +202,7 @@
static int fm2fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
u_int transp, struct fb_info *info)
{
- if (regno > 255)
+ if (regno > 15)
return 1;
red >>= 8;
green >>= 8;
@@ -210,91 +216,66 @@
* Initialisation
*/
-static int __devinit fm2fb_probe(struct zorro_dev *z,
- const struct zorro_device_id *id);
-
-static struct zorro_device_id fm2fb_devices[] __devinitdata = {
- { ZORRO_PROD_BSC_FRAMEMASTER_II },
- { ZORRO_PROD_HELFRICH_RAINBOW_II },
- { 0 }
-};
-
-static struct zorro_driver fm2fb_driver = {
- .name = "fm2fb",
- .id_table = fm2fb_devices,
- .probe = fm2fb_probe,
-};
-
-static int __devinit fm2fb_probe(struct zorro_dev *z,
- const struct zorro_device_id *id)
+int __init fm2fb_init(void)
{
- struct fb_info *info;
+ struct zorro_dev *z = NULL;
unsigned long *ptr;
int is_fm;
int x, y;
- is_fm = z->id == ZORRO_PROD_BSC_FRAMEMASTER_II;
-
- if (!zorro_request_device(z,"fm2fb"))
- return -ENXIO;
+ while ((z = zorro_find_device(ZORRO_WILDCARD, z))) {
+ if (z->id == ZORRO_PROD_BSC_FRAMEMASTER_II)
+ is_fm = 1;
+ else if (z->id == ZORRO_PROD_HELFRICH_RAINBOW_II)
+ is_fm = 0;
+ else
+ continue;
+
+ if (!request_mem_region(z->resource.start, FRAMEMASTER_SIZE, "fm2fb"))
+ continue;
+
+ /* assigning memory to kernel space */
+ fb_fix.smem_start = z->resource.start;
+ fb_info.screen_base = ioremap(fb_fix.smem_start, FRAMEMASTER_SIZE);
+ fb_fix.mmio_start = fb_fix.smem_start + FRAMEMASTER_REG;
+ fm2fb_reg = (unsigned char *)(fb_info.screen_base+FRAMEMASTER_REG);
+
+ strcpy(fb_fix.id, is_fm ? "FrameMaster II" : "Rainbow II");
+
+ /* make EBU color bars on display */
+ ptr = (unsigned long *)fb_fix.smem_start;
+ for (y = 0; y < 576; y++) {
+ for (x = 0; x < 96; x++) *ptr++ = 0xffffff;/* white */
+ for (x = 0; x < 96; x++) *ptr++ = 0xffff00;/* yellow */
+ for (x = 0; x < 96; x++) *ptr++ = 0x00ffff;/* cyan */
+ for (x = 0; x < 96; x++) *ptr++ = 0x00ff00;/* green */
+ for (x = 0; x < 96; x++) *ptr++ = 0xff00ff;/* magenta */
+ for (x = 0; x < 96; x++) *ptr++ = 0xff0000;/* red */
+ for (x = 0; x < 96; x++) *ptr++ = 0x0000ff;/* blue */
+ for (x = 0; x < 96; x++) *ptr++ = 0x000000;/* black */
+ }
+ fm2fb_blank(0, NULL);
- info = framebuffer_alloc(256 * sizeof(u32), &z->dev);
- if (!info) {
- zorro_release_device(z);
- return -ENOMEM;
- }
+ if (fm2fb_mode == -1)
+ fm2fb_mode = FM2FB_MODE_PAL;
- if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
- framebuffer_release(info);
- zorro_release_device(z);
- return -ENOMEM;
- }
+ fb_info.fbops = &fm2fb_ops;
+ fb_info.var = fb_var_modes[fm2fb_mode];
+ fb_info.screen_base = (char *)fb_fix.smem_start;
+ fb_info.pseudo_palette = pseudo_palette;
+ fb_info.fix = fb_fix;
+ fb_info.flags = FBINFO_FLAG_DEFAULT;
- /* assigning memory to kernel space */
- fb_fix.smem_start = zorro_resource_start(z);
- info->screen_base = ioremap(fb_fix.smem_start, FRAMEMASTER_SIZE);
- fb_fix.mmio_start = fb_fix.smem_start + FRAMEMASTER_REG;
- fm2fb_reg = (unsigned char *)(info->screen_base+FRAMEMASTER_REG);
-
- strcpy(fb_fix.id, is_fm ? "FrameMaster II" : "Rainbow II");
-
- /* make EBU color bars on display */
- ptr = (unsigned long *)fb_fix.smem_start;
- for (y = 0; y < 576; y++) {
- for (x = 0; x < 96; x++) *ptr++ = 0xffffff;/* white */
- for (x = 0; x < 96; x++) *ptr++ = 0xffff00;/* yellow */
- for (x = 0; x < 96; x++) *ptr++ = 0x00ffff;/* cyan */
- for (x = 0; x < 96; x++) *ptr++ = 0x00ff00;/* green */
- for (x = 0; x < 96; x++) *ptr++ = 0xff00ff;/* magenta */
- for (x = 0; x < 96; x++) *ptr++ = 0xff0000;/* red */
- for (x = 0; x < 96; x++) *ptr++ = 0x0000ff;/* blue */
- for (x = 0; x < 96; x++) *ptr++ = 0x000000;/* black */
- }
- fm2fb_blank(0, info);
+ /* The below fields will go away !!!! */
+ fb_alloc_cmap(&fb_info.cmap, 16, 0);
- if (fm2fb_mode == -1)
- fm2fb_mode = FM2FB_MODE_PAL;
+ if (register_framebuffer(&fb_info) < 0)
+ return -EINVAL;
- info->fbops = &fm2fb_ops;
- info->var = fb_var_modes[fm2fb_mode];
- info->pseudo_palette = info->par;
- info->par = NULL;
- info->fix = fb_fix;
- info->flags = FBINFO_FLAG_DEFAULT;
-
- if (register_framebuffer(info) < 0) {
- fb_dealloc_cmap(&info->cmap);
- framebuffer_release(info);
- zorro_release_device(z);
- return -EINVAL;
+ printk("fb%d: %s frame buffer device\n", fb_info.node, fb_fix.id);
+ return 0;
}
- printk("fb%d: %s frame buffer device\n", info->node, fb_fix.id);
- return 0;
-}
-
-int __init fm2fb_init(void)
-{
- return zorro_register_driver(&fm2fb_driver);
+ return -ENXIO;
}
int __init fm2fb_setup(char *options)
@@ -304,7 +285,7 @@
if (!options || !*options)
return 0;
- while ((this_opt = strsep(&options, ",")) != NULL) {
+ while ((this_opt = strsep(&options, ",")) != NULL) {
if (!strncmp(this_opt, "pal", 3))
fm2fb_mode = FM2FB_MODE_PAL;
else if (!strncmp(this_opt, "ntsc", 4))
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Apollo framebuffer sysfs
2004-02-23 20:00 ` Geert Uytterhoeven
@ 2004-02-23 22:16 ` James Simmons
2004-02-24 8:32 ` Geert Uytterhoeven
0 siblings, 1 reply; 11+ messages in thread
From: James Simmons @ 2004-02-23 22:16 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Linux Kernel Mailing List, Linux Fbdev development list
> Wow, the first platform_device on m68k ;-)
:-)
Merged with my patch. This patch is against linus tree. Please test.
--- linus-2.6/drivers/video/dnfb.c 2004-02-18 20:59:07.000000000 -0800
+++ fbdev-2.6/drivers/video/dnfb.c 2004-02-22 21:17:16.000000000 -0800
@@ -103,8 +103,6 @@
#define SWAP(A) ((A>>8) | ((A&0xff) <<8))
-static struct fb_info fb_info;
-
/* frame buffer operations */
static int dnfb_blank(int blank, struct fb_info *info);
@@ -119,7 +117,7 @@
.fb_cursor = soft_cursor,
};
-struct fb_var_screeninfo dnfb_var __initdata = {
+struct fb_var_screeninfo dnfb_var __devinitdata = {
.xres 1280,
.yres 1024,
.xres_virtual 2048,
@@ -130,7 +128,7 @@
.vmode FB_VMODE_NONINTERLACED,
};
-static struct fb_fix_screeninfo dnfb_fix __initdata = {
+static struct fb_fix_screeninfo dnfb_fix __devinitdata = {
.id "Apollo Mono",
.smem_start (FRAME_BUFFER_START + IO_BASE),
.smem_len FRAME_BUFFER_LEN,
@@ -148,7 +146,7 @@
return 0;
}
-static
+static
void dnfb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
{
@@ -224,21 +222,38 @@
out_8(AP_CONTROL_0, NORMAL_MODE);
}
+/*
+ * Initialization
+ */
-unsigned long __init dnfb_init(unsigned long mem_start)
+static int __devinit dnfb_probe(struct device *device)
{
- int err;
-
- fb_info.fbops = &dn_fb_ops;
- fb_info.fix = dnfb_fix;
- fb_info.var = dnfb_var;
- fb_info.screen_base = (u_char *) fb_info.fix.smem_start;
-
- fb_alloc_cmap(&fb_info.cmap, 2, 0);
-
- err = register_framebuffer(&fb_info);
- if (err < 0)
- panic("unable to register apollo frame buffer\n");
+ struct platform_device *dev = to_platform_device(device);
+ struct fb_info *info;
+ int err = 0;
+
+ info = framebuffer_alloc(0, &dev->dev);
+ if (!info)
+ return -ENOMEM;
+
+ info->fbops = &dn_fb_ops;
+ info->fix = dnfb_fix;
+ info->var = dnfb_var;
+ info->screen_base = (u_char *) info->fix.smem_start;
+
+ err = fb_alloc_cmap(&info->cmap, 2, 0);
+ if (err < 0) {
+ framebuffer_release(info);
+ return err;
+ }
+
+ err = register_framebuffer(info);
+ if (err < 0) {
+ fb_dealloc_cmap(&info->cmap);
+ framebuffer_release(info);
+ return err;
+ }
+ dev_set_drvdata(&dev->dev, info);
/* now we have registered we can safely setup the hardware */
out_8(AP_CONTROL_3A, RESET_CREG);
@@ -249,7 +264,32 @@
out_be16(AP_ROP_1, SWAP(0x3));
printk("apollo frame buffer alive and kicking !\n");
- return mem_start;
+ return err;
+}
+
+static struct device_driver dnfb_driver = {
+ .name = "dnfb",
+ .bus = &platform_bus_type,
+ .probe = dnfb_probe,
+};
+
+static struct platform_device dnfb_device = {
+ .name = "dnfb",
+ .id = 0,
+};
+
+int __init dnfb_init(void)
+{
+ int ret;
+
+ ret = driver_register(&dnfb_driver);
+
+ if (!ret) {
+ ret = platform_device_register(&dnfb_device);
+ if (ret)
+ driver_unregister(&dnfb_driver);
+ }
+ return ret;
}
MODULE_LICENSE("GPL");
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: FrameMasterII fbdev updates.
2004-02-23 22:16 ` James Simmons
@ 2004-02-24 8:31 ` Geert Uytterhoeven
2004-02-24 17:07 ` James Simmons
0 siblings, 1 reply; 11+ messages in thread
From: Geert Uytterhoeven @ 2004-02-24 8:31 UTC (permalink / raw)
To: James Simmons; +Cc: Linux Kernel Mailing List, Linux Fbdev development list
On Mon, 23 Feb 2004, James Simmons wrote:
> > On Wed, 18 Feb 2004, James Simmons wrote:
> > > Can you test this patch. It is a port of the driver to use sysfs.
>
> Merged your patch with mine. Here is the latest patch. Please test. The
> patch is against linus tree. Thank you.
>
>
> --- fbdev-2.6/drivers/video/fm2fb.c 2004-02-22 20:18:18.000000000 -0800
> +++ linus-2.6/drivers/video/fm2fb.c 2004-02-18 20:59:07.000000000 -0800
Woops, wrong direction :-)
You missed these two:
- Fix indentation
- Kill space at end of line
--- linux/drivers/video/fm2fb.c.orig 2004-02-24 09:28:59.000000000 +0100
+++ linux/drivers/video/fm2fb.c 2004-02-23 20:48:50.000000000 +0100
@@ -211,7 +211,7 @@
*/
static int __devinit fm2fb_probe(struct zorro_dev *z,
- const struct zorro_device_id *id);
+ const struct zorro_device_id *id);
static struct zorro_device_id fm2fb_devices[] __devinitdata = {
{ ZORRO_PROD_BSC_FRAMEMASTER_II },
@@ -226,7 +226,7 @@
};
static int __devinit fm2fb_probe(struct zorro_dev *z,
- const struct zorro_device_id *id)
+ const struct zorro_device_id *id)
{
struct fb_info *info;
unsigned long *ptr;
@@ -238,7 +238,7 @@
if (!zorro_request_device(z,"fm2fb"))
return -ENXIO;
- info = framebuffer_alloc(256 * sizeof(u32), &z->dev);
+ info = framebuffer_alloc(256 * sizeof(u32), &z->dev);
if (!info) {
zorro_release_device(z);
return -ENOMEM;
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Apollo framebuffer sysfs
2004-02-23 22:16 ` James Simmons
@ 2004-02-24 8:32 ` Geert Uytterhoeven
2004-02-24 17:08 ` James Simmons
0 siblings, 1 reply; 11+ messages in thread
From: Geert Uytterhoeven @ 2004-02-24 8:32 UTC (permalink / raw)
To: James Simmons; +Cc: Linux Kernel Mailing List, Linux Fbdev development list
On Mon, 23 Feb 2004, James Simmons wrote:
> > Wow, the first platform_device on m68k ;-)
>
> :-)
>
> Merged with my patch. This patch is against linus tree. Please test.
>
>
> --- linus-2.6/drivers/video/dnfb.c 2004-02-18 20:59:07.000000000 -0800
> +++ fbdev-2.6/drivers/video/dnfb.c 2004-02-22 21:17:16.000000000 -0800
You missed these:
- Kill space at end of line
- Kill unneeded initialization
--- linux/drivers/video/dnfb.c.orig 2004-02-24 09:28:19.000000000 +0100
+++ linux/drivers/video/dnfb.c 2004-02-23 20:59:20.000000000 +0100
@@ -246,7 +246,7 @@
framebuffer_release(info);
return err;
}
-
+
err = register_framebuffer(info);
if (err < 0) {
fb_dealloc_cmap(&info->cmap);
@@ -275,7 +275,6 @@
static struct platform_device dnfb_device = {
.name = "dnfb",
- .id = 0,
};
int __init dnfb_init(void)
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: FrameMasterII fbdev updates.
2004-02-24 8:31 ` Geert Uytterhoeven
@ 2004-02-24 17:07 ` James Simmons
2004-02-24 17:20 ` James Simmons
0 siblings, 1 reply; 11+ messages in thread
From: James Simmons @ 2004-02-24 17:07 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Linux Kernel Mailing List, Linux Fbdev development list
Okay. Applied. Try this. Its against the standard tree. Send it to linus
if you are happy with it.
--- linus-2.6/drivers/video/fm2fb.c 2004-02-18 20:59:07.000000000 -0800
+++ fbdev-2.6/drivers/video/fm2fb.c 2004-02-23 15:56:38.000000000 -0800
@@ -49,7 +49,7 @@
* not assembled with memory for the alpha channel. In this
* case it could be possible to add the frame buffer into the
* normal memory pool.
- *
+ *
* At relative address 0x1ffff8 of the frame buffers base address
* there exists a control register with the number of
* four control bits. They have the following meaning:
@@ -64,7 +64,7 @@
* is not very much information about the FrameMaster II in
* the world so I add these information for completeness.
*
- * JP1 interlace selection (1-2 non interlaced/2-3 interlaced)
+ * JP1 interlace selection (1-2 non interlaced/2-3 interlaced)
* JP2 wait state creation (leave as is!)
* JP3 wait state creation (leave as is!)
* JP4 modulate composite sync on green output (1-2 composite
@@ -127,12 +127,7 @@
static volatile unsigned char *fm2fb_reg;
-#define arraysize(x) (sizeof(x)/sizeof(*(x)))
-
-static struct fb_info fb_info;
-static u32 pseudo_palette[17];
-
-static struct fb_fix_screeninfo fb_fix __initdata = {
+static struct fb_fix_screeninfo fb_fix __devinitdata = {
.smem_len = FRAMEMASTER_REG,
.type = FB_TYPE_PACKED_PIXELS,
.visual = FB_VISUAL_TRUECOLOR,
@@ -141,12 +136,12 @@
.accel = FB_ACCEL_NONE,
};
-static int fm2fb_mode __initdata = -1;
+static int fm2fb_mode __devinitdata = -1;
#define FM2FB_MODE_PAL 0
#define FM2FB_MODE_NTSC 1
-static struct fb_var_screeninfo fb_var_modes[] __initdata = {
+static struct fb_var_screeninfo fb_var_modes[] __devinitdata = {
{
/* 768 x 576, 32 bpp (PAL) */
768, 576, 768, 576, 0, 0, 32, 0,
@@ -161,11 +156,10 @@
33333, 10, 102, 10, 5, 80, 34, FB_SYNC_COMP_HIGH_ACT, 0
}
};
-
+
/*
* Interface used by the world
*/
-int fm2fb_init(void);
static int fm2fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
u_int transp, struct fb_info *info);
@@ -174,7 +168,7 @@
static struct fb_ops fm2fb_ops = {
.owner = THIS_MODULE,
.fb_setcolreg = fm2fb_setcolreg,
- .fb_blank = fm2fb_blank,
+ .fb_blank = fm2fb_blank,
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
@@ -202,7 +196,7 @@
static int fm2fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
u_int transp, struct fb_info *info)
{
- if (regno > 15)
+ if (regno > 255)
return 1;
red >>= 8;
green >>= 8;
@@ -216,66 +210,91 @@
* Initialisation
*/
-int __init fm2fb_init(void)
+static int __devinit fm2fb_probe(struct zorro_dev *z,
+ const struct zorro_device_id *id);
+
+static struct zorro_device_id fm2fb_devices[] __devinitdata = {
+ { ZORRO_PROD_BSC_FRAMEMASTER_II },
+ { ZORRO_PROD_HELFRICH_RAINBOW_II },
+ { 0 }
+};
+
+static struct zorro_driver fm2fb_driver = {
+ .name = "fm2fb",
+ .id_table = fm2fb_devices,
+ .probe = fm2fb_probe,
+};
+
+static int __devinit fm2fb_probe(struct zorro_dev *z,
+ const struct zorro_device_id *id)
{
- struct zorro_dev *z = NULL;
+ struct fb_info *info;
unsigned long *ptr;
int is_fm;
int x, y;
- while ((z = zorro_find_device(ZORRO_WILDCARD, z))) {
- if (z->id == ZORRO_PROD_BSC_FRAMEMASTER_II)
- is_fm = 1;
- else if (z->id == ZORRO_PROD_HELFRICH_RAINBOW_II)
- is_fm = 0;
- else
- continue;
-
- if (!request_mem_region(z->resource.start, FRAMEMASTER_SIZE, "fm2fb"))
- continue;
-
- /* assigning memory to kernel space */
- fb_fix.smem_start = z->resource.start;
- fb_info.screen_base = ioremap(fb_fix.smem_start, FRAMEMASTER_SIZE);
- fb_fix.mmio_start = fb_fix.smem_start + FRAMEMASTER_REG;
- fm2fb_reg = (unsigned char *)(fb_info.screen_base+FRAMEMASTER_REG);
-
- strcpy(fb_fix.id, is_fm ? "FrameMaster II" : "Rainbow II");
-
- /* make EBU color bars on display */
- ptr = (unsigned long *)fb_fix.smem_start;
- for (y = 0; y < 576; y++) {
- for (x = 0; x < 96; x++) *ptr++ = 0xffffff;/* white */
- for (x = 0; x < 96; x++) *ptr++ = 0xffff00;/* yellow */
- for (x = 0; x < 96; x++) *ptr++ = 0x00ffff;/* cyan */
- for (x = 0; x < 96; x++) *ptr++ = 0x00ff00;/* green */
- for (x = 0; x < 96; x++) *ptr++ = 0xff00ff;/* magenta */
- for (x = 0; x < 96; x++) *ptr++ = 0xff0000;/* red */
- for (x = 0; x < 96; x++) *ptr++ = 0x0000ff;/* blue */
- for (x = 0; x < 96; x++) *ptr++ = 0x000000;/* black */
- }
- fm2fb_blank(0, NULL);
+ is_fm = z->id == ZORRO_PROD_BSC_FRAMEMASTER_II;
- if (fm2fb_mode == -1)
- fm2fb_mode = FM2FB_MODE_PAL;
+ if (!zorro_request_device(z,"fm2fb"))
+ return -ENXIO;
- fb_info.fbops = &fm2fb_ops;
- fb_info.var = fb_var_modes[fm2fb_mode];
- fb_info.screen_base = (char *)fb_fix.smem_start;
- fb_info.pseudo_palette = pseudo_palette;
- fb_info.fix = fb_fix;
- fb_info.flags = FBINFO_FLAG_DEFAULT;
+ info = framebuffer_alloc(256 * sizeof(u32), &z->dev);
+ if (!info) {
+ zorro_release_device(z);
+ return -ENOMEM;
+ }
- /* The below fields will go away !!!! */
- fb_alloc_cmap(&fb_info.cmap, 16, 0);
+ if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
+ framebuffer_release(info);
+ zorro_release_device(z);
+ return -ENOMEM;
+ }
- if (register_framebuffer(&fb_info) < 0)
- return -EINVAL;
+ /* assigning memory to kernel space */
+ fb_fix.smem_start = zorro_resource_start(z);
+ info->screen_base = ioremap(fb_fix.smem_start, FRAMEMASTER_SIZE);
+ fb_fix.mmio_start = fb_fix.smem_start + FRAMEMASTER_REG;
+ fm2fb_reg = (unsigned char *)(info->screen_base+FRAMEMASTER_REG);
+
+ strcpy(fb_fix.id, is_fm ? "FrameMaster II" : "Rainbow II");
+
+ /* make EBU color bars on display */
+ ptr = (unsigned long *)fb_fix.smem_start;
+ for (y = 0; y < 576; y++) {
+ for (x = 0; x < 96; x++) *ptr++ = 0xffffff;/* white */
+ for (x = 0; x < 96; x++) *ptr++ = 0xffff00;/* yellow */
+ for (x = 0; x < 96; x++) *ptr++ = 0x00ffff;/* cyan */
+ for (x = 0; x < 96; x++) *ptr++ = 0x00ff00;/* green */
+ for (x = 0; x < 96; x++) *ptr++ = 0xff00ff;/* magenta */
+ for (x = 0; x < 96; x++) *ptr++ = 0xff0000;/* red */
+ for (x = 0; x < 96; x++) *ptr++ = 0x0000ff;/* blue */
+ for (x = 0; x < 96; x++) *ptr++ = 0x000000;/* black */
+ }
+ fm2fb_blank(0, info);
- printk("fb%d: %s frame buffer device\n", fb_info.node, fb_fix.id);
- return 0;
+ if (fm2fb_mode == -1)
+ fm2fb_mode = FM2FB_MODE_PAL;
+
+ info->fbops = &fm2fb_ops;
+ info->var = fb_var_modes[fm2fb_mode];
+ info->pseudo_palette = info->par;
+ info->par = NULL;
+ info->fix = fb_fix;
+ info->flags = FBINFO_FLAG_DEFAULT;
+
+ if (register_framebuffer(info) < 0) {
+ fb_dealloc_cmap(&info->cmap);
+ framebuffer_release(info);
+ zorro_release_device(z);
+ return -EINVAL;
}
- return -ENXIO;
+ printk("fb%d: %s frame buffer device\n", info->node, fb_fix.id);
+ return 0;
+}
+
+int __init fm2fb_init(void)
+{
+ return zorro_register_driver(&fm2fb_driver);
}
int __init fm2fb_setup(char *options)
@@ -285,7 +304,7 @@
if (!options || !*options)
return 0;
- while ((this_opt = strsep(&options, ",")) != NULL) {
+ while ((this_opt = strsep(&options, ",")) != NULL) {
if (!strncmp(this_opt, "pal", 3))
fm2fb_mode = FM2FB_MODE_PAL;
else if (!strncmp(this_opt, "ntsc", 4))
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Apollo framebuffer sysfs
2004-02-24 8:32 ` Geert Uytterhoeven
@ 2004-02-24 17:08 ` James Simmons
0 siblings, 0 replies; 11+ messages in thread
From: James Simmons @ 2004-02-24 17:08 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Linux Kernel Mailing List, Linux Fbdev development list
Okay. Applied. Try this patch. If you are happy with it send it to linus.
--- linus-2.6/drivers/video/dnfb.c 2004-02-18 20:59:07.000000000 -0800
+++ fbdev-2.6/drivers/video/dnfb.c 2004-02-23 15:58:26.000000000 -0800
@@ -103,8 +103,6 @@
#define SWAP(A) ((A>>8) | ((A&0xff) <<8))
-static struct fb_info fb_info;
-
/* frame buffer operations */
static int dnfb_blank(int blank, struct fb_info *info);
@@ -119,7 +117,7 @@
.fb_cursor = soft_cursor,
};
-struct fb_var_screeninfo dnfb_var __initdata = {
+struct fb_var_screeninfo dnfb_var __devinitdata = {
.xres 1280,
.yres 1024,
.xres_virtual 2048,
@@ -130,7 +128,7 @@
.vmode FB_VMODE_NONINTERLACED,
};
-static struct fb_fix_screeninfo dnfb_fix __initdata = {
+static struct fb_fix_screeninfo dnfb_fix __devinitdata = {
.id "Apollo Mono",
.smem_start (FRAME_BUFFER_START + IO_BASE),
.smem_len FRAME_BUFFER_LEN,
@@ -148,7 +146,7 @@
return 0;
}
-static
+static
void dnfb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
{
@@ -224,21 +222,38 @@
out_8(AP_CONTROL_0, NORMAL_MODE);
}
+/*
+ * Initialization
+ */
-unsigned long __init dnfb_init(unsigned long mem_start)
+static int __devinit dnfb_probe(struct device *device)
{
- int err;
+ struct platform_device *dev = to_platform_device(device);
+ struct fb_info *info;
+ int err = 0;
+
+ info = framebuffer_alloc(0, &dev->dev);
+ if (!info)
+ return -ENOMEM;
+
+ info->fbops = &dn_fb_ops;
+ info->fix = dnfb_fix;
+ info->var = dnfb_var;
+ info->screen_base = (u_char *) info->fix.smem_start;
+
+ err = fb_alloc_cmap(&info->cmap, 2, 0);
+ if (err < 0) {
+ framebuffer_release(info);
+ return err;
+ }
- fb_info.fbops = &dn_fb_ops;
- fb_info.fix = dnfb_fix;
- fb_info.var = dnfb_var;
- fb_info.screen_base = (u_char *) fb_info.fix.smem_start;
-
- fb_alloc_cmap(&fb_info.cmap, 2, 0);
-
- err = register_framebuffer(&fb_info);
- if (err < 0)
- panic("unable to register apollo frame buffer\n");
+ err = register_framebuffer(info);
+ if (err < 0) {
+ fb_dealloc_cmap(&info->cmap);
+ framebuffer_release(info);
+ return err;
+ }
+ dev_set_drvdata(&dev->dev, info);
/* now we have registered we can safely setup the hardware */
out_8(AP_CONTROL_3A, RESET_CREG);
@@ -249,7 +264,31 @@
out_be16(AP_ROP_1, SWAP(0x3));
printk("apollo frame buffer alive and kicking !\n");
- return mem_start;
+ return err;
+}
+
+static struct device_driver dnfb_driver = {
+ .name = "dnfb",
+ .bus = &platform_bus_type,
+ .probe = dnfb_probe,
+};
+
+static struct platform_device dnfb_device = {
+ .name = "dnfb",
+};
+
+int __init dnfb_init(void)
+{
+ int ret;
+
+ ret = driver_register(&dnfb_driver);
+
+ if (!ret) {
+ ret = platform_device_register(&dnfb_device);
+ if (ret)
+ driver_unregister(&dnfb_driver);
+ }
+ return ret;
}
MODULE_LICENSE("GPL");
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: FrameMasterII fbdev updates.
2004-02-24 17:07 ` James Simmons
@ 2004-02-24 17:20 ` James Simmons
0 siblings, 0 replies; 11+ messages in thread
From: James Simmons @ 2004-02-24 17:20 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Linux Kernel Mailing List, Linux Fbdev development list
> Okay. Applied. Try this. Its against the standard tree. Send it to linus
> if you are happy with it.
One more change. Here you go.
--- linus-2.6/drivers/video/fm2fb.c 2004-02-18 20:59:07.000000000 -0800
+++ fbdev-2.6/drivers/video/fm2fb.c 2004-02-23 16:12:19.000000000 -0800
@@ -49,7 +49,7 @@
* not assembled with memory for the alpha channel. In this
* case it could be possible to add the frame buffer into the
* normal memory pool.
- *
+ *
* At relative address 0x1ffff8 of the frame buffers base address
* there exists a control register with the number of
* four control bits. They have the following meaning:
@@ -64,7 +64,7 @@
* is not very much information about the FrameMaster II in
* the world so I add these information for completeness.
*
- * JP1 interlace selection (1-2 non interlaced/2-3 interlaced)
+ * JP1 interlace selection (1-2 non interlaced/2-3 interlaced)
* JP2 wait state creation (leave as is!)
* JP3 wait state creation (leave as is!)
* JP4 modulate composite sync on green output (1-2 composite
@@ -127,12 +127,7 @@
static volatile unsigned char *fm2fb_reg;
-#define arraysize(x) (sizeof(x)/sizeof(*(x)))
-
-static struct fb_info fb_info;
-static u32 pseudo_palette[17];
-
-static struct fb_fix_screeninfo fb_fix __initdata = {
+static struct fb_fix_screeninfo fb_fix __devinitdata = {
.smem_len = FRAMEMASTER_REG,
.type = FB_TYPE_PACKED_PIXELS,
.visual = FB_VISUAL_TRUECOLOR,
@@ -141,12 +136,12 @@
.accel = FB_ACCEL_NONE,
};
-static int fm2fb_mode __initdata = -1;
+static int fm2fb_mode __devinitdata = -1;
#define FM2FB_MODE_PAL 0
#define FM2FB_MODE_NTSC 1
-static struct fb_var_screeninfo fb_var_modes[] __initdata = {
+static struct fb_var_screeninfo fb_var_modes[] __devinitdata = {
{
/* 768 x 576, 32 bpp (PAL) */
768, 576, 768, 576, 0, 0, 32, 0,
@@ -161,11 +156,10 @@
33333, 10, 102, 10, 5, 80, 34, FB_SYNC_COMP_HIGH_ACT, 0
}
};
-
+
/*
* Interface used by the world
*/
-int fm2fb_init(void);
static int fm2fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
u_int transp, struct fb_info *info);
@@ -174,7 +168,7 @@
static struct fb_ops fm2fb_ops = {
.owner = THIS_MODULE,
.fb_setcolreg = fm2fb_setcolreg,
- .fb_blank = fm2fb_blank,
+ .fb_blank = fm2fb_blank,
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
@@ -202,7 +196,7 @@
static int fm2fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
u_int transp, struct fb_info *info)
{
- if (regno > 15)
+ if (regno > info->cmap.len)
return 1;
red >>= 8;
green >>= 8;
@@ -216,66 +210,91 @@
* Initialisation
*/
-int __init fm2fb_init(void)
+static int __devinit fm2fb_probe(struct zorro_dev *z,
+ const struct zorro_device_id *id);
+
+static struct zorro_device_id fm2fb_devices[] __devinitdata = {
+ { ZORRO_PROD_BSC_FRAMEMASTER_II },
+ { ZORRO_PROD_HELFRICH_RAINBOW_II },
+ { 0 }
+};
+
+static struct zorro_driver fm2fb_driver = {
+ .name = "fm2fb",
+ .id_table = fm2fb_devices,
+ .probe = fm2fb_probe,
+};
+
+static int __devinit fm2fb_probe(struct zorro_dev *z,
+ const struct zorro_device_id *id)
{
- struct zorro_dev *z = NULL;
+ struct fb_info *info;
unsigned long *ptr;
int is_fm;
int x, y;
- while ((z = zorro_find_device(ZORRO_WILDCARD, z))) {
- if (z->id == ZORRO_PROD_BSC_FRAMEMASTER_II)
- is_fm = 1;
- else if (z->id == ZORRO_PROD_HELFRICH_RAINBOW_II)
- is_fm = 0;
- else
- continue;
-
- if (!request_mem_region(z->resource.start, FRAMEMASTER_SIZE, "fm2fb"))
- continue;
-
- /* assigning memory to kernel space */
- fb_fix.smem_start = z->resource.start;
- fb_info.screen_base = ioremap(fb_fix.smem_start, FRAMEMASTER_SIZE);
- fb_fix.mmio_start = fb_fix.smem_start + FRAMEMASTER_REG;
- fm2fb_reg = (unsigned char *)(fb_info.screen_base+FRAMEMASTER_REG);
-
- strcpy(fb_fix.id, is_fm ? "FrameMaster II" : "Rainbow II");
-
- /* make EBU color bars on display */
- ptr = (unsigned long *)fb_fix.smem_start;
- for (y = 0; y < 576; y++) {
- for (x = 0; x < 96; x++) *ptr++ = 0xffffff;/* white */
- for (x = 0; x < 96; x++) *ptr++ = 0xffff00;/* yellow */
- for (x = 0; x < 96; x++) *ptr++ = 0x00ffff;/* cyan */
- for (x = 0; x < 96; x++) *ptr++ = 0x00ff00;/* green */
- for (x = 0; x < 96; x++) *ptr++ = 0xff00ff;/* magenta */
- for (x = 0; x < 96; x++) *ptr++ = 0xff0000;/* red */
- for (x = 0; x < 96; x++) *ptr++ = 0x0000ff;/* blue */
- for (x = 0; x < 96; x++) *ptr++ = 0x000000;/* black */
- }
- fm2fb_blank(0, NULL);
+ is_fm = z->id == ZORRO_PROD_BSC_FRAMEMASTER_II;
- if (fm2fb_mode == -1)
- fm2fb_mode = FM2FB_MODE_PAL;
+ if (!zorro_request_device(z,"fm2fb"))
+ return -ENXIO;
- fb_info.fbops = &fm2fb_ops;
- fb_info.var = fb_var_modes[fm2fb_mode];
- fb_info.screen_base = (char *)fb_fix.smem_start;
- fb_info.pseudo_palette = pseudo_palette;
- fb_info.fix = fb_fix;
- fb_info.flags = FBINFO_FLAG_DEFAULT;
+ info = framebuffer_alloc(256 * sizeof(u32), &z->dev);
+ if (!info) {
+ zorro_release_device(z);
+ return -ENOMEM;
+ }
- /* The below fields will go away !!!! */
- fb_alloc_cmap(&fb_info.cmap, 16, 0);
+ if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
+ framebuffer_release(info);
+ zorro_release_device(z);
+ return -ENOMEM;
+ }
- if (register_framebuffer(&fb_info) < 0)
- return -EINVAL;
+ /* assigning memory to kernel space */
+ fb_fix.smem_start = zorro_resource_start(z);
+ info->screen_base = ioremap(fb_fix.smem_start, FRAMEMASTER_SIZE);
+ fb_fix.mmio_start = fb_fix.smem_start + FRAMEMASTER_REG;
+ fm2fb_reg = (unsigned char *)(info->screen_base+FRAMEMASTER_REG);
+
+ strcpy(fb_fix.id, is_fm ? "FrameMaster II" : "Rainbow II");
+
+ /* make EBU color bars on display */
+ ptr = (unsigned long *)fb_fix.smem_start;
+ for (y = 0; y < 576; y++) {
+ for (x = 0; x < 96; x++) *ptr++ = 0xffffff;/* white */
+ for (x = 0; x < 96; x++) *ptr++ = 0xffff00;/* yellow */
+ for (x = 0; x < 96; x++) *ptr++ = 0x00ffff;/* cyan */
+ for (x = 0; x < 96; x++) *ptr++ = 0x00ff00;/* green */
+ for (x = 0; x < 96; x++) *ptr++ = 0xff00ff;/* magenta */
+ for (x = 0; x < 96; x++) *ptr++ = 0xff0000;/* red */
+ for (x = 0; x < 96; x++) *ptr++ = 0x0000ff;/* blue */
+ for (x = 0; x < 96; x++) *ptr++ = 0x000000;/* black */
+ }
+ fm2fb_blank(0, info);
- printk("fb%d: %s frame buffer device\n", fb_info.node, fb_fix.id);
- return 0;
+ if (fm2fb_mode == -1)
+ fm2fb_mode = FM2FB_MODE_PAL;
+
+ info->fbops = &fm2fb_ops;
+ info->var = fb_var_modes[fm2fb_mode];
+ info->pseudo_palette = info->par;
+ info->par = NULL;
+ info->fix = fb_fix;
+ info->flags = FBINFO_FLAG_DEFAULT;
+
+ if (register_framebuffer(info) < 0) {
+ fb_dealloc_cmap(&info->cmap);
+ framebuffer_release(info);
+ zorro_release_device(z);
+ return -EINVAL;
}
- return -ENXIO;
+ printk("fb%d: %s frame buffer device\n", info->node, fb_fix.id);
+ return 0;
+}
+
+int __init fm2fb_init(void)
+{
+ return zorro_register_driver(&fm2fb_driver);
}
int __init fm2fb_setup(char *options)
@@ -285,7 +304,7 @@
if (!options || !*options)
return 0;
- while ((this_opt = strsep(&options, ",")) != NULL) {
+ while ((this_opt = strsep(&options, ",")) != NULL) {
if (!strncmp(this_opt, "pal", 3))
fm2fb_mode = FM2FB_MODE_PAL;
else if (!strncmp(this_opt, "ntsc", 4))
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2004-02-24 17:23 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-18 18:28 FrameMasterII fbdev updates James Simmons
2004-02-18 19:13 ` Apollo framebuffer sysfs James Simmons
2004-02-23 20:00 ` Geert Uytterhoeven
2004-02-23 22:16 ` James Simmons
2004-02-24 8:32 ` Geert Uytterhoeven
2004-02-24 17:08 ` James Simmons
2004-02-23 19:54 ` FrameMasterII fbdev updates Geert Uytterhoeven
2004-02-23 22:16 ` James Simmons
2004-02-24 8:31 ` Geert Uytterhoeven
2004-02-24 17:07 ` James Simmons
2004-02-24 17:20 ` James Simmons
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).