Skip to contentSkip to conversation

OMAP3 EVM: Add twl4030 keypad driver support

PATCH In review Miguel Angel Aguilar Ulloa 3 participants 6 messages Jun 23, 2008 – Jun 26, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 OMAP3 EVM: Add twl4030 keypad driver support

Add twl4030 keypad driver support to OMAP3 EVM

arch/arm/mach-omap2/board-omap3evm.c +0 -0
@@ -19,6 +19,7 @@

#include <linux/err.h>
#include <linux/clk.h>
#include <linux/io.h>
+#include <linux/input.h>
#include <linux/spi/spi.h>
#include <linux/spi/ads7846.h>

@@ -28,6 +29,7 @@
#include <asm/mach/map.h>

#include <asm/arch/gpio.h>
+#include <asm/arch/keypad.h>
#include <asm/arch/board.h>
#include <asm/arch/hsmmc.h>
#include <asm/arch/usb-musb.h>
@@ -149,6 +151,56 @@ struct spi_board_info omap3evm_spi_board

	},
};

+static int omap3evm_keymap[] = {
+ KEY(0, 0, KEY_LEFT),
+ KEY(0, 1, KEY_RIGHT),
+ KEY(0, 2, KEY_A),
+ KEY(0, 3, KEY_B),
+ KEY(0, 4, KEY_C),
+ KEY(1, 0, KEY_DOWN),
+ KEY(1, 1, KEY_UP),
+ KEY(1, 2, KEY_E),
+ KEY(1, 3, KEY_F),
+ KEY(1, 4, KEY_G),
+ KEY(2, 0, KEY_ENTER),
+ KEY(2, 1, KEY_I),
+ KEY(2, 2, KEY_J),
+ KEY(2, 3, KEY_K),
+ KEY(2, 4, KEY_3),
+ KEY(3, 0, KEY_M),
+ KEY(3, 1, KEY_N),
+ KEY(3, 2, KEY_O),
+ KEY(3, 3, KEY_P),
+ KEY(3, 4, KEY_Q),
+ KEY(4, 0, KEY_R),
+ KEY(4, 1, KEY_4),
+ KEY(4, 2, KEY_T),
+ KEY(4, 3, KEY_U),
+ KEY(4, 4, KEY_D),
+ KEY(5, 0, KEY_V),
+ KEY(5, 1, KEY_W),
+ KEY(5, 2, KEY_L),
+ KEY(5, 3, KEY_S),
+ KEY(5, 4, KEY_H),
+ 0
+};
+
+static struct omap_kp_platform_data omap3evm_kp_data = {
+ .rows = 4,
+ .cols = 4,
+ .keymap = omap3evm_keymap,
+ .keymapsize = ARRAY_SIZE(omap3evm_keymap),
+ .rep = 1,
+};
+
+static struct platform_device omap3evm_kp_device = {
+ .name = "omap_twl4030keypad",
+ .id = -1,
+ .dev = {
+ .platform_data = &omap3evm_kp_data,
+ },
+};
+
static void __init omap3_evm_init_irq(void)

{
	omap2_init_common_hw();

@@ -165,6 +217,7 @@ static struct omap_board_config_kernel o

static struct platform_device *omap3_evm_devices[] __initdata = {
	&omap3_evm_lcd_device,
+	&omap3evm_kp_device,
#ifdef CONFIG_RTC_DRV_TWL4030
	&omap3_evm_twl4030rtc_device,

#endif

#1 lore raw
Quoted 1 line · Miguel Angel Aguilar Ulloa

Add twl4030 keypad driver support to OMAP3 EVM

Generally all your patches look really good but the subject should be something more self-explanatory.

For this first is ok, but second and third should be something like:

OMAP3: EVM: KEYPAD: Fix Kconfig dependency
OMAP3: EVM: KEYPAD: Add twl4030 keypad to defconfig

or something similar ;-)

Signature · 5 lines
Best Regards,

Felipe Balbi
[email protected]
http://blog.felipebalbi.com
#2 lore raw
In reply to Miguel Angel Aguilar Ulloa
Quoted 52 lines · Miguel Angel Aguilar Ulloa

Add twl4030 keypad driver support to OMAP3 EVM

--- a/arch/arm/mach-omap2/board-omap3evm.c 2008-06-23
15:07:13.000000000 -0600
+++ b/arch/arm/mach-omap2/board-omap3evm.c 2008-06-23
14:32:29.000000000 -0600

(quoted diff) +26 -0
@@ -19,6 +19,7 @@
 #include <linux/err.h>
 #include <linux/clk.h>
 #include <linux/io.h>
+#include <linux/input.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/ads7846.h>
 
@@ -28,6 +29,7 @@
 #include <asm/mach/map.h>
 
 #include <asm/arch/gpio.h>
+#include <asm/arch/keypad.h>
 #include <asm/arch/board.h>
 #include <asm/arch/hsmmc.h>
 #include <asm/arch/usb-musb.h>
@@ -149,6 +151,56 @@ struct spi_board_info omap3evm_spi_board
       },
 };
 
+static int omap3evm_keymap[] = {
+       KEY(0, 0, KEY_LEFT),
+       KEY(0, 1, KEY_RIGHT),
+       KEY(0, 2, KEY_A),
+       KEY(0, 3, KEY_B),
+       KEY(0, 4, KEY_C),
+       KEY(1, 0, KEY_DOWN),
+       KEY(1, 1, KEY_UP),
+       KEY(1, 2, KEY_E),
+       KEY(1, 3, KEY_F),
+       KEY(1, 4, KEY_G),
+       KEY(2, 0, KEY_ENTER),
+       KEY(2, 1, KEY_I),
+       KEY(2, 2, KEY_J),
+       KEY(2, 3, KEY_K),
+       KEY(2, 4, KEY_3),
+       KEY(3, 0, KEY_M),
+       KEY(3, 1, KEY_N),
+       KEY(3, 2, KEY_O),
+       KEY(3, 3, KEY_P),
+       KEY(3, 4, KEY_Q),
+       KEY(4, 0, KEY_R),
+       KEY(4, 1, KEY_4),
+       KEY(4, 2, KEY_T),

Review struct spi_board_info omap3evm_spi_board · line 187

Quoted 10 lines
(quoted diff) +10 -0
+       KEY(4, 3, KEY_U),
+       KEY(4, 4, KEY_D),
+       KEY(5, 0, KEY_V),
+       KEY(5, 1, KEY_W),
+       KEY(5, 2, KEY_L),
+       KEY(5, 3, KEY_S),
+       KEY(5, 4, KEY_H),
+       0
+};
+

Omap3evm has only 15 keys right?(Some body correct me if I am wrong). Then how the
mapping and dividing into rows and columns is done?

Quoted 32 lines
(quoted diff) +17 -1
+static struct omap_kp_platform_data omap3evm_kp_data = {
+       .rows           = 4,
+       .cols           = 4,
+       .keymap         = omap3evm_keymap,
+       .keymapsize     = ARRAY_SIZE(omap3evm_keymap),
+       .rep            = 1,
+};
+
+static struct platform_device omap3evm_kp_device = {
+       .name           = "omap_twl4030keypad",
+       .id             = -1,
+       .dev            = {
+                               .platform_data = &omap3evm_kp_data,
+                       },
+};
+
 static void __init omap3_evm_init_irq(void)
 {
       omap2_init_common_hw();
@@ -165,6 +217,7 @@ static struct omap_board_config_kernel o
 
 static struct platform_device *omap3_evm_devices[] __initdata = {
       &omap3_evm_lcd_device,
+       &omap3evm_kp_device,
 #ifdef CONFIG_RTC_DRV_TWL4030
       &omap3_evm_twl4030rtc_device,
 #endif
--

To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw

The OMAP3 EVM has 15 keys arranged in a matrix from SW4 to SW18, but it also has a user key (power on/off) in SW3, this key is included in the keypad mapping. This is how mapping is done in an 4x4 array.

Quoted 101 lines · arun c
Quoted 52 lines · Miguel Angel Aguilar Ulloa

Add twl4030 keypad driver support to OMAP3 EVM

--- a/arch/arm/mach-omap2/board-omap3evm.c 2008-06-23
15:07:13.000000000 -0600
+++ b/arch/arm/mach-omap2/board-omap3evm.c 2008-06-23
14:32:29.000000000 -0600

(quoted diff) +26 -0
@@ -19,6 +19,7 @@
 #include <linux/err.h>
 #include <linux/clk.h>
 #include <linux/io.h>
+#include <linux/input.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/ads7846.h>
 
@@ -28,6 +29,7 @@
 #include <asm/mach/map.h>
 
 #include <asm/arch/gpio.h>
+#include <asm/arch/keypad.h>
 #include <asm/arch/board.h>
 #include <asm/arch/hsmmc.h>
 #include <asm/arch/usb-musb.h>
@@ -149,6 +151,56 @@ struct spi_board_info omap3evm_spi_board
       },
 };
 
+static int omap3evm_keymap[] = {
+       KEY(0, 0, KEY_LEFT),
+       KEY(0, 1, KEY_RIGHT),
+       KEY(0, 2, KEY_A),
+       KEY(0, 3, KEY_B),
+       KEY(0, 4, KEY_C),
+       KEY(1, 0, KEY_DOWN),
+       KEY(1, 1, KEY_UP),
+       KEY(1, 2, KEY_E),
+       KEY(1, 3, KEY_F),
+       KEY(1, 4, KEY_G),
+       KEY(2, 0, KEY_ENTER),
+       KEY(2, 1, KEY_I),
+       KEY(2, 2, KEY_J),
+       KEY(2, 3, KEY_K),
+       KEY(2, 4, KEY_3),
+       KEY(3, 0, KEY_M),
+       KEY(3, 1, KEY_N),
+       KEY(3, 2, KEY_O),
+       KEY(3, 3, KEY_P),
+       KEY(3, 4, KEY_Q),
+       KEY(4, 0, KEY_R),
+       KEY(4, 1, KEY_4),
+       KEY(4, 2, KEY_T),

Review struct spi_board_info omap3evm_spi_board · line 187

Quoted 10 lines
(quoted diff) +10 -0
+       KEY(4, 3, KEY_U),
+       KEY(4, 4, KEY_D),
+       KEY(5, 0, KEY_V),
+       KEY(5, 1, KEY_W),
+       KEY(5, 2, KEY_L),
+       KEY(5, 3, KEY_S),
+       KEY(5, 4, KEY_H),
+       0
+};
+

Omap3evm has only 15 keys right?(Some body correct me if I am wrong). Then how the
mapping and dividing into rows and columns is done?

Quoted 32 lines
(quoted diff) +17 -1
+static struct omap_kp_platform_data omap3evm_kp_data = {
+       .rows           = 4,
+       .cols           = 4,
+       .keymap         = omap3evm_keymap,
+       .keymapsize     = ARRAY_SIZE(omap3evm_keymap),
+       .rep            = 1,
+};
+
+static struct platform_device omap3evm_kp_device = {
+       .name           = "omap_twl4030keypad",
+       .id             = -1,
+       .dev            = {
+                               .platform_data = &omap3evm_kp_data,
+                       },
+};
+
 static void __init omap3_evm_init_irq(void)
 {
       omap2_init_common_hw();
@@ -165,6 +217,7 @@ static struct omap_board_config_kernel o
 
 static struct platform_device *omap3_evm_devices[] __initdata = {
       &omap3_evm_lcd_device,
+       &omap3evm_kp_device,
 #ifdef CONFIG_RTC_DRV_TWL4030
       &omap3_evm_twl4030rtc_device,
 #endif
--

To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 5 lines
Miguel Angel Aguilar Ulloa
Embedded Software Engineer
RidgeRun Embedded Solutions
[email protected]
Office: +(506) 2225-9596
#4 lore raw
Quoted 28 lines · Miguel Angel Aguilar Ulloa

The OMAP3 EVM has 15 keys arranged in a matrix from SW4 to SW18, but it also has a user key (power on/off) in SW3, this key is included in the keypad mapping. This is how mapping is done in an 4x4 array.

Quoted 23 lines · arun c
Quoted 20 lines · Miguel Angel Aguilar Ulloa

Add twl4030 keypad driver support to OMAP3 EVM

--- a/arch/arm/mach-omap2/board-omap3evm.c 2008-06-23
15:07:13.000000000 -0600
+++ b/arch/arm/mach-omap2/board-omap3evm.c 2008-06-23
14:32:29.000000000 -0600

(quoted diff) +1 -0
@@ -19,6 +19,7 @@
 #include <linux/err.h>
 #include <linux/clk.h>
 #include <linux/io.h>
+#include <linux/input.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/ads7846.h>
 
@@ -28,6 +29,7 @@
 #include <asm/mach/map.h>
 
Quoted 9 lines
Quoted 9 lines

Review struct spi_board_info omap3evm_spi_board · line 153

Quoted 9 lines
(quoted diff) +1 -0
 #include <asm/arch/gpio.h>
+#include <asm/arch/keypad.h>
 #include <asm/arch/board.h>
 #include <asm/arch/hsmmc.h>
 #include <asm/arch/usb-musb.h>
@@ -149,6 +151,56 @@ struct spi_board_info omap3evm_spi_board
      },
 };
 

Yes option is there to add sw3 to key matrix. So we have a total of 16 keys, then
why there are more no of keys(30keys) in omap3evm_keymap[] array?

Quoted 80 lines
Quoted 60 lines
Quoted 24 lines
(quoted diff) +24 -0
+static int omap3evm_keymap[] = {
+       KEY(0, 0, KEY_LEFT),
+       KEY(0, 1, KEY_RIGHT),
+       KEY(0, 2, KEY_A),
+       KEY(0, 3, KEY_B),
+       KEY(0, 4, KEY_C),
+       KEY(1, 0, KEY_DOWN),
+       KEY(1, 1, KEY_UP),
+       KEY(1, 2, KEY_E),
+       KEY(1, 3, KEY_F),
+       KEY(1, 4, KEY_G),
+       KEY(2, 0, KEY_ENTER),
+       KEY(2, 1, KEY_I),
+       KEY(2, 2, KEY_J),
+       KEY(2, 3, KEY_K),
+       KEY(2, 4, KEY_3),
+       KEY(3, 0, KEY_M),
+       KEY(3, 1, KEY_N),
+       KEY(3, 2, KEY_O),
+       KEY(3, 3, KEY_P),
+       KEY(3, 4, KEY_Q),
+       KEY(4, 0, KEY_R),
+       KEY(4, 1, KEY_4),
+       KEY(4, 2, KEY_T),

Review struct spi_board_info omap3evm_spi_board · line 187

Quoted 10 lines
(quoted diff) +10 -0
+       KEY(4, 3, KEY_U),
+       KEY(4, 4, KEY_D),
+       KEY(5, 0, KEY_V),
+       KEY(5, 1, KEY_W),
+       KEY(5, 2, KEY_L),
+       KEY(5, 3, KEY_S),
+       KEY(5, 4, KEY_H),
+       0
+};
+

Omap3evm has only 15 keys right?(Some body correct me if I am wrong). Then how the
mapping and dividing into rows and columns is done?

Quoted 21 lines
(quoted diff) +16 -0
+static struct omap_kp_platform_data omap3evm_kp_data = {
+       .rows           = 4,
+       .cols           = 4,
+       .keymap         = omap3evm_keymap,
+       .keymapsize     = ARRAY_SIZE(omap3evm_keymap),
+       .rep            = 1,
+};
+
+static struct platform_device omap3evm_kp_device = {
+       .name           = "omap_twl4030keypad",
+       .id             = -1,
+       .dev            = {
+                               .platform_data = &omap3evm_kp_data,
+                       },
+};
+
 static void __init omap3_evm_init_irq(void)
 {
      omap2_init_common_hw();
@@ -165,6 +217,7 @@ static struct omap_board_config_kernel o
 
Quoted 11 lines
Quoted 11 lines
(quoted diff) +1 -1
 static struct platform_device *omap3_evm_devices[] __initdata = {
      &omap3_evm_lcd_device,
+       &omap3evm_kp_device,
 #ifdef CONFIG_RTC_DRV_TWL4030
      &omap3_evm_twl4030rtc_device,
 #endif
--

To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Miguel Angel Aguilar Ulloa
Embedded Software Engineer
RidgeRun Embedded Solutions
[email protected]
Office: +(506) 2225-9596

#5 lore raw
Quoted 28 lines · arun c
Quoted 26 lines · Miguel Angel Aguilar Ulloa

The OMAP3 EVM has 15 keys arranged in a matrix from SW4 to SW18, but it also has a user key (power on/off) in SW3, this key is included in the keypad mapping. This is how mapping is done in an 4x4 array.

Quoted 21 lines · arun c
Quoted 19 lines · Miguel Angel Aguilar Ulloa

Add twl4030 keypad driver support to OMAP3 EVM

--- a/arch/arm/mach-omap2/board-omap3evm.c 2008-06-23
15:07:13.000000000 -0600
+++ b/arch/arm/mach-omap2/board-omap3evm.c 2008-06-23
14:32:29.000000000 -0600

(quoted diff) +1 -0
@@ -19,6 +19,7 @@
 #include <linux/err.h>
 #include <linux/clk.h>
 #include <linux/io.h>
+#include <linux/input.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/ads7846.h>
 
@@ -28,6 +29,7 @@
 #include <asm/mach/map.h>
 
Quoted 14 lines
Quoted 9 lines
Quoted 9 lines

Review struct spi_board_info omap3evm_spi_board · line 153

Quoted 9 lines
(quoted diff) +1 -0
 #include <asm/arch/gpio.h>
+#include <asm/arch/keypad.h>
 #include <asm/arch/board.h>
 #include <asm/arch/hsmmc.h>
 #include <asm/arch/usb-musb.h>
@@ -149,6 +151,56 @@ struct spi_board_info omap3evm_spi_board
      },
 };
 

Yes option is there to add sw3 to key matrix. So we have a total of 16 keys, then
why there are more no of keys(30keys) in omap3evm_keymap[] array?

Check new patch version

Quoted 79 lines
Quoted 79 lines
Quoted 60 lines
Quoted 25 lines
(quoted diff) +24 -0
+static int omap3evm_keymap[] = {
+       KEY(0, 0, KEY_LEFT),
+       KEY(0, 1, KEY_RIGHT),
+       KEY(0, 2, KEY_A),
+       KEY(0, 3, KEY_B),
+       KEY(0, 4, KEY_C),
+       KEY(1, 0, KEY_DOWN),
+       KEY(1, 1, KEY_UP),
+       KEY(1, 2, KEY_E),
+       KEY(1, 3, KEY_F),
+       KEY(1, 4, KEY_G),
+       KEY(2, 0, KEY_ENTER),
+       KEY(2, 1, KEY_I),
+       KEY(2, 2, KEY_J),
+       KEY(2, 3, KEY_K),
+       KEY(2, 4, KEY_3),
+       KEY(3, 0, KEY_M),
+       KEY(3, 1, KEY_N),
+       KEY(3, 2, KEY_O),
+       KEY(3, 3, KEY_P),
+       KEY(3, 4, KEY_Q),
+       KEY(4, 0, KEY_R),
+       KEY(4, 1, KEY_4),
+       KEY(4, 2, KEY_T),

Review struct spi_board_info omap3evm_spi_board · line 187

Quoted 10 lines
(quoted diff) +10 -0
+       KEY(4, 3, KEY_U),
+       KEY(4, 4, KEY_D),
+       KEY(5, 0, KEY_V),
+       KEY(5, 1, KEY_W),
+       KEY(5, 2, KEY_L),
+       KEY(5, 3, KEY_S),
+       KEY(5, 4, KEY_H),
+       0
+};
+

Omap3evm has only 15 keys right?(Some body correct me if I am wrong). Then how the
mapping and dividing into rows and columns is done?

Quoted 21 lines
(quoted diff) +16 -0
+static struct omap_kp_platform_data omap3evm_kp_data = {
+       .rows           = 4,
+       .cols           = 4,
+       .keymap         = omap3evm_keymap,
+       .keymapsize     = ARRAY_SIZE(omap3evm_keymap),
+       .rep            = 1,
+};
+
+static struct platform_device omap3evm_kp_device = {
+       .name           = "omap_twl4030keypad",
+       .id             = -1,
+       .dev            = {
+                               .platform_data = &omap3evm_kp_data,
+                       },
+};
+
 static void __init omap3_evm_init_irq(void)
 {
      omap2_init_common_hw();
@@ -165,6 +217,7 @@ static struct omap_board_config_kernel o
 
Quoted 11 lines
Quoted 11 lines
(quoted diff) +1 -1
 static struct platform_device *omap3_evm_devices[] __initdata = {
      &omap3_evm_lcd_device,
+       &omap3evm_kp_device,
 #ifdef CONFIG_RTC_DRV_TWL4030
      &omap3_evm_twl4030rtc_device,
 #endif
--

To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Miguel Angel Aguilar Ulloa
Embedded Software Engineer
RidgeRun Embedded Solutions
[email protected]
Office: +(506) 2225-9596

Signature · 5 lines
Miguel Angel Aguilar Ulloa
Embedded Software Engineer
RidgeRun Embedded Solutions
[email protected]
Office: +(506) 2225-9596