diff options
author | Geert Uytterhoeven <geert@linux-m68k.org> | 2009-04-05 06:45:56 -0400 |
---|---|---|
committer | Geert Uytterhoeven <geert@linux-m68k.org> | 2010-05-17 15:37:43 -0400 |
commit | fa6688e1c7e7341fb7d1ca5878a3641762e60dec (patch) | |
tree | fee19a4b0ade07bb2de1848ea75c29950599d5b0 /drivers/video/amifb.c | |
parent | 0d305464aefff342c85b4db8b3d7a4345246e5a1 (diff) |
m68k: amiga - Frame buffer platform device conversion
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Diffstat (limited to 'drivers/video/amifb.c')
-rw-r--r-- | drivers/video/amifb.c | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/drivers/video/amifb.c b/drivers/video/amifb.c index dca48df98444..e5d6b56d4447 100644 --- a/drivers/video/amifb.c +++ b/drivers/video/amifb.c | |||
@@ -50,8 +50,9 @@ | |||
50 | #include <linux/fb.h> | 50 | #include <linux/fb.h> |
51 | #include <linux/init.h> | 51 | #include <linux/init.h> |
52 | #include <linux/ioport.h> | 52 | #include <linux/ioport.h> |
53 | 53 | #include <linux/platform_device.h> | |
54 | #include <linux/uaccess.h> | 54 | #include <linux/uaccess.h> |
55 | |||
55 | #include <asm/system.h> | 56 | #include <asm/system.h> |
56 | #include <asm/irq.h> | 57 | #include <asm/irq.h> |
57 | #include <asm/amigahw.h> | 58 | #include <asm/amigahw.h> |
@@ -1135,7 +1136,7 @@ static int amifb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg | |||
1135 | * Interface to the low level console driver | 1136 | * Interface to the low level console driver |
1136 | */ | 1137 | */ |
1137 | 1138 | ||
1138 | static void amifb_deinit(void); | 1139 | static void amifb_deinit(struct platform_device *pdev); |
1139 | 1140 | ||
1140 | /* | 1141 | /* |
1141 | * Internal routines | 1142 | * Internal routines |
@@ -2246,7 +2247,7 @@ static inline void chipfree(void) | |||
2246 | * Initialisation | 2247 | * Initialisation |
2247 | */ | 2248 | */ |
2248 | 2249 | ||
2249 | static int __init amifb_init(void) | 2250 | static int __init amifb_probe(struct platform_device *pdev) |
2250 | { | 2251 | { |
2251 | int tag, i, err = 0; | 2252 | int tag, i, err = 0; |
2252 | u_long chipptr; | 2253 | u_long chipptr; |
@@ -2261,16 +2262,6 @@ static int __init amifb_init(void) | |||
2261 | } | 2262 | } |
2262 | amifb_setup(option); | 2263 | amifb_setup(option); |
2263 | #endif | 2264 | #endif |
2264 | if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(AMI_VIDEO)) | ||
2265 | return -ENODEV; | ||
2266 | |||
2267 | /* | ||
2268 | * We request all registers starting from bplpt[0] | ||
2269 | */ | ||
2270 | if (!request_mem_region(CUSTOM_PHYSADDR+0xe0, 0x120, | ||
2271 | "amifb [Denise/Lisa]")) | ||
2272 | return -EBUSY; | ||
2273 | |||
2274 | custom.dmacon = DMAF_ALL | DMAF_MASTER; | 2265 | custom.dmacon = DMAF_ALL | DMAF_MASTER; |
2275 | 2266 | ||
2276 | switch (amiga_chipset) { | 2267 | switch (amiga_chipset) { |
@@ -2377,6 +2368,7 @@ default_chipset: | |||
2377 | fb_info.fbops = &amifb_ops; | 2368 | fb_info.fbops = &amifb_ops; |
2378 | fb_info.par = ¤tpar; | 2369 | fb_info.par = ¤tpar; |
2379 | fb_info.flags = FBINFO_DEFAULT; | 2370 | fb_info.flags = FBINFO_DEFAULT; |
2371 | fb_info.device = &pdev->dev; | ||
2380 | 2372 | ||
2381 | if (!fb_find_mode(&fb_info.var, &fb_info, mode_option, ami_modedb, | 2373 | if (!fb_find_mode(&fb_info.var, &fb_info, mode_option, ami_modedb, |
2382 | NUM_TOTAL_MODES, &ami_modedb[defmode], 4)) { | 2374 | NUM_TOTAL_MODES, &ami_modedb[defmode], 4)) { |
@@ -2451,18 +2443,18 @@ default_chipset: | |||
2451 | return 0; | 2443 | return 0; |
2452 | 2444 | ||
2453 | amifb_error: | 2445 | amifb_error: |
2454 | amifb_deinit(); | 2446 | amifb_deinit(pdev); |
2455 | return err; | 2447 | return err; |
2456 | } | 2448 | } |
2457 | 2449 | ||
2458 | static void amifb_deinit(void) | 2450 | static void amifb_deinit(struct platform_device *pdev) |
2459 | { | 2451 | { |
2460 | if (fb_info.cmap.len) | 2452 | if (fb_info.cmap.len) |
2461 | fb_dealloc_cmap(&fb_info.cmap); | 2453 | fb_dealloc_cmap(&fb_info.cmap); |
2454 | fb_dealloc_cmap(&fb_info.cmap); | ||
2462 | chipfree(); | 2455 | chipfree(); |
2463 | if (videomemory) | 2456 | if (videomemory) |
2464 | iounmap((void*)videomemory); | 2457 | iounmap((void*)videomemory); |
2465 | release_mem_region(CUSTOM_PHYSADDR+0xe0, 0x120); | ||
2466 | custom.dmacon = DMAF_ALL | DMAF_MASTER; | 2458 | custom.dmacon = DMAF_ALL | DMAF_MASTER; |
2467 | } | 2459 | } |
2468 | 2460 | ||
@@ -3794,14 +3786,35 @@ static void ami_rebuild_copper(void) | |||
3794 | } | 3786 | } |
3795 | } | 3787 | } |
3796 | 3788 | ||
3797 | static void __exit amifb_exit(void) | 3789 | static int __exit amifb_remove(struct platform_device *pdev) |
3798 | { | 3790 | { |
3799 | unregister_framebuffer(&fb_info); | 3791 | unregister_framebuffer(&fb_info); |
3800 | amifb_deinit(); | 3792 | amifb_deinit(pdev); |
3801 | amifb_video_off(); | 3793 | amifb_video_off(); |
3794 | return 0; | ||
3795 | } | ||
3796 | |||
3797 | static struct platform_driver amifb_driver = { | ||
3798 | .remove = __exit_p(amifb_remove), | ||
3799 | .driver = { | ||
3800 | .name = "amiga-video", | ||
3801 | .owner = THIS_MODULE, | ||
3802 | }, | ||
3803 | }; | ||
3804 | |||
3805 | static int __init amifb_init(void) | ||
3806 | { | ||
3807 | return platform_driver_probe(&amifb_driver, amifb_probe); | ||
3802 | } | 3808 | } |
3803 | 3809 | ||
3804 | module_init(amifb_init); | 3810 | module_init(amifb_init); |
3811 | |||
3812 | static void __exit amifb_exit(void) | ||
3813 | { | ||
3814 | platform_driver_unregister(&amifb_driver); | ||
3815 | } | ||
3816 | |||
3805 | module_exit(amifb_exit); | 3817 | module_exit(amifb_exit); |
3806 | 3818 | ||
3807 | MODULE_LICENSE("GPL"); | 3819 | MODULE_LICENSE("GPL"); |
3820 | MODULE_ALIAS("platform:amiga-video"); | ||