input: keyboard: Add keys driver for the LPC32xx SoC
Subsystems (4)
PATCH v5 1/1 input: keyboard: Add keys driver for the LPC32xx SoC
This patch adds a driver for the key scan interface of the LPC32xx SoC
For the DT binding: Acked-by: Rob Herring <[email protected]>
---
Applies to v3.5-rc3
Changes since v4:
* Remove irq from struct lpc32xx_kscan_drv
Changes since v3:
* Make driver DT-only since LPC32xx is converted to DT anyway now.
* Use MATRIX_SCAN_CODE()
* Use matrix_keypad_build_keymap()
* Emit MSC_SCAN also
* Use PTR_ERR() on error handling
* Rename return value to error
* Removed unnecessary '&' on initializations with function pointers
* Use CONFIG_PM_SLEEP, dev_pm_ops, SIMPLE_DEV_PM_OPS instead of CONFIG_PM
* Removed devm_*() management
* Re-enabled clock for period of probe()
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
Changes since v1:
* Removed devm_kfree(), lpc32XX_free_dt(), iounmap(), release_mem_region()
* Changed __raw_writel()+__raw_readl() to writel()+readl()
Thanks to Axel Lin, Russell King, Rob Herring, Shubhrajyoti and Dmitry Torokhov 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 | 376 ++++++++++++++++ 4 files changed, 415 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
@@ -332,6 +332,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 && OF + 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
@@ -26,6 +26,7 @@ obj-$(CONFIG_KEYBOARD_LKKBD) += lkkbd.o obj-$(CONFIG_KEYBOARD_LM8323) += lm8323.o obj-$(CONFIG_KEYBOARD_LM8333) += lm8333.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 +376 -0
376 lines not on this page · raw message
Quoted 4 lines · Roland Stigge
This patch adds a driver for the key scan interface of the LPC32xx SoC
Signed-off-by Roland Stigge <[email protected]>For the DT binding: Acked-by: Rob Herring <[email protected]>
Dmitry Torokhov
maintainerQuoted 7 lines · Alexandre Pereira da Silva
Quoted 4 lines · Roland Stigge
This patch adds a driver for the key scan interface of the LPC32xx SoC
Signed-off-by Roland Stigge <[email protected]>For the DT binding: Acked-by: Rob Herring <[email protected]>
FYI:
I am back and should be starting getting through my mail backlog...
Signature · 1 line
Dmitry