Skip to contentSkip to conversation

keypad refresh2

PATCH In review Komal Shah 3 participants 8 messages Jan 17, 2006 – Jan 24, 2006

Subsystems (5)
lore
Share & tools
lore

Komal Shah

author
#0 lore raw

PATCH 1/1 keypad refresh2

Tony/Juha,

Attached patch implements the review comments given by Juha.

FIXME:
keypad_state and new_state max value is set to 8 right now. But I think its ok for a while.

Patch is tested with h4 and buids for h3 and osk. Let me know if any suggestions are there.

---Komal Shah
http://komalshah.blogspot.com/

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

arch/arm/mach-omap1/board-h2.c +67 -0
index 4161e87..4cc6a31 100644
@@ -26,6 +26,7 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
 #include <linux/mtd/partitions.h>
+#include <linux/input.h>
 
 #include <asm/hardware.h>
 #include <asm/mach-types.h>
@@ -38,10 +39,50 @@
 #include <asm/arch/tc.h>
 #include <asm/arch/irda.h>
 #include <asm/arch/usb.h>
+#include <asm/arch/keypad.h>
 #include <asm/arch/common.h>
 
 extern int omap_gpio_init(void);
 
+static int h2_keymap[] = {
+	KEY(0, 0, KEY_LEFT),
+	KEY(0, 1, KEY_RIGHT),
+	KEY(0, 2, KEY_3),
+	KEY(0, 3, KEY_F10),
+	KEY(0, 4, KEY_F5),
+	KEY(0, 5, KEY_9),
+	KEY(1, 0, KEY_DOWN),
+	KEY(1, 1, KEY_UP),
+	KEY(1, 2, KEY_2),
+	KEY(1, 3, KEY_F9),
+	KEY(1, 4, KEY_F7),
+	KEY(1, 5, KEY_0),
+	KEY(2, 0, KEY_ENTER),
+	KEY(2, 1, KEY_6),
+	KEY(2, 2, KEY_1),
+	KEY(2, 3, KEY_F2),
+	KEY(2, 4, KEY_F6),
+	KEY(2, 5, KEY_HOME),
+	KEY(3, 0, KEY_8),
+	KEY(3, 1, KEY_5),
+	KEY(3, 2, KEY_F12),
+	KEY(3, 3, KEY_F3),
+	KEY(3, 4, KEY_F8),
+	KEY(3, 5, KEY_END),
+	KEY(4, 0, KEY_7),
+	KEY(4, 1, KEY_4),
+	KEY(4, 2, KEY_F11),
+	KEY(4, 3, KEY_F1),
+	KEY(4, 4, KEY_F4),
+	KEY(4, 5, KEY_ESC),
+	KEY(5, 0, KEY_F13),
+	KEY(5, 1, KEY_F14),
+	KEY(5, 2, KEY_F15),
+	KEY(5, 3, KEY_F16),
+	KEY(5, 4, KEY_SLEEP),
+	0
+};
+
 static struct mtd_partition h2_nor_partitions[] = {
 	/* bootloader (U-Boot, etc) in first sector */
 	{
@@ -172,6 +213,31 @@ static struct platform_device h2_smc91x_
 	.resource	= h2_smc91x_resources,
 };
 
+static struct resource h2_kp_resources[] = {
+	[0] = {
+		.start	= INT_KEYBOARD,
+		.end	= INT_KEYBOARD,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct omap_kp_platform_data h2_kp_data = {
+	.rows	= 8,
+	.cols	= 8,
+	.keymap = h2_keymap,
+	.rep	= 1,
+};
+
+static struct platform_device h2_kp_device = {
+	.name		= "omap-keypad",
+	.id		= -1,
+	.dev		= {
+		.platform_data = &h2_kp_data,
+	},
+	.num_resources	= ARRAY_SIZE(h2_kp_resources),
+	.resource	= h2_kp_resources,
+};
+
 #define H2_IRDA_FIRSEL_GPIO_PIN	17
 
 static int h2_transceiver_mode(struct device *dev, int state)
@@ -210,6 +276,7 @@ static struct platform_device *h2_device
 	&h2_nand_device,
 	&h2_smc91x_device,
 	&h2_irda_device,
+	&h2_kp_device,
 };
 
 static void __init h2_init_smc91x(void)
arch/arm/mach-omap1/board-h3.c +70 -0

104 lines not on this page · raw message

arch/arm/mach-omap1/board-innovator.c +42 -0

74 lines not on this page · raw message

arch/arm/mach-omap1/board-osk.c +41 -0

66 lines not on this page · raw message

arch/arm/mach-omap1/board-perseus2.c +61 -0

86 lines not on this page · raw message

arch/arm/mach-omap2/Kconfig +1 -1
index 46634a0..85cc78b 100644
@@ -19,5 +19,5 @@ config MACH_OMAP_GENERIC
 config MACH_OMAP_H4
 	bool "OMAP 2420 H4 board"
 	depends on ARCH_OMAP2 && ARCH_OMAP24XX
-	select GPIOEXPANDER_OMAP
+	select GPIOEXPANDER_OMAP	
 
arch/arm/mach-omap2/board-h4.c +57 -0

84 lines not on this page · raw message

arch/arm/mach-omap2/mux.c +20 -0
index 1a906d8..d3cef53 100644
@@ -71,6 +71,26 @@ MUX_CFG_24XX("P20_24XX_TSC_IRQ",	0x108,	
 MUX_CFG_24XX("K15_24XX_UART3_TX",	0x118,	0,	0,	0,	1)
 MUX_CFG_24XX("K14_24XX_UART3_RX",	0x119,	0,	0,	0,	1)
 
+/* Keypad GPIO*/
+MUX_CFG_24XX("T19_24XX_KBR0",		0x106,	3,	1,	1,	1)
+MUX_CFG_24XX("R19_24XX_KBR1",		0x107,	3,	1,	1,	1)
+MUX_CFG_24XX("V18_24XX_KBR2",		0x139,	3,	1,	1,	1)
+MUX_CFG_24XX("M21_24XX_KBR3",		0xc9,	3,	1,	1,	1)
+MUX_CFG_24XX("E5__24XX_KBR4",		0x138,	3,	1,	1,	1)
+MUX_CFG_24XX("M18_24XX_KBR5",		0x10e,	3,	1,	1,	1)
+MUX_CFG_24XX("R20_24XX_KBC0",		0x108,	3,	0,	0,	1)
+MUX_CFG_24XX("M14_24XX_KBC1",		0x109,	3,	0,	0,	1)
+MUX_CFG_24XX("H19_24XX_KBC2",		0x114,	3,	0,	0,	1)
+MUX_CFG_24XX("V17_24XX_KBC3",		0x135,	3,	0,	0,	1)
+MUX_CFG_24XX("P21_24XX_KBC4",		0xca,	3,	0,	0,	1)
+MUX_CFG_24XX("L14_24XX_KBC5",		0x10f,	3,	0,	0,	1)
+MUX_CFG_24XX("N19_24XX_KBC6",		0x110,	3,	0,	0,	1)
+
+/* 24xx Meneluase Keypad GPIO */
+MUX_CFG_24XX("B3__24XX_KBR5",		0x30,	3,	1,	1,	1)
+MUX_CFG_24XX("AA4_24XX_KBC2",		0xe7,	3,	0,	0,	1)
+MUX_CFG_24XX("B13_24XX_KBC6",		0x110,	3,	0,	0,	1)
+
 };
 
 int __init omap2_mux_init(void)
arch/arm/plat-omap/devices.c +21 -6
index 640e507..572f86d 100644
@@ -24,6 +24,7 @@
 #include <asm/arch/board.h>
 #include <asm/arch/mux.h>
 #include <asm/arch/gpio.h>
+#include <asm/arch/menelaus.h>
 
 
 void omap_nop_release(struct device *dev)
@@ -99,10 +100,6 @@ static inline void omap_init_i2c(void) {
 
 /*-------------------------------------------------------------------------*/
 #if	defined(CONFIG_KEYBOARD_OMAP) || defined(CONFIG_KEYBOARD_OMAP_MODULE)
-static struct platform_device omap_kp_device = {
-	.name	   = "omap-keypad",
-	.id	     = -1,
-};
 
 static void omap_init_kp(void)
 {
@@ -131,9 +128,27 @@ static void omap_init_kp(void)
 		omap_cfg_reg(E4_730_KBC2);
 		omap_cfg_reg(F4_730_KBC3);
 		omap_cfg_reg(E3_730_KBC4);
+	} else if (machine_is_omap_h4()) {
+		omap_cfg_reg(T19_24XX_KBR0);
+		omap_cfg_reg(R19_24XX_KBR1);
+		omap_cfg_reg(V18_24XX_KBR2);
+		omap_cfg_reg(M21_24XX_KBR3);
+		omap_cfg_reg(E5__24XX_KBR4);
+		if (omap_has_menelaus()) {
+			omap_cfg_reg(B3__24XX_KBR5);
+			omap_cfg_reg(AA4_24XX_KBC2);
+			omap_cfg_reg(B13_24XX_KBC6);
+		} else {
+			omap_cfg_reg(M18_24XX_KBR5);
+			omap_cfg_reg(H19_24XX_KBC2);
+			omap_cfg_reg(N19_24XX_KBC6);
+		}
+		omap_cfg_reg(R20_24XX_KBC0);
+		omap_cfg_reg(M14_24XX_KBC1);
+		omap_cfg_reg(V17_24XX_KBC3);
+		omap_cfg_reg(P21_24XX_KBC4);
+		omap_cfg_reg(L14_24XX_KBC5);
 	}
-
-	(void) platform_device_register(&omap_kp_device);
 }
 #else
 static inline void omap_init_kp(void) {}
drivers/input/keyboard/Kconfig +1 -1
index 11a7f3f..1286eac 100644
@@ -186,7 +186,7 @@ config KEYBOARD_HIL
 
 config KEYBOARD_OMAP
 	tristate "TI OMAP keypad support"
-	depends on ARCH_OMAP1
+	depends on (ARCH_OMAP1 || ARCH_OMAP2)
 	help
 	  Say Y here if you want to use the OMAP keypad.
 
drivers/input/keyboard/omap-keypad.c +166 -137

404 lines not on this page · raw message

include/asm-arm/arch-omap/cpu.h +0 -0
include/asm-arm/arch-omap/irda.h +0 -0
include/asm-arm/arch-omap/keypad.h new file +26 -0
new file mode 100644
index 0000000..0d90b4f
@@ -0,0 +1,26 @@
+/*
+ *  linux/include/asm-arm/arch-omap/keypad.h
+ *
+ *  Copyright (C) 2006 Komal Shah <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef ASMARM_ARCH_KEYPAD_H
+#define ASMARM_ARCH_KEYPAD_H
+
+struct omap_kp_platform_data {
+	int rows;
+	int cols;
+	int *keymap;
+	unsigned int rep:1;
+	/* specific to OMAP242x*/
+	unsigned int *row_gpios;
+	unsigned int *col_gpios;
+};
+
+#define KEY(col, row, val) (((col) << 28) | ((row) << 24) | (val))
+
+#endif
+
include/asm-arm/arch-omap/mux.h +19 -0
index 27d54c0..7a1a28a 100644
@@ -427,6 +427,25 @@ enum omap24xx_index {
 	K15_24XX_UART3_TX,
 	K14_24XX_UART3_RX,
 
+	/* Keypad GPIO*/
+	T19_24XX_KBR0,
+	R19_24XX_KBR1,
+	V18_24XX_KBR2,
+	M21_24XX_KBR3,
+	E5__24XX_KBR4,
+	M18_24XX_KBR5,
+	R20_24XX_KBC0,
+	M14_24XX_KBC1,
+	H19_24XX_KBC2,
+	V17_24XX_KBC3,
+	P21_24XX_KBC4,
+	L14_24XX_KBC5,
+	N19_24XX_KBC6,
+
+	/* 24xx Meneluas Keypad GPIO */
+	B3__24XX_KBR5,
+	AA4_24XX_KBC2,
+	B13_24XX_KBC6,
 };
 
 #ifdef	CONFIG_OMAP_MUX
author
#1 lore raw
Quoted 8 lines · --- Komal Shah

Tony/Juha,

Attached patch implements the review comments given by Juha.

FIXME:
keypad_state and new_state max value is set to 8 right now. But I think
its ok for a while.

If there are no review comments, then please consider it in next set of commits.

Today I have rebased this keypad branch with latest git head and it works without any changes.

---Komal Shah
http://komalshah.blogspot.com/

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

#2 lore raw
Quoted 10 lines · Komal Shah
Quoted 8 lines · --- Komal Shah

Tony/Juha,

Attached patch implements the review comments given by Juha.

FIXME:
keypad_state and new_state max value is set to 8 right now. But I think
its ok for a while.

Quoted 5 lines

If there are no review comments, then please consider it in next set of commits.

Today I have rebased this keypad branch with latest git head and it works without any changes.

Nice, I'll push it today. I've s/Meneluas/Menelaus/ in the patch.

Tony

#3 lore raw
In reply to Komal Shah

drivers/input/keyboard/omap-keypad.c static int __init omap_kp_probe(struct p · line 306

Quoted 5 lines · ext Komal Shah
drivers/input/keyboard/omap-keypad.c +5 -0
+	if (cpu_is_omap24xx() && omap_has_menelaus()) {
+		row_gpios[5] = 0;
+		col_gpios[2] = 15;
+		col_gpios[6] = 18;
+	}

What's this about? What does the keypad have to do with Menelaus?

Cheers,
Juha

author
#4 lore raw
Quoted 9 lines · --- Juha Yrjölä

drivers/input/keyboard/omap-keypad.c static int __init omap_kp_probe(struct p · line 306

Quoted 5 lines · ext Komal Shah
drivers/input/keyboard/omap-keypad.c +5 -0
+	if (cpu_is_omap24xx() && omap_has_menelaus()) {
+		row_gpios[5] = 0;
+		col_gpios[2] = 15;
+		col_gpios[6] = 18;
+	}

What's this about? What does the keypad have to do with Menelaus?

The first H4 board came out from TI was not having Menelaus chip. And gpio signals were changed in the H4 EVM came out with Menelaus for keypad. So only way to differentiate between the two was Menelaus chip on the new board.

---Komal Shah
http://komalshah.blogspot.com/

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

maintainer
#5 lore raw
Quoted 12 lines · Komal Shah
Quoted 9 lines · --- Juha Yrjölä

drivers/input/keyboard/omap-keypad.c static int __init omap_kp_probe(struct p · line 306

Quoted 5 lines · ext Komal Shah
drivers/input/keyboard/omap-keypad.c +5 -0
+	if (cpu_is_omap24xx() && omap_has_menelaus()) {
+		row_gpios[5] = 0;
+		col_gpios[2] = 15;
+		col_gpios[6] = 18;
+	}

What's this about? What does the keypad have to do with Menelaus?

Quoted 4 lines

The first H4 board came out from TI was not having Menelaus chip. And gpio signals were changed in the H4 EVM came out with Menelaus for keypad. So only way to differentiate between the two was Menelaus chip on the new board.

How about just adding && machine_is_omap_h4() there too?

Tony

author
#6 lore raw
Quoted 2 lines · --- Tony Lindgren

How about just adding && machine_is_omap_h4() there too?

Ok, attached patch adds machine_is_omap_h4() condition.

---Komal Shah
http://komalshah.blogspot.com/

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

drivers/input/keyboard/omap-keypad.c +2 -1
index ef30720..4dff4d3 100644
@@ -299,7 +299,8 @@ static int __init omap_kp_probe(struct p
 		col_gpios = pdata->col_gpios;
 	}
 
-	if (cpu_is_omap24xx() && omap_has_menelaus()) {
+	if (cpu_is_omap24xx() && omap_has_menelaus() 
+		&& machine_is_omap_h4()) {
 		row_gpios[5] = 0;
 		col_gpios[2] = 15;
 		col_gpios[6] = 18;
#7 lore raw
In reply to Tony Lindgren
Quoted 6 lines · ext Tony Lindgren
Quoted 4 lines

The first H4 board came out from TI was not having Menelaus chip. And gpio signals were changed in the H4 EVM came out with Menelaus for keypad. So only way to differentiate between the two was Menelaus chip on the new board.

How about just adding && machine_is_omap_h4() there too?

This check should be performed in the board-specific code, i.e. in board-h4.c. The data passed to the keyboard driver should be modified there.

Cheers,
Juha