Skip to contentSkip to conversation

Input: matrix-keypad - Add device tree support

PATCH Superseded AnilKumar Ch 3 participants 3 messages Nov 2, 2012 – Nov 5, 2012 2 messages not in the archive

Subsystems (3)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 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.

---
This patch was tested on AM335x-EVM with DT patches, DT data patches will be submitted once this is accepted.

Changes from v2:
- Incorporated Stephen Warren's review comments on v2
* Renamed the bindings file to gpio-matrix-keypad.txt
* Added description to clustered-irq binding

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

 .../bindings/input/gpio-matrix-keypad.txt          |   51 ++++++++++
 drivers/input/keyboard/matrix_keypad.c             |  107 +++++++++++++++++++-
 2 files changed, 157 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/input/gpio-matrix-keypad.txt
Documentation/devicetree/bindings/input/gpio-matrix-keypad.txt new file +51 -0
new file mode 100644
index 0000000..0a1e81c
@@ -0,0 +1,51 @@
+* 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-matrix-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.
+- linux,keymap:		The definition can be found at
+			bindings/input/matrix-keymap.txt
+
+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, that is needed if the irq
+			is a combined irq source for the whole matix keypad.
+			This is useful if rows and columns of the keypad are
+			connected to a GPIO expander.
+- clustered-irq-flags:	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

A message that is not in the archive (sent off-list or not yet received): 1351854182-10978-1-git-send-email-anilkumar-l0cyMroinI0@public.gmane.org

#2 lore raw

Documentation/devicetree/bindings/input/gpio-matrix-keypad.txt line 30

Quoted 13 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.

+++ b/Documentation/devicetree/bindings/input/gpio-matrix-keypad.txt

Documentation/devicetree/bindings/input/gpio-matrix-keypad.txt new file +6 -0
+Optional Properties:
 
+- clustered-irq:	have clustered irq number, that is needed if the irq
+			is a combined irq source for the whole matix keypad.
+			This is useful if rows and columns of the keypad are
+			connected to a GPIO expander.
+- clustered-irq-flags:	clustered irq flags

Shouldn't the GPIO expander itself be an IRQ controller too? What are the clustered-irq-flags values?

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

+Luotao Fu

Quoted 9 lines · Stephen Warren
Quoted 7 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.

+++ b/Documentation/devicetree/bindings/input/gpio-matrix-keypad.txt

+Optional Properties:

Quoted 8 lines

Documentation/devicetree/bindings/input/gpio-matrix-keypad.txt line 30

Quoted 5 lines

+- clustered-irq: have clustered irq number, that is needed if the irq

Documentation/devicetree/bindings/input/gpio-matrix-keypad.txt new file +4 -0
+			is a combined irq source for the whole matix keypad.
+			This is useful if rows and columns of the keypad are
+			connected to a GPIO expander.
+- clustered-irq-flags:	clustered irq flags

Shouldn't the GPIO expander itself be an IRQ controller too? What are the clustered-irq-flags values?

These are clustered-irq corresponding flags whether the IRQ is IRQF_TRIGGER_RISING (or) IRQF_TRIGGER_FALLING (or) both and etc. I have given the pointers based on this patch
https://lkml.org/lkml/2010/5/27/45

I am not able to provide the further details because my hardware is different. Luotao Fu have added the clustered-irq support he might have some pointers here.

Hi Luotao Fu,

Do you have any comments here?

Thanks
AnilKumar