1 index dc5f1d3..a24bf8c 100644
2 --- a/arch/x86/platform/geode/alix.c
3 +++ b/arch/x86/platform/geode/alix.c
6 * Copyright (C) 2008 Constantin Baranov <const@mimas.ru>
7 * Copyright (C) 2011 Ed Wildgoose <kernel@wildgooses.com>
8 + * and Philip Prindeville <philipp@redfish-solutions.com>
10 * TODO: There are large similarities with leds-net5501.c
11 * by Alessandro Zummo <a.zummo@towertech.it>
13 #include <linux/leds.h>
14 #include <linux/platform_device.h>
15 #include <linux/gpio.h>
16 +#include <linux/input.h>
17 +#include <linux/gpio_keys.h>
18 +#include <linux/dmi.h>
20 #include <asm/geode.h>
22 -static int force = 0;
23 +#define BIOS_SIGNATURE_TINYBIOS 0xf0000
24 +#define BIOS_SIGNATURE_COREBOOT 0x500
25 +#define BIOS_REGION_SIZE 0x10000
27 +static bool force = 0;
28 module_param(force, bool, 0444);
29 /* FIXME: Award bios is not automatically detected as Alix platform */
30 MODULE_PARM_DESC(force, "Force detection as ALIX.2/ALIX.3 platform");
32 +static struct gpio_keys_button alix_gpio_buttons[] = {
34 + .code = KEY_RESTART,
37 + .desc = "Reset button",
40 + .debounce_interval = 100,
44 +static struct gpio_keys_platform_data alix_buttons_data = {
45 + .buttons = alix_gpio_buttons,
46 + .nbuttons = ARRAY_SIZE(alix_gpio_buttons),
47 + .poll_interval = 20,
50 +static struct platform_device alix_buttons_dev = {
51 + .name = "gpio-keys-polled",
54 + .platform_data = &alix_buttons_data,
58 static struct gpio_led alix_leds[] = {
61 @@ -64,17 +98,22 @@ static struct platform_device alix_leds_
62 .dev.platform_data = &alix_leds_data,
65 +static struct __initdata platform_device *alix_devs[] = {
70 static void __init register_alix(void)
72 /* Setup LED control through leds-gpio driver */
73 - platform_device_register(&alix_leds_dev);
74 + platform_add_devices(alix_devs, ARRAY_SIZE(alix_devs));
77 static int __init alix_present(unsigned long bios_phys,
81 - const size_t bios_len = 0x00010000;
82 + const size_t bios_len = BIOS_REGION_SIZE;
83 const char *bios_virt;
86 @@ -109,7 +148,8 @@ static int __init alix_present(unsigned
89 tail = p + alix_sig_len;
90 - if ((tail[0] == '2' || tail[0] == '3')) {
91 + if ((tail[0] == '2' || tail[0] == '3' || tail[0] == '6')) {
94 "%s: system is recognized as \"%s\"\n",
95 KBUILD_MODNAME, name);
96 @@ -120,6 +160,24 @@ static int __init alix_present(unsigned
100 +static bool __init alix_present_dmi(void)
102 + const char *vendor, *product;
104 + vendor = dmi_get_system_info(DMI_SYS_VENDOR);
105 + if (!vendor || strcmp(vendor, "PC Engines"))
108 + product = dmi_get_system_info(DMI_PRODUCT_NAME);
109 + if (!product || (strcmp(product, "ALIX.2D") && strcmp(product, "ALIX.6")))
112 + printk(KERN_INFO "%s: system is recognized as \"%s %s\"\n",
113 + KBUILD_MODNAME, vendor, product);
118 static int __init alix_init(void)
120 const char tinybios_sig[] = "PC Engines ALIX.";
121 @@ -128,8 +186,9 @@ static int __init alix_init(void)
125 - if (alix_present(0xf0000, tinybios_sig, sizeof(tinybios_sig) - 1) ||
126 - alix_present(0x500, coreboot_sig, sizeof(coreboot_sig) - 1))
127 + if (alix_present(BIOS_SIGNATURE_TINYBIOS, tinybios_sig, sizeof(tinybios_sig) - 1) ||
128 + alix_present(BIOS_SIGNATURE_COREBOOT, coreboot_sig, sizeof(coreboot_sig) - 1) ||
129 + alix_present_dmi())