[PATCH omapzoom tree] Fix keypad for LDP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Vikram,

This patch fixes the keypad for LDP on the OMAPZOOM tree.

- Adds dependency on MACH_LDP for TWL4030 KEYPAD menuconfig option.
- Adds correct keypad IRQ to LDP board file.
- Adds the struct omap_keypad to GPIO part of the T2 keypad driver.

Regards,
dom


Signed-off-by: Dominic Curran <dcurran@xxxxxx>
---
 arch/arm/mach-omap2/board-ldp.c                    |    1 +
 drivers/input/keyboard/Kconfig                     |    2 +-
 drivers/input/keyboard/omap-twl4030keypad.c        |   25 ++++++++++++--------
 3 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index 175668e..58f56a2 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -286,6 +286,7 @@ static struct omap_kp_platform_data ldp_kp_data = {
        .keymap         = ldp_twl4030_keymap,
        .keymapsize     = ARRAY_SIZE(ldp_twl4030_keymap),
        .rep            = 1,
+       .irq            = TWL4030_MODIRQ_KEYPAD,
        /* Use row_gpios as a way to pass the OMAP GPIO keymap pointer */
        .row_gpios      = ldp_omap_gpio_keymap,
 };
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index e4d0436..c8abf13 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -261,7 +261,7 @@ config KEYBOARD_OMAP

 config KEYBOARD_TWL4030
        tristate "TI TWL4030 keypad support"
-       depends on TWL4030_CORE && (MACH_OMAP_2430SDP || MACH_OMAP2EVM || MACH_OMAP_3430SDP || MACH_OMAP3EVM)
+       depends on TWL4030_CORE && (MACH_OMAP_2430SDP || MACH_OMAP2EVM || MACH_OMAP_3430SDP || MACH_OMAP3EVM || MACH_OMAP_LDP)
        help
          Say Y here if you want to use the OMAP TWL4030 keypad.

diff --git a/drivers/input/keyboard/omap-twl4030keypad.c b/drivers/input/keyboard/omap-twl4030keypad.c
index 1ca2987..87ee1dd 100644
--- a/drivers/input/keyboard/omap-twl4030keypad.c
+++ b/drivers/input/keyboard/omap-twl4030keypad.c
@@ -38,6 +38,7 @@
 #include <linux/i2c.h>
 #include <linux/i2c/twl4030.h>
 #include <linux/irq.h>
+#include <mach/gpio.h>
 #include <mach/keypad.h>
 #include "twl4030-keypad.h"

@@ -241,7 +242,7 @@ static irqreturn_t do_kp_irq(int irq, void *_kp)
 }

 #ifdef CONFIG_MACH_OMAP_LDP
-static void omap_gpio_kp_scan(void)
+static void omap_gpio_kp_scan(struct omap_keypad *kp)
 {
        unsigned int new_gpio;
        int idx = 0, chg = 0, key, state;
@@ -254,7 +255,7 @@ static void omap_gpio_kp_scan(void)
                if (chg) {
                        key = GET_KEY(omap_gpios[idx]);
                        state = (new_gpio == 0);
-                       input_report_key(omap_twl4030kp, key, state);
+                       input_report_key(kp->omap_twl4030kp, key, state);
                }

                if (!new_gpio)
@@ -281,10 +282,12 @@ static void omap_gpio_kp_scan(void)
 /*
  * Keypad interrupt handler for OMAP GPIO's.
  */
-static irqreturn_t do_kp_gpio_irq(int irq, void *dev_id)
+static irqreturn_t do_kp_gpio_irq(int irq, void *_kp)
 {
+       struct omap_keypad *kp = _kp;
+
        /* Scan keypad for any changes in GPIO keys. */
-       omap_gpio_kp_scan();
+       omap_gpio_kp_scan(kp);

        return IRQ_HANDLED;
 }
@@ -292,10 +295,12 @@ static irqreturn_t do_kp_gpio_irq(int irq, void *dev_id)

 static void omap_gpio_kp_timer(unsigned long arg)
 {
-       omap_gpio_kp_scan();
+       struct omap_keypad *kp = (struct omap_keypad*)arg;
+       omap_gpio_kp_scan(kp);
 }

-static int omap_gpio_kp_probe(unsigned int *gpio_keymap)
+static int
+omap_gpio_kp_probe(struct omap_keypad *kp, unsigned int *gpio_keymap)
 {
        int i, idx = 0, irq_idx = 0;

@@ -321,18 +326,18 @@ static int omap_gpio_kp_probe(unsigned int *gpio_keymap)
        while (omap_gpios[irq_idx] != 0) {
                if (request_irq(OMAP_GPIO_IRQ(GET_GPIO(omap_gpios[irq_idx])),
                                do_kp_gpio_irq, IRQF_TRIGGER_FALLING,
-                               "omap-keypad", NULL) < 0)
+                               "omap-keypad", kp) < 0)
                        goto err2;
                irq_idx++;
        }

        /* Initialize GPIO timer */
        gpio_timer.function = omap_gpio_kp_timer;
-       gpio_timer.data     = (unsigned long)NULL;
+       gpio_timer.data     = (unsigned long)kp;
        init_timer(&gpio_timer);

        /* scan current key state */
-       omap_gpio_kp_scan();
+       omap_gpio_kp_scan(kp);

        return 0;

@@ -503,7 +508,7 @@ static int __init omap_kp_probe(struct platform_device *pdev)
                goto err4;

 #ifdef CONFIG_MACH_OMAP_LDP
-       omap_gpio_kp_probe(pdata->row_gpios);
+       omap_gpio_kp_probe(kp, pdata->row_gpios);
 #endif

        return ret;
--
1.5.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux