Skip to contentSkip to conversation

input: mcs5000 - Add MCS5000 touchkey support

PATCH In review Joonyoung Shim 2 participants 4 messages May 20, 2010

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

PATCH 1/1 input: mcs5000 - Add MCS5000 touchkey support

The MELPAS MCS5000 can use to touchkey controller. This is patch to support touchkey at original MCS5000 touchscreen driver.

---
 drivers/input/touchscreen/Kconfig      |    6 +-
 drivers/input/touchscreen/mcs5000_ts.c |  245 ++++++++++++++++++++++++--------
 include/linux/i2c/mcs5000_ts.h         |   17 ++-
 3 files changed, 201 insertions(+), 67 deletions(-)
drivers/input/touchscreen/Kconfig +3 -3
index cc47198..d569e87 100644
@@ -202,11 +202,11 @@ config TOUCHSCREEN_WACOM_W8001
 	  module will be called wacom_w8001.
 
 config TOUCHSCREEN_MCS5000
-	tristate "MELFAS MCS-5000 touchscreen"
+	tristate "MELFAS MCS5000 touchscreen/touchkey"
 	depends on I2C
 	help
-	  Say Y here if you have the MELFAS MCS-5000 touchscreen controller
-	  chip in your system.
+	  Say Y here if you have the MELFAS MCS5000 touchscreen/touchkey
+	  controller chip in your system.
 
 	  If unsure, say N.
 
drivers/input/touchscreen/mcs5000_ts.c +184 -61

373 lines not on this page · raw message

include/linux/i2c/mcs5000_ts.h +14 -3
index 5a117b5..578e3e5 100644
@@ -1,8 +1,9 @@
 /*
  * mcs5000_ts.h
  *
- * Copyright (C) 2009 Samsung Electronics Co.Ltd
+ * Copyright (C) 2009 - 2010 Samsung Electronics Co.Ltd
  * Author: Joonyoung Shim <[email protected]>
+ * Author: HeungJun Kim <[email protected]>
  *
  *  This program is free software; you can redistribute  it and/or modify it
  *  under  the terms of  the GNU General  Public License as published by the
@@ -14,11 +15,21 @@
 #ifndef __LINUX_MCS5000_TS_H
 #define __LINUX_MCS5000_TS_H
 
-/* platform data for the MELFAS MCS-5000 touchscreen driver */
-struct mcs5000_ts_platform_data {
+#define MCS5000_KEY_MAP(v, c)		((((v) & 0xff) << 16) | ((c) & 0xffff))
+#define MCS5000_KEY_VAL(v)		(((v) >> 16) & 0xff)
+#define MCS5000_KEY_CODE(v)		((v) & 0xffff)
+
+/* platform data for the MELFAS MCS5000 touchscreen/touchkey driver */
+struct mcs5000_platform_data {
 	void (*cfg_pin)(void);
+
+	/* touchscreen */
 	int x_size;
 	int y_size;
+
+	/* touchkey */
+	const uint32_t *keymap;
+	unsigned int keymap_size;
 };
 
 #endif	/* __LINUX_MCS5000_TS_H */
Signature · 1 line
1.7.0.4
maintainer
#1 lore raw

Hi Joonyoung,

Quoted 3 lines · Joonyoung Shim

The MELPAS MCS5000 can use to touchkey controller. This is patch to support touchkey at original MCS5000 touchscreen driver.

Not much of the touchscreen code ends up being reused it seems. Would not creating a separate keypad driver make more sense?

Also, please amke sure that driver allows remapping the keymap (by setting keycode, kmeycodemax, keycodesize in input device).

Quoted 4 lines
drivers/input/touchscreen/mcs5000_ts.c +4 -0
+
+	key_val = val & 0x7f;
+	pressed = val >> 7;
+

drivers/input/touchscreen/mcs5000_ts.c enum mcs5000_ts_read_offset { · line 161

Quoted 10 lines
drivers/input/touchscreen/mcs5000_ts.c +10 -0
+	if (pressed) {
+		for (i = 0; i < pdata->keymap_size; i++) {
+			if (MCS5000_KEY_VAL(pdata->keymap[i]) == key_val) {
+				key_code = MCS5000_KEY_CODE(pdata->keymap[i]);
+				data->key_code = key_code;
+				break;
+			}
+		}
+	} else
+		key_code = data->key_code;

Does that mean that controller does not report code of released key? And we can't have several keys being pressed at once?

drivers/input/touchscreen/mcs5000_ts.c enum mcs5000_ts_read_offset { · line 164

Quoted 3 lines
drivers/input/touchscreen/mcs5000_ts.c +3 -0
+
+	input_report_key(input, key_code, pressed ? 1 : 0);
+	input_sync(input);

Please also report EV_MSC/MSC_SCAN.

Thanks.

Signature · 1 line
Dmitry
#2 lore raw
Quoted 10 lines · Dmitry Torokhov

Hi Joonyoung,

Quoted 3 lines · Joonyoung Shim

The MELPAS MCS5000 can use to touchkey controller. This is patch to support touchkey at original MCS5000 touchscreen driver.

Not much of the touchscreen code ends up being reused it seems. Would not creating a separate keypad driver make more sense?

OK, i will make a separate keypad driver and it will support MCS5080 keypad together.

Quoted 3 lines

Also, please amke sure that driver allows remapping the keymap (by setting keycode, kmeycodemax, keycodesize in input device).

Do you mean a implementation of setkeycode and getkeycode functions?

Quoted 9 lines
Quoted 9 lines
drivers/input/touchscreen/mcs5000_ts.c +9 -0
+
+	key_val = val & 0x7f;
+	pressed = val >> 7;
+
+	if (pressed) {
+		for (i = 0; i < pdata->keymap_size; i++) {
+			if (MCS5000_KEY_VAL(pdata->keymap[i]) == key_val) {
+				key_code = MCS5000_KEY_CODE(pdata->keymap[i]);
+				data->key_code = key_code;
Quoted 9 lines

drivers/input/touchscreen/mcs5000_ts.c enum mcs5000_ts_read_offset { · line 161

Quoted 5 lines
drivers/input/touchscreen/mcs5000_ts.c +5 -0
+				break;
+			}
+		}
+	} else
+		key_code = data->key_code;

Does that mean that controller does not report code of released key? And we can't have several keys being pressed at once?

Yes, this keypad doesn't report key values when releases and keypad cannot detect several keys at once, so i saved and used last key_code.

Quoted 6 lines

drivers/input/touchscreen/mcs5000_ts.c enum mcs5000_ts_read_offset { · line 164

Quoted 3 lines
drivers/input/touchscreen/mcs5000_ts.c +3 -0
+
+	input_report_key(input, key_code, pressed ? 1 : 0);
+	input_sync(input);

Please also report EV_MSC/MSC_SCAN.

OK.

Thanks.

maintainer
#3 lore raw
Quoted 12 lines · Joonyoung Shim
Quoted 10 lines · Dmitry Torokhov

Hi Joonyoung,

Quoted 3 lines · Joonyoung Shim

The MELPAS MCS5000 can use to touchkey controller. This is patch to support touchkey at original MCS5000 touchscreen driver.

Not much of the touchscreen code ends up being reused it seems. Would not creating a separate keypad driver make more sense?

Quoted 9 lines

OK, i will make a separate keypad driver and it will support MCS5080 keypad together.

Quoted 3 lines

Also, please amke sure that driver allows remapping the keymap (by setting keycode, kmeycodemax, keycodesize in input device).

Do you mean a implementation of setkeycode and getkeycode functions?

That is another possibility, it all depends on how you organize the keymap.

Signature · 1 line
Dmitry