Skip to contentSkip to conversation

Add support for nuvoton ma35d1 keypad controller

PATCH In review Ming-Jen 2 participants 4 messages Jan 9, 2025

Subsystems (4)
lore
Share & tools
lore

Ming-Jen

author
#0 lore raw

v6 cover Add support for nuvoton ma35d1 keypad controller

From: Ming-jen Chen <[email protected]>

v6:
- Update nuvoton,ma35d1-keypad.yaml
- Modify 'compatible' to make filename matching compatible.
- Update ma35d1_keypad.c
- Modify 'compatible' to match the name in the .yaml file.

v5:
- Update nuvoton,ma35d1-keypad.yaml
- Reorders the items in the properties and required blocks to ensure their order and items are consistent.
v4:
- Update nuvoton,ma35d1-keypad.yaml
- Kept the same order of properties as in the required block.
- Changed register addresses to lowercase.
v3:
- Update nuvoton,ma35d1-keypad.yaml
- Removed vendor-specific properties and replaced them with common properties
- Update ma35d1_keypad.c
- Modified the driver to reflect changes in the YAML properties
v2:
- Update nuvoton,ma35d1-keypad.yaml
- Fixed warnings and errors generated by running checkpatch.pl
- Removed the previous version's properties and rewrote the properties in the Device Tree schema.
- Renamed the Device Tree binding file to nuvoton,ma35d1-keypad.yaml
- Update Kconfig
- Added COMPILE_TEST to the depends on line in the Kconfig
- Update ma35d1_keypad.c
- Refactored error handling within the probe function.
- Fixed the mixed use of devm and non-devm resource management.
- Corrected alignment issues in the code.
- Updated suspend and resume handling methods.
- Fixed variable naming to remove camel casing.
- Used for_each_set_bit() to check key states.
- Modified the code to align with updates in the device tree binding

Ming-jen Chen (2):
dt-bindings: input: Add Nuvoton MA35D1 keypad
input: keypad: add new keypad driver for MA35D1

 .../bindings/input/nuvoton,ma35d1-keypad.yaml |  82 ++++
 drivers/input/keyboard/Kconfig                |  10 +
 drivers/input/keyboard/Makefile               |   1 +
 drivers/input/keyboard/ma35d1_keypad.c        | 387 ++++++++++++++++++
 4 files changed, 480 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.25.1
author
#1 lore raw

PATCH v6 1/2 dt-bindings: input: Add Nuvoton MA35D1 keypad

From: Ming-jen Chen <[email protected]>

Add YAML bindings for MA35D1 SoC keypad.

---
 .../bindings/input/nuvoton,ma35d1-keypad.yaml | 82 +++++++++++++++++++
 1 file changed, 82 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/nuvoton,ma35d1-keypad.yaml
Documentation/devicetree/bindings/input/nuvoton,ma35d1-keypad.yaml new file +82 -0
new file mode 100644
index 000000000000..9d262f87dca0
@@ -0,0 +1,82 @@
+# SPDX-License-Identifier: (GPL-2.0 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 Keypad
+
+maintainers:
+  - Ming-jen Chen <[email protected]>
+
+allOf:
+  - $ref: /schemas/input/matrix-keymap.yaml#
+
+properties:
+  compatible:
+    const: nuvoton,ma35d1-keypad
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  linux,keymap:
+    description: Keymap for the keypad.
+
+  keypad,num-rows:
+    description: Number of rows in the keypad.
+    minimum: 2
+    maximum: 8
+
+  keypad,num-columns:
+    description: Number of columns in the keypad.
+    minimum: 1
+    maximum: 8
+
+  debounce-delay-ms:
+    description: Debounce delay time in milliseconds.
+    maxItems: 1
+
+  scan-interval-ms:
+    description: Scan interval time in milliseconds.
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - linux,keymap
+  - keypad,num-rows
+  - keypad,num-columns
+  - debounce-delay-ms
+  - scan-interval-ms
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/input/input.h>
+    keypad@404a0000 {
+      compatible = "nuvoton,ma35d1-keypad";
+      reg = <0x404a0000 0x10000>;
+      interrupts = <79>;
+      clocks = <&clk>;
+      keypad,num-rows = <2>;
+      keypad,num-columns = <2>;
+
+      linux,keymap = <
+         MATRIX_KEY(0, 0, KEY_ENTER)
+         MATRIX_KEY(0, 1, KEY_ENTER)
+         MATRIX_KEY(1, 0, KEY_SPACE)
+         MATRIX_KEY(1, 1, KEY_Z)
+      >;
+
+      debounce-delay-ms = <1>;
+      scan-interval-ms = <20>;
+    };
Signature · 1 line
2.25.1
author
#3 lore raw

PATCH v6 2/2 input: keypad: add new keypad driver for MA35D1

In reply to Ming-Jen

From: Ming-jen Chen <[email protected]>

Adds a new keypad driver for the MA35D1 platform. The driver supports key scanning and interrupt handling.

---
 drivers/input/keyboard/Kconfig         |  10 +
 drivers/input/keyboard/Makefile        |   1 +
 drivers/input/keyboard/ma35d1_keypad.c | 387 +++++++++++++++++++++++++
 3 files changed, 398 insertions(+)
 create mode 100644 drivers/input/keyboard/ma35d1_keypad.c
drivers/input/keyboard/Kconfig +10 -0
index 721ab69e84ac..d7c0d0f4a88d 100644
@@ -797,4 +797,14 @@ config KEYBOARD_CYPRESS_SF
 	  To compile this driver as a module, choose M here: the
 	  module will be called cypress-sf.
 
+config KEYBOARD_MA35D1
+	tristate "Nuvoton MA35D1 keypad driver"
+	depends on ARCH_MA35 || COMPILE_TEST
+	select INPUT_MATRIXKMAP
+	help
+	  Say Y here if you want to use Nuvoton MA35D1 keypad.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called ma35d1-keypad.
+
 endif
drivers/input/keyboard/Makefile +1 -0
index 1e0721c30709..9b858cdd1b6b 100644
@@ -70,3 +70,4 @@ obj-$(CONFIG_KEYBOARD_TEGRA)		+= tegra-kbc.o
 obj-$(CONFIG_KEYBOARD_TM2_TOUCHKEY)	+= tm2-touchkey.o
 obj-$(CONFIG_KEYBOARD_TWL4030)		+= twl4030_keypad.o
 obj-$(CONFIG_KEYBOARD_XTKBD)		+= xtkbd.o
+obj-$(CONFIG_KEYBOARD_MA35D1)		+= ma35d1_keypad.o
drivers/input/keyboard/ma35d1_keypad.c new file +387 -0

387 lines not on this page · raw message

Signature · 1 line
2.25.1