Add device tree support for Samsung's keypad controller driver
Subsystems (4)
v5 cover Add device tree support for Samsung's keypad controller driver
Changes since v4:
- Tested with linux 3.1-rc9. No changes in code.
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(-) create mode 100644 Documentation/devicetree/bindings/input/samsung-keypad.txt
PATCH v5 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 v5 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@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
PATCH v5 2/2 input: samsung-keypad: Add device tree support
Hi,
I came across this searching for other proposed device tree bindings based on what I wanted to do for Tegra.
Comments below.
Quoted 7 lines · Thomas Abraham
+- 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.
[...]
Quoted 7 lines
+ ? ? ? ? ? ? ?
key_1{
+ ? ? ? ? ? ? ? ? ? ? ? keypad,row = <0>;
+ ? ? ? ? ? ? ? ? ? ? ? keypad,column = <3>;
+ ? ? ? ? ? ? ? ? ? ? ? linux,code = <2>;
+ ? ? ? ? ? ? ? };(quoted diff) +2
-0+ + ? ? ? ? ? ? ? key_2 {
Review
Quoted 10 lines
(quoted diff) +10
-0+ ? ? ? ? ? ? ? ? ? ? ? keypad,row = <0>; + ? ? ? ? ? ? ? ? ? ? ? keypad,column = <4>; + ? ? ? ? ? ? ? ? ? ? ? linux,code = <3>; + ? ? ? ? ? ? ? }; + + ? ? ? ? ? ? ? key_3 { + ? ? ? ? ? ? ? ? ? ? ? keypad,row = <0>; + ? ? ? ? ? ? ? ? ? ? ? keypad,column = <5>; + ? ? ? ? ? ? ? ? ? ? ? linux,code = <4>; + ? ? ? ? ? ? ? };
The above is good if all you want to specify is a few keys. If you want a full keyboard specification, it gets very verbose.
I would prefer a simpler binding, something along the lines of:
linux,keymap = < row col code ... >;
Where it's just an array of the above, so your example would be:
linux,keymap = < 0 3 2
0 4 3
0 5 4 >;Same amount of data, it would be more or less as easy to read but a _much_ more compact representation when you need to provide 100+ keys.
-Olof
v5 cover Add device tree support for Samsung's keypad controller driver
In reply to Thomas AbrahamQuoted 8 lines · Thomas Abraham
Changes since v4:
- Tested with linux 3.1-rc9. No changes in code.Changes since v3:
- Addressed comments from Grant Likely.
- Setnum_rowsandnum_colsto zero insamsung_keypad_parse_dtfunction.
- Fixed the wierd looking if-else block insamsung_keypad_probe
function.
Quoted 8 lines
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 onlyEV_KEYevent type.
Quoted 14 lines
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 translateKEY(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.
Quoted 3 lines
This patchset adds device tree support for samsung's keypad controller
driver.
Quoted 1 line
First patch adds a new config option to be used by device tree enabled
platforms
Quoted 1 line
for selecting the samsung's keypad controller driver. The second patch
adds
Quoted 8 lines
device
tree support for the keypad driver.Thomas Abraham (2):
input: samsung-keypad: AddHAVE_SAMSUNG_KEYPADconfig option
input: samsung-keypad: Add device tree support
Quoted 7 lines
.../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(-) create mode 100644 Documentation/devicetree/bindings/input/samsung-keypad.txt
Looks ok to me,
Hi Dmitry,
If you're ok on this, please adding this in your tree for upcoming merge window.
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.
v5 cover Add device tree support for Samsung's keypad controller driver
Quoted 57 lines · Kukjin Kim
Quoted 8 lines · Thomas Abraham
Changes since v4:
- Tested with linux 3.1-rc9. No changes in code.Changes since v3:
- Addressed comments from Grant Likely.
- Setnum_rowsandnum_colsto zero insamsung_keypad_parse_dtfunction.
- Fixed the wierd looking if-else block insamsung_keypad_probefunction.
Quoted 8 lines
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 onlyEV_KEYevent type.Quoted 14 lines
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 translateKEY(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 thispatchset.
Quoted 3 lines
This patchset adds device tree support for samsung's keypad controller
driver.
Quoted 1 line
First patch adds a new config option to be used by device tree enabled
platforms
Quoted 1 line
for selecting the samsung's keypad controller driver. The second patch
adds
Quoted 8 lines
device
tree support for the keypad driver.Thomas Abraham (2):
input: samsung-keypad: AddHAVE_SAMSUNG_KEYPADconfig option
input: samsung-keypad: Add device tree supportQuoted 7 lines
.../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(-)create mode 100644
Documentation/devicetree/bindings/input/samsung-
keypad.txt
Quoted 7 lines
Looks ok to me,
Acked-by Kukjin Kim<[email protected]>Hi Dmitry,
If you're ok on this, please adding this in your tree for upcoming merge window.
Dmitry,
Any problem on this?
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.
v5 cover Add device tree support for Samsung's keypad controller driver
Quoted 4 lines · Kukjin Kim
Quoted 2 lines · Kukjin Kim
Quoted 1 line · Thomas Abraham
Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
Changes since v4:
- Tested with linux 3.1-rc9. No changes in code.Changes since v3:
- Addressed comments from Grant Likely.
- Setnum_rowsandnum_colsto zero insamsung_keypad_parse_dtfunction.
Quoted 7 lines
Quoted 1 line
- Fixed the wierd looking if-else block in
samsung_keypad_probefunction.
Quoted 5 lines
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.
Quoted 1 line
Quoted 1 line
Quoted 1 line
- linux,input-type binding was not added as suggested since the
driver
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
supports only
EV_KEYevent type.Changes since v1:
- Addressed comments from Dmitry Torokhov.
- Type of controller is cached in driver's private data and the
function
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
that determines the type of the controller for each keypad scan is removed.
- pdata allocated during probe is explicitly freed after probe
completes
Quoted 1 line
Quoted 1 line
Quoted 1 line
without any error. In case of exit from probe due a error, no
explicit
Quoted 1 line
Quoted 1 line
Quoted 1 line
deallocation of pdata memory is performed and it is left to devres
to
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
handle that.
- The generic code to translateKEY(x,y,code)is retained in the
driver
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
itself. I am unsure of a right common place for it.
- Driver continues with the probe even if one or more gpio
configuration
Quoted 30 lines
Quoted 30 lines
Quoted 2 lines
fails.
- Patch 1 that adds a new config option is still retained in thispatchset.
Quoted 3 lines
This patchset adds device tree support for samsung's keypad controller
driver.
Quoted 1 line
First patch adds a new config option to be used by device tree enabled
platforms
Quoted 1 line
for selecting the samsung's keypad controller driver. The second patch
adds
Quoted 8 lines
device
tree support for the keypad driver.Thomas Abraham (2):
input: samsung-keypad: AddHAVE_SAMSUNG_KEYPADconfig option
input: samsung-keypad: Add device tree supportQuoted 7 lines
.../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(-)create mode 100644
Documentation/devicetree/bindings/input/samsung-
keypad.txtLooks ok to me,
Acked-by Kukjin Kim<[email protected]>
Quoted 8 lines
Quoted 4 lines
Hi Dmitry,
If you're ok on this, please adding this in your tree for upcoming merge window.Dmitry,
Any problem on this?
Hi Dmitry,
I applied this in Samsung tree, if any problems, please let me know.
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.