Skip to contentSkip to conversation

Add support for MediaTek keypad

PATCH Superseded Fengping yu 3 participants 5 messages Apr 5, 2020 – Apr 6, 2020

Subsystems (3)

v3 of 18 Superseded Latest is v18 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 Add support for MediaTek keypad

This patchset add support to MediaTek matrix keypad.

Change since V2:
- remove extra space and redundant lines
- update keypad devicetree document debounce time unit
- change to use devm_platform_ioremap_resource() to simplify resource management
- use bitmap to store and check keypad state

fengping.yu (2):
add dt-binding document for MediaTek Keypad
add MediaTek keypad driver

 .../devicetree/bindings/input/mtk-kpd.txt     |  61 +++++
 arch/arm64/configs/defconfig                  |   1 +
 drivers/input/keyboard/Kconfig                |   7 +
 drivers/input/keyboard/Makefile               |   1 +
 drivers/input/keyboard/mtk-kpd.c              | 258 ++++++++++++++++++
 5 files changed, 328 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/mtk-kpd.txt
 create mode 100644 drivers/input/keyboard/mtk-kpd.c

--
2.18.0

#1 lore raw

PATCH v3 1/2 add dt-binding document for MediaTek Keypad

From: "fengping.yu" <[email protected]>

---
 .../devicetree/bindings/input/mtk-kpd.txt     | 61 +++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/mtk-kpd.txt
Documentation/devicetree/bindings/input/mtk-kpd.txt new file +61 -0
new file mode 100644
index 000000000000..8b154a5e2f7d
@@ -0,0 +1,61 @@
+* Mediatek's Keypad Controller device tree binding
+
+Mediatek'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 properties:
+- compatible should contain:
+	* "mediatek,kp" for common keypad
+	* "mediatek,mt6779-keypad" for specific keypad chip
+
+- reg: The base address of the Keypad register bank.
+
+- interrupts: A single interrupt specifier.
+
+- mediatek,debounce-us: Debounce interval in microseconds, maximum value
+  is 256000 microseconds.
+
+- keypad,num-rows: Number of row lines connected to the keypad controller, it is
+	not equal to PCB rows number, instead you should add required value for each IC.
+
+- keypad,num-columns: Number of column lines connected to the keypad controller,
+	it is not equal to PCB columns number, instead you should add required value
+	for each IC.
+
+- linux,keymap: The keymap for keys as described in the binding document
+  devicetree/bindings/input/matrix-keymap.txt.
+
+- pinctrl: Should specify pin control groups used for this controller.
+  See ../pinctrl/pinctrl-bindings.txt for details.
+
+- clocks: Must contain one entry, for the module clock.
+  See ../clocks/clock-bindings.txt for details.
+
+- clock-names: Names of the clocks listed in clocks property in the same order.
+
+Optional Properties:
+- wakeup-source: use any event on keypad as wakeup event.
+
+Example:
+
+	keypad: kp@10010000 {
+		compatible = "mediatek,kp";
+		reg = <0 0x10010000 0 0x1000>;
+		wakeup-source;
+		interrupts = <GIC_SPI 75 IRQ_TYPE_EDGE_FALLING>;
+		clocks = <&clk26m>;
+		clock-names = "kpd";
+	};
+
+	&keypad {
+		mediatek,debounce-us = <32000>;
+		keypad,num-rows = <8>;
+		keypad,num-columns = <9>;
+		linux,keymap = < MATRIX_KEY(0x00, 0x00, KEY_VOLUMEDOWN) >;
+		status = "okay";
+		pinctrl-names = "default";
+		pinctrl-0 = <&kpd_gpios_def_cfg>;
+	};
Signature · 5 lines
2.18.0
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
#2 lore raw

Re: [PATCH v3 1/2] add dt-binding document for MediaTek Keypad

Fengping,

I think this is V4, you sent v3 in
http://lists.infradead.org/pipermail/linux-mediatek/2020-January/026390.html

Quoted 1 line · Fengping yu

From: "fengping.yu" <[email protected]>

This is a regression, please restore commit message (including first line).

Many of my comments in previous version are not addressed. Please either change according to comment, or discuss why you think you shouldn't.

Joe.C

Quoted 64 lines
---
 .../devicetree/bindings/input/mtk-kpd.txt     | 61 +++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/mtk-kpd.txt
Documentation/devicetree/bindings/input/mtk-kpd.txt new file +51 -0
new file mode 100644
index 000000000000..8b154a5e2f7d
@@ -0,0 +1,61 @@
+* Mediatek's Keypad Controller device tree binding
+
+Mediatek'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 properties:
+- compatible should contain:
+	* "mediatek,kp" for common keypad
+	* "mediatek,mt6779-keypad" for specific keypad chip
+
+- reg: The base address of the Keypad register bank.
+
+- interrupts: A single interrupt specifier.
+
+- mediatek,debounce-us: Debounce interval in microseconds, maximum value
+  is 256000 microseconds.
+
+- keypad,num-rows: Number of row lines connected to the keypad controller, it is
+	not equal to PCB rows number, instead you should add required value for each IC.
+
+- keypad,num-columns: Number of column lines connected to the keypad controller,
+	it is not equal to PCB columns number, instead you should add required value
+	for each IC.
+
+- linux,keymap: The keymap for keys as described in the binding document
+  devicetree/bindings/input/matrix-keymap.txt.
+
+- pinctrl: Should specify pin control groups used for this controller.
+  See ../pinctrl/pinctrl-bindings.txt for details.
+
+- clocks: Must contain one entry, for the module clock.
+  See ../clocks/clock-bindings.txt for details.
+
+- clock-names: Names of the clocks listed in clocks property in the same order.
+
+Optional Properties:
+- wakeup-source: use any event on keypad as wakeup event.
+
+Example:
+
+	keypad: kp@10010000 {
+		compatible = "mediatek,kp";
+		reg = <0 0x10010000 0 0x1000>;
+		wakeup-source;
+		interrupts = <GIC_SPI 75 IRQ_TYPE_EDGE_FALLING>;
+		clocks = <&clk26m>;
+		clock-names = "kpd";
+	};

Documentation/devicetree/bindings/input/mtk-kpd.txt line 61

Quoted 10 lines
Documentation/devicetree/bindings/input/mtk-kpd.txt new file +10 -0
+
+	&keypad {
+		mediatek,debounce-us = <32000>;
+		keypad,num-rows = <8>;
+		keypad,num-columns = <9>;
+		linux,keymap = < MATRIX_KEY(0x00, 0x00, KEY_VOLUMEDOWN) >;
+		status = "okay";
+		pinctrl-names = "default";
+		pinctrl-0 = <&kpd_gpios_def_cfg>;
+	};

_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek

#3 lore raw

PATCH v3 2/2 add MediaTek keypad driver

In reply to Fengping yu

From: "fengping.yu" <[email protected]>

---
 arch/arm64/configs/defconfig     |   1 +
 drivers/input/keyboard/Kconfig   |   7 +
 drivers/input/keyboard/Makefile  |   1 +
 drivers/input/keyboard/mtk-kpd.c | 258 +++++++++++++++++++++++++++++++
 4 files changed, 267 insertions(+)
 create mode 100644 drivers/input/keyboard/mtk-kpd.c
arch/arm64/configs/defconfig +1 -0
index 0f212889c931..7863352521e5 100644
@@ -316,6 +316,7 @@ CONFIG_KEYBOARD_GPIO=y
 CONFIG_KEYBOARD_SNVS_PWRKEY=m
 CONFIG_KEYBOARD_IMX_SC_KEY=m
 CONFIG_KEYBOARD_CROS_EC=y
+CONFIG_KEYBOARD_MTK_KPD=y
 CONFIG_INPUT_TOUCHSCREEN=y
 CONFIG_TOUCHSCREEN_ATMEL_MXT=m
 CONFIG_INPUT_MISC=y
drivers/input/keyboard/Kconfig +7 -0
index 4706ff09f0e8..0ddb753f7d7e 100644
@@ -772,6 +772,13 @@ config KEYBOARD_BCM
 	  To compile this driver as a module, choose M here: the
 	  module will be called bcm-keypad.
 
+config KEYBOARD_MTK_KPD
+	tristate "MediaTek Keypad Support"
+	help
+	  Say Y here if you want to use the keypad.
+	  If unuse, say N.
+	  To compile this driver as a module, choose M here: the
+	  module will be called mtk-kpd.
 config KEYBOARD_MTK_PMIC
 	tristate "MediaTek PMIC keys support"
 	depends on MFD_MT6397
drivers/input/keyboard/Makefile +1 -0
index f5b17524adf2..63324d3e36c5 100644
@@ -42,6 +42,7 @@ obj-$(CONFIG_KEYBOARD_MATRIX)		+= matrix_keypad.o
 obj-$(CONFIG_KEYBOARD_MAX7359)		+= max7359_keypad.o
 obj-$(CONFIG_KEYBOARD_MCS)		+= mcs_touchkey.o
 obj-$(CONFIG_KEYBOARD_MPR121)		+= mpr121_touchkey.o
+obj-$(CONFIG_KEYBOARD_MTK_KPD)		+= mtk-kpd.o
 obj-$(CONFIG_KEYBOARD_MTK_PMIC) 	+= mtk-pmic-keys.o
 obj-$(CONFIG_KEYBOARD_NEWTON)		+= newtonkbd.o
 obj-$(CONFIG_KEYBOARD_NOMADIK)		+= nomadik-ske-keypad.o
drivers/input/keyboard/mtk-kpd.c new file +258 -0

258 lines not on this page · raw message

Signature · 5 lines
2.18.0
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
#4 lore raw
In reply to Fengping yu
Quoted 2 lines · Fengping yu

This patchset add support to MediaTek matrix keypad.

Seems it has not addressed comments I gave.

Quoted 23 lines

Change since V2:
- remove extra space and redundant lines
- update keypad devicetree document debounce time unit
- change to use devm_platform_ioremap_resource() to simplify resource management
- use bitmap to store and check keypad state

fengping.yu (2):
add dt-binding document for MediaTek Keypad
add MediaTek keypad driver

 .../devicetree/bindings/input/mtk-kpd.txt     |  61 +++++
 arch/arm64/configs/defconfig                  |   1 +
 drivers/input/keyboard/Kconfig                |   7 +
 drivers/input/keyboard/Makefile               |   1 +
 drivers/input/keyboard/mtk-kpd.c              | 258 ++++++++++++++++++
 5 files changed, 328 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/mtk-kpd.txt
 create mode 100644 drivers/input/keyboard/mtk-kpd.c

--
2.18.0

Signature · 9 lines
With Best Regards,
Andy Shevchenko



_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek