omap24xx: Export certain n8x0 GPIO switches as input device
authormb <mb@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Sun, 26 Sep 2010 12:50:53 +0000 (12:50 +0000)
committermb <mb@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Sun, 26 Sep 2010 12:50:53 +0000 (12:50 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@23120 3c298f89-4303-0410-b956-a3cf2f4a3e73

target/linux/omap24xx/patches-2.6.36/310-n8x0-gpioswitch-input.patch [new file with mode: 0644]
target/linux/omap24xx/patches-2.6.36/900-n810-battery-management.patch

diff --git a/target/linux/omap24xx/patches-2.6.36/310-n8x0-gpioswitch-input.patch b/target/linux/omap24xx/patches-2.6.36/310-n8x0-gpioswitch-input.patch
new file mode 100644 (file)
index 0000000..474829a
--- /dev/null
@@ -0,0 +1,98 @@
+---
+ arch/arm/mach-omap2/board-n8x0.c |   73 +++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 73 insertions(+)
+
+--- linux-2.6.36-rc5.orig/arch/arm/mach-omap2/board-n8x0.c
++++ linux-2.6.36-rc5/arch/arm/mach-omap2/board-n8x0.c
+@@ -796,6 +796,77 @@ extern void n8x0_blizzard_init(void);
+ extern void n8x0_usb_init(void);
++struct gpio_switch_input_dev {
++      struct input_dev *idev;
++      unsigned int swcode;
++};
++
++static struct gpio_switch_input_dev *slide_input;
++static struct gpio_switch_input_dev *kblock_input;
++
++static void n8x0_gpio_switch_input_notify(struct gpio_switch_input_dev *gdev,
++                                        int state)
++{
++      if (gdev) {
++              input_report_switch(gdev->idev, gdev->swcode, state);
++              input_sync(gdev->idev);
++      }
++}
++
++static void n8x0_slide_notify(void *data, int state)
++{
++      n8x0_gpio_switch_input_notify(slide_input, state);
++}
++
++static void n8x0_kb_lock_notify(void *data, int state)
++{
++      n8x0_gpio_switch_input_notify(kblock_input, state);
++}
++
++static struct gpio_switch_input_dev * __init gpioswitch_input_init(
++                      const char *name,
++                      unsigned int swcode)
++{
++      struct gpio_switch_input_dev *gdev;
++      int err;
++
++      gdev = kzalloc(sizeof(*gdev), GFP_KERNEL);
++      if (!gdev)
++              goto error;
++      gdev->swcode = swcode;
++
++      gdev->idev = input_allocate_device();
++      if (!gdev->idev)
++              goto err_free;
++
++      gdev->idev->evbit[0] = BIT_MASK(EV_SW);
++      gdev->idev->swbit[BIT_WORD(swcode)] = BIT_MASK(swcode);
++      gdev->idev->name = name;
++
++      err = input_register_device(gdev->idev);
++      if (err)
++              goto err_free_idev;
++
++      return gdev;
++
++err_free_idev:
++      input_free_device(gdev->idev);
++err_free:
++      kfree(gdev);
++error:
++      return NULL;
++}
++
++static int __init n8x0_gpio_switches_input_init(void)
++{
++      slide_input = gpioswitch_input_init("slide", SW_KEYPAD_SLIDE);
++      kblock_input = gpioswitch_input_init("kb_lock", SW_LID);
++      if (WARN_ON(!slide_input || !kblock_input))
++              return -ENODEV;
++      return 0;
++}
++late_initcall(n8x0_gpio_switches_input_init);
++
+ static struct omap_gpio_switch n8x0_gpio_switches[] __initdata = {
+       {
+               .name                   = "headphone",
+@@ -817,11 +888,13 @@ static struct omap_gpio_switch n8x0_gpio
+               .gpio                   = -1,
+               .debounce_rising        = 200,
+               .debounce_falling       = 200,
++              .notify                 = n8x0_slide_notify,
+       }, {
+               .name                   = "kb_lock",
+               .gpio                   = -1,
+               .debounce_rising        = 200,
+               .debounce_falling       = 200,
++              .notify                 = n8x0_kb_lock_notify,
+       },
+ };
index c3507fb..f3b8edb 100644 (file)
@@ -7,8 +7,8 @@
  drivers/cbus/retu.h              |    2 
  6 files changed, 425 insertions(+), 3 deletions(-)
 
---- linux-2.6.36-rc4.orig/drivers/cbus/Kconfig
-+++ linux-2.6.36-rc4/drivers/cbus/Kconfig
+--- linux-2.6.36-rc5.orig/drivers/cbus/Kconfig
++++ linux-2.6.36-rc5/drivers/cbus/Kconfig
 @@ -94,4 +94,16 @@ config CBUS_RETU_HEADSET
          to Retu/Vilma. Detection state and events are exposed through
          sysfs.
 +        If unsure, say N.
 +
  endmenu
---- linux-2.6.36-rc4.orig/drivers/cbus/Makefile
-+++ linux-2.6.36-rc4/drivers/cbus/Makefile
+--- linux-2.6.36-rc5.orig/drivers/cbus/Makefile
++++ linux-2.6.36-rc5/drivers/cbus/Makefile
 @@ -12,3 +12,4 @@ obj-$(CONFIG_CBUS_RETU_WDT)  += retu-wdt.
  obj-$(CONFIG_CBUS_TAHVO_USER) += tahvo-user.o
  obj-$(CONFIG_CBUS_RETU_USER)  += retu-user.o
  obj-$(CONFIG_CBUS_RETU_HEADSET)       += retu-headset.o
 +obj-$(CONFIG_N810BM)          += n810bm.o
 --- /dev/null
-+++ linux-2.6.36-rc4/drivers/cbus/n810bm.c
++++ linux-2.6.36-rc5/drivers/cbus/n810bm.c
 @@ -0,0 +1,396 @@
 +/*
 + *   Nokia n810 battery management
 +MODULE_DESCRIPTION("Nokia n810 battery management");
 +MODULE_LICENSE("GPL");
 +MODULE_AUTHOR("Michael Buesch");
---- linux-2.6.36-rc4.orig/drivers/cbus/retu.c
-+++ linux-2.6.36-rc4/drivers/cbus/retu.c
+--- linux-2.6.36-rc5.orig/drivers/cbus/retu.c
++++ linux-2.6.36-rc5/drivers/cbus/retu.c
 @@ -85,10 +85,10 @@ int retu_read_reg(int reg)
   *
   * This function writes a value to the specified register
  }
  
  void retu_set_clear_reg_bits(int reg, u16 set, u16 clear)
---- linux-2.6.36-rc4.orig/drivers/cbus/retu.h
-+++ linux-2.6.36-rc4/drivers/cbus/retu.h
+--- linux-2.6.36-rc5.orig/drivers/cbus/retu.h
++++ linux-2.6.36-rc5/drivers/cbus/retu.h
 @@ -58,7 +58,7 @@
  #define       MAX_RETU_IRQ_HANDLERS   16
  
  void retu_set_clear_reg_bits(int reg, u16 set, u16 clear);
  int retu_read_adc(int channel);
  int retu_request_irq(int id, void *irq_handler, unsigned long arg, char *name);
---- linux-2.6.36-rc4.orig/arch/arm/mach-omap2/board-n8x0.c
-+++ linux-2.6.36-rc4/arch/arm/mach-omap2/board-n8x0.c
-@@ -833,6 +833,17 @@ static void __init n8x0_gpio_switches_in
+--- linux-2.6.36-rc5.orig/arch/arm/mach-omap2/board-n8x0.c
++++ linux-2.6.36-rc5/arch/arm/mach-omap2/board-n8x0.c
+@@ -906,6 +906,17 @@ static void __init n8x0_gpio_switches_in
                                    ARRAY_SIZE(n8x0_gpio_switches));
  }
  
  static void __init n8x0_init_machine(void)
  {
        omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAC);
-@@ -860,6 +871,8 @@ static void __init n8x0_init_machine(voi
+@@ -933,6 +944,8 @@ static void __init n8x0_init_machine(voi
        n8x0_onenand_init();
        n8x0_mmc_init();
        n8x0_usb_init();
This page took 0.029296 seconds and 4 git commands to generate.