aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/imacfb.c
diff options
context:
space:
mode:
authorEdgar Hucek <hostmaster@ed-soft.at>2006-08-14 02:24:16 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-08-14 15:54:28 -0400
commitb64ef8afa58f397e1eaba2bd9ecaa6812064d464 (patch)
tree2e8a312cbf4ff9df84ecee3ea2eca5c0c349d9a2 /drivers/video/imacfb.c
parente9fa4f7bd291c29a785666e2fa5a9cf3241ee6c3 (diff)
[PATCH] add imacfb documentation and detection
Add basic Machine detection to imacfb and some Ducumentation bits for imacfb. Signed-off-by: Edgar Hucek <hostmaster@ed-soft.at> Cc: "Antonino A. Daplas" <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/video/imacfb.c')
-rw-r--r--drivers/video/imacfb.c49
1 files changed, 44 insertions, 5 deletions
diff --git a/drivers/video/imacfb.c b/drivers/video/imacfb.c
index ff233b84dec4..b485bece5fc9 100644
--- a/drivers/video/imacfb.c
+++ b/drivers/video/imacfb.c
@@ -18,6 +18,8 @@
18#include <linux/screen_info.h> 18#include <linux/screen_info.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/string.h> 20#include <linux/string.h>
21#include <linux/dmi.h>
22#include <linux/efi.h>
21 23
22#include <asm/io.h> 24#include <asm/io.h>
23 25
@@ -28,7 +30,7 @@ typedef enum _MAC_TYPE {
28 M_I20, 30 M_I20,
29 M_MINI, 31 M_MINI,
30 M_MACBOOK, 32 M_MACBOOK,
31 M_NEW 33 M_UNKNOWN
32} MAC_TYPE; 34} MAC_TYPE;
33 35
34/* --------------------------------------------------------------------- */ 36/* --------------------------------------------------------------------- */
@@ -52,10 +54,36 @@ static struct fb_fix_screeninfo imacfb_fix __initdata = {
52}; 54};
53 55
54static int inverse; 56static int inverse;
55static int model = M_NEW; 57static int model = M_UNKNOWN;
56static int manual_height; 58static int manual_height;
57static int manual_width; 59static int manual_width;
58 60
61static int set_system(struct dmi_system_id *id)
62{
63 printk(KERN_INFO "imacfb: %s detected - set system to %ld\n",
64 id->ident, (long)id->driver_data);
65
66 model = (long)id->driver_data;
67
68 return 0;
69}
70
71static struct dmi_system_id __initdata dmi_system_table[] = {
72 { set_system, "iMac4,1", {
73 DMI_MATCH(DMI_BIOS_VENDOR,"Apple Computer, Inc."),
74 DMI_MATCH(DMI_BIOS_VERSION,"iMac4,1") }, (void*)M_I17},
75 { set_system, "MacBookPro1,1", {
76 DMI_MATCH(DMI_BIOS_VENDOR,"Apple Computer, Inc."),
77 DMI_MATCH(DMI_BIOS_VERSION,"MacBookPro1,1") }, (void*)M_I17},
78 { set_system, "MacBook1,1", {
79 DMI_MATCH(DMI_BIOS_VENDOR,"Apple Computer, Inc."),
80 DMI_MATCH(DMI_PRODUCT_NAME,"MacBook1,1")}, (void *)M_MACBOOK},
81 { set_system, "Macmini1,1", {
82 DMI_MATCH(DMI_BIOS_VENDOR,"Apple Computer, Inc."),
83 DMI_MATCH(DMI_PRODUCT_NAME,"Macmini1,1")}, (void *)M_MINI},
84 {},
85};
86
59#define DEFAULT_FB_MEM 1024*1024*16 87#define DEFAULT_FB_MEM 1024*1024*16
60 88
61/* --------------------------------------------------------------------- */ 89/* --------------------------------------------------------------------- */
@@ -149,7 +177,6 @@ static int __init imacfb_probe(struct platform_device *dev)
149 screen_info.lfb_linelength = 1472 * 4; 177 screen_info.lfb_linelength = 1472 * 4;
150 screen_info.lfb_base = 0x80010000; 178 screen_info.lfb_base = 0x80010000;
151 break; 179 break;
152 case M_NEW:
153 case M_I20: 180 case M_I20:
154 screen_info.lfb_width = 1680; 181 screen_info.lfb_width = 1680;
155 screen_info.lfb_height = 1050; 182 screen_info.lfb_height = 1050;
@@ -207,6 +234,10 @@ static int __init imacfb_probe(struct platform_device *dev)
207 size_remap = size_total; 234 size_remap = size_total;
208 imacfb_fix.smem_len = size_remap; 235 imacfb_fix.smem_len = size_remap;
209 236
237#ifndef __i386__
238 screen_info.imacpm_seg = 0;
239#endif
240
210 if (!request_mem_region(imacfb_fix.smem_start, size_total, "imacfb")) { 241 if (!request_mem_region(imacfb_fix.smem_start, size_total, "imacfb")) {
211 printk(KERN_WARNING 242 printk(KERN_WARNING
212 "imacfb: cannot reserve video memory at 0x%lx\n", 243 "imacfb: cannot reserve video memory at 0x%lx\n",
@@ -324,8 +355,16 @@ static int __init imacfb_init(void)
324 int ret; 355 int ret;
325 char *option = NULL; 356 char *option = NULL;
326 357
327 /* ignore error return of fb_get_options */ 358 if (!efi_enabled)
328 fb_get_options("imacfb", &option); 359 return -ENODEV;
360 if (!dmi_check_system(dmi_system_table))
361 return -ENODEV;
362 if (model == M_UNKNOWN)
363 return -ENODEV;
364
365 if (fb_get_options("imacfb", &option))
366 return -ENODEV;
367
329 imacfb_setup(option); 368 imacfb_setup(option);
330 ret = platform_driver_register(&imacfb_driver); 369 ret = platform_driver_register(&imacfb_driver);
331 370