Messages in this thread Patch in this message | | | Date | Mon, 23 Feb 2004 22:16:54 +0000 (GMT) | From | James Simmons <> | Subject | Re: Apollo framebuffer sysfs |
| |
> 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"); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |