Commit d8059782 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Apollo fb sysfsification

From: Geert Uytterhoeven <geert@linux-m68k.org>

Apollo fb: Add sysfs support (from James Simmons)
parent 77375e79
...@@ -103,8 +103,6 @@ ...@@ -103,8 +103,6 @@
#define SWAP(A) ((A>>8) | ((A&0xff) <<8)) #define SWAP(A) ((A>>8) | ((A&0xff) <<8))
static struct fb_info fb_info;
/* frame buffer operations */ /* frame buffer operations */
static int dnfb_blank(int blank, struct fb_info *info); static int dnfb_blank(int blank, struct fb_info *info);
...@@ -119,7 +117,7 @@ static struct fb_ops dn_fb_ops = { ...@@ -119,7 +117,7 @@ static struct fb_ops dn_fb_ops = {
.fb_cursor = soft_cursor, .fb_cursor = soft_cursor,
}; };
struct fb_var_screeninfo dnfb_var __initdata = { struct fb_var_screeninfo dnfb_var __devinitdata = {
.xres 1280, .xres 1280,
.yres 1024, .yres 1024,
.xres_virtual 2048, .xres_virtual 2048,
...@@ -130,7 +128,7 @@ struct fb_var_screeninfo dnfb_var __initdata = { ...@@ -130,7 +128,7 @@ struct fb_var_screeninfo dnfb_var __initdata = {
.vmode FB_VMODE_NONINTERLACED, .vmode FB_VMODE_NONINTERLACED,
}; };
static struct fb_fix_screeninfo dnfb_fix __initdata = { static struct fb_fix_screeninfo dnfb_fix __devinitdata = {
.id "Apollo Mono", .id "Apollo Mono",
.smem_start (FRAME_BUFFER_START + IO_BASE), .smem_start (FRAME_BUFFER_START + IO_BASE),
.smem_len FRAME_BUFFER_LEN, .smem_len FRAME_BUFFER_LEN,
...@@ -148,7 +146,7 @@ static int dnfb_blank(int blank, struct fb_info *info) ...@@ -148,7 +146,7 @@ static int dnfb_blank(int blank, struct fb_info *info)
return 0; return 0;
} }
static static
void dnfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) void dnfb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
{ {
...@@ -224,21 +222,38 @@ void dnfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) ...@@ -224,21 +222,38 @@ void dnfb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
out_8(AP_CONTROL_0, NORMAL_MODE); 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;
fb_info.fbops = &dn_fb_ops; int err = 0;
fb_info.fix = dnfb_fix;
fb_info.var = dnfb_var; info = framebuffer_alloc(0, &dev->dev);
fb_info.screen_base = (u_char *) fb_info.fix.smem_start; if (!info)
return -ENOMEM;
fb_alloc_cmap(&fb_info.cmap, 2, 0);
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(&fb_info); err = register_framebuffer(info);
if (err < 0) if (err < 0) {
panic("unable to register apollo frame buffer\n"); 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 */ /* now we have registered we can safely setup the hardware */
out_8(AP_CONTROL_3A, RESET_CREG); out_8(AP_CONTROL_3A, RESET_CREG);
...@@ -249,7 +264,31 @@ unsigned long __init dnfb_init(unsigned long mem_start) ...@@ -249,7 +264,31 @@ unsigned long __init dnfb_init(unsigned long mem_start)
out_be16(AP_ROP_1, SWAP(0x3)); out_be16(AP_ROP_1, SWAP(0x3));
printk("apollo frame buffer alive and kicking !\n"); 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"); MODULE_LICENSE("GPL");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment