input: keyboard: Add keys driver for the LPC32xx SoC
Subsystems (6)
PATCH v3 1/2 input: keyboard: Add keys driver for the LPC32xx SoC
This patch adds a driver for the key scan interface of the LPC32xx SoC
---
Applies to v3.4-rc4
Please pick this patch for the input subsystem.
Changes since v2:
* Fixed case of lpc32XX_* -> lpc32xx_*
* Removed unnecessary casts
* Removed unnecessary unlikely()
* Use unsigned for key bits
* Included Russell's lpc32xx_mod_states() algorithm change suggestion
* Replaced (res == NULL) with (!res)
* clk_enable() -> clk_prepare_enable()
* Moved clk_prepare_enable() and clk_disable_unprepare() to input's open()/close() callbacks to save power
* Handle clk_prepare_enable() return value appropriately
* DT: Use "keypad,num-rows", "keypad,num-columns" and "linux,keymap" properties
Thanks to Axel Lin and Russell King for reviewing!
Documentation/devicetree/bindings/input/lpc32xx-key.txt | 28 + drivers/input/keyboard/Kconfig | 10 drivers/input/keyboard/Makefile | 1 drivers/input/keyboard/lpc32xx-keys.c | 382 ++++++++++++++++ 4 files changed, 421 insertions(+)
Documentation/devicetree/bindings/input/lpc32xx-key.txt new file +28 -0
@@ -0,0 +1,28 @@ +NXP LPC32xx Key Scan Interface + +Required Properties: +- compatible: Should be "nxp,lpc3220-key" +- reg: Physical base address of the controller and length of memory mapped + region. +- interrupts: The interrupt number to the cpu. +- keypad,num-rows: Number of rows and columns, e.g. 1: 1x1, 6: 6x6 +- keypad,num-columns: Must be equal to keypad,num-rows since LPC32xx only + supports square matrices +- nxp,debounce-delay-ms: Debounce delay in ms +- nxp,scan-delay-ms: Repeated scan period in ms +- linux,keymap: the key-code to be reported when the key is pressed + and released, see also + Documentation/devicetree/bindings/input/matrix-keymap.txt + +Example: + + key at 40050000 { + compatible = "nxp,lpc3220-key"; + reg = <0x40050000 0x1000>; + interrupts = <54 0>; + keypad,num-rows = <1>; + keypad,num-columns = <1>; + nxp,debounce-delay-ms = <3>; + nxp,scan-delay-ms = <34>; + linux,keymap = <0x00000002>; + };
drivers/input/keyboard/Kconfig +10 -0
@@ -318,6 +318,16 @@ config KEYBOARD_LOCOMO To compile this driver as a module, choose M here: the module will be called locomokbd. +config KEYBOARD_LPC32XX + tristate "LPC32XX matrix key scanner support" + depends on ARCH_LPC32XX + help + Say Y here if you want to use NXP LPC32XX SoC key scanner interface, + connected to a key matrix. + + To compile this driver as a module, choose M here: the + module will be called lpc32xx-keys. + config KEYBOARD_MAPLE tristate "Maple bus keyboard" depends on SH_DREAMCAST && MAPLE
drivers/input/keyboard/Makefile +1 -0
@@ -25,6 +25,7 @@ obj-$(CONFIG_KEYBOARD_HP7XX) += jornada obj-$(CONFIG_KEYBOARD_LKKBD) += lkkbd.o obj-$(CONFIG_KEYBOARD_LM8323) += lm8323.o obj-$(CONFIG_KEYBOARD_LOCOMO) += locomokbd.o +obj-$(CONFIG_KEYBOARD_LPC32XX) += lpc32xx-keys.o obj-$(CONFIG_KEYBOARD_MAPLE) += maple_keyb.o obj-$(CONFIG_KEYBOARD_MATRIX) += matrix_keypad.o obj-$(CONFIG_KEYBOARD_MAX7359) += max7359_keypad.o
drivers/input/keyboard/lpc32xx-keys.c new file +382 -0
382 lines not on this page · raw message
PATCH v3 2/2 ARM: LPC32xx: Make platform use key driver
This patch connects the lpc32xx-key driver to the LPC32xx platform (via lpc32xx.dtsi), and more specifically to the reference board via its dts file. The clock.c file needs to be changed to match the automatic device name to its clock.
---
Applies to v3.4-rc4 + LPC32xx DT patches
Please pick this patch for the arm-soc subsystem.
Changes since v2:
* DT: Use "keypad,num-rows", "keypad,num-columns" and "linux,keymap" properties
arch/arm/boot/dts/lpc32xx.dtsi | 2 ++ arch/arm/boot/dts/phy3250.dts | 9 +++++++++ arch/arm/mach-lpc32xx/clock.c | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-)
arch/arm/boot/dts/lpc32xx.dtsi +2 -0
@@ -285,6 +285,8 @@ key at 40050000 { compatible = "nxp,lpc3220-key"; reg = <0x40050000 0x1000>; + interrupts = <54 0>; + status = "disable"; }; };
arch/arm/boot/dts/phy3250.dts +9 -0
@@ -124,6 +124,15 @@ tsc at 40048000 { status = "okay"; }; + + key at 40050000 { + status = "okay"; + keypad,num-rows = <1>; + keypad,num-columns = <1>; + nxp,debounce-delay-ms = <3>; + nxp,scan-delay-ms = <34>; + linux,keymap = <0x00000002>; + }; }; };
arch/arm/mach-lpc32xx/clock.c +1 -1
@@ -1131,7 +1131,7 @@ static struct clk_lookup lookups[] = {CLKDEV_INIT ("31020300.i2c" ,NULL , &clk_i2c2),CLKDEV_INIT ("dev:ssp0" ,NULL , &clk_ssp0),CLKDEV_INIT ("dev:ssp1" ,NULL , &clk_ssp1), -CLKDEV_INIT ("lpc32xx_keys.0" ,NULL , &clk_kscan), +CLKDEV_INIT ("40050000.key" ,NULL , &clk_kscan),CLKDEV_INIT ("lpc32xx-nand.0" ,"nand_ck" , &clk_nand),CLKDEV_INIT ("200b0000.flash" ,"nand_ck_mlc" , &clk_nand_mlc), CLKDEV_INIT("40048000.adc", NULL, &clk_adc),