Add Nuvoton MA35D1 keypad controller support
Subsystems (4)
v2 cover Add Nuvoton MA35D1 keypad controller support
The Nuvoton MA35D1 SoC provides a hardware matrix keypad controller supporting up to eight rows and eight columns.
This series adds the Device Tree binding and input driver for key press/release events, clock management, and system suspend/resume support.
Tested on a Nuvoton MA35D1 board with a 4x1 keypad configuration and a 1 MHz KPI clock using evtest.
Feng-Yi Hsueh (2):
dt-bindings: input: Add Nuvoton MA35D1 keypad controller
Input: keyboard: Add Nuvoton MA35D1 keypad driver
---
Changes since v1:
- dt-bindings: add optional resets and reference input.yaml.
- dt-bindings: fix interrupt, clock, and keymap formatting.
- input: use guard(mutex) in suspend/resume callbacks.
- input: rename error variables from ret to error and explicitly return 0 on successful resume.
- input: remove the unnecessary linux/mod_devicetable.h include.
.../bindings/input/nuvoton,ma35d1-keypad.yaml | 75 ++++ drivers/input/keyboard/Kconfig | 11 + drivers/input/keyboard/Makefile | 1 + drivers/input/keyboard/ma35d1_keypad.c | 407 ++++++++++++++++++ 4 files changed, 494 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/nuvoton,ma35d1-keypad.yaml create mode 100644 drivers/input/keyboard/ma35d1_keypad.c
Signature · 1 line
2.43.0
PATCH v2 1/2 dt-bindings: input: Add Nuvoton MA35D1 keypad controller
Document the Nuvoton MA35D1 hardware matrix keypad controller.
The controller supports up to eight rows and eight columns and generates interrupts for key press and release events.
--- .../bindings/input/nuvoton,ma35d1-keypad.yaml | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/nuvoton,ma35d1-keypad.yaml
Documentation/devicetree/bindings/input/nuvoton,ma35d1-keypad.yaml new file +75 -0
@@ -0,0 +1,75 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/input/nuvoton,ma35d1-keypad.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Nuvoton MA35D1 Matrix Keypad Controller + +maintainers: + - Feng-Yi Hsueh <[email protected]> + +description: | + The Nuvoton MA35D1 keypad controller scans a matrix of up to eight rows + and eight columns and reports key press and release interrupts. + +allOf: + - $ref: /schemas/input/matrix-keymap.yaml# + - $ref: /schemas/input/input.yaml# + +properties: + compatible: + const: nuvoton,ma35d1-keypad + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + maxItems: 1 + + resets: + maxItems: 1 + + keypad,num-rows: + minimum: 2 + maximum: 8 + + keypad,num-columns: + minimum: 1 + maximum: 8 + + autorepeat: true + +required: + - compatible + - reg + - interrupts + - clocks + - keypad,num-rows + - keypad,num-columns + - linux,keymap + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/clock/nuvoton,ma35d1-clk.h> + #include <dt-bindings/input/input.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + + keypad@404a0000 { + compatible = "nuvoton,ma35d1-keypad"; + reg = <0x404a0000 0x10000>; + interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk KPI_GATE>; + + keypad,num-rows = <4>; + keypad,num-columns = <1>; + linux,keymap = <MATRIX_KEY(0, 0, KEY_1) + MATRIX_KEY(1, 0, KEY_2) + MATRIX_KEY(2, 0, KEY_3) + MATRIX_KEY(3, 0, KEY_4)>; + };
Signature · 1 line
2.43.0
Re: [PATCH v2 1/2] dt-bindings: input: Add Nuvoton MA35D1 keypad controller
pw-bot: not-applicable
PATCH v2 2/2 Input: keyboard: Add Nuvoton MA35D1 keypad driver
In reply to Feng-Yi HsuehAdd support for the Nuvoton MA35D1 hardware matrix keypad controller.
The driver handles key press and release interrupts, reports key events through the Linux input subsystem, and manages the peripheral clock during device open, close, and system suspend and resume.
--- drivers/input/keyboard/Kconfig | 11 + drivers/input/keyboard/Makefile | 1 + drivers/input/keyboard/ma35d1_keypad.c | 407 +++++++++++++++++++++++++ 3 files changed, 419 insertions(+) create mode 100644 drivers/input/keyboard/ma35d1_keypad.c
drivers/input/keyboard/Kconfig +11 -0
@@ -358,6 +358,17 @@ config KEYBOARD_LPC32XX To compile this driver as a module, choose M here: the module will be called lpc32xx-keys. +config KEYBOARD_MA35D1 + tristate "Nuvoton MA35D1 keypad controller" + depends on ARCH_MA35 || COMPILE_TEST + select INPUT_MATRIXKMAP + help + Say Y here to enable support for the Nuvoton MA35D1 + hardware matrix keypad controller. + + To compile this driver as a module, choose M here. + The module will be called ma35d1_keypad. + config KEYBOARD_MAPLE tristate "Maple bus keyboard" depends on SH_DREAMCAST && MAPLE
drivers/input/keyboard/Makefile +1 -0
@@ -39,6 +39,7 @@ obj-$(CONFIG_KEYBOARD_LM8323) += lm8323.o obj-$(CONFIG_KEYBOARD_LM8333) += lm8333.o obj-$(CONFIG_KEYBOARD_LOCOMO) += locomokbd.o obj-$(CONFIG_KEYBOARD_LPC32XX) += lpc32xx-keys.o +obj-$(CONFIG_KEYBOARD_MA35D1) += ma35d1_keypad.o obj-$(CONFIG_KEYBOARD_MAPLE) += maple_keyb.o obj-$(CONFIG_KEYBOARD_MATRIX) += matrix_keypad.o obj-$(CONFIG_KEYBOARD_MAX7359) += max7359_keypad.o
drivers/input/keyboard/ma35d1_keypad.c new file +407 -0
407 lines not on this page · raw message
Signature · 1 line
2.43.0