Add device tree support for Samsung's keypad controller driver
Subsystems (4)
v4 cover Add device tree support for Samsung's keypad controller driver
Changes since v3:
- Addressed comments from Grant Likely.
- Set num_rows and num_cols to zero in samsung_keypad_parse_dt function.
- Fixed the wierd looking if-else block in samsung_keypad_probe function.
Changes since v2:
- Addressed comments from Grant Likely.
- Renamed 'keypad,key-code' property name to 'linux,code'.
- Fixed incorrect data types for all instances of of_property+read_u32.
- linux,input-type binding was not added as suggested since the driver supports only EV_KEY event type.
Changes since v1:
- Addressed comments from Dmitry Torokhov.
- Type of controller is cached in driver's private data and the function that determines the type of the controller for each keypad scan is removed.
- pdata allocated during probe is explicitly freed after probe completes without any error. In case of exit from probe due a error, no explicit deallocation of pdata memory is performed and it is left to devres to handle that.
- The generic code to translate KEY(x,y,code) is retained in the driver itself. I am unsure of a right common place for it.
- Driver continues with the probe even if one or more gpio configuration fails.
- Patch 1 that adds a new config option is still retained in this patchset.
This patchset adds device tree support for samsung's keypad controller driver. First patch adds a new config option to be used by device tree enabled platforms for selecting the samsung's keypad controller driver. The second patch adds device tree support for the keypad driver.
Thomas Abraham (2):
input: samsung-keypad: Add HAVE_SAMSUNG_KEYPAD config option
input: samsung-keypad: Add device tree support
.../devicetree/bindings/input/samsung-keypad.txt | 88 ++++++++++ drivers/input/keyboard/Kconfig | 9 +- drivers/input/keyboard/samsung-keypad.c | 174 ++++++++++++++++++-- 3 files changed, 258 insertions(+), 13 deletions(-)
PATCH v4 1/2 input: samsung-keypad: Add HAVE_SAMSUNG_KEYPAD config option
For platforms using device tree, the static keypad device instances are not required and SAMSUNG_DEV_KEYPAD is not selected. Since, samsung keypad driver has dependency on SAMSUNG_DEV_KEYPAD config option, the driver is left out of the compilation for dt enabled platforms.
An additional config option 'HAVE_SAMSUNG_KEYPAD' is added which the device tree based platforms can select. This config option is added as an alternative dependency for keypad driver.
--- drivers/input/keyboard/Kconfig | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
drivers/input/keyboard/Kconfig +8 -1
@@ -423,9 +423,16 @@ config KEYBOARD_PMIC8XXX To compile this driver as a module, choose M here: the module will be called pmic8xxx-keypad. +config HAVE_SAMSUNG_KEYPAD + bool + help + This will include Samsung Keypad controller driver support. If you + want to include Samsung Keypad support for any machine, kindly + select this in the respective mach-xxxx/Kconfig file. + config KEYBOARD_SAMSUNG tristate "Samsung keypad support" - depends on SAMSUNG_DEV_KEYPAD + depends on SAMSUNG_DEV_KEYPAD || HAVE_SAMSUNG_KEYPAD help Say Y here if you want to use the Samsung keypad.
Signature · 1 line
1.6.6.rc2
PATCH v4 2/2 input: samsung-keypad: Add device tree support
In reply to Thomas AbrahamAdd device tree based discovery support for Samsung's keypad controller.
--- .../devicetree/bindings/input/samsung-keypad.txt | 88 ++++++++++ drivers/input/keyboard/samsung-keypad.c | 174 ++++++++++++++++++-- 2 files changed, 250 insertions(+), 12 deletions(-) create mode 100644 Documentation/devicetree/bindings/input/samsung-keypad.txt
Documentation/devicetree/bindings/input/samsung-keypad.txt new file +88 -0
@@ -0,0 +1,88 @@ +* Samsung's Keypad Controller device tree bindings + +Samsung's Keypad controller is used to interface a SoC with a matrix-type +keypad device. The keypad controller supports multiple row and column lines. +A key can be placed at each intersection of a unique row and a unique column. +The keypad controller can sense a key-press and key-release and report the +event using a interrupt to the cpu. + +Required SoC Specific Properties: +- compatible: should be one of the following + - "samsung,s3c6410-keypad": For controllers compatible with s3c6410 keypad + controller. + - "samsung,s5pv210-keypad": For controllers compatible with s5pv210 keypad + controller. + +- reg: physical base address of the controller and length of memory mapped + region. + +- interrupts: The interrupt number to the cpu. + +Required Board Specific Properties: +- samsung,keypad-num-rows: Number of row lines connected to the keypad + controller. + +- samsung,keypad-num-columns: Number of column lines connected to the + keypad controller. + +- row-gpios: List of gpios used as row lines. The gpio specifier for + this property depends on the gpio controller to which these row lines + are connected. + +- col-gpios: List of gpios used as column lines. The gpio specifier for + this property depends on the gpio controller to which these column + lines are connected. + +- Keys represented as child nodes: Each key connected to the keypad + controller is represented as a child node to the keypad controller + device node and should include the following properties. + - keypad,row: the row number to which the key is connected. + - keypad,column: the column number to which the key is connected. + - linux,code: the key-code to be reported when the key is pressed + and released. + +Optional Properties specific to linux: +- linux,keypad-no-autorepeat: do no enable autorepeat feature. +- linux,keypad-wakeup: use any event on keypad as wakeup event. + + +Example: + keypad at 100A0000 { + compatible = "samsung,s5pv210-keypad"; + reg = <0x100A0000 0x100>; + interrupts = <173>; + samsung,keypad-num-rows = <2>; + samsung,keypad-num-columns = <8>; + linux,input-no-autorepeat; + linux,input-wakeup; + + row-gpios = <&gpx2 0 3 3 0 + &gpx2 1 3 3 0>; + + col-gpios = <&gpx1 0 3 0 0 + &gpx1 1 3 0 0 + &gpx1 2 3 0 0 + &gpx1 3 3 0 0 + &gpx1 4 3 0 0 + &gpx1 5 3 0 0 + &gpx1 6 3 0 0 + &gpx1 7 3 0 0>; + + key_1 { + keypad,row = <0>; + keypad,column = <3>; + linux,code = <2>; + }; + + key_2 { + keypad,row = <0>; + keypad,column = <4>; + linux,code = <3>; + }; + + key_3 { + keypad,row = <0>; + keypad,column = <5>; + linux,code = <4>; + }; + };
drivers/input/keyboard/samsung-keypad.c +162 -12
248 lines not on this page · raw message
Signature · 1 line
1.6.6.rc2