Input: matrix-keypad - Add device tree support
Subsystems (3)
PATCH v2 1/1 Input: matrix-keypad - Add device tree support
Add device tree support to matrix keypad driver and usage details are added to device tree documentation. Driver was tested on AM335x EVM.
---
These patches were tested on AM335x-EVM with DT patches, DT data patches will be submitted once this is accepted.
Changes from v1:
- Incorporated Rob's review comments on v1
* Changed matix-keypad compatible to gpio-matrix-keypad
* Removed unnecessary props (num of gpios)
* Used of_match_ptr()
- Removed first patch based on Dmitry's comments on v1
.../devicetree/bindings/input/matrix-keypad.txt | 46 +++++++++ drivers/input/keyboard/matrix_keypad.c | 107 +++++++++++++++++++- 2 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/input/matrix-keypad.txt
Documentation/devicetree/bindings/input/matrix-keypad.txt new file +46 -0
@@ -0,0 +1,46 @@ +* GPIO driven matrix keypad device tree bindings + +GPIO driven matrix keypad is used to interface a SoC with a matrix keypad. +The matrix keypad supports multiple row and column lines, a key can be +placed at each intersection of a unique row and a unique column. The matrix +keypad can sense a key-press and key-release by means of GPIO lines and +report the event using GPIO interrupts to the cpu. + +Required Properties: +- compatible: Should be "gpio-matix-keypad" +- 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. + +Optional Properties: +- linux,no-autorepeat: do no enable autorepeat feature. +- linux,wakeup: use any event on keypad as wakeup event. +- debounce-delay-ms: debounce interval in milliseconds +- col-scan-delay-us: delay, measured in microseconds, that is needed + before we can scan keypad after activating column gpio +- clustered-irq: have clustered irq number +- clustered-irq-flags: have clustered irq flags + +Example: + matrix-keypad { + compatible = "gpio-matrix-keypad"; + debounce-delay-ms = <5>; + col-scan-delay-us = <2>; + + row-gpios = <&gpio2 25 0 + &gpio2 26 0 + &gpio2 27 0>; + + col-gpios = <&gpio2 21 0 + &gpio2 22 0>; + + linux,keymap = <0x0000008B + 0x0100009E + 0x02000069 + 0x0001006A + 0x0101001C + 0x0201006C>; + };
drivers/input/keyboard/matrix_keypad.c +106 -1
137 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Documentation/devicetree/bindings/input/matrix-keypad.txt
Quoted 8 lines · AnilKumar Ch
Add device tree support to matrix keypad driver and usage details are added to device tree documentation. Driver was tested on AM335x EVM.
Documentation/devicetree/bindings/input/matrix-keypad.txt new file +1
-0+- compatible: Should be "gpio-matix-keypad"
There's a typo there.
Given that compatible value, shouldn't the file be named gpio-matrix-keypad.txt then?
It seems like the property linux,keymap should be mentioned here too, with a note to read matrix-keymap.txt for the definition.
Quoted 4 lines
+Optional Properties:
+- clustered-irq: have clustered irq number +- clustered-irq-flags: have clustered irq flags
Explaining what those mean would be useful.
Quoted 8 lines · Stephen Warren
Quoted 6 lines · AnilKumar Ch
Add device tree support to matrix keypad driver and usage details are added to device tree documentation. Driver was tested on AM335x EVM.
Documentation/devicetree/bindings/input/matrix-keypad.txt new file +0
-0
Quoted 6 lines
Quoted 1 line
+- compatible: Should be "gpio-matix-keypad"
There's a typo there.
Given that compatible value, shouldn't the file be named gpio-matrix-keypad.txt then?
Stephen,
Thanks for the comments.
I agree and I have same thing in my mind but the driver name is matrix-keypad.c. And I think we have to change the driver file names as well. (drivers/../matrix_keypad.c, linux/input/ matrix_keypad.h).
Quoted 3 lines
It seems like the property linux,keymap should be mentioned here too, with a note to read matrix-keymap.txt for the definition.
I will add a point to specify "details of linux,keymap are available at matrix-keymap.txt"
Quoted 7 lines
Quoted 5 lines
+Optional Properties:
+- clustered-irq: have clustered irq number +- clustered-irq-flags: have clustered irq flagsExplaining what those mean would be useful.
Sure.
Thanks
AnilKumar
Quoted 16 lines · Chimata
Quoted 8 lines · Stephen Warren
Quoted 6 lines · AnilKumar Ch
Add device tree support to matrix keypad driver and usage details are added to device tree documentation. Driver was tested on AM335x EVM.
Documentation/devicetree/bindings/input/matrix-keypad.txt new file +0
-0Quoted 6 lines
Quoted 1 line
+- compatible: Should be "gpio-matix-keypad"
There's a typo there.
Given that compatible value, shouldn't the file be named gpio-matrix-keypad.txt then?
Quoted 8 lines
Stephen,
Thanks for the comments.
I agree and I have same thing in my mind but the driver name is
matrix-keypad.c. And I think we have to change the driver file names as well. (drivers/../matrix_keypad.c, linux/input/matrix_keypad.h).
I don't think there's any requirement that the Linux driver source filename needs to match the DT binding compatible value in any way. Given the bindings are OS-agnostic, naming the binding file based on the compatible value seems better than naming the binding based on the Linux driver name when there's a discrepancy. I see you've renamed the file in V3, so everything's fine.