* [PATCH 0/3] new input keycodes, gpio-keys for RX-51 [not found] <20091027162040.GB22541@core.coreip.homeip.net> @ 2009-10-30 13:38 ` Jani Nikula 2009-10-30 13:38 ` [PATCH 1/3] Input: add new keycodes useful in mobile devices Jani Nikula ` (3 more replies) 0 siblings, 4 replies; 11+ messages in thread From: Jani Nikula @ 2009-10-30 13:38 UTC (permalink / raw) To: tony, dmitry.torokhov; +Cc: linux-omap, linux-input, ext-jani.1.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. 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(-) ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/3] Input: add new keycodes useful in mobile devices 2009-10-30 13:38 ` [PATCH 0/3] new input keycodes, gpio-keys for RX-51 Jani Nikula @ 2009-10-30 13:38 ` Jani Nikula 2009-10-30 21:41 ` James Mastros 2009-10-30 13:38 ` [PATCH 2/3] ARM OMAP3: RX-51 board: add initialization of gpio keys Jani Nikula ` (2 subsequent siblings) 3 siblings, 1 reply; 11+ messages in thread From: Jani Nikula @ 2009-10-30 13:38 UTC (permalink / raw) To: tony, dmitry.torokhov; +Cc: linux-omap, linux-input, ext-jani.1.nikula From: Jani Nikula <ext-jani.1.nikula@nokia.com> Add new codes for camera focus key, and camera lense cover, keypad slide, front proximity switches. Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com> --- include/linux/input.h | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/include/linux/input.h b/include/linux/input.h index 0ccfc30..c90a177 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -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) -- 1.6.5.2 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/3] Input: add new keycodes useful in mobile devices 2009-10-30 13:38 ` [PATCH 1/3] Input: add new keycodes useful in mobile devices Jani Nikula @ 2009-10-30 21:41 ` James Mastros 0 siblings, 0 replies; 11+ messages in thread From: James Mastros @ 2009-10-30 21:41 UTC (permalink / raw) To: Jani Nikula; +Cc: tony, dmitry.torokhov, linux-omap, linux-input > +#define SW_CAMERA_LENSE_COVER 0x09 /* 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 majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/3] ARM OMAP3: RX-51 board: add initialization of gpio keys 2009-10-30 13:38 ` [PATCH 0/3] new input keycodes, gpio-keys for RX-51 Jani Nikula 2009-10-30 13:38 ` [PATCH 1/3] Input: add new keycodes useful in mobile devices Jani Nikula @ 2009-10-30 13:38 ` Jani Nikula 2009-10-30 17:43 ` Tony Lindgren 2009-10-30 13:38 ` [PATCH 3/3] ARM OMAP3: rx51_defconfig: enable support for " Jani Nikula 2009-11-04 15:13 ` [PATCH v2 0/2] new input keycodes, gpio-keys for RX-51 Jani Nikula 3 siblings, 1 reply; 11+ messages in thread From: Jani Nikula @ 2009-10-30 13:38 UTC (permalink / raw) To: tony, dmitry.torokhov; +Cc: linux-omap, linux-input, ext-jani.1.nikula From: Jani Nikula <ext-jani.1.nikula@nokia.com> Initialize some of the RX-51 input GPIO lines as gpio keys. Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com> --- arch/arm/mach-omap2/board-rx51.c | 84 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 84 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/board-rx51.c b/arch/arm/mach-omap2/board-rx51.c index f1e7e5b..fe47790 100644 --- a/arch/arm/mach-omap2/board-rx51.c +++ b/arch/arm/mach-omap2/board-rx51.c @@ -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) -- 1.6.5.2 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 2/3] ARM OMAP3: RX-51 board: add initialization of gpio keys 2009-10-30 13:38 ` [PATCH 2/3] ARM OMAP3: RX-51 board: add initialization of gpio keys Jani Nikula @ 2009-10-30 17:43 ` Tony Lindgren 0 siblings, 0 replies; 11+ messages in thread From: Tony Lindgren @ 2009-10-30 17:43 UTC (permalink / raw) To: Jani Nikula; +Cc: dmitry.torokhov, linux-omap, linux-input * Jani Nikula <ext-jani.1.nikula@nokia.com> [091030 06:38]: > From: Jani Nikula <ext-jani.1.nikula@nokia.com> > > Initialize some of the RX-51 input GPIO lines as gpio keys. > > Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com> 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. Acked-by: Tony Lindgren <tony@atomide.com> > arch/arm/mach-omap2/board-rx51.c | 84 ++++++++++++++++++++++++++++++++++++++ > 1 files changed, 84 insertions(+), 0 deletions(-) > > diff --git a/arch/arm/mach-omap2/board-rx51.c b/arch/arm/mach-omap2/board-rx51.c > index f1e7e5b..fe47790 100644 > --- a/arch/arm/mach-omap2/board-rx51.c > +++ b/arch/arm/mach-omap2/board-rx51.c > @@ -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) > -- > 1.6.5.2 > ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 3/3] ARM OMAP3: rx51_defconfig: enable support for gpio keys 2009-10-30 13:38 ` [PATCH 0/3] new input keycodes, gpio-keys for RX-51 Jani Nikula 2009-10-30 13:38 ` [PATCH 1/3] Input: add new keycodes useful in mobile devices Jani Nikula 2009-10-30 13:38 ` [PATCH 2/3] ARM OMAP3: RX-51 board: add initialization of gpio keys Jani Nikula @ 2009-10-30 13:38 ` Jani Nikula 2009-10-30 17:44 ` Tony Lindgren 2009-11-04 15:13 ` [PATCH v2 0/2] new input keycodes, gpio-keys for RX-51 Jani Nikula 3 siblings, 1 reply; 11+ messages in thread From: Jani Nikula @ 2009-10-30 13:38 UTC (permalink / raw) To: tony, dmitry.torokhov; +Cc: linux-omap, linux-input, ext-jani.1.nikula From: Jani Nikula <ext-jani.1.nikula@nokia.com> Compile gpio_keys driver a module. Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com> --- arch/arm/configs/rx51_defconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/arm/configs/rx51_defconfig b/arch/arm/configs/rx51_defconfig index e7e3133..1559734 100644 --- a/arch/arm/configs/rx51_defconfig +++ b/arch/arm/configs/rx51_defconfig @@ -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 -- 1.6.5.2 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 3/3] ARM OMAP3: rx51_defconfig: enable support for gpio keys 2009-10-30 13:38 ` [PATCH 3/3] ARM OMAP3: rx51_defconfig: enable support for " Jani Nikula @ 2009-10-30 17:44 ` Tony Lindgren 0 siblings, 0 replies; 11+ messages in thread From: Tony Lindgren @ 2009-10-30 17:44 UTC (permalink / raw) To: Jani Nikula; +Cc: dmitry.torokhov, linux-omap, linux-input * Jani Nikula <ext-jani.1.nikula@nokia.com> [091030 06:38]: > From: Jani Nikula <ext-jani.1.nikula@nokia.com> > > Compile gpio_keys driver a module. > > Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com> This patch could be merged into 2/3. Acked-by: Tony Lindgren <tony@atomide.com> > --- > arch/arm/configs/rx51_defconfig | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/arch/arm/configs/rx51_defconfig b/arch/arm/configs/rx51_defconfig > index e7e3133..1559734 100644 > --- a/arch/arm/configs/rx51_defconfig > +++ b/arch/arm/configs/rx51_defconfig > @@ -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 > -- > 1.6.5.2 > ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 0/2] new input keycodes, gpio-keys for RX-51 2009-10-30 13:38 ` [PATCH 0/3] new input keycodes, gpio-keys for RX-51 Jani Nikula ` (2 preceding siblings ...) 2009-10-30 13:38 ` [PATCH 3/3] ARM OMAP3: rx51_defconfig: enable support for " Jani Nikula @ 2009-11-04 15:13 ` Jani Nikula 2009-11-04 15:13 ` [PATCH v2 1/2] Input: add new keycodes useful in mobile devices Jani Nikula ` (2 more replies) 3 siblings, 3 replies; 11+ messages in thread From: Jani Nikula @ 2009-11-04 15:13 UTC (permalink / raw) To: tony, dmitry.torokhov; +Cc: james, linux-omap, linux-input, ext-jani.1.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. 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(-) ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 1/2] Input: add new keycodes useful in mobile devices 2009-11-04 15:13 ` [PATCH v2 0/2] new input keycodes, gpio-keys for RX-51 Jani Nikula @ 2009-11-04 15:13 ` Jani Nikula 2009-11-04 15:13 ` [PATCH v2 2/2] ARM OMAP3: RX-51 board: add initialization of gpio keys Jani Nikula 2009-11-06 7:40 ` [PATCH v2 0/2] new input keycodes, gpio-keys for RX-51 Dmitry Torokhov 2 siblings, 0 replies; 11+ messages in thread From: Jani Nikula @ 2009-11-04 15:13 UTC (permalink / raw) To: tony, dmitry.torokhov; +Cc: james, linux-omap, linux-input, ext-jani.1.nikula From: Jani Nikula <ext-jani.1.nikula@nokia.com> Add new codes for camera focus key, and camera lens cover, keypad slide, front proximity switches. Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com> --- include/linux/input.h | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/include/linux/input.h b/include/linux/input.h index 0ccfc30..0e25401 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -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) -- 1.6.5.2 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 2/2] ARM OMAP3: RX-51 board: add initialization of gpio keys 2009-11-04 15:13 ` [PATCH v2 0/2] new input keycodes, gpio-keys for RX-51 Jani Nikula 2009-11-04 15:13 ` [PATCH v2 1/2] Input: add new keycodes useful in mobile devices Jani Nikula @ 2009-11-04 15:13 ` Jani Nikula 2009-11-06 7:40 ` [PATCH v2 0/2] new input keycodes, gpio-keys for RX-51 Dmitry Torokhov 2 siblings, 0 replies; 11+ messages in thread From: Jani Nikula @ 2009-11-04 15:13 UTC (permalink / raw) To: tony, dmitry.torokhov; +Cc: james, linux-omap, linux-input, ext-jani.1.nikula From: Jani Nikula <ext-jani.1.nikula@nokia.com> Initialize some of the RX-51 input GPIO lines as gpio keys. Enable gpio keys as a module in rx51_defconfig. Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com> --- arch/arm/configs/rx51_defconfig | 2 +- arch/arm/mach-omap2/board-rx51-peripherals.c | 82 ++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 1 deletions(-) diff --git a/arch/arm/configs/rx51_defconfig b/arch/arm/configs/rx51_defconfig index e7e3133..1559734 100644 --- a/arch/arm/configs/rx51_defconfig +++ b/arch/arm/configs/rx51_defconfig @@ -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 diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c index cf4583a..fb5988c 100644 --- a/arch/arm/mach-omap2/board-rx51-peripherals.c +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c @@ -20,6 +20,7 @@ #include <linux/delay.h> #include <linux/regulator/machine.h> #include <linux/gpio.h> +#include <linux/gpio_keys.h> #include <linux/mmc/host.h> #include <plat/mcspi.h> @@ -36,6 +37,86 @@ #define SYSTEM_REV_B_USES_VAUX3 0x1699 #define SYSTEM_REV_S_USES_VAUX3 0x8 +#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) + +#define RX51_GPIO_CAMERA_LENS_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 Lens Cover", + .type = EV_SW, + .code = SW_CAMERA_LENS_COVER, + .gpio = RX51_GPIO_CAMERA_LENS_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 /* CONFIG_KEYBOARD_GPIO || CONFIG_KEYBOARD_GPIO_MODULE */ + static int board_keymap[] = { KEY(0, 0, KEY_Q), KEY(0, 1, KEY_O), @@ -541,5 +622,6 @@ void __init rx51_peripherals_init(void) rx51_i2c_init(); board_onenand_init(); board_smc91x_init(); + rx51_add_gpio_keys(); } -- 1.6.5.2 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v2 0/2] new input keycodes, gpio-keys for RX-51 2009-11-04 15:13 ` [PATCH v2 0/2] new input keycodes, gpio-keys for RX-51 Jani Nikula 2009-11-04 15:13 ` [PATCH v2 1/2] Input: add new keycodes useful in mobile devices Jani Nikula 2009-11-04 15:13 ` [PATCH v2 2/2] ARM OMAP3: RX-51 board: add initialization of gpio keys Jani Nikula @ 2009-11-06 7:40 ` Dmitry Torokhov 2 siblings, 0 replies; 11+ messages in thread From: Dmitry Torokhov @ 2009-11-06 7:40 UTC (permalink / raw) To: Jani Nikula; +Cc: tony, james, linux-omap, linux-input Hi Jani, On Wed, Nov 04, 2009 at 05:13:56PM +0200, Jani Nikula wrote: > 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. -- Dmitry ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2009-11-06 7:40 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20091027162040.GB22541@core.coreip.homeip.net>
2009-10-30 13:38 ` [PATCH 0/3] new input keycodes, gpio-keys for RX-51 Jani Nikula
2009-10-30 13:38 ` [PATCH 1/3] Input: add new keycodes useful in mobile devices Jani Nikula
2009-10-30 21:41 ` James Mastros
2009-10-30 13:38 ` [PATCH 2/3] ARM OMAP3: RX-51 board: add initialization of gpio keys Jani Nikula
2009-10-30 17:43 ` Tony Lindgren
2009-10-30 13:38 ` [PATCH 3/3] ARM OMAP3: rx51_defconfig: enable support for " Jani Nikula
2009-10-30 17:44 ` Tony Lindgren
2009-11-04 15:13 ` [PATCH v2 0/2] new input keycodes, gpio-keys for RX-51 Jani Nikula
2009-11-04 15:13 ` [PATCH v2 1/2] Input: add new keycodes useful in mobile devices Jani Nikula
2009-11-04 15:13 ` [PATCH v2 2/2] ARM OMAP3: RX-51 board: add initialization of gpio keys Jani Nikula
2009-11-06 7:40 ` [PATCH v2 0/2] new input keycodes, gpio-keys for RX-51 Dmitry Torokhov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox