omap24xx: Add n8x0 specific GPIO switch code
[openwrt/svn-archive/archive.git] / target / linux / omap24xx / patches-2.6.36 / 300-nokia-board.patch
index 4bec75ec8b0ada026be907b6b5d40afb4911071a..825d8be0663a300a8d9e9a236d7798200896221d 100644 (file)
@@ -1,13 +1,13 @@
 ---
  arch/arm/mach-omap1/board-nokia770.c |   16 +
- arch/arm/mach-omap2/Kconfig          |   10 +
+ arch/arm/mach-omap2/Kconfig          |   10 
  arch/arm/mach-omap2/Makefile         |    2 
- arch/arm/mach-omap2/board-n8x0-lcd.c |  127 +++++++++++++
- arch/arm/mach-omap2/board-n8x0-usb.c |  175 +++++++++++++++++++
- arch/arm/mach-omap2/board-n8x0.c     |  318 +++++++++++++++++++++++++----------
+ arch/arm/mach-omap2/board-n8x0-lcd.c |  127 ++++++++++++
+ arch/arm/mach-omap2/board-n8x0-usb.c |  175 +++++++++++++++++
+ arch/arm/mach-omap2/board-n8x0.c     |  355 ++++++++++++++++++++++++++---------
  arch/arm/mach-omap2/control.c        |    2 
  arch/arm/mach-omap2/serial.c         |    8 
- 8 files changed, 571 insertions(+), 87 deletions(-)
+ 8 files changed, 608 insertions(+), 87 deletions(-)
 
 --- linux-2.6.36-rc4.orig/arch/arm/mach-omap1/board-nokia770.c
 +++ linux-2.6.36-rc4/arch/arm/mach-omap1/board-nokia770.c
  
  #include <asm/mach/arch.h>
  #include <asm/mach-types.h>
-@@ -32,6 +36,7 @@
+@@ -32,6 +36,8 @@
  #include <plat/onenand.h>
  #include <plat/mmc.h>
  #include <plat/serial.h>
 +#include <plat/cbus.h>
++#include <plat/gpio-switch.h>
  
  #include "mux.h"
  
-@@ -39,109 +44,154 @@ static int slot1_cover_open;
+@@ -39,109 +45,154 @@ static int slot1_cover_open;
  static int slot2_cover_open;
  static struct device *mmc_device;
  
        {
                .modalias       = "p54spi",
                .bus_num        = 2,
-@@ -149,6 +199,68 @@ static struct spi_board_info n800_spi_bo
+@@ -149,6 +200,68 @@ static struct spi_board_info n800_spi_bo
                .max_speed_hz   = 48000000,
                .controller_data = &p54spi_mcspi_config,
        },
  };
  
  #if defined(CONFIG_MTD_ONENAND_OMAP2) || \
-@@ -183,6 +295,20 @@ static struct mtd_partition onenand_part
+@@ -183,6 +296,20 @@ static struct mtd_partition onenand_part
        },
  };
  
  static struct omap_onenand_platform_data board_onenand_data = {
        .cs             = 0,
        .gpio_irq       = 26,
-@@ -659,15 +785,41 @@ static struct omap_board_mux board_mux[]
+@@ -659,15 +786,77 @@ static struct omap_board_mux board_mux[]
  #define board_mux     NULL
  #endif
  
 +#endif
 +
 +extern void n8x0_usb_init(void);
++
++static struct omap_gpio_switch n8x0_gpio_switches[] __initdata = {
++      {
++              .name                   = "headphone",
++              .gpio                   = -1,
++              .debounce_rising        = 200,
++              .debounce_falling       = 200,
++      }, {
++              .name                   = "cam_act",
++              .gpio                   = -1,
++              .debounce_rising        = 200,
++              .debounce_falling       = 200,
++      }, {
++              .name                   = "cam_turn",
++              .gpio                   = -1,
++              .debounce_rising        = 100,
++              .debounce_falling       = 100,
++      }, {
++              .name                   = "slide",
++              .gpio                   = -1,
++              .debounce_rising        = 200,
++              .debounce_falling       = 200,
++      }, {
++              .name                   = "kb_lock",
++              .gpio                   = -1,
++              .debounce_rising        = 200,
++              .debounce_falling       = 200,
++      },
++};
++
++static void __init n8x0_gpio_switches_init(void)
++{
++      /* The switches are actually registered through ATAG mechanism.
++       * This just updates the parameters (thus .gpio is -1) */
++      omap_register_gpio_switches(n8x0_gpio_switches,
++                                  ARRAY_SIZE(n8x0_gpio_switches));
++}
 +
  static void __init n8x0_init_machine(void)
  {
        omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAC);
-+
++      n8x0_gpio_switches_init();
 +      platform_device_register(&n8x0_cbus_device);
-+
 +      n8x0_bt_init();
 +
        /* FIXME: add n810 spi devices */