Add matrix keypad driver support for Mediatek SoCs
Subsystems (4)
PATCH RESEND v11 1/1 Add matrix keypad driver support for Mediatek SoCs
Change since v10:
- add wakeup source setting in probe function
fengping.yu (3):
dt-bindings: Add keypad devicetree documentation
drivers: input: keyboard: Add mtk keypad driver
configs: defconfig: Add CONFIG_KEYBOARD_MTK_KPD=m
.../devicetree/bindings/input/mtk-kpd.yaml | 95 ++++++++ arch/arm64/configs/defconfig | 1 + drivers/input/keyboard/Kconfig | 11 + drivers/input/keyboard/Makefile | 1 + drivers/input/keyboard/mtk-kpd.c | 206 ++++++++++++++++++ 5 files changed, 314 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/mtk-kpd.yaml create mode 100644 drivers/input/keyboard/mtk-kpd.c
Signature · 1 line
2.18.0
PATCH RESEND v11 1/3 dt-bindings: Add keypad devicetree documentation
From: "fengping.yu" <[email protected]>
Add Mediatek matrix keypad dt-bindings doc as yaml schema.
--- .../devicetree/bindings/input/mtk-kpd.yaml | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/mtk-kpd.yaml
Documentation/devicetree/bindings/input/mtk-kpd.yaml new file +95 -0
@@ -0,0 +1,95 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +version: 1 + +$id: http://devicetree.org/schemas/input/mtk-keypad.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Mediatek's Keypad Controller device tree bindings + +maintainer: + - Fengping Yu <[email protected]> + +description: | + 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. + +properties: + compatible: + oneOf: + - const: "mediatek,mt6779-keypad" + - const: "mediatek,mt6873-keypad" + + clock-names: + description: Names of the clocks listed in clocks property in the same order + maxItems: 1 + + clocks: + description: Must contain one entry, for the module clock + refs: devicetree/bindings/clocks/clock-bindings.txt for details. + + interrupts: + description: A single interrupt specifier + maxItems: 1 + + linux,keymap: + description: The keymap for keys as described in the binding document + refs: devicetree/bindings/input/matrix-keymap.txt + minItems: 1 + maxItems: 16 + + pinctrl-0: + description: Specify pin control groups used for this controller + refs: devicetree/bindings/pinctrl/pinctrl-bindings.txt + + pinctrl-names: + description: Names for optional pin modes + maxItems: 1 + + reg: + description: The base address of the Keypad register bank + maxItems: 1 + + wakeup-source: + description: use any event on keypad as wakeup event + type: boolean + + keypad,num-columns: + description: 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 + + keypad,num-rows: + description: 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 + + mediatek,debounce-us: + description: Debounce interval in microseconds + maximum: 256000 + +required: + - compatible + - reg + - interrupts + - linux,keymap + - pinctrl + - clocks + - clock-names + +examples: + - | + + keypad: kp@10010000 { + compatible = "mediatek,mt6779-keypad"; + reg = <0 0x10010000 0 0x1000>; + linux,keymap = < MATRIX_KEY(0x00, 0x00, KEY_VOLUMEDOWN) >; + interrupts = <GIC_SPI 75 IRQ_TYPE_EDGE_FALLING>; + clocks = <&clk26m>; + clock-names = "kpd"; + pinctrl-names = "default"; + pinctrl-0 = <&kpd_gpios_def_cfg>; + };
Signature · 5 lines
2.18.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH RESEND v11 2/3 drivers: input: keyboard: Add mtk keypad driver
In reply to Fengping YuFrom: "fengping.yu" <[email protected]>
This adds matrix keypad support for Mediatek SoCs.
--- drivers/input/keyboard/Kconfig | 11 ++ drivers/input/keyboard/Makefile | 1 + drivers/input/keyboard/mtk-kpd.c | 206 +++++++++++++++++++++++++++++++ 3 files changed, 218 insertions(+) create mode 100644 drivers/input/keyboard/mtk-kpd.c
drivers/input/keyboard/Kconfig +11 -0
@@ -782,6 +782,17 @@ 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" + depends on ARCH_MEDIATEK || COMPILE_TEST + select CONFIG_REGMAP_MMIO + select INPUT_MATRIXKMAP + help + 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. + config KEYBOARD_MTK_PMIC tristate "MediaTek PMIC keys support" depends on MFD_MT6397
drivers/input/keyboard/Makefile +1 -0
@@ -43,6 +43,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 +206 -0
206 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
Re: [RESEND PATCH v11 2/3] drivers: input: keyboard: Add mtk keypad driver
Quoted 3 lines · Fengping Yu
From: "fengping.yu" <[email protected]>
This adds matrix keypad support for Mediatek SoCs.
...
drivers/input/keyboard/Kconfig config KEYBOARD_BCM · line 788
Quoted 5 lines
drivers/input/keyboard/Kconfig +4
-0+config KEYBOARD_MTK_KPD + tristate "MediaTek Keypad Support" + depends on ARCH_MEDIATEK || COMPILE_TEST + select CONFIG_REGMAP_MMIO
This is wrong.
Quoted 1 line
drivers/input/keyboard/Kconfig +1
-0+ select INPUT_MATRIXKMAP
...
drivers/input/keyboard/mtk-kpd.c line 163
Quoted 2 lines
drivers/input/keyboard/mtk-kpd.c new file +2
-0+ ret =devm_add_action_or_reset (&pdev->dev, kpd_clk_disable, + keypad->clk);
I would leave on one line (only 81 characters).
Quoted 2 lines
(quoted diff) +2
-0+ if (ret) + return ret;
Signature · 9 lines
With Best Regards, Andy Shevchenko _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [RESEND PATCH v11 2/3] drivers: input: keyboard: Add mtk keypad driver
Hi Andy,
Quoted 7 lines · Andy Shevchenko
Quoted 3 lines · Fengping Yu
From: "fengping.yu" <[email protected]>
This adds matrix keypad support for Mediatek SoCs.
...
Quoted 7 lines
drivers/input/keyboard/Kconfig config KEYBOARD_BCM · line 788
Quoted 5 lines
drivers/input/keyboard/Kconfig +4
-0+config KEYBOARD_MTK_KPD + tristate "MediaTek Keypad Support" + depends on ARCH_MEDIATEK || COMPILE_TEST + select CONFIG_REGMAP_MMIOThis is wrong.
Why is this wrong? The driver uses the rmap-mmio functions.
Thanks for the explanation =)
Marco
Quoted 17 lines
Quoted 2 lines
drivers/input/keyboard/Kconfig +1
-0+ select INPUT_MATRIXKMAP...
drivers/input/keyboard/mtk-kpd.c line 163
Quoted 2 lines
drivers/input/keyboard/mtk-kpd.c new file +2
-0+ ret =devm_add_action_or_reset (&pdev->dev, kpd_clk_disable, + keypad->clk);I would leave on one line (only 81 characters).
Quoted 2 lines
(quoted diff) +2
-0+ if (ret) + return ret;Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [RESEND PATCH v11 2/3] drivers: input: keyboard: Add mtk keypad driver
Quoted 2 lines · Marco Felsch
Quoted 1 line · Andy Shevchenko
On Thu, May 28, 2020 at 05:01:47PM +0800, Fengping Yu wrote:
...
Quoted 5 lines
Quoted 3 lines
drivers/input/keyboard/Kconfig config KEYBOARD_BCM · line 788
Quoted 1 line
drivers/input/keyboard/Kconfig +1
-0+ select CONFIG_REGMAP_MMIOThis is wrong.
Why is this wrong? The driver uses the rmap-mmio functions.
In Kconfig CONFIG_ prefix is implied.
There is no CONFIG_CONFIG_REGMAP_MMIO.
Quoted 1 line
Thanks for the explanation =)
Sorry, I think it's obvious...
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/input/keyboard/Kconfig +1
-0+ select INPUT_MATRIXKMAP
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [RESEND PATCH v11 2/3] drivers: input: keyboard: Add mtk keypad driver
Quoted 12 lines · Andy Shevchenko
Quoted 2 lines · Marco Felsch
Quoted 1 line · Andy Shevchenko
On Thu, May 28, 2020 at 05:01:47PM +0800, Fengping Yu wrote:
...
Quoted 5 lines
Quoted 3 lines
drivers/input/keyboard/Kconfig config KEYBOARD_BCM · line 788
Quoted 1 line
drivers/input/keyboard/Kconfig +1
-0+ select CONFIG_REGMAP_MMIOThis is wrong.
Why is this wrong? The driver uses the rmap-mmio functions.
Quoted 7 lines
In
KconfigCONFIG_prefix is implied.There is no
CONFIG_CONFIG_REGMAP_MMIO.Quoted 1 line
Thanks for the explanation =)
Sorry, I think it's obvious...
Damn, you right it is. Bloody automatism mismatch in my brain.
Regards,
Marco
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/input/keyboard/Kconfig +1
-0+ select INPUT_MATRIXKMAPSignature · 2 lines
With Best Regards, Andy Shevchenko
PATCH RESEND v11 3/3 configs: defconfig: Add CONFIG_KEYBOARD_MTK_KPD=m
In reply to Fengping YuFrom: "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
@@ -349,6 +349,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=m 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
Quoted 3 lines · Fengping Yu
Change since v10:
- add wakeup source setting in probe function
You forgot tags by Marco
Quoted 18 lines
fengping.yu (3):
dt-bindings: Add keypad devicetree documentation
drivers: input: keyboard: Add mtk keypad driver
configs: defconfig: AddCONFIG_KEYBOARD_MTK_KPD=m.../devicetree/bindings/input/mtk-kpd.yaml | 95 ++++++++ arch/arm64/configs/defconfig | 1 + drivers/input/keyboard/Kconfig | 11 + drivers/input/keyboard/Makefile | 1 + drivers/input/keyboard/mtk-kpd.c | 206 ++++++++++++++++++ 5 files changed, 314 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/mtk-kpd.yaml create mode 100644 drivers/input/keyboard/mtk-kpd.cSignature · 1 line
2.18.0
Signature · 2 lines
With Best Regards, Andy Shevchenko