Skip to contentSkip to conversation

msm: trout: add keypad support

PATCH New Daniel Walker 5 participants 12 messages Dec 9, 2010 – Dec 15, 2010

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

PATCH 1/1 msm: trout: add keypad support

This adds matrix keypad support, and gpio buttons support for trout's various keys and buttons.

---
 arch/arm/mach-msm/Makefile             |    2 +-
 arch/arm/mach-msm/board-trout-keypad.c |  342 ++++++++++++++++++++++++++++++++
 2 files changed, 343 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-msm/board-trout-keypad.c
arch/arm/mach-msm/Makefile +1 -1
index 3abe889..a11b4e9 100644
@@ -20,7 +20,7 @@ obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o
 obj-$(CONFIG_MSM_SMD) += last_radio_log.o
 
 obj-$(CONFIG_MACH_TROUT) += board-trout.o board-trout-gpio.o board-trout-mmc.o devices-msm7x00.o
-obj-$(CONFIG_MACH_TROUT) += board-trout.o board-trout-gpio.o board-trout-mmc.o board-trout-panel.o devices-msm7x00.o
+obj-$(CONFIG_MACH_TROUT) += board-trout.o board-trout-gpio.o board-trout-mmc.o board-trout-panel.o devices-msm7x00.o board-trout-keypad.o
 obj-$(CONFIG_MACH_HALIBUT) += board-halibut.o devices-msm7x00.o
 obj-$(CONFIG_ARCH_MSM7X30) += board-msm7x30.o devices-msm7x30.o
 obj-$(CONFIG_ARCH_QSD8X50) += board-qsd8x50.o devices-qsd8x50.o
arch/arm/mach-msm/board-trout-keypad.c new file +342 -0

342 lines not on this page · raw message

Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 msm: trout: add keypad support

Hi Daniel,

Quoted 10 lines · Daniel Walker

This adds matrix keypad support, and gpio buttons support for trout's various keys and buttons.

---
?arch/arm/mach-msm/Makefile ? ? ? ? ? ? | ? ?2 +- ?arch/arm/mach-msm/board-trout-keypad.c | ?342 ++++++++++++++++++++++++++++++++ ?2 files changed, 343 insertions(+), 1 deletions(-)
?create mode 100644 arch/arm/mach-msm/board-trout-keypad.c

[...]

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+static unsigned int trout_col_gpios_evt2[] = { 35, 34, 33, 32, 31, 23, 30, 109 };

WARNING: line over 80 characters

[...]

Best Regards
Abraham

#2 lore raw

PATCH 1/1 msm: trout: add keypad support

Hi Abraham,

Quoted 5 lines · Abraham

Review

Quoted 3 lines
(quoted diff) +2 -0
+
+static unsigned int trout_col_gpios_evt2[] = { 35, 34, 33, 32, 31, 23, 30, 109 };

WARNING: line over 80 characters

I would leave this to Daniel if he wants to fix it, because by making it under 80 is not going to improve any code readability, so I prefer to keep it as is.

---Trilok Soni

Signature · 2 lines
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#3 lore raw

PATCH 1/1 msm: trout: add keypad support

In reply to Daniel Walker

Hi Daniel,

arch/arm/mach-msm/board-trout-keypad.c line 1

Quoted 4 lines
arch/arm/mach-msm/board-trout-keypad.c new file +1 -0
@@ -0,0 +1,342 @@
+/* arch/arm/mach-msm/board-trout-keypad.c

No paths please.

Quoted 17 lines
arch/arm/mach-msm/board-trout-keypad.c new file +17 -0
+ *
+ * Copyright (C) 2008 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful),
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/platform_device.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>

arch/arm/mach-msm/board-trout-keypad.c line 28

Quoted 10 lines
arch/arm/mach-msm/board-trout-keypad.c new file +10 -0
+#include <linux/input/matrix_keypad.h>
+#include <linux/gpio_keys.h>
+#include <asm/mach-types.h>
+
+#include "board-trout.h"
+
+static char *keycaps = "--qwerty";
+#undef MODULE_PARAM_PREFIX
+#define MODULE_PARAM_PREFIX "board_trout."
+module_param_named(keycaps, keycaps, charp, 0);

I would like to know what is the use of this param?

arch/arm/mach-msm/board-trout-keypad.c line 32

Quoted 4 lines
arch/arm/mach-msm/board-trout-keypad.c new file +4 -0
+
+
+static unsigned int trout_col_gpios[] = { 35, 34, 33, 32, 31, 23, 30, 78 };
+static unsigned int trout_row_gpios[] = { 42, 41, 40, 39, 38, 37, 36 };

const?

arch/arm/mach-msm/board-trout-keypad.c line 99

Quoted 3 lines
arch/arm/mach-msm/board-trout-keypad.c new file +3 -0
+
+static unsigned int trout_col_gpios_evt2[] = { 35, 34, 33, 32, 31, 23, 30, 109 };
+static unsigned int trout_row_gpios_evt2[] = { 42, 41, 40, 39, 38, 37, 36 };

const?

Quoted 8 lines
arch/arm/mach-msm/board-trout-keypad.c new file +8 -0
+static int __init trout_init_keypad(void)
+{
+	int ret;
+
+	if (!machine_is_trout())
+		return 0;
+
+	switch (system_rev) {

arch/arm/mach-msm/board-trout-keypad.c line 321

Quoted 10 lines
arch/arm/mach-msm/board-trout-keypad.c new file +10 -0
+	case 0:
+		/* legacy default keylayout */
+		break;
+	case 1:
+		/* v1 has a new keyboard layout */
+		trout_pdata.keymap_data = &trout_keymap_data_2_1;
+		trout_pdata.col_gpios = trout_col_gpios_evt2;
+		trout_pdata.row_gpios = trout_row_gpios_evt2;
+
+		/* userspace needs to know about these changes as well */

?? what is the meaning of this comment?

arch/arm/mach-msm/board-trout-keypad.c line 329

Quoted 8 lines
arch/arm/mach-msm/board-trout-keypad.c new file +8 -0
+		break;
+	default: /* 2, 3, 4 currently */
+		/* v2 has a new keyboard layout */
+		trout_pdata.keymap_data = &trout_keymap_data_2_2;
+		trout_pdata.col_gpios = trout_col_gpios_evt2;
+		trout_pdata.row_gpios = trout_row_gpios_evt2;
+
+		/* userspace needs to know about these changes as well */

ditto.

---Trilok Soni

Signature · 2 lines
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#4 lore raw

PATCH 1/1 msm: trout: add keypad support

Quoted 6 lines · Trilok Soni

arch/arm/mach-msm/board-trout-keypad.c line 28

Quoted 4 lines
arch/arm/mach-msm/board-trout-keypad.c new file +4 -0
+static char *keycaps = "--qwerty";
+#undef MODULE_PARAM_PREFIX
+#define MODULE_PARAM_PREFIX "board_trout."
+module_param_named(keycaps, keycaps, charp, 0);

I would like to know what is the use of this param?

No idea .. It was part of Google's implementation ..

Daniel

Signature · 2 lines
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#5 lore raw

PATCH 1/1 msm: trout: add keypad support

Quoted 11 lines · Daniel Walker
Quoted 6 lines · Trilok Soni

arch/arm/mach-msm/board-trout-keypad.c line 28

Quoted 4 lines
arch/arm/mach-msm/board-trout-keypad.c new file +4 -0
+static char *keycaps = "--qwerty";
+#undef MODULE_PARAM_PREFIX
+#define MODULE_PARAM_PREFIX "board_trout."
+module_param_named(keycaps, keycaps, charp, 0);

I would like to know what is the use of this param?

No idea .. It was part of Google's implementation ..

You removed the code that uses it. If you look at the original file you can see how it is used:
http://android.git.kernel.org/?p=kernel/msm.git;a=blob;f=arch/arm/mach-msm/board-trout-keypad.c;hb=refs/heads/android-msm-2.6.35
It is set by the bootloader according to the hardware version.

You can also see that the "/* userspace needs to know about these changes as well */" comments refer to the code that changes the name of the input device.

I don't think this change will work correctly with our existing user-space code though since you are now reporting the power-key, camera-key and slide-switch from a separate input device.

Signature · 1 line
Arve Hj?nnev?g
#6 lore raw

PATCH 1/1 msm: trout: add keypad support

Quoted 18 lines · Arve Hj?nnev?g
Quoted 11 lines · Daniel Walker
Quoted 6 lines · Trilok Soni

arch/arm/mach-msm/board-trout-keypad.c line 28

Quoted 4 lines
arch/arm/mach-msm/board-trout-keypad.c new file +4 -0
+static char *keycaps = "--qwerty";
+#undef MODULE_PARAM_PREFIX
+#define MODULE_PARAM_PREFIX "board_trout."
+module_param_named(keycaps, keycaps, charp, 0);

I would like to know what is the use of this param?

No idea .. It was part of Google's implementation ..

You removed the code that uses it. If you look at the original file you can see how it is used:
http://android.git.kernel.org/?p=kernel/msm.git;a=blob;f=arch/arm/mach-msm/board-trout-keypad.c;hb=refs/heads/android-msm-2.6.35
It is set by the bootloader according to the hardware version.

Quoted 7 lines

You can also see that the "/* userspace needs to know about these changes as well */" comments refer to the code that changes the name of the input device.

I don't think this change will work correctly with our existing user-space code though since you are now reporting the power-key, camera-key and slide-switch from a separate input device.

Yeah, I did remove those parts.. I'm not sure where to put that stuff in this new implementation. I can try to find an appropriate place , unless you have some suggestions ?

Daniel

Signature · 2 lines
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#7 lore raw

PATCH 1/1 msm: trout: add keypad support

Hi Daniel,

Quoted 23 lines · Daniel Walker
Quoted 22 lines · Arve Hj?nnev?g
Quoted 11 lines · Daniel Walker
Quoted 6 lines · Trilok Soni

arch/arm/mach-msm/board-trout-keypad.c line 28

Quoted 4 lines
arch/arm/mach-msm/board-trout-keypad.c new file +4 -0
+static char *keycaps = "--qwerty";
+#undef MODULE_PARAM_PREFIX
+#define MODULE_PARAM_PREFIX "board_trout."
+module_param_named(keycaps, keycaps, charp, 0);

I would like to know what is the use of this param?

No idea .. It was part of Google's implementation ..

You removed the code that uses it. If you look at the original file you can see how it is used:
http://android.git.kernel.org/?p=kernel/msm.git;a=blob;f=arch/arm/mach-msm/board-trout-keypad.c;hb=refs/heads/android-msm-2.6.35
It is set by the bootloader according to the hardware version.

You can also see that the "/* userspace needs to know about these changes as well */" comments refer to the code that changes the name of the input device.

Quoted 7 lines
Quoted 3 lines

I don't think this change will work correctly with our existing user-space code though since you are now reporting the power-key, camera-key and slide-switch from a separate input device.

Yeah, I did remove those parts.. I'm not sure where to put that stuff in this new implementation. I can try to find an appropriate place , unless you have some suggestions ?

To support this, we need to override the input device .name and submit the patches for matrix keypad and gpio keys and let the name come through platform data.

You can refer how I am doing in PM8058 keypad driver patch.

But the real question is why can't we just do this in userspace? we should be able to override the keymap using setkeycode functionality, isn't it?

---Trilok Soni

Signature · 2 lines
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#8 lore raw

PATCH 1/1 msm: trout: add keypad support

Quoted 4 lines · Trilok Soni

To support this, we need to override the input device .name and submit the patches for matrix keypad and gpio keys and let the name come through platform data.

You can refer how I am doing in PM8058 keypad driver patch.

ok ..

Quoted 2 lines

But the real question is why can't we just do this in userspace? we should be able to override the keymap using setkeycode functionality, isn't it?

It might be possible, but some of the keys are missing in some of the configurations .. If you had one big configuration with all of the gpio lines, it might be possible that the missing gpio lines aren't configured or don't exist.

Daniel

Signature · 3 lines
Sent by an consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
Forum.
#9 lore raw

PATCH 1/1 msm: trout: add keypad support

In reply to Trilok Soni
Quoted 30 lines · Trilok Soni

Hi Daniel,

Quoted 27 lines · Daniel Walker
Quoted 25 lines · Arve Hj?nnev?g
Quoted 11 lines · Daniel Walker
Quoted 6 lines · Trilok Soni

arch/arm/mach-msm/board-trout-keypad.c line 28

Quoted 4 lines
arch/arm/mach-msm/board-trout-keypad.c new file +4 -0
+static char *keycaps = "--qwerty";
+#undef MODULE_PARAM_PREFIX
+#define MODULE_PARAM_PREFIX "board_trout."
+module_param_named(keycaps, keycaps, charp, 0);

I would like to know what is the use of this param?

No idea .. It was part of Google's implementation ..

You removed the code that uses it. If you look at the original file you can see how it is used:
http://android.git.kernel.org/?p=kernel/msm.git;a=blob;f=arch/arm/mach-msm/board-trout-keypad.c;hb=refs/heads/android-msm-2.6.35
It is set by the bootloader according to the hardware version.

You can also see that the "/* userspace needs to know about these changes as well */" comments refer to the code that changes the name of the input device.

I don't think this change will work correctly with our existing user-space code though since you are now reporting the power-key, camera-key and slide-switch from a separate input device.

Quoted 8 lines
Quoted 3 lines

Yeah, I did remove those parts.. I'm not sure where to put that stuff in this new implementation. I can try to find an appropriate place , unless you have some suggestions ?

To support this, we need to override the input device .name and submit the patches for matrix keypad and gpio keys and let the name come through platform data.

You can refer how I am doing in PM8058 keypad driver patch.

Not sure what your talking about .. I'm not making a new driver. I'm just using the matrix keypad driver.

Daniel

Signature · 2 lines
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#10 lore raw

PATCH 1/1 msm: trout: add keypad support

Hi Daniel,

Quoted 35 lines · Daniel Walker
Quoted 34 lines · Trilok Soni

Hi Daniel,

Quoted 30 lines · Daniel Walker
Quoted 18 lines · Arve Hj?nnev?g
Quoted 11 lines · Daniel Walker
Quoted 6 lines · Trilok Soni

Review

Quoted 4 lines
(quoted diff) +4 -0
+static char *keycaps = "--qwerty";
+#undef MODULE_PARAM_PREFIX
+#define MODULE_PARAM_PREFIX "board_trout."
+module_param_named(keycaps, keycaps, charp, 0);

I would like to know what is the use of this param?

No idea .. It was part of Google's implementation ..

You removed the code that uses it. If you look at the original file you can see how it is used:
http://android.git.kernel.org/?p=kernel/msm.git;a=blob;f=arch/arm/mach-msm/board-trout-keypad.c;hb=refs/heads/android-msm-2.6.35
It is set by the bootloader according to the hardware version.

Quoted 7 lines

You can also see that the "/* userspace needs to know about these changes as well */" comments refer to the code that changes the name of the input device.

I don't think this change will work correctly with our existing user-space code though since you are now reporting the power-key, camera-key and slide-switch from a separate input device.

Yeah, I did remove those parts.. I'm not sure where to put that stuff in this new implementation. I can try to find an appropriate place , unless you have some suggestions ?

Quoted 7 lines
Quoted 4 lines

To support this, we need to override the input device .name and submit the patches for matrix keypad and gpio keys and let the name come through platform data.

You can refer how I am doing in PM8058 keypad driver patch.

Not sure what your talking about .. I'm not making a new driver. I'm just using the matrix keypad driver.

I am just referring about changing the .name part of input device, which you will need in-order to get the userspace working. For that to happen you need to change gpio-keys and matrix keypad driver. I am not asking about creating a new driver.

---Trilok Soni

Signature · 2 lines
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#11 lore raw

PATCH 1/1 msm: trout: add keypad support

In reply to Daniel Walker
Quoted 2 lines · Daniel Walker

This adds matrix keypad support, and gpio buttons support for trout's various keys and buttons.

Yeah, but everyone knows trout as 'HTC Dream'.

Quoted 1 line

+static const uint32_t trout_keymap_evt2_1[] = {

u32?

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html