Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394...
[cascardo/linux.git] / arch / arm / mach-pxa / spitz.c
index ee8d603..3da45d0 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 #include <linux/delay.h>
+#include <linux/gpio_keys.h>
 #include <linux/gpio.h>
 #include <linux/leds.h>
 #include <linux/mtd/physmap.h>
@@ -375,6 +376,43 @@ static struct platform_device spitzkbd_device = {
 };
 
 
+static struct gpio_keys_button spitz_gpio_keys[] = {
+       {
+               .type   = EV_PWR,
+               .code   = KEY_SUSPEND,
+               .gpio   = SPITZ_GPIO_ON_KEY,
+               .desc   = "On/Off",
+               .wakeup = 1,
+       },
+       /* Two buttons detecting the lid state */
+       {
+               .type   = EV_SW,
+               .code   = 0,
+               .gpio   = SPITZ_GPIO_SWA,
+               .desc   = "Display Down",
+       },
+       {
+               .type   = EV_SW,
+               .code   = 1,
+               .gpio   = SPITZ_GPIO_SWB,
+               .desc   = "Lid Closed",
+       },
+};
+
+static struct gpio_keys_platform_data spitz_gpio_keys_platform_data = {
+       .buttons        = spitz_gpio_keys,
+       .nbuttons       = ARRAY_SIZE(spitz_gpio_keys),
+};
+
+static struct platform_device spitz_gpio_keys_device = {
+       .name   = "gpio-keys",
+       .id     = -1,
+       .dev    = {
+               .platform_data  = &spitz_gpio_keys_platform_data,
+       },
+};
+
+
 /*
  * Spitz LEDs
  */
@@ -689,6 +727,7 @@ static struct platform_device sharpsl_rom_device = {
 static struct platform_device *devices[] __initdata = {
        &spitzscoop_device,
        &spitzkbd_device,
+       &spitz_gpio_keys_device,
        &spitzled_device,
        &sharpsl_nand_device,
        &sharpsl_rom_device,
@@ -740,11 +779,34 @@ static void __init common_init(void)
        pxa_set_i2c_info(NULL);
 }
 
+#if defined(CONFIG_MACH_AKITA) || defined(CONFIG_MACH_BORZOI)
+static struct nand_bbt_descr sharpsl_akita_bbt = {
+       .options = 0,
+       .offs = 4,
+       .len = 1,
+       .pattern = scan_ff_pattern
+};
+
+static struct nand_ecclayout akita_oobinfo = {
+       .eccbytes = 24,
+       .eccpos = {
+                  0x5, 0x1, 0x2, 0x3, 0x6, 0x7, 0x15, 0x11,
+                  0x12, 0x13, 0x16, 0x17, 0x25, 0x21, 0x22, 0x23,
+                  0x26, 0x27, 0x35, 0x31, 0x32, 0x33, 0x36, 0x37},
+       .oobfree = {{0x08, 0x09}}
+};
+#endif
+
 #if defined(CONFIG_MACH_SPITZ) || defined(CONFIG_MACH_BORZOI)
 static void __init spitz_init(void)
 {
        spitz_ficp_platform_data.gpio_pwdown = SPITZ_GPIO_IR_ON;
 
+       if (machine_is_borzoi()) {
+               sharpsl_nand_platform_data.badblock_pattern = &sharpsl_akita_bbt;
+               sharpsl_nand_platform_data.ecc_layout = &akita_oobinfo;
+       }
+
        platform_scoop_config = &spitz_pcmcia_config;
 
        common_init();
@@ -769,22 +831,6 @@ static struct i2c_board_info akita_i2c_board_info[] = {
        },
 };
 
-static struct nand_bbt_descr sharpsl_akita_bbt = {
-       .options = 0,
-       .offs = 4,
-       .len = 1,
-       .pattern = scan_ff_pattern
-};
-
-static struct nand_ecclayout akita_oobinfo = {
-       .eccbytes = 24,
-       .eccpos = {
-                  0x5, 0x1, 0x2, 0x3, 0x6, 0x7, 0x15, 0x11,
-                  0x12, 0x13, 0x16, 0x17, 0x25, 0x21, 0x22, 0x23,
-                  0x26, 0x27, 0x35, 0x31, 0x32, 0x33, 0x36, 0x37},
-       .oobfree = {{0x08, 0x09}}
-};
-
 static void __init akita_init(void)
 {
        spitz_ficp_platform_data.gpio_pwdown = AKITA_GPIO_IR_ON;