Skip to contentSkip to conversation

Driver for TC35894XBG keypad controller

PATCH In review Alan Cox 3 participants 3 messages Oct 5, 2010 – Oct 6, 2010 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

Alan Cox

author
#0 lore raw

PATCH 1/1 Driver for TC35894XBG keypad controller

From: Charlie Paul <[email protected]>

The actual keypad translation is done via platform supplied data. This is neccessary as there are multiple driver users with different keypad layouts already, and will no doubt be more.

---

 drivers/input/keyboard/Kconfig           |    6 
 drivers/input/keyboard/Makefile          |    1 
 drivers/input/keyboard/tc35894xbg.c      |  722 ++++++++++++++
 drivers/input/keyboard/tc35894xbg_regs.h | 1528 ++++++++++++++++++++++++++++++
 include/linux/i2c/tc35894xbg.h           |   72 +
 5 files changed, 2329 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/keyboard/tc35894xbg.c
 create mode 100644 drivers/input/keyboard/tc35894xbg_regs.h
 create mode 100644 include/linux/i2c/tc35894xbg.h
drivers/input/keyboard/Kconfig +6 -0
index 7dacba3..24d5e81 100644
@@ -318,6 +318,12 @@ config KEYBOARD_IMX
 	  To compile this driver as a module, choose M here: the
 	  module will be called imx_keypad.
 
+config KEYBOARD_TC35894XBG
+	tristate "TC35894XBG I2C keypad support"
+	depends on I2C
+	help
+	  Say Y if you have Toshiba TX35894XBG keypad controller
+
 config KEYBOARD_NEWTON
 	tristate "Newton keyboard"
 	select SERIO
drivers/input/keyboard/Makefile +1 -0
index a34452e..1057855 100644
@@ -40,6 +40,7 @@ obj-$(CONFIG_KEYBOARD_SH_KEYSC)		+= sh_keysc.o
 obj-$(CONFIG_KEYBOARD_STMPE)		+= stmpe-keypad.o
 obj-$(CONFIG_KEYBOARD_STOWAWAY)		+= stowaway.o
 obj-$(CONFIG_KEYBOARD_SUNKBD)		+= sunkbd.o
+obj-$(CONFIG_KEYBOARD_TC35894XBG)	+= tc35894xbg.o
 obj-$(CONFIG_KEYBOARD_TNETV107X)	+= tnetv107x-keypad.o
 obj-$(CONFIG_KEYBOARD_TWL4030)		+= twl4030_keypad.o
 obj-$(CONFIG_KEYBOARD_XTKBD)		+= xtkbd.o
drivers/input/keyboard/tc35894xbg.c new file +722 -0

722 lines not on this page · raw message

drivers/input/keyboard/tc35894xbg_regs.h new file +1528 -0

1,528 lines not on this page · raw message

include/linux/i2c/tc35894xbg.h new file +72 -0

72 lines not on this page · raw message

A message that is not in the archive (sent off-list or not yet received): 20101005161838.16209.16231.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/[email protected]

#2 lore raw
Quoted 13 lines · Alan Cox
include/linux/i2c/tc35894xbg.h new file +13 -0
+
+/*
+ * Largest keycode that the chip can send, plus one,
+ * so keys can be mapped directly at the index of the
+ * TC35894XBG keycode instead of subtracting one.
+ */
+#define TC35894XBG_KEYMAP_SIZE      (0x7f + 1)
+
+#define SHIFT_NEEDED    (0x1000)
+
+#define KEY_EXCLAM      (KEY_1 + SHIFT_NEEDED)  /* '!' -> shift+1 */
+#define KEY_AT          (KEY_2 + SHIFT_NEEDED)  /* '@' -> shift+2 */
+#define KEY_NUMBER_SIGN (KEY_3 + SHIFT_NEEDED)  /* '#' -> shift+3 */

include/linux/i2c/tc35894xbg.h line 39

Quoted 10 lines
include/linux/i2c/tc35894xbg.h new file +10 -0
+#define KEY_DOLLAR_SIGN (KEY_4 + SHIFT_NEEDED)  /* '$' -> shift+4 */
+#define KEY_NOR         (KEY_6 + SHIFT_NEEDED)  /* '^' -> shift+6 */
+#define KEY_PERCENT     (KEY_5 + SHIFT_NEEDED)  /* '%' -> shift+5 */
+#define KEY_AMPERSAND   (KEY_7 + SHIFT_NEEDED)  /* '&' -> shift+7 */
+#define KEY_PLUS        (KEY_EQUAL + SHIFT_NEEDED) /* '+' -> shift+= */
+
+#define KEY_BAR         (KEY_BACKSLASH + SHIFT_NEEDED)  /* '|' -> shift+\ */
+#define KEY_COLON       (KEY_SEMICOLON + SHIFT_NEEDED)  /* ':' -> shift+; */
+#define KEY_UNDERSCORE  (KEY_MINUS + SHIFT_NEEDED) /* '_' -> shift+- */
+#define KEY_QUOTE_DBL   (KEY_APOSTROPHE + SHIFT_NEEDED) /* '"' -> shift+' */

No, this will not fly. It assumes presence of certain keymap which is not necessarily the case.

Signature · 1 line
Dmitry
#3 lore raw
In reply to Alan Cox

drivers/input/keyboard/Kconfig config KEYBOARD_IMX · line 322

Quoted 2 lines · Alan Cox
drivers/input/keyboard/Kconfig +2 -0
+config KEYBOARD_TC35894XBG
+	tristate "TC35894XBG I2C keypad support"

This looks one of the TC3589x family of I/O expanders. For the TC35892, there's already a minimal MFD core in driver/mfd/tc35892.c, and a driver for the GPIO block based on that in drivers/gpio/tc35892-gpio.c.

Comparing the registers map in this patch with the TC35892 datasheet, the parts look very similar, so would it be possible for you to make this driver use the TC35892 MFD core, so that multiple blocks can used simultaneously?

There's no keypad driver for the series in mainline yet, but Sundar was readying one for the TC35893; I'll let him comment on how similar the keypad parts look, and what it would take to support the TC35894XBG and TC35893 keypads in one driver.

Rabin