generic GPIO driven matrix keypad
Subsystems (2)
PATCH 1/1 generic GPIO driven matrix keypad
Hi,
the following patch adds the generic GPIO driven matrix keypad driver. I tested this on two devices I had available - palmtc and palmt3. It should be able to replace corgikbd.c later as well, but I dont have that device. And since this is platform independent driver, any chip that makes it's GPIOs available through gpiolib should be OK with this driver as well. Please consider applying.
drivers/input/keyboard/Kconfig +10 -0
@@ -323,4 +323,14 @@ config KEYBOARD_SH_KEYSC To compile this driver as a module, choose M here: the module will be called sh_keysc. + +config KEYBOARD_MATRIX + tristate "GPIO driven matrix keypad support" + depends on GENERIC_GPIO + help + Enable support for GPIO driven matrix keypad + + To compile this driver as a module, choose M here: the + module will be called matrix_keypad. + endif
drivers/input/keyboard/Makefile +1 -0
@@ -27,3 +27,4 @@ obj-$(CONFIG_KEYBOARD_HP7XX) += jornada720_kbd.o obj-$(CONFIG_KEYBOARD_MAPLE) += maple_keyb.o obj-$(CONFIG_KEYBOARD_BFIN) += bf54x-keys.o obj-$(CONFIG_KEYBOARD_SH_KEYSC) += sh_keysc.o +obj-$(CONFIG_KEYBOARD_MATRIX) += matrix_keypad.o
drivers/input/keyboard/matrix_keypad.c new file +346 -0
346 lines not on this page · raw message
include/linux/matrix_keypad.h new file +39 -0
@@ -0,0 +1,39 @@ +#ifndef _MATRIX_KEYPAD_H +#define _MATRIX_KEYPAD_H + +#include <linux/input.h> + +struct matrix_keypad_platform_data { + +/* code map for the matrix keys */ +unsigned int *map; +int map_size; + +unsigned int *col_gpio; +int col_gpio_size; +unsigned int *row_gpio; +int row_gpio_size; + +/* line polarities */ +unsigned int col_polarity; +unsigned int row_polarity; + +/* key debounce interval */ +unsigned int scan_delay; + +/* GPIO level change delay */ +unsigned int gpio_delay; + +/* Callbacks */ +int (*suspend)(struct platform_device *dev,pm_message_t state); +int (*resume)(struct platform_device *dev); +}; + +#define KEY (row, col, val) (((row) << 28) | ((col) << 24) | (val & 0xfff)) + +/* key not connected */ +#define KEY_NC 0xfff +/* key to be pressed with shift */ +#define KEY_SFT 0x800 + +#endif /* _MATRIX_KEYPAD_H */
Dne Friday 01 of August 2008 19:50:26 Marek Vasut napsal(a):
Quoted 7 lines
Hi,
the following patch adds the generic GPIO driven matrix keypad driver. I tested this on two devices I had available - palmtc and palmt3. It should be able to replacecorgikbd.clater as well, but I dont have that device. And since this is platform independent driver, any chip that makes it's GPIOs available through gpiolib should be OK with this driver as well. Please consider applying.
Just to be exact, I was reported by Ian Molton, that the matrix keypad driver works on Toshiba e800 as well.