new keycodes
Subsystems (5)
cover new keycodes
Hi Dmitry -
Here's a proposal for a few new keycodes. Do you prefer to have such additions in a patch set that actually uses them, instead of preparing for the future like this? Basically I'd just like to have some confirmation that you're not opposed to these before I do something that relies on them.
BR,
Jani.
Jani Nikula (1):
Input: add new keycodes useful in mobile devices
include/linux/input.h | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
RFC PATCH 1/1 Input: add new keycodes useful in mobile devices
From: Jani Nikula <[email protected]>
--- include/linux/input.h | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
include/linux/input.h +5 -0
@@ -595,6 +595,8 @@ struct input_absinfo {#define KEY_NUMERIC_STAR 0x20a#define KEY_NUMERIC_POUND 0x20b +#define KEY_CAMERA_FOCUS 0x210 +/* We avoid low common keys in module aliases so they don't get huge. */ #define KEY_MIN_INTERESTING KEY_MUTE#define KEY_MAX 0x2ff
@@ -677,6 +679,9 @@ struct input_absinfo {#define SW_LINEOUT_INSERT 0x06/* set = inserted */ #define SW_JACK_PHYSICAL_INSERT 0x07/* set = mechanical switch set */ #define SW_VIDEOOUT_INSERT 0x08/* set = inserted */ +#define SW_CAMERA_LENSE_COVER 0x09/* set = lense covered */ +#define SW_KEYPAD_SLIDE 0x0a/* set = keypad slide out */ +#define SW_PROXIMITY 0x0b/* set = proximity sensor covered */ #define SW_MAX 0x0f#define SW_CNT (SW_MAX+1)
Signature · 1 line
1.6.3.2
Dmitry Torokhov
maintainerRe: [RFC PATCH 1/1] Input: add new keycodes useful in mobile devices
Hi Jani,
Quoted 12 lines · Jani Nikula
From: Jani Nikula <[email protected]>
Signed-off-by Jani Nikula <[email protected]>--- include/linux/input.h | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)include/linux/input.h +0
-0
include/linux/input.h struct input_absinfo { · line 598
Quoted 4 lines
include/linux/input.h +1
-0@@ -595,6 +595,8 @@ struct input_absinfo {#define KEY_NUMERIC_STAR 0x20a#define KEY_NUMERIC_POUND 0x20b +#define KEY_CAMERA_FOCUS 0x210
I believe that this has already been discussed and I am OK with adding such keycode, as long and there are in-kernel users.
include/linux/input.h struct input_absinfo { · line 684
Quoted 11 lines
include/linux/input.h +4
-0+/* We avoid low common keys in module aliases so they don't get huge. */ #define KEY_MIN_INTERESTING KEY_MUTE#define KEY_MAX 0x2ff@@ -677,6 +679,9 @@ struct input_absinfo {#define SW_LINEOUT_INSERT 0x06/* set = inserted */ #define SW_JACK_PHYSICAL_INSERT 0x07/* set = mechanical switch set */ #define SW_VIDEOOUT_INSERT 0x08/* set = inserted */ +#define SW_CAMERA_LENSE_COVER 0x09/* set = lense covered */ +#define SW_KEYPAD_SLIDE 0x0a/* set = keypad slide out */ +#define SW_PROXIMITY 0x0b/* set = proximity sensor covered */
Don't quite like the name for this one, any alternatives?
include/linux/input.h struct input_absinfo { · line 687
Quoted 3 lines
include/linux/input.h +0
-0#define SW_MAX 0x0f#define SW_CNT (SW_MAX+1)
Thanks.
Signature · 1 line
Dmitry
Re: [RFC PATCH 1/1] Input: add new keycodes useful in mobile devices
Hi Dmitry -
Quoted 7 lines · ext Dmitry Torokhov
Hi Jani,
Quoted 1 line · Jani Nikula
+#define
SW_PROXIMITY0x0b/* set = proximity sensor covered */Don't quite like the name for this one, any alternatives?
SW_PROXIMITY is admittedly pretty vague, but I don't quite know how specific you'd like it to be. The main idea is to indicate that the device is covered, for example because it's in your pocket or near your ear, so the UI should probably adapt to the situation (for example disable touchscreen and display on some devices). Someone might also use it as a "button" you don't have to touch.
How about one of these?
SW_FRONT_COVEREDSW_FRONT_PROXIMITYSW_DISPLAY_COVEREDSW_DISPLAY_PROXIMITYSW_EARPIECE_MODE (too specific IMHO)
BR,
Jani.
Dmitry Torokhov
maintainerRe: [RFC PATCH 1/1] Input: add new keycodes useful in mobile devices
Quoted 18 lines · Jani Nikula
Hi Dmitry -
Quoted 7 lines · ext Dmitry Torokhov
Hi Jani,
Quoted 1 line · Jani Nikula
+#define
SW_PROXIMITY0x0b/* set = proximity sensor covered */Don't quite like the name for this one, any alternatives?
SW_PROXIMITYis admittedly pretty vague, but I don't quite know how specific you'd like it to be. The main idea is to indicate that the device is covered, for example because it's in your pocket or near your ear, so the UI should probably adapt to the situation (for example disable touchscreen and display on some devices). Someone might also use it as a "button" you don't have to touch.
Quoted 8 lines
How about one of these?
SW_FRONT_COVEREDSW_FRONT_PROXIMITYSW_DISPLAY_COVEREDSW_DISPLAY_PROXIMITYSW_EARPIECE_MODE(too specific IMHO)
Actually I like the "earpiece mode" because it describes the intended use. Another option I think would be SW_HOLSTER_MODE. Proximity made me think alll kinds of things but not the "phone in a pocket" scenario...
Signature · 1 line
Dmitry
cover new input keycodes, gpio-keys for RX-51
Hi Dmitry and Tony -
These patches expose some RX-51 input GPIO lines to user space through gpio-keys, and introduce a few new relevant keycodes.
Dmitry, I hope you don't think I'm being too stubborn, but I'd prefer SW_FRONT_PROXIMITY over SW_EARPIECE_MODE. IMHO front proximity activation describes better what has actually occured; earpiece mode is just one use case for that. The front proximity sensor can be activated by for example shoving the device in pocket or placing it upside down on a surface (an actual use case with accelerometer) in addition to holding the device against your ear. And I know of at least one game that uses the said proximity sensor as fire button. Anyway, in the end it's your call, and I can change it if necessary.
These have been tested with RX-51, vanilla linux-omap, minimal console and evtest.
BR,
Jani.
Jani Nikula (3):
Input: add new keycodes useful in mobile devices ARM OMAP3: RX-51 board: add initialization of gpio keys ARM OMAP3: rx51_defconfig: enable support for gpio keys
arch/arm/configs/rx51_defconfig | 2 +- arch/arm/mach-omap2/board-rx51.c | 84 ++++++++++++++++++++++++++++++++++++++ include/linux/input.h | 5 ++ 3 files changed, 90 insertions(+), 1 deletions(-)
PATCH 1/3 Input: add new keycodes useful in mobile devices
From: Jani Nikula <[email protected]>
Add new codes for camera focus key, and camera lense cover, keypad slide, front proximity switches.
--- include/linux/input.h | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
include/linux/input.h +5 -0
@@ -595,6 +595,8 @@ struct input_absinfo {#define KEY_NUMERIC_STAR 0x20a#define KEY_NUMERIC_POUND 0x20b +#define KEY_CAMERA_FOCUS 0x210 +/* We avoid low common keys in module aliases so they don't get huge. */ #define KEY_MIN_INTERESTING KEY_MUTE#define KEY_MAX 0x2ff
@@ -677,6 +679,9 @@ struct input_absinfo {#define SW_LINEOUT_INSERT 0x06/* set = inserted */ #define SW_JACK_PHYSICAL_INSERT 0x07/* set = mechanical switch set */ #define SW_VIDEOOUT_INSERT 0x08/* set = inserted */ +#define SW_CAMERA_LENSE_COVER 0x09/* set = lense covered */ +#define SW_KEYPAD_SLIDE 0x0a/* set = keypad slide out */ +#define SW_FRONT_PROXIMITY 0x0b/* set = front proximity active */ #define SW_MAX 0x0f#define SW_CNT (SW_MAX+1)
Signature · 1 line
1.6.5.2
PATCH 2/3 ARM OMAP3: RX-51 board: add initialization of gpio keys
From: Jani Nikula <[email protected]>
Initialize some of the RX-51 input GPIO lines as gpio keys.
--- arch/arm/mach-omap2/board-rx51.c | 84 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 84 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-rx51.c +84 -0
@@ -16,6 +16,8 @@#include <linux/clk.h> #include <linux/io.h> #include <linux/gpio.h> +#include <linux/input.h> +#include <linux/gpio_keys.h> #include <mach/hardware.h> #include <asm/mach-types.h>
@@ -30,6 +32,86 @@#include <plat/gpmc.h> #include <plat/usb.h> +#if defined(CONFIG_KEYBOARD_GPIO ) || defined(CONFIG_KEYBOARD_GPIO_MODULE ) + +#define RX51_GPIO_CAMERA_LENSE_COVER 110 +#define RX51_GPIO_CAMERA_FOCUS 68 +#define RX51_GPIO_CAMERA_CAPTURE 69 +#define RX51_GPIO_KEYPAD_SLIDE 71 +#define RX51_GPIO_LOCK_BUTTON 113 +#define RX51_GPIO_PROXIMITY 89 + +#define RX51_GPIO_DEBOUNCE_TIMEOUT 10 + +static struct gpio_keys_button rx51_gpio_keys[] = { + { + .desc ="Camera Lense Cover" , + .type =EV_SW , + .code =SW_CAMERA_LENSE_COVER , + .gpio =RX51_GPIO_CAMERA_LENSE_COVER , + .active_low =1 , + .debounce_interval =RX51_GPIO_DEBOUNCE_TIMEOUT , + }, { + .desc ="Camera Focus" , + .type =EV_KEY , + .code =KEY_CAMERA_FOCUS , + .gpio =RX51_GPIO_CAMERA_FOCUS , + .active_low =1 , + .debounce_interval =RX51_GPIO_DEBOUNCE_TIMEOUT , + }, { + .desc ="Camera Capture" , + .type =EV_KEY , + .code =KEY_CAMERA , + .gpio =RX51_GPIO_CAMERA_CAPTURE , + .active_low =1 , + .debounce_interval =RX51_GPIO_DEBOUNCE_TIMEOUT , + }, { + .desc ="Lock Button" , + .type =EV_KEY , + .code =KEY_SCREENLOCK , + .gpio =RX51_GPIO_LOCK_BUTTON , + .active_low =1 , + .debounce_interval =RX51_GPIO_DEBOUNCE_TIMEOUT , + }, { + .desc ="Keypad Slide" , + .type =EV_SW , + .code =SW_KEYPAD_SLIDE , + .gpio =RX51_GPIO_KEYPAD_SLIDE , + .active_low =1 , + .debounce_interval =RX51_GPIO_DEBOUNCE_TIMEOUT , + }, { + .desc ="Proximity Sensor" , + .type =EV_SW , + .code =SW_FRONT_PROXIMITY , + .gpio =RX51_GPIO_PROXIMITY , + .active_low =0 , + .debounce_interval =RX51_GPIO_DEBOUNCE_TIMEOUT , + } +}; + +static struct gpio_keys_platform_data rx51_gpio_keys_data = { + .buttons = rx51_gpio_keys, + .nbuttons =ARRAY_SIZE (rx51_gpio_keys), +}; + +static struct platform_device rx51_gpio_keys_device = { + .name ="gpio-keys" , + .id =-1 , + .dev = { + .platform_data = &rx51_gpio_keys_data, + }, +}; + +static void __init rx51_add_gpio_keys (void ) +{ +platform_device_register (&rx51_gpio_keys_device); +} +#else +static void __init rx51_add_gpio_keys (void ) +{ +} +#endif +static struct omap_lcd_config rx51_lcd_config = { .ctrl_name ="internal" , };
@@ -73,6 +155,8 @@ static void __init rx51_init(void)/* Ensure SDRC pins are mux'd for self-refresh */ omap_cfg_reg (H16_34XX_SDRC_CKE0 );omap_cfg_reg (H17_34XX_SDRC_CKE1 ); + +rx51_add_gpio_keys (); }static void __init rx51_map_io (void )
Signature · 1 line
1.6.5.2
PATCH 3/3 ARM OMAP3: rx51_defconfig: enable support for gpio keys
From: Jani Nikula <[email protected]>
Compile gpio_keys driver a module.
--- arch/arm/configs/rx51_defconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/configs/rx51_defconfig +1 -1
@@ -784,7 +784,7 @@ CONFIG_INPUT_KEYBOARD=y # CONFIG_KEYBOARD_XTKBD is not set # CONFIG_KEYBOARD_NEWTON is not set # CONFIG_KEYBOARD_STOWAWAY is not set -# CONFIG_KEYBOARD_GPIO is not set +CONFIG_KEYBOARD_GPIO=m # CONFIG_INPUT_MOUSE is not set # CONFIG_INPUT_JOYSTICK is not set # CONFIG_INPUT_TABLET is not set
Signature · 1 line
1.6.5.2
Re: [PATCH 3/3] ARM OMAP3: rx51_defconfig: enable support for gpio keys
Quoted 5 lines · Jani Nikula
From: Jani Nikula <[email protected]>
Compile
gpio_keysdriver a module.Signed-off-by Jani Nikula <[email protected]>
This patch could be merged into 2/3.
Quoted 20 lines
--- arch/arm/configs/rx51_defconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)arch/arm/configs/rx51_defconfig +1
-1@@ -784,7 +784,7 @@ CONFIG_INPUT_KEYBOARD=y # CONFIG_KEYBOARD_XTKBD is not set # CONFIG_KEYBOARD_NEWTON is not set # CONFIG_KEYBOARD_STOWAWAY is not set -# CONFIG_KEYBOARD_GPIO is not set +CONFIG_KEYBOARD_GPIO=m # CONFIG_INPUT_MOUSE is not set # CONFIG_INPUT_JOYSTICK is not set # CONFIG_INPUT_TABLET is not setSignature · 1 line
1.6.5.2
Re: [PATCH 2/3] ARM OMAP3: RX-51 board: add initialization of gpio keys
In reply to Jani NikulaQuoted 5 lines · Jani Nikula
From: Jani Nikula <[email protected]>
Initialize some of the RX-51 input GPIO lines as gpio keys.
Signed-off-by Jani Nikula <[email protected]>
To me this looks like a nice way to deal with all the board specific gpio buttons.
It also looks safe to merge via Dmitry once he's happy with it.
Hmm, should it be in board-rx51-peripherals.c instead? Up to Jani to decide, just a thought.
Quoted 115 lines
arch/arm/mach-omap2/board-rx51.c | 84 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 84 insertions(+), 0 deletions(-)arch/arm/mach-omap2/board-rx51.c +84
-0@@ -16,6 +16,8 @@#include <linux/clk.h> #include <linux/io.h> #include <linux/gpio.h> +#include <linux/input.h> +#include <linux/gpio_keys.h> #include <mach/hardware.h> #include <asm/mach-types.h> @@ -30,6 +32,86 @@#include <plat/gpmc.h> #include <plat/usb.h> +#if defined(CONFIG_KEYBOARD_GPIO ) || defined(CONFIG_KEYBOARD_GPIO_MODULE ) + +#define RX51_GPIO_CAMERA_LENSE_COVER 110 +#define RX51_GPIO_CAMERA_FOCUS 68 +#define RX51_GPIO_CAMERA_CAPTURE 69 +#define RX51_GPIO_KEYPAD_SLIDE 71 +#define RX51_GPIO_LOCK_BUTTON 113 +#define RX51_GPIO_PROXIMITY 89 + +#define RX51_GPIO_DEBOUNCE_TIMEOUT 10 + +static struct gpio_keys_button rx51_gpio_keys[] = { + { + .desc ="Camera Lense Cover" , + .type =EV_SW , + .code =SW_CAMERA_LENSE_COVER , + .gpio =RX51_GPIO_CAMERA_LENSE_COVER , + .active_low =1 , + .debounce_interval =RX51_GPIO_DEBOUNCE_TIMEOUT , + }, { + .desc ="Camera Focus" , + .type =EV_KEY , + .code =KEY_CAMERA_FOCUS , + .gpio =RX51_GPIO_CAMERA_FOCUS , + .active_low =1 , + .debounce_interval =RX51_GPIO_DEBOUNCE_TIMEOUT , + }, { + .desc ="Camera Capture" , + .type =EV_KEY , + .code =KEY_CAMERA , + .gpio =RX51_GPIO_CAMERA_CAPTURE , + .active_low =1 , + .debounce_interval =RX51_GPIO_DEBOUNCE_TIMEOUT , + }, { + .desc ="Lock Button" , + .type =EV_KEY , + .code =KEY_SCREENLOCK , + .gpio =RX51_GPIO_LOCK_BUTTON , + .active_low =1 , + .debounce_interval =RX51_GPIO_DEBOUNCE_TIMEOUT , + }, { + .desc ="Keypad Slide" , + .type =EV_SW , + .code =SW_KEYPAD_SLIDE , + .gpio =RX51_GPIO_KEYPAD_SLIDE , + .active_low =1 , + .debounce_interval =RX51_GPIO_DEBOUNCE_TIMEOUT , + }, { + .desc ="Proximity Sensor" , + .type =EV_SW , + .code =SW_FRONT_PROXIMITY , + .gpio =RX51_GPIO_PROXIMITY , + .active_low =0 , + .debounce_interval =RX51_GPIO_DEBOUNCE_TIMEOUT , + } +}; + +static struct gpio_keys_platform_data rx51_gpio_keys_data = { + .buttons = rx51_gpio_keys, + .nbuttons =ARRAY_SIZE (rx51_gpio_keys), +}; + +static struct platform_device rx51_gpio_keys_device = { + .name ="gpio-keys" , + .id =-1 , + .dev = { + .platform_data = &rx51_gpio_keys_data, + }, +}; + +static void __init rx51_add_gpio_keys (void ) +{ +platform_device_register (&rx51_gpio_keys_device); +} +#else +static void __init rx51_add_gpio_keys (void ) +{ +} +#endif +static struct omap_lcd_config rx51_lcd_config = { .ctrl_name ="internal" , };@@ -73,6 +155,8 @@ static void __init rx51_init(void)/* Ensure SDRC pins are mux'd for self-refresh */ omap_cfg_reg (H16_34XX_SDRC_CKE0 );omap_cfg_reg (H17_34XX_SDRC_CKE1 ); + +rx51_add_gpio_keys (); }static void __init rx51_map_io (void )Signature · 1 line
1.6.5.2
Re: [PATCH 1/3] Input: add new keycodes useful in mobile devices
In reply to Jani NikulaQuoted 1 line
+#define
SW_CAMERA_LENSE_COVER0x09 /* set = lense covered */
The correct spelling is "lens", no trailing "e". (If it were a comment, I wouldn't care, but in a constant it's far more important.
-=- James Mastros
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
v2 cover new input keycodes, gpio-keys for RX-51
In reply to Jani NikulaHi Dmitry and Tony -
These patches expose some RX-51 input GPIO lines to user space through gpio-keys, and introduce a few new relevant keycodes. Second round.
BR,
Jani.
Changes in v2:
* SW_CAMERA_LENS_COVER typo fixed (thanks to James Mastros).
* Use board-rx51-peripherals.c instead of board-rx51.c as suggested by Tony.
* Merge rx51_defconfig change into patch 2/2 as suggested by Tony.
Jani Nikula (2):
Input: add new keycodes useful in mobile devices ARM OMAP3: RX-51 board: add initialization of gpio keys
arch/arm/configs/rx51_defconfig | 2 +- arch/arm/mach-omap2/board-rx51-peripherals.c | 82 ++++++++++++++++++++++++++ include/linux/input.h | 5 ++ 3 files changed, 88 insertions(+), 1 deletions(-)
PATCH v2 1/2 Input: add new keycodes useful in mobile devices
From: Jani Nikula <[email protected]>
Add new codes for camera focus key, and camera lens cover, keypad slide, front proximity switches.
--- include/linux/input.h | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
include/linux/input.h +5 -0
@@ -595,6 +595,8 @@ struct input_absinfo {#define KEY_NUMERIC_STAR 0x20a#define KEY_NUMERIC_POUND 0x20b +#define KEY_CAMERA_FOCUS 0x210 +/* We avoid low common keys in module aliases so they don't get huge. */ #define KEY_MIN_INTERESTING KEY_MUTE#define KEY_MAX 0x2ff
@@ -677,6 +679,9 @@ struct input_absinfo {#define SW_LINEOUT_INSERT 0x06/* set = inserted */ #define SW_JACK_PHYSICAL_INSERT 0x07/* set = mechanical switch set */ #define SW_VIDEOOUT_INSERT 0x08/* set = inserted */ +#define SW_CAMERA_LENS_COVER 0x09/* set = lens covered */ +#define SW_KEYPAD_SLIDE 0x0a/* set = keypad slide out */ +#define SW_FRONT_PROXIMITY 0x0b/* set = front proximity active */ #define SW_MAX 0x0f#define SW_CNT (SW_MAX+1)
Signature · 1 line
1.6.5.2
PATCH v2 2/2 ARM OMAP3: RX-51 board: add initialization of gpio keys
From: Jani Nikula <[email protected]>
Initialize some of the RX-51 input GPIO lines as gpio keys. Enable gpio keys as a module in rx51_defconfig.
--- arch/arm/configs/rx51_defconfig | 2 +- arch/arm/mach-omap2/board-rx51-peripherals.c | 82 ++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 1 deletions(-)
arch/arm/configs/rx51_defconfig +1 -1
@@ -784,7 +784,7 @@ CONFIG_INPUT_KEYBOARD=y # CONFIG_KEYBOARD_XTKBD is not set # CONFIG_KEYBOARD_NEWTON is not set # CONFIG_KEYBOARD_STOWAWAY is not set -# CONFIG_KEYBOARD_GPIO is not set +CONFIG_KEYBOARD_GPIO=m # CONFIG_INPUT_MOUSE is not set # CONFIG_INPUT_JOYSTICK is not set # CONFIG_INPUT_TABLET is not set
arch/arm/mach-omap2/board-rx51-peripherals.c +82 -0
99 lines not on this page · raw message
Signature · 1 line
1.6.5.2
Re: [PATCH v2 0/2] new input keycodes, gpio-keys for RX-51
In reply to Jani NikulaHi Jani,
Quoted 5 lines · Jani Nikula
Hi Dmitry and Tony -
These patches expose some RX-51 input GPIO lines to user space through gpio-keys, and introduce a few new relevant keycodes. Second round.
Applied to next branch, thank you.
Signature · 1 line
Dmitry