diff options
| author | Peter Jones <pjones@redhat.com> | 2008-10-16 01:03:43 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-16 14:21:44 -0400 |
| commit | 7c08c9ae0c145807c0dae4a55f240fa3d4fd5262 (patch) | |
| tree | 63e2edd3731e0293b4190a82391e2d3f27e61983 | |
| parent | f928ac0a9810d46c8ba3bde7c969984340da9f5d (diff) | |
efifb/imacfb consolidation + hardware support
Remove imacfb entirely, merging its DMI table into the (otherwise very
similar) efifb driver. This also adds hardware support for many of the
newer Intel Apple hardware. This has been fairly well tested; we've been
shipping it in Fedora for some time.
Signed-off-by: Peter Jones <pjones@redhat.com>
Cc: Krzysztof Helt <krzysztof.h1@poczta.fm>
Cc: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Cc: Jaya Kumar <jayakumar.lkml@gmail.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Maciej W. Rozycki <macro@linux-mips.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| -rw-r--r-- | drivers/video/Kconfig | 15 | ||||
| -rw-r--r-- | drivers/video/Makefile | 1 | ||||
| -rw-r--r-- | drivers/video/efifb.c | 191 | ||||
| -rw-r--r-- | drivers/video/imacfb.c | 376 |
4 files changed, 184 insertions, 399 deletions
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index e63e5648e0a6..3b296e410f91 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
| @@ -689,23 +689,14 @@ config FB_VESA | |||
| 689 | 689 | ||
| 690 | config FB_EFI | 690 | config FB_EFI |
| 691 | bool "EFI-based Framebuffer Support" | 691 | bool "EFI-based Framebuffer Support" |
| 692 | depends on (FB = y) && X86 | ||
| 693 | select FB_CFB_FILLRECT | ||
| 694 | select FB_CFB_COPYAREA | ||
| 695 | select FB_CFB_IMAGEBLIT | ||
| 696 | help | ||
| 697 | This is the EFI frame buffer device driver. If the firmware on | ||
| 698 | your platform is UEFI2.0, select Y to add support for | ||
| 699 | Graphics Output Protocol for early console messages to appear. | ||
| 700 | |||
| 701 | config FB_IMAC | ||
| 702 | bool "Intel-based Macintosh Framebuffer Support" | ||
| 703 | depends on (FB = y) && X86 && EFI | 692 | depends on (FB = y) && X86 && EFI |
| 704 | select FB_CFB_FILLRECT | 693 | select FB_CFB_FILLRECT |
| 705 | select FB_CFB_COPYAREA | 694 | select FB_CFB_COPYAREA |
| 706 | select FB_CFB_IMAGEBLIT | 695 | select FB_CFB_IMAGEBLIT |
| 707 | help | 696 | help |
| 708 | This is the frame buffer device driver for the Intel-based Macintosh | 697 | This is the EFI frame buffer device driver. If the firmware on |
| 698 | your platform is EFI 1.10 or UEFI 2.0, select Y to add support for | ||
| 699 | using the EFI framebuffer as your console. | ||
| 709 | 700 | ||
| 710 | config FB_N411 | 701 | config FB_N411 |
| 711 | tristate "N411 Apollo/Hecuba devkit support" | 702 | tristate "N411 Apollo/Hecuba devkit support" |
diff --git a/drivers/video/Makefile b/drivers/video/Makefile index dcae8d402fb2..2bc94d8eb3c8 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile | |||
| @@ -125,7 +125,6 @@ obj-$(CONFIG_FB_CARMINE) += carminefb.o | |||
| 125 | # Platform or fallback drivers go here | 125 | # Platform or fallback drivers go here |
| 126 | obj-$(CONFIG_FB_UVESA) += uvesafb.o | 126 | obj-$(CONFIG_FB_UVESA) += uvesafb.o |
| 127 | obj-$(CONFIG_FB_VESA) += vesafb.o | 127 | obj-$(CONFIG_FB_VESA) += vesafb.o |
| 128 | obj-$(CONFIG_FB_IMAC) += imacfb.o | ||
| 129 | obj-$(CONFIG_FB_EFI) += efifb.o | 128 | obj-$(CONFIG_FB_EFI) += efifb.o |
| 130 | obj-$(CONFIG_FB_VGA16) += vga16fb.o | 129 | obj-$(CONFIG_FB_VGA16) += vga16fb.o |
| 131 | obj-$(CONFIG_FB_OF) += offb.o | 130 | obj-$(CONFIG_FB_OF) += offb.o |
diff --git a/drivers/video/efifb.c b/drivers/video/efifb.c index bd779ae44b1e..daf9b81878a4 100644 --- a/drivers/video/efifb.c +++ b/drivers/video/efifb.c | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include <linux/fb.h> | 12 | #include <linux/fb.h> |
| 13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
| 14 | #include <linux/screen_info.h> | 14 | #include <linux/screen_info.h> |
| 15 | #include <linux/dmi.h> | ||
| 15 | 16 | ||
| 16 | #include <video/vga.h> | 17 | #include <video/vga.h> |
| 17 | 18 | ||
| @@ -33,6 +34,105 @@ static struct fb_fix_screeninfo efifb_fix __initdata = { | |||
| 33 | .visual = FB_VISUAL_TRUECOLOR, | 34 | .visual = FB_VISUAL_TRUECOLOR, |
| 34 | }; | 35 | }; |
| 35 | 36 | ||
| 37 | enum { | ||
| 38 | M_I17, /* 17-Inch iMac */ | ||
| 39 | M_I20, /* 20-Inch iMac */ | ||
| 40 | M_I20_SR, /* 20-Inch iMac (Santa Rosa) */ | ||
| 41 | M_I24, /* 24-Inch iMac */ | ||
| 42 | M_MINI, /* Mac Mini */ | ||
| 43 | M_MB, /* MacBook */ | ||
| 44 | M_MB_2, /* MacBook, 2nd rev. */ | ||
| 45 | M_MB_3, /* MacBook, 3rd rev. */ | ||
| 46 | M_MB_SR, /* MacBook, 2nd gen, (Santa Rosa) */ | ||
| 47 | M_MBA, /* MacBook Air */ | ||
| 48 | M_MBP, /* MacBook Pro */ | ||
| 49 | M_MBP_2, /* MacBook Pro 2nd gen */ | ||
| 50 | M_MBP_SR, /* MacBook Pro (Santa Rosa) */ | ||
| 51 | M_MBP_4, /* MacBook Pro, 4th gen */ | ||
| 52 | M_UNKNOWN /* placeholder */ | ||
| 53 | }; | ||
| 54 | |||
| 55 | static struct efifb_dmi_info { | ||
| 56 | char *optname; | ||
| 57 | unsigned long base; | ||
| 58 | int stride; | ||
| 59 | int width; | ||
| 60 | int height; | ||
| 61 | } dmi_list[] = { | ||
| 62 | [M_I17] = { "i17", 0x80010000, 1472 * 4, 1440, 900 }, | ||
| 63 | [M_I20] = { "i20", 0x80010000, 1728 * 4, 1680, 1050 }, /* guess */ | ||
| 64 | [M_I20_SR] = { "imac7", 0x40010000, 1728 * 4, 1680, 1050 }, | ||
| 65 | [M_I24] = { "i24", 0x80010000, 2048 * 4, 1920, 1200 }, /* guess */ | ||
| 66 | [M_MINI]= { "mini", 0x80000000, 2048 * 4, 1024, 768 }, | ||
| 67 | [M_MB] = { "macbook", 0x80000000, 2048 * 4, 1280, 800 }, | ||
| 68 | [M_MBA] = { "mba", 0x80000000, 2048 * 4, 1280, 800 }, | ||
| 69 | [M_MBP] = { "mbp", 0x80010000, 1472 * 4, 1440, 900 }, | ||
| 70 | [M_MBP_2] = { "mbp2", 0, 0, 0, 0 }, /* placeholder */ | ||
| 71 | [M_MBP_SR] = { "mbp3", 0x80030000, 2048 * 4, 1440, 900 }, | ||
| 72 | [M_MBP_4] = { "mbp4", 0xc0060000, 2048 * 4, 1920, 1200 }, | ||
| 73 | [M_UNKNOWN] = { NULL, 0, 0, 0, 0 } | ||
| 74 | }; | ||
| 75 | |||
| 76 | static int set_system(const struct dmi_system_id *id); | ||
| 77 | |||
| 78 | #define EFIFB_DMI_SYSTEM_ID(vendor, name, enumid) \ | ||
| 79 | { set_system, name, { \ | ||
| 80 | DMI_MATCH(DMI_BIOS_VENDOR, vendor), \ | ||
| 81 | DMI_MATCH(DMI_PRODUCT_NAME, name) }, \ | ||
| 82 | &dmi_list[enumid] } | ||
| 83 | |||
| 84 | static struct dmi_system_id __initdata dmi_system_table[] = { | ||
| 85 | EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "iMac4,1", M_I17), | ||
| 86 | /* At least one of these two will be right; maybe both? */ | ||
| 87 | EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "iMac5,1", M_I20), | ||
| 88 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "iMac5,1", M_I20), | ||
| 89 | /* At least one of these two will be right; maybe both? */ | ||
| 90 | EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "iMac6,1", M_I24), | ||
| 91 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "iMac6,1", M_I24), | ||
| 92 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "iMac7,1", M_I20_SR), | ||
| 93 | EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "Macmini1,1", M_MINI), | ||
| 94 | EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBook1,1", M_MB), | ||
| 95 | /* At least one of these two will be right; maybe both? */ | ||
| 96 | EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBook2,1", M_MB), | ||
| 97 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBook2,1", M_MB), | ||
| 98 | /* At least one of these two will be right; maybe both? */ | ||
| 99 | EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBook3,1", M_MB), | ||
| 100 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBook3,1", M_MB), | ||
| 101 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBook4,1", M_MB), | ||
| 102 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookAir1,1", M_MBA), | ||
| 103 | EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBookPro1,1", M_MBP), | ||
| 104 | EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBookPro2,1", M_MBP_2), | ||
| 105 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro2,1", M_MBP_2), | ||
| 106 | EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBookPro3,1", M_MBP_SR), | ||
| 107 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro3,1", M_MBP_SR), | ||
| 108 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro4,1", M_MBP_4), | ||
| 109 | {}, | ||
| 110 | }; | ||
| 111 | |||
| 112 | static int set_system(const struct dmi_system_id *id) | ||
| 113 | { | ||
| 114 | struct efifb_dmi_info *info = id->driver_data; | ||
| 115 | if (info->base == 0) | ||
| 116 | return -ENODEV; | ||
| 117 | |||
| 118 | printk(KERN_INFO "efifb: dmi detected %s - framebuffer at %p " | ||
| 119 | "(%dx%d, stride %d)\n", id->ident, | ||
| 120 | (void *)info->base, info->width, info->height, | ||
| 121 | info->stride); | ||
| 122 | |||
| 123 | /* Trust the bootloader over the DMI tables */ | ||
| 124 | if (screen_info.lfb_base == 0) | ||
| 125 | screen_info.lfb_base = info->base; | ||
| 126 | if (screen_info.lfb_linelength == 0) | ||
| 127 | screen_info.lfb_linelength = info->stride; | ||
| 128 | if (screen_info.lfb_width == 0) | ||
| 129 | screen_info.lfb_width = info->width; | ||
| 130 | if (screen_info.lfb_height == 0) | ||
| 131 | screen_info.lfb_height = info->height; | ||
| 132 | |||
| 133 | return 0; | ||
| 134 | } | ||
| 135 | |||
| 36 | static int efifb_setcolreg(unsigned regno, unsigned red, unsigned green, | 136 | static int efifb_setcolreg(unsigned regno, unsigned red, unsigned green, |
| 37 | unsigned blue, unsigned transp, | 137 | unsigned blue, unsigned transp, |
| 38 | struct fb_info *info) | 138 | struct fb_info *info) |
| @@ -67,6 +167,38 @@ static struct fb_ops efifb_ops = { | |||
| 67 | .fb_imageblit = cfb_imageblit, | 167 | .fb_imageblit = cfb_imageblit, |
| 68 | }; | 168 | }; |
| 69 | 169 | ||
| 170 | static int __init efifb_setup(char *options) | ||
| 171 | { | ||
| 172 | char *this_opt; | ||
| 173 | int i; | ||
| 174 | |||
| 175 | if (!options || !*options) | ||
| 176 | return 0; | ||
| 177 | |||
| 178 | while ((this_opt = strsep(&options, ",")) != NULL) { | ||
| 179 | if (!*this_opt) continue; | ||
| 180 | |||
| 181 | for (i = 0; i < M_UNKNOWN; i++) { | ||
| 182 | if (!strcmp(this_opt, dmi_list[i].optname) && | ||
| 183 | dmi_list[i].base != 0) { | ||
| 184 | screen_info.lfb_base = dmi_list[i].base; | ||
| 185 | screen_info.lfb_linelength = dmi_list[i].stride; | ||
| 186 | screen_info.lfb_width = dmi_list[i].width; | ||
| 187 | screen_info.lfb_height = dmi_li | ||
