summaryrefslogtreecommitdiff
path: root/arch/arm
diff options
context:
space:
mode:
authorKatsunaga Kinoshita <katsu@katsu-ubuntu.(none)>2012-06-28 19:32:40 +0900
committerJustin Waters <justin.waters@timesys.com>2012-07-03 17:15:29 -0400
commitaf19cb297b5d2cd5eab561b6e6e8068799f254f5 (patch)
tree27c2079f991dd5be14a91d9f2cd2d6ca4b2a83f4 /arch/arm
parent7b4dac27a6a0566666aeaed8009c9d9d7a9511e6 (diff)
Add: KPP Kyepad driver
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-mvf/board-twr_vf600.c90
-rw-r--r--arch/arm/plat-mxc/mvf_gpio.c7
2 files changed, 73 insertions, 24 deletions
diff --git a/arch/arm/mach-mvf/board-twr_vf600.c b/arch/arm/mach-mvf/board-twr_vf600.c
index 34a2b403816a..c8c68e72a2ed 100644
--- a/arch/arm/mach-mvf/board-twr_vf600.c
+++ b/arch/arm/mach-mvf/board-twr_vf600.c
@@ -80,32 +80,75 @@
#include "board-twr_vf600.h"
/* GPIO PIN, sort by PORT/BIT */
-#define TWR_VF600_GPIO10 IMX_GPIO_NR(1, 10) //PTA20
-#define TWR_VF600_GPIO20 IMX_GPIO_NR(1, 20) //PTA30
-#define TWR_VF600_GPIO21 IMX_GPIO_NR(1, 21) //PTA31
-#define TWR_VF600_GPIO28 IMX_GPIO_NR(1, 28) //PTB6
-#define TWR_VF600_GPIO29 IMX_GPIO_NR(1, 29) //PTB7
-#define TWR_VF600_GPIO30 IMX_GPIO_NR(1, 30) //PTB8
-#define TWR_VF600_GPIO31 IMX_GPIO_NR(1, 31) //PTB9
-#define TWR_VF600_GPIO32 IMX_GPIO_NR(2, 0) //PTB10
-#define TWR_VF600_GPIO33 IMX_GPIO_NR(2, 1) //PTB11
-#define TWR_VF600_GPIO34 IMX_GPIO_NR(2, 2) //PTB12
-#define TWR_VF600_GPIO38 IMX_GPIO_NR(2, 6) //PTB16
-#define TWR_VF600_GPIO39 IMX_GPIO_NR(2, 7) //PTB17
-#define TWR_VF600_GPIO85 IMX_GPIO_NR(3, 21) //PTD6
-#define TWR_VF600_GPIO92 IMX_GPIO_NR(3, 28) //PTD13
-#define TWR_VF600_GPIO93 IMX_GPIO_NR(3, 29) //PTB23
-#define TWR_VF600_GPIO96 IMX_GPIO_NR(4, 0) //PTB26
-#define TWR_VF600_GPIO98 IMX_GPIO_NR(4, 2) //PTB28
-#define TWR_VF600_GPIO102 IMX_GPIO_NR(4, 6) //PTC29
-#define TWR_VF600_GPIO103 IMX_GPIO_NR(4, 7) //PTC30
-#define TWR_VF600_GPIO104 IMX_GPIO_NR(4, 8) //PTC31
-#define TWR_VF600_GPIO108 IMX_GPIO_NR(4, 12) //PTE3
-#define TWR_VF600_GPIO134 IMX_GPIO_NR(5, 6) //PTA7
-
+#define TWR_VF600_GPIO10 MVF_GPIO_NR(1, 10) //PTA20
+#define TWR_VF600_GPIO20 MVF_GPIO_NR(1, 20) //PTA30
+#define TWR_VF600_GPIO21 MVF_GPIO_NR(1, 21) //PTA31
+#define TWR_VF600_GPIO28 MVF_GPIO_NR(1, 28) //PTB6
+#define TWR_VF600_GPIO29 MVF_GPIO_NR(1, 29) //PTB7
+#define TWR_VF600_GPIO30 MVF_GPIO_NR(1, 30) //PTB8
+#define TWR_VF600_GPIO31 MVF_GPIO_NR(1, 31) //PTB9
+#define TWR_VF600_GPIO32 MVF_GPIO_NR(2, 0) //PTB10
+#define TWR_VF600_GPIO33 MVF_GPIO_NR(2, 1) //PTB11
+#define TWR_VF600_GPIO34 MVF_GPIO_NR(2, 2) //PTB12
+#define TWR_VF600_GPIO38 MVF_GPIO_NR(2, 6) //PTB16
+#define TWR_VF600_GPIO39 MVF_GPIO_NR(2, 7) //PTB17
+#define TWR_VF600_GPIO85 MVF_GPIO_NR(3, 21) //PTD6
+#define TWR_VF600_GPIO92 MVF_GPIO_NR(3, 28) //PTD13
+#define TWR_VF600_GPIO93 MVF_GPIO_NR(3, 29) //PTB23
+#define TWR_VF600_GPIO96 MVF_GPIO_NR(4, 0) //PTB26
+#define TWR_VF600_GPIO98 MVF_GPIO_NR(4, 2) //PTB28
+#define TWR_VF600_GPIO102 MVF_GPIO_NR(4, 6) //PTC29
+#define TWR_VF600_GPIO103 MVF_GPIO_NR(4, 7) //PTC30
+#define TWR_VF600_GPIO104 MVF_GPIO_NR(4, 8) //PTC31
+#define TWR_VF600_GPIO108 MVF_GPIO_NR(4, 12) //PTE3
+#define TWR_VF600_GPIO134 MVF_GPIO_NR(5, 6) //PTA7
+
+#define HOME TWR_VF600_GPIO38
+#define BACK TWR_VF600_GPIO39
+#define MENU TWR_VF600_GPIO29
+#define VOLUP TWR_VF600_GPIO30
+#define VOLDOWN TWR_VF600_GPIO31
void __init early_console_setup(unsigned long base, struct clk *clk);
+#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
+#define GPIO_BUTTON(gpio_num, ev_code, act_low, descr, wake) \
+ { \
+ .gpio = gpio_num, \
+ .type = EV_KEY, \
+ .code = ev_code, \
+ .active_low = act_low, \
+ .desc = "btn " descr, \
+ .wakeup = wake, \
+ }
+static struct gpio_keys_button mvf_buttons[] = {
+ GPIO_BUTTON(HOME, KEY_HOME, 1,"home", 0),
+ GPIO_BUTTON(BACK, KEY_BACK, 1,"back", 0),
+ GPIO_BUTTON(MENU, KEY_MENU, 1,"menu", 0),
+ GPIO_BUTTON(VOLUP, KEY_VOLUMEUP, 1,"volume-up", 0),
+ GPIO_BUTTON(VOLDOWN,KEY_VOLUMEDOWN,1,"volume-down",0),
+};
+/* For Keypad dirver*/
+static struct gpio_keys_platform_data mvf_button_data = {
+ .buttons = mvf_buttons,
+ .nbuttons = ARRAY_SIZE(mvf_buttons),
+};
+static struct platform_device mvf_android_button_device = {
+ .name = "gpio-keys",
+ .id = -1,
+ .num_resources = 0,
+ .dev = {
+ .platform_data = &mvf_button_data,
+ },
+};
+static void __init vf600_add_android_device_buttons(void)
+{
+ platform_device_register(&mvf_android_button_device);
+}
+#else
+static void __init vf600_add_android_device_buttons(void) {}
+#endif
+
#if 0 //FIXME
static const struct imxuart_platform_data mx6_arm2_uart1_data __initconst = {
.flags = IMXUART_HAVE_RTSCTS | IMXUART_USE_DCEDTE | IMXUART_SDMA,
@@ -258,6 +301,7 @@ static void __init twr_vf600_init(void)
mvf_init_fec(fec_data);
platform_device_register(&edma_device);
+ vf600_add_android_device_buttons();
#if 0
diff --git a/arch/arm/plat-mxc/mvf_gpio.c b/arch/arm/plat-mxc/mvf_gpio.c
index 43d32f0b3916..ce57bcf2f352 100644
--- a/arch/arm/plat-mxc/mvf_gpio.c
+++ b/arch/arm/plat-mxc/mvf_gpio.c
@@ -31,6 +31,7 @@
//#define GPIO_DEBUG
+#undef GPIO_DEBUG
#ifdef GPIO_DEBUG
#define GPRT(fmt, args...) printk("DBG:%s[%d]" fmt,__func__,__LINE__,## args)
#else
@@ -176,7 +177,6 @@ static void gpio_mask_irq(struct irq_data *d)
static void gpio_unmask_irq(struct irq_data *d)
{
u32 gpio = irq_to_gpio(d->irq);
- printk("gpio = %d\n",gpio);
_set_gpio_irqenable(&mvf_gpio_ports[gpio / 32], gpio & 0x1f, 1);
}
@@ -226,9 +226,11 @@ static void mvf_gpio_irq_handler(struct mvf_gpio_port *port, u32 irq_stat)
{
u32 gpio_irq_no_base = port->virtual_irq_start;
+ GPRT("irq_stat = %d\n",irq_stat);
while (irq_stat != 0) {
int irqoffset = fls(irq_stat) - 1;
generic_handle_irq(gpio_irq_no_base + irqoffset);
+ GPRT("virq = %d\n",gpio_irq_no_base + irqoffset);
irq_stat &= ~(1 << irqoffset);
}
@@ -240,12 +242,15 @@ static void mvf_gpio_irq_chain_handler(u32 irq, struct irq_desc *desc)
struct mvf_gpio_port *port = irq_get_handler_data(irq);
struct irq_chip *chip = irq_get_chip(irq);
+ GPRT("irq = %d\n",irq);
chained_irq_enter(chip, desc);
irq_stat = __raw_readl((void __iomem *)((u32)(port->pbase) + PORT_ISFR));
mvf_gpio_irq_handler(port, irq_stat);
+ __raw_writel(irq_stat,(void __iomem *)((u32)(port->pbase) + PORT_ISFR));
+
chained_irq_exit(chip, desc);
}