Skip to contentSkip to conversation

input: Add new driver for ARM CLPS711X keypad

PATCH Applied Alexander Shiyan 2 participants 5 messages Mar 18, 2014 – Mar 31, 2014

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

PATCH v3 1/2 input: Add new driver for ARM CLPS711X keypad

This patch adds a new driver for keypad for Cirrus Logic CLPS711X CPUs. Target CPU contain keyboard interface which can scan 8 column lines, so we can read row GPIOs to read status and determine asserted state.

---
 drivers/input/keyboard/Kconfig           |  12 ++
 drivers/input/keyboard/Makefile          |   1 +
 drivers/input/keyboard/clps711x-keypad.c | 209 +++++++++++++++++++++++++++++++
 3 files changed, 222 insertions(+)
 create mode 100644 drivers/input/keyboard/clps711x-keypad.c
drivers/input/keyboard/Kconfig +12 -0
index a673c9f..45274e3 100644
@@ -151,6 +151,18 @@ config KEYBOARD_BFIN
 	  To compile this driver as a module, choose M here: the
 	  module will be called bf54x-keys.
 
+config KEYBOARD_CLPS711X
+	tristate "CLPS711X Keypad support"
+	depends on OF_GPIO && (ARCH_CLPS711X || COMPILE_TEST)
+	select INPUT_MATRIXKMAP
+	select INPUT_POLLDEV
+	help
+	  Say Y here to enable the matrix keypad on the Cirrus Logic
+	  CLPS711X CPUs.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called clps711x-keypad.
+
 config KEYBOARD_LKKBD
 	tristate "DECstation/VAXstation LK201/LK401 keyboard"
 	select SERIO
drivers/input/keyboard/Makefile +1 -0
index a699b61..f8589fe 100644
@@ -11,6 +11,7 @@ obj-$(CONFIG_KEYBOARD_AMIGA)		+= amikbd.o
 obj-$(CONFIG_KEYBOARD_ATARI)		+= atakbd.o
 obj-$(CONFIG_KEYBOARD_ATKBD)		+= atkbd.o
 obj-$(CONFIG_KEYBOARD_BFIN)		+= bf54x-keys.o
+obj-$(CONFIG_KEYBOARD_CLPS711X)		+= clps711x-keypad.o
 obj-$(CONFIG_KEYBOARD_CROS_EC)		+= cros_ec_keyb.o
 obj-$(CONFIG_KEYBOARD_DAVINCI)		+= davinci_keyscan.o
 obj-$(CONFIG_KEYBOARD_EP93XX)		+= ep93xx_keypad.o
drivers/input/keyboard/clps711x-keypad.c new file +209 -0

209 lines not on this page · raw message

Signature · 1 line
1.8.3.2
maintainer
#1 lore raw

Hi Alexander,

drivers/input/keyboard/clps711x-keypad.c line 172

Quoted 7 lines · Alexander Shiyan
drivers/input/keyboard/clps711x-keypad.c new file +7 -0
+	err = input_register_polled_device(poll_dev);
+	if (!err) {
+		/* Report initial state */
+		clps711x_keypad_poll(poll_dev);
+
+		return 0;
+	}

The polled device core will report initial state when input device is opened (as long as polling is enabled) so I removed this cunk and applied the rest.

Thanks.

Signature · 1 line
Dmitry
#2 lore raw

Fri, 28 Mar 2014 09:42:28 -0700 от Dmitry Torokhov <[email protected]>:

Quoted 14 lines

Hi Alexander,

drivers/input/keyboard/clps711x-keypad.c line 172

Quoted 7 lines · Alexander Shiyan
drivers/input/keyboard/clps711x-keypad.c new file +7 -0
+	err = input_register_polled_device(poll_dev);
+	if (!err) {
+		/* Report initial state */
+		clps711x_keypad_poll(poll_dev);
+
+		return 0;
+	}

The polled device core will report initial state when input device is opened (as long as polling is enabled) so I removed this cunk and applied the rest.

Today I stumbled with race condition with this, so your solution is OK. Thanks.

---

#3 lore raw
In reply to Dmitry Torokhov

Fri, 28 Mar 2014 09:42:28 -0700 от Dmitry Torokhov <[email protected]>:

Quoted 14 lines

Hi Alexander,

drivers/input/keyboard/clps711x-keypad.c line 172

Quoted 7 lines · Alexander Shiyan
drivers/input/keyboard/clps711x-keypad.c new file +7 -0
+	err = input_register_polled_device(poll_dev);
+	if (!err) {
+		/* Report initial state */
+		clps711x_keypad_poll(poll_dev);
+
+		return 0;
+	}

The polled device core will report initial state when input device is opened (as long as polling is enabled) so I removed this cunk and applied the rest.

I looked amended version, it is made incorrectly.
...
+ err = input_register_polled_device(poll_dev);
+ if (err)
+ goto out_err;
+
+out_err:
+ input_free_polled_device(poll_dev);
...

Should be:
err = input_register_polled_device(poll_dev);
if (!err)
return 0;

---

maintainer
#4 lore raw
Quoted 1 line · Alexander Shiyan

Fri, 28 Mar 2014 09:42:28 -0700 от Dmitry Torokhov

<[email protected]>:

Quoted 25 lines
Quoted 14 lines

Hi Alexander,

drivers/input/keyboard/clps711x-keypad.c line 172

Quoted 7 lines · Alexander Shiyan
drivers/input/keyboard/clps711x-keypad.c new file +7 -0
+	err = input_register_polled_device(poll_dev);
+	if (!err) {
+		/* Report initial state */
+		clps711x_keypad_poll(poll_dev);
+
+		return 0;
+	}

The polled device core will report initial state when input device is opened (as long as polling is enabled) so I removed this cunk and applied the rest.

I looked amended version, it is made incorrectly.
...
+ err = input_register_polled_device(poll_dev);
+ if (err)
+ goto out_err;

drivers/input/keyboard/clps711x-keypad.c new file +3 -0
+
+out_err:
+ input_free_polled_device(poll_dev);
...
Quoted 4 lines

Should be:
err = input_register_polled_device(poll_dev);
if (!err)
return 0;

Yes, I missed that "return 0;" should be fixed now.

Signature · 5 lines
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html