From f4f37c8ec7d2491c8885c890ba74254b9adfbeee Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Sun, 4 Nov 2007 00:41:12 -0400 Subject: Input: Add proper locking when changing device's keymap Take dev->event_lock to make sure that we don't race with input_event() and also force key up event when removing a key from keymap table. Signed-off-by: Dmitry Torokhov --- include/linux/input.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/linux/input.h b/include/linux/input.h index 2075d6d..9a963fe 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -1309,6 +1309,9 @@ static inline void input_set_abs_params(struct input_dev *dev, int axis, int min dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis); } +int input_get_keycode(struct input_dev *dev, int scancode, int *keycode); +int input_set_keycode(struct input_dev *dev, int scancode, int keycode); + extern struct class input_class; /** -- cgit v1.1 From 93e9012f40f75b8ab8a37deaf532b3c5e9b527c6 Mon Sep 17 00:00:00 2001 From: Dmitry Baryshkov Date: Mon, 21 Jan 2008 01:04:20 -0500 Subject: Input: add Tosa keyboard driver Add keyboard support on tosa (Sharp Zaurus SL-6000x). Largely based on patches by Dirk Opfer. Signed-off-by: Dmitry Baryshkov Signed-off-by: Dmitry Torokhov --- include/asm-arm/arch-pxa/tosa.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'include') diff --git a/include/asm-arm/arch-pxa/tosa.h b/include/asm-arm/arch-pxa/tosa.h index c3364a2..c05e4fa 100644 --- a/include/asm-arm/arch-pxa/tosa.h +++ b/include/asm-arm/arch-pxa/tosa.h @@ -163,4 +163,34 @@ extern struct platform_device tosascoop_jc_device; extern struct platform_device tosascoop_device; + +#define TOSA_KEY_SYNC KEY_102ND /* ??? */ + + +#ifndef CONFIG_KEYBOARD_TOSA_USE_EXT_KEYCODES +#define TOSA_KEY_RECORD KEY_YEN +#define TOSA_KEY_ADDRESSBOOK KEY_KATAKANA +#define TOSA_KEY_CANCEL KEY_ESC +#define TOSA_KEY_CENTER KEY_HIRAGANA +#define TOSA_KEY_OK KEY_HENKAN +#define TOSA_KEY_CALENDAR KEY_KATAKANAHIRAGANA +#define TOSA_KEY_HOMEPAGE KEY_HANGEUL +#define TOSA_KEY_LIGHT KEY_MUHENKAN +#define TOSA_KEY_MENU KEY_HANJA +#define TOSA_KEY_FN KEY_RIGHTALT +#define TOSA_KEY_MAIL KEY_ZENKAKUHANKAKU +#else +#define TOSA_KEY_RECORD KEY_RECORD +#define TOSA_KEY_ADDRESSBOOK KEY_ADDRESSBOOK +#define TOSA_KEY_CANCEL KEY_CANCEL +#define TOSA_KEY_CENTER KEY_SELECT /* ??? */ +#define TOSA_KEY_OK KEY_OK +#define TOSA_KEY_CALENDAR KEY_CALENDAR +#define TOSA_KEY_HOMEPAGE KEY_HOMEPAGE +#define TOSA_KEY_LIGHT KEY_KBDILLUMTOGGLE +#define TOSA_KEY_MENU KEY_MENU +#define TOSA_KEY_FN KEY_FN +#define TOSA_KEY_MAIL KEY_MAIL +#endif + #endif /* _ASM_ARCH_TOSA_H_ */ -- cgit v1.1 From 0c1efd365306c9b04df5abdd41e9b4dc721e84fb Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Mon, 21 Jan 2008 01:08:24 -0500 Subject: Input: remove cdev from input_dev structure Cdev field was obsolete and provided only for backward compatibility since conversion of input core from class devices to regular devices. It is time to remove it. Signed-off-by: Dmitry Torokhov --- include/linux/input.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'include') diff --git a/include/linux/input.h b/include/linux/input.h index 9a963fe..48937ff 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -1018,7 +1018,6 @@ struct ff_effect { * @going_away: marks devices that are in a middle of unregistering and * causes input_open_device*() fail with -ENODEV. * @dev: driver model's view of this device - * @cdev: union for struct device pointer * @h_list: list of input handles associated with the device. When * accessing the list dev->mutex must be held * @node: used to place the device onto input_dev_list @@ -1083,9 +1082,6 @@ struct input_dev { int going_away; struct device dev; - union { /* temporarily so while we switching to struct device */ - struct device *dev; - } cdev; struct list_head h_list; struct list_head node; -- cgit v1.1 From 0e5f11aa80bd01d048f374cc64ef0819ad7d86f2 Mon Sep 17 00:00:00 2001 From: Eric Miao Date: Thu, 31 Jan 2008 00:56:46 -0500 Subject: Input: pxa27x_keypad - rename the driver (was pxa27x_keyboard) The controller should really be called keypad, and also align the naming of functions and structures to use "pxa27x_keypad" as prefix, instead of "pxakbd". Signed-off-by: Eric Miao Signed-off-by: Dmitry Torokhov --- include/asm-arm/arch-pxa/pxa27x_keyboard.h | 13 ------------- include/asm-arm/arch-pxa/pxa27x_keypad.h | 13 +++++++++++++ 2 files changed, 13 insertions(+), 13 deletions(-) delete mode 100644 include/asm-arm/arch-pxa/pxa27x_keyboard.h create mode 100644 include/asm-arm/arch-pxa/pxa27x_keypad.h (limited to 'include') diff --git a/include/asm-arm/arch-pxa/pxa27x_keyboard.h b/include/asm-arm/arch-pxa/pxa27x_keyboard.h deleted file mode 100644 index 3aaff92..0000000 --- a/include/asm-arm/arch-pxa/pxa27x_keyboard.h +++ /dev/null @@ -1,13 +0,0 @@ -#define PXAKBD_MAXROW 8 -#define PXAKBD_MAXCOL 8 - -struct pxa27x_keyboard_platform_data { - int nr_rows, nr_cols; - int keycodes[PXAKBD_MAXROW][PXAKBD_MAXCOL]; - int gpio_modes[PXAKBD_MAXROW + PXAKBD_MAXCOL]; - -#ifdef CONFIG_PM - u32 reg_kpc; - u32 reg_kprec; -#endif -}; diff --git a/include/asm-arm/arch-pxa/pxa27x_keypad.h b/include/asm-arm/arch-pxa/pxa27x_keypad.h new file mode 100644 index 0000000..f19f74a --- /dev/null +++ b/include/asm-arm/arch-pxa/pxa27x_keypad.h @@ -0,0 +1,13 @@ +#define PXAKBD_MAXROW 8 +#define PXAKBD_MAXCOL 8 + +struct pxa27x_keypad_platform_data { + int nr_rows, nr_cols; + int keycodes[PXAKBD_MAXROW][PXAKBD_MAXCOL]; + int gpio_modes[PXAKBD_MAXROW + PXAKBD_MAXCOL]; + +#ifdef CONFIG_PM + u32 reg_kpc; + u32 reg_kprec; +#endif +}; -- cgit v1.1 From 1a1cd739a4b985f87c47e2809db7e240dba2c385 Mon Sep 17 00:00:00 2001 From: Eric Miao Date: Thu, 31 Jan 2008 00:58:00 -0500 Subject: Input: pxa27x_keypad - remove pin configuration from the driver The pin configurations will slowly be moved to the board specific code at initialization thus to make the driver more generic. Signed-off-by: Eric Miao Signed-off-by: Dmitry Torokhov --- include/asm-arm/arch-pxa/pxa27x_keypad.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/asm-arm/arch-pxa/pxa27x_keypad.h b/include/asm-arm/arch-pxa/pxa27x_keypad.h index f19f74a..ef17db6 100644 --- a/include/asm-arm/arch-pxa/pxa27x_keypad.h +++ b/include/asm-arm/arch-pxa/pxa27x_keypad.h @@ -4,7 +4,6 @@ struct pxa27x_keypad_platform_data { int nr_rows, nr_cols; int keycodes[PXAKBD_MAXROW][PXAKBD_MAXCOL]; - int gpio_modes[PXAKBD_MAXROW + PXAKBD_MAXCOL]; #ifdef CONFIG_PM u32 reg_kpc; -- cgit v1.1 From 1814db69698479eec2c000a43c83b5f263f6fbb6 Mon Sep 17 00:00:00 2001 From: Eric Miao Date: Thu, 31 Jan 2008 00:58:37 -0500 Subject: Input: pxa27x_keypad - introduce driver structure and use KEY() to define matrix keys 1. Introduce the "struct pxa27x_keypad" structure for driver specific information, such as "struct clk", generated matrix key codes and so on 2. Use KEY() macro to define matrix keys, instead of original 8x8 map this makes definition easier with keypad where keys are sparse 3. Keep a generated array in "struct pxa27x_keypad" for fast lookup 4. Separate the matrix scan into a dedicated function for readability and report only those keys whose state has been changed, instead of report all states 5. Make use of KPAS to decide the faster path if only one key has been detected Signed-off-by: Eric Miao Signed-off-by: Dmitry Torokhov --- include/asm-arm/arch-pxa/pxa27x_keypad.h | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/asm-arm/arch-pxa/pxa27x_keypad.h b/include/asm-arm/arch-pxa/pxa27x_keypad.h index ef17db6..1b1bf9f 100644 --- a/include/asm-arm/arch-pxa/pxa27x_keypad.h +++ b/include/asm-arm/arch-pxa/pxa27x_keypad.h @@ -1,12 +1,25 @@ -#define PXAKBD_MAXROW 8 -#define PXAKBD_MAXCOL 8 +#ifndef __ASM_ARCH_PXA27x_KEYPAD_H +#define __ASM_ARCH_PXA27x_KEYPAD_H + +#include + +#define MAX_MATRIX_KEY_ROWS (8) +#define MAX_MATRIX_KEY_COLS (8) struct pxa27x_keypad_platform_data { - int nr_rows, nr_cols; - int keycodes[PXAKBD_MAXROW][PXAKBD_MAXCOL]; + + /* code map for the matrix keys */ + unsigned int matrix_key_rows; + unsigned int matrix_key_cols; + unsigned int *matrix_key_map; + int matrix_key_map_size; #ifdef CONFIG_PM u32 reg_kpc; u32 reg_kprec; #endif }; + +#define KEY(row, col, val) (((row) << 28) | ((col) << 24) | (val)) + +#endif /* __ASM_ARCH_PXA27x_KEYPAD_H */ -- cgit v1.1 From d7416f9eaa5427f47648973aac3a65e7a0eeda04 Mon Sep 17 00:00:00 2001 From: Eric Miao Date: Thu, 31 Jan 2008 00:58:52 -0500 Subject: Input: pxa27x_keypad - introduce pxa27x_keypad_config() Introduce pxa27x_keypad_config() for keypad registers configuration and remove the reg_kpc, reg_kprec from platform data structure so that configurations of keypad registers can be centralized to a single function. It can also be re-used when resuming. Signed-off-by: Eric Miao Signed-off-by: Dmitry Torokhov --- include/asm-arm/arch-pxa/pxa27x_keypad.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'include') diff --git a/include/asm-arm/arch-pxa/pxa27x_keypad.h b/include/asm-arm/arch-pxa/pxa27x_keypad.h index 1b1bf9f..23f4ebc 100644 --- a/include/asm-arm/arch-pxa/pxa27x_keypad.h +++ b/include/asm-arm/arch-pxa/pxa27x_keypad.h @@ -13,11 +13,6 @@ struct pxa27x_keypad_platform_data { unsigned int matrix_key_cols; unsigned int *matrix_key_map; int matrix_key_map_size; - -#ifdef CONFIG_PM - u32 reg_kpc; - u32 reg_kprec; -#endif }; #define KEY(row, col, val) (((row) << 28) | ((col) << 24) | (val)) -- cgit v1.1 From 62059d9e912717abbfb875440621d935d091f289 Mon Sep 17 00:00:00 2001 From: Eric Miao Date: Thu, 31 Jan 2008 00:59:03 -0500 Subject: Input: pxa27x_keypad - enable rotary encoders and direct keys 1. Rotary encoder events can be configured either as relative events as the legacy code does or as any specified key code, this is useful on some platform which uses the rotary keys as KEY_{UP/DOWN/LEFT/RIGHT} 2. Add support for direct keys, the corresponding keycodes for each direct key can now be specified within the platform data 3. Remove the direct/rotary key detection code from the IRQ handler to dedicated functions to improve readability Signed-off-by: Eric Miao Signed-off-by: Dmitry Torokhov --- include/asm-arm/arch-pxa/pxa27x_keypad.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'include') diff --git a/include/asm-arm/arch-pxa/pxa27x_keypad.h b/include/asm-arm/arch-pxa/pxa27x_keypad.h index 23f4ebc..6b832329 100644 --- a/include/asm-arm/arch-pxa/pxa27x_keypad.h +++ b/include/asm-arm/arch-pxa/pxa27x_keypad.h @@ -6,6 +6,20 @@ #define MAX_MATRIX_KEY_ROWS (8) #define MAX_MATRIX_KEY_COLS (8) +/* pxa3xx keypad platform specific parameters + * + * NOTE: + * 1. direct_key_num indicates the number of keys in the direct keypad + * _plus_ the number of rotary-encoder sensor inputs, this can be + * left as 0 if only rotary encoders are enabled, the driver will + * automatically calculate this + * + * 2. direct_key_map is the key code map for the direct keys, if rotary + * encoder(s) are enabled, direct key 0/1(2/3) will be ignored + * + * 3. rotary can be either interpreted as a relative input event (e.g. + * REL_WHEEL/REL_HWHEEL) or specific keys (e.g. UP/DOWN/LEFT/RIGHT) + */ struct pxa27x_keypad_platform_data { /* code map for the matrix keys */ @@ -13,6 +27,22 @@ struct pxa27x_keypad_platform_data { unsigned int matrix_key_cols; unsigned int *matrix_key_map; int matrix_key_map_size; + + /* direct keys */ + int direct_key_num; + unsigned int direct_key_map[8]; + + /* rotary encoders 0 */ + int enable_rotary0; + int rotary0_rel_code; + int rotary0_up_key; + int rotary0_down_key; + + /* rotary encoders 1 */ + int enable_rotary1; + int rotary1_rel_code; + int rotary1_up_key; + int rotary1_down_key; }; #define KEY(row, col, val) (((row) << 28) | ((col) << 24) | (val)) -- cgit v1.1 From 76cb44e1a853f9c438ccf62eb5006f089430da72 Mon Sep 17 00:00:00 2001 From: Eric Miao Date: Thu, 31 Jan 2008 00:59:23 -0500 Subject: Input: pxa27x_keypad - add debounce_interval to the keypad platform data Currently, only one debounce_interval is introduced for both direct and matrix keys. This is true in most cases, although the keypad controller supports different debounce for direct/matrix keys. Some platforms do require this to be tuned, instead of the default reset value of 100ms. Rotary encoder will always use zero debounce time for now to achieve certain sensitivity. Signed-off-by: Eric Miao Signed-off-by: Dmitry Torokhov --- include/asm-arm/arch-pxa/pxa27x_keypad.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/asm-arm/arch-pxa/pxa27x_keypad.h b/include/asm-arm/arch-pxa/pxa27x_keypad.h index 6b832329..644f760 100644 --- a/include/asm-arm/arch-pxa/pxa27x_keypad.h +++ b/include/asm-arm/arch-pxa/pxa27x_keypad.h @@ -19,6 +19,9 @@ * * 3. rotary can be either interpreted as a relative input event (e.g. * REL_WHEEL/REL_HWHEEL) or specific keys (e.g. UP/DOWN/LEFT/RIGHT) + * + * 4. matrix key and direct key will use the same debounce_interval by + * default, which should be sufficient in most cases */ struct pxa27x_keypad_platform_data { @@ -43,6 +46,9 @@ struct pxa27x_keypad_platform_data { int rotary1_rel_code; int rotary1_up_key; int rotary1_down_key; + + /* key debounce interval */ + unsigned int debounce_interval; }; #define KEY(row, col, val) (((row) << 28) | ((col) << 24) | (val)) -- cgit v1.1