Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759773AbZDRSxs (ORCPT ); Sat, 18 Apr 2009 14:53:48 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757011AbZDRSwi (ORCPT ); Sat, 18 Apr 2009 14:52:38 -0400 Received: from jacques.telenet-ops.be ([195.130.132.50]:45699 "EHLO jacques.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756472AbZDRSw2 (ORCPT ); Sat, 18 Apr 2009 14:52:28 -0400 From: Geert Uytterhoeven To: linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Geert Uytterhoeven , linux-fbdev-devel@lists.sourceforge.net Subject: [PATCH/RFC 04/16] m68k: amiga - Frame buffer platform device conversion Date: Sat, 18 Apr 2009 20:52:12 +0200 Message-Id: <1240080744-14995-5-git-send-email-geert@linux-m68k.org> X-Mailer: git-send-email 1.6.2.3 In-Reply-To: <1240080744-14995-4-git-send-email-geert@linux-m68k.org> References: <1240080744-14995-1-git-send-email-geert@linux-m68k.org> <1240080744-14995-2-git-send-email-geert@linux-m68k.org> <1240080744-14995-3-git-send-email-geert@linux-m68k.org> <1240080744-14995-4-git-send-email-geert@linux-m68k.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3911 Lines: 156 Signed-off-by: Geert Uytterhoeven Cc: linux-fbdev-devel@lists.sourceforge.net --- arch/m68k/amiga/platform.c | 15 +++++++++++++ drivers/video/amifb.c | 49 +++++++++++++++++++++++++++---------------- 2 files changed, 46 insertions(+), 18 deletions(-) diff --git a/arch/m68k/amiga/platform.c b/arch/m68k/amiga/platform.c index 33a7669..7fa929c 100644 --- a/arch/m68k/amiga/platform.c +++ b/arch/m68k/amiga/platform.c @@ -56,3 +56,18 @@ static int __init amiga_init_bus(void) subsys_initcall(amiga_init_bus); #endif /* CONFIG_ZORRO */ + + +static int __init amiga_init_devices(void) +{ + if (!MACH_IS_AMIGA) + return -ENODEV; + + /* video hardware */ + if (AMIGAHW_PRESENT(AMI_VIDEO)) + platform_device_register_simple("amiga-video", -1, NULL, 0); + + return 0; +} + +device_initcall(amiga_init_devices); diff --git a/drivers/video/amifb.c b/drivers/video/amifb.c index 82bedd7..36a4018 100644 --- a/drivers/video/amifb.c +++ b/drivers/video/amifb.c @@ -51,8 +51,9 @@ #include #include #include - +#include #include + #include #include #include @@ -1136,7 +1137,7 @@ static int amifb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg * Interface to the low level console driver */ -static void amifb_deinit(void); +static void amifb_deinit(struct platform_device *pdev); /* * Internal routines @@ -2247,7 +2248,7 @@ static inline void chipfree(void) * Initialisation */ -static int __init amifb_init(void) +static int __init amifb_probe(struct platform_device *pdev) { int tag, i, err = 0; u_long chipptr; @@ -2262,16 +2263,6 @@ static int __init amifb_init(void) } amifb_setup(option); #endif - if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(AMI_VIDEO)) - return -ENODEV; - - /* - * We request all registers starting from bplpt[0] - */ - if (!request_mem_region(CUSTOM_PHYSADDR+0xe0, 0x120, - "amifb [Denise/Lisa]")) - return -EBUSY; - custom.dmacon = DMAF_ALL | DMAF_MASTER; switch (amiga_chipset) { @@ -2378,6 +2369,7 @@ default_chipset: fb_info.fbops = &amifb_ops; fb_info.par = ¤tpar; fb_info.flags = FBINFO_DEFAULT; + fb_info.device = &pdev->dev; if (!fb_find_mode(&fb_info.var, &fb_info, mode_option, ami_modedb, NUM_TOTAL_MODES, &ami_modedb[defmode], 4)) { @@ -2452,18 +2444,18 @@ default_chipset: return 0; amifb_error: - amifb_deinit(); + amifb_deinit(pdev); return err; } -static void amifb_deinit(void) +static void amifb_deinit(struct platform_device *pdev) { if (fb_info.cmap.len) fb_dealloc_cmap(&fb_info.cmap); + fb_dealloc_cmap(&fb_info.cmap); chipfree(); if (videomemory) iounmap((void*)videomemory); - release_mem_region(CUSTOM_PHYSADDR+0xe0, 0x120); custom.dmacon = DMAF_ALL | DMAF_MASTER; } @@ -3795,14 +3787,35 @@ static void ami_rebuild_copper(void) } } -static void __exit amifb_exit(void) +static int __exit amifb_remove(struct platform_device *pdev) { unregister_framebuffer(&fb_info); - amifb_deinit(); + amifb_deinit(pdev); amifb_video_off(); + return 0; +} + +static struct platform_driver amifb_driver = { + .remove = __exit_p(amifb_remove), + .driver = { + .name = "amiga-video", + .owner = THIS_MODULE, + }, +}; + +static int __init amifb_init(void) +{ + return platform_driver_probe(&amifb_driver, amifb_probe); } module_init(amifb_init); + +static void __exit amifb_exit(void) +{ + platform_driver_unregister(&amifb_driver); +} + module_exit(amifb_exit); MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:amiga-video"); -- 1.6.2.3 -- 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/