Skip to contentSkip to conversation

Add mtk matrix keypad driver for keypad on MTK SoC

PATCH In review Fengping Yu 2 participants 5 messages May 9, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v6 1/1 Add mtk matrix keypad driver for keypad on MTK SoC

Change since v5:
- remove unnecessary include files
- remove redundant comments and newlines
- use local irqnr variable instead of member variable of mtk_keypad struct
- use regmap to read and write registers
- drop kpd_get_dts_info directly into probe function
- use devm_add_action_or_reset to avoid goto error handling when do clk setting
- use devm_request_threaded_irq api to request irq
- remove platform_set_drvdata

fengping.yu (3):
dt-bindings: Change keypad documentation schema
drivers: input: keyboard: Add mtk keypad driver
configs: defconfig: Add CONFIG_KEYBOARD_MTK_KPD=y

 .../devicetree/bindings/input/mtk-kpd.txt     |  61 -------
 .../devicetree/bindings/input/mtk-kpd.yaml    |  93 +++++++++++
 arch/arm64/configs/defconfig                  |   1 +
 drivers/input/keyboard/Kconfig                |   5 +-
 drivers/input/keyboard/mtk-kpd.c              | 151 ++++++++----------
 5 files changed, 163 insertions(+), 148 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/input/mtk-kpd.txt
 create mode 100644 Documentation/devicetree/bindings/input/mtk-kpd.yaml

--
2.18.0

#1 lore raw

PATCH v6 1/3 dt-bindings: Change keypad documentation schema

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

Change Mediatek matrix keypad dt-bindings doc to yaml schema.

---
 .../devicetree/bindings/input/mtk-kpd.txt     | 61 ------------
 .../devicetree/bindings/input/mtk-kpd.yaml    | 93 +++++++++++++++++++
 2 files changed, 93 insertions(+), 61 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/input/mtk-kpd.txt
 create mode 100644 Documentation/devicetree/bindings/input/mtk-kpd.yaml
Documentation/devicetree/bindings/input/mtk-kpd.txt deleted +0 -61
deleted file mode 100644
index 8b154a5e2f7d..000000000000
@@ -1,61 +0,0 @@
-* 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>;
-	};
Documentation/devicetree/bindings/input/mtk-kpd.yaml new file +93 -0

93 lines not on this page · raw message

Signature · 5 lines
2.18.0
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#2 lore raw

PATCH v6 2/3 drivers: input: keyboard: Add mtk keypad driver

In reply to Fengping Yu

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

This adds matrix keypad support for Mediatek SoCs.

---
 drivers/input/keyboard/Kconfig   |   5 +-
 drivers/input/keyboard/mtk-kpd.c | 151 ++++++++++++++-----------------
 2 files changed, 69 insertions(+), 87 deletions(-)
drivers/input/keyboard/Kconfig +3 -2
index 4a387d8683b1..4ed9eff681f1 100644
@@ -774,9 +774,10 @@ config KEYBOARD_BCM
 
 config KEYBOARD_MTK_KPD
 	tristate "MediaTek Keypad Support"
+	depends on OF && HAVE_CLK
 	help
-	  Say Y here if you want to use the keypad.
-	  If unuse, say N.
+	  Say Y here if you want to use the keypad on MediaTek SoCs.
+	  If unsure, say N.
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called mtk-kpd.
drivers/input/keyboard/mtk-kpd.c +66 -85

276 lines not on this page · raw message

Signature · 5 lines
2.18.0
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#3 lore raw

PATCH v6 3/3 configs: defconfig: Add CONFIG_KEYBOARD_MTK_KPD=y

In reply to Fengping Yu

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

Add Mediatek matrix keypad support in defconfig.

---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
index 7863352521e5..140c7a5832f7 100644
@@ -317,6 +317,7 @@ CONFIG_KEYBOARD_SNVS_PWRKEY=m
 CONFIG_KEYBOARD_IMX_SC_KEY=m
 CONFIG_KEYBOARD_CROS_EC=y
 CONFIG_KEYBOARD_MTK_KPD=y
+# CONFIG_KEYBOARD_MTK_PMIC is not set
 CONFIG_INPUT_TOUCHSCREEN=y
 CONFIG_TOUCHSCREEN_ATMEL_MXT=m
 CONFIG_INPUT_MISC=y
Signature · 5 lines
2.18.0
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#4 lore raw
In reply to Fengping Yu

Hi Yu,

sorry if this is not your first name..
Something went wrong with you v6 since you are sending diffs to files that are not present in input-master/next.

Regards,
Marco

Quoted 28 lines · Fengping Yu

Change since v5:
- remove unnecessary include files
- remove redundant comments and newlines
- use local irqnr variable instead of member variable of mtk_keypad struct
- use regmap to read and write registers
- drop kpd_get_dts_info directly into probe function
- use devm_add_action_or_reset to avoid goto error handling when do clk setting
- use devm_request_threaded_irq api to request irq
- remove platform_set_drvdata

fengping.yu (3):
dt-bindings: Change keypad documentation schema
drivers: input: keyboard: Add mtk keypad driver
configs: defconfig: Add CONFIG_KEYBOARD_MTK_KPD=y

 .../devicetree/bindings/input/mtk-kpd.txt     |  61 -------
 .../devicetree/bindings/input/mtk-kpd.yaml    |  93 +++++++++++
 arch/arm64/configs/defconfig                  |   1 +
 drivers/input/keyboard/Kconfig                |   5 +-
 drivers/input/keyboard/mtk-kpd.c              | 151 ++++++++----------
 5 files changed, 163 insertions(+), 148 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/input/mtk-kpd.txt
 create mode 100644 Documentation/devicetree/bindings/input/mtk-kpd.yaml

--
2.18.0

Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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