Skip to contentSkip to conversation

add tnetv107x input drivers

PATCH Superseded Cyril Chemparathy 2 participants 8 messages Sep 20, 2010

Subsystems (5)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover add tnetv107x input drivers

Texas Instruments' TNETV107X is an ARM1176 based SoC, with on-chip touchscreen and keypad controllers. This patch series adds drivers for these controllers.

Changes between v1 and v2:
1. Cleaned up platform data needs by reusing matrix keypad pdata
2. Eliminated calibration code from touch driver
3. Relocated h/w init code to open and close
4. Other minor cleanups

Changes between v2 and v3:
1. Merged keycodes alloc into keypad data
2. Moved irq hookup to probe from open
3. Other minor cleanups

Cyril Chemparathy (5):
input: add driver for tnetv107x on-chip keypad controller
davinci: add tnetv107x keypad platform device
davinci: add keypad config for tnetv107x evm board
input: add driver for tnetv107x touchscreen controller
davinci: add tnetv107x touchscreen platform device

 arch/arm/mach-davinci/board-tnetv107x-evm.c    |   56 ++++
 arch/arm/mach-davinci/devices-tnetv107x.c      |   50 +++
 arch/arm/mach-davinci/include/mach/tnetv107x.h |    3 +
 drivers/input/keyboard/Kconfig                 |    9 +
 drivers/input/keyboard/Makefile                |    1 +
 drivers/input/keyboard/tnetv107x-keypad.c      |  328 ++++++++++++++++++++
 drivers/input/touchscreen/Kconfig              |    9 +
 drivers/input/touchscreen/Makefile             |    1 +
 drivers/input/touchscreen/tnetv107x-ts.c       |  396 ++++++++++++++++++++++++
 9 files changed, 853 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/keyboard/tnetv107x-keypad.c
 create mode 100644 drivers/input/touchscreen/tnetv107x-ts.c
#1 lore raw

PATCH v3 1/5 input: add driver for tnetv107x on-chip keypad controller

This patch adds support for tnetv107x's on-chip keypad controller.

---
 drivers/input/keyboard/Kconfig            |    9 +
 drivers/input/keyboard/Makefile           |    1 +
 drivers/input/keyboard/tnetv107x-keypad.c |  328 +++++++++++++++++++++++++++++
 3 files changed, 338 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/keyboard/tnetv107x-keypad.c
drivers/input/keyboard/Kconfig +9 -0
index 9cc488d..df1facb 100644
@@ -424,6 +424,15 @@ config KEYBOARD_OMAP
 	  To compile this driver as a module, choose M here: the
 	  module will be called omap-keypad.
 
+config KEYBOARD_TNETV107X
+	tristate "TI TNETV107X keypad support"
+	depends on ARCH_DAVINCI_TNETV107X
+	help
+	  Say Y here if you want to use the TNETV107X keypad.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called tnetv107x-keypad.
+
 config KEYBOARD_TWL4030
 	tristate "TI TWL4030/TWL5030/TPS659x0 keypad support"
 	depends on TWL4030_CORE
drivers/input/keyboard/Makefile +1 -0
index 504b591..dc04518 100644
@@ -38,6 +38,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_TNETV107X)	+= tnetv107x-keypad.o
 obj-$(CONFIG_KEYBOARD_TWL4030)		+= twl4030_keypad.o
 obj-$(CONFIG_KEYBOARD_XTKBD)		+= xtkbd.o
 obj-$(CONFIG_KEYBOARD_W90P910)		+= w90p910_keypad.o
drivers/input/keyboard/tnetv107x-keypad.c new file +328 -0

328 lines not on this page · raw message

Signature · 1 line
1.7.0.4
maintainer Acked-by on v3 1/5
#2 lore raw

Re: [PATCH v3 1/5] input: add driver for tnetv107x on-chip keypad controller

Hi Cyril,

Quoted 2 lines · Cyril Chemparathy

This patch adds support for tnetv107x's on-chip keypad controller.

There is one thing that I missed - since you have 2 separate irqs they may execute at the same time on 2 different CPUs (theoretically, if platform will ever have multiple CPUs) so you need to take a spinlock inside the interrupt handler to protect from simultaneous access to shared data.

Once you add it please add

and forward it to Kevin so it is merged through his tree.

Thanks.

Signature · 1 line
Dmitry
#3 lore raw

PATCH v3 2/5 davinci: add tnetv107x keypad platform device

In reply to Cyril Chemparathy

This patch adds a platform device definition for tnetv107x's keypad controller.

---
 arch/arm/mach-davinci/devices-tnetv107x.c      |   30 ++++++++++++++++++++++++
 arch/arm/mach-davinci/include/mach/tnetv107x.h |    3 ++
 2 files changed, 33 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/devices-tnetv107x.c +30 -0
index 2718a3a..086269f 100644
@@ -33,6 +33,7 @@
 #define TNETV107X_WDOG_BASE			0x08086700
 #define TNETV107X_SDIO0_BASE			0x08088700
 #define TNETV107X_SDIO1_BASE			0x08088800
+#define TNETV107X_KEYPAD_BASE			0x08088a00
 #define TNETV107X_ASYNC_EMIF_CNTRL_BASE		0x08200000
 #define TNETV107X_ASYNC_EMIF_DATA_CE0_BASE	0x30000000
 #define TNETV107X_ASYNC_EMIF_DATA_CE1_BASE	0x40000000
@@ -298,6 +299,30 @@ static int __init nand_init(int chipsel, struct davinci_nand_pdata *data)
 	return platform_device_register(pdev);
 }
 
+static struct resource keypad_resources[] = {
+	{
+		.start	= TNETV107X_KEYPAD_BASE,
+		.end	= TNETV107X_KEYPAD_BASE + 0xff,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.start	= IRQ_TNETV107X_KEYPAD,
+		.flags	= IORESOURCE_IRQ,
+		.name	= "press",
+	},
+	{
+		.start	= IRQ_TNETV107X_KEYPAD_FREE,
+		.flags	= IORESOURCE_IRQ,
+		.name	= "release",
+	},
+};
+
+static struct platform_device keypad_device = {
+	.name		= "tnetv107x-keypad",
+	.num_resources	= ARRAY_SIZE(keypad_resources),
+	.resource	= keypad_resources,
+};
+
 void __init tnetv107x_devices_init(struct tnetv107x_device_info *info)
 {
 	int i;
@@ -317,4 +342,9 @@ void __init tnetv107x_devices_init(struct tnetv107x_device_info *info)
 	for (i = 0; i < 4; i++)
 		if (info->nand_config[i])
 			nand_init(i, info->nand_config[i]);
+
+	if (info->keypad_config) {
+		keypad_device.dev.platform_data = info->keypad_config;
+		platform_device_register(&keypad_device);
+	}
 }
arch/arm/mach-davinci/include/mach/tnetv107x.h +3 -0
index c720647..5a681d8 100644
@@ -33,6 +33,8 @@
 #ifndef __ASSEMBLY__
 
 #include <linux/serial_8250.h>
+#include <linux/input/matrix_keypad.h>
+
 #include <mach/mmc.h>
 #include <mach/nand.h>
 #include <mach/serial.h>
@@ -41,6 +43,7 @@ struct tnetv107x_device_info {
 	struct davinci_uart_config	*serial_config;
 	struct davinci_mmc_config	*mmc_config[2];  /* 2 controllers */
 	struct davinci_nand_pdata	*nand_config[4]; /* 4 chipsels */
+	struct matrix_keypad_platform_data *keypad_config;
 };
 
 extern struct platform_device tnetv107x_wdt_device;
Signature · 1 line
1.7.0.4
#4 lore raw

PATCH v3 3/5 davinci: add keypad config for tnetv107x evm board

In reply to Cyril Chemparathy

This patch adds evm board specific keymap definitions and controller configuration data for on-chip keypad controller on tnetv107x silicon.

---
 arch/arm/mach-davinci/board-tnetv107x-evm.c |   56 +++++++++++++++++++++++++++
 1 files changed, 56 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/board-tnetv107x-evm.c +56 -0
index fe2a9d9..5afa8fc 100644
@@ -23,6 +23,9 @@
 #include <linux/ratelimit.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
+#include <linux/input.h>
+#include <linux/input/matrix_keypad.h>
+
 #include <asm/mach/arch.h>
 #include <asm/mach-types.h>
 
@@ -141,10 +144,63 @@ static struct davinci_uart_config serial_config __initconst = {
 	.enabled_uarts	= BIT(1),
 };
 
+static const uint32_t keymap[] = {
+	KEY(0, 0, KEY_NUMERIC_1),
+	KEY(0, 1, KEY_NUMERIC_2),
+	KEY(0, 2, KEY_NUMERIC_3),
+	KEY(0, 3, KEY_FN_F1),
+	KEY(0, 4, KEY_MENU),
+
+	KEY(1, 0, KEY_NUMERIC_4),
+	KEY(1, 1, KEY_NUMERIC_5),
+	KEY(1, 2, KEY_NUMERIC_6),
+	KEY(1, 3, KEY_UP),
+	KEY(1, 4, KEY_FN_F2),
+
+	KEY(2, 0, KEY_NUMERIC_7),
+	KEY(2, 1, KEY_NUMERIC_8),
+	KEY(2, 2, KEY_NUMERIC_9),
+	KEY(2, 3, KEY_LEFT),
+	KEY(2, 4, KEY_ENTER),
+
+	KEY(3, 0, KEY_NUMERIC_STAR),
+	KEY(3, 1, KEY_NUMERIC_0),
+	KEY(3, 2, KEY_NUMERIC_POUND),
+	KEY(3, 3, KEY_DOWN),
+	KEY(3, 4, KEY_RIGHT),
+
+	KEY(4, 0, KEY_FN_F3),
+	KEY(4, 1, KEY_FN_F4),
+	KEY(4, 2, KEY_MUTE),
+	KEY(4, 3, KEY_HOME),
+	KEY(4, 4, KEY_BACK),
+
+	KEY(5, 0, KEY_VOLUMEDOWN),
+	KEY(5, 1, KEY_VOLUMEUP),
+	KEY(5, 2, KEY_F1),
+	KEY(5, 3, KEY_F2),
+	KEY(5, 4, KEY_F3),
+};
+
+static const struct matrix_keymap_data keymap_data = {
+	.keymap		= keymap,
+	.keymap_size	= ARRAY_SIZE(keymap),
+};
+
+static struct matrix_keypad_platform_data keypad_config = {
+	.keymap_data	= &keymap_data,
+	.num_row_gpios	= 6,
+	.num_col_gpios	= 5,
+	.debounce_ms	= 0, /* minimum */
+	.active_low	= 0, /* pull up realization */
+	.no_autorepeat	= 0,
+};
+
 static struct tnetv107x_device_info evm_device_info __initconst = {
 	.serial_config		= &serial_config,
 	.mmc_config[1]		= &mmc_config,	/* controller 1 */
 	.nand_config[0]		= &nand_config,	/* chip select 0 */
+	.keypad_config		= &keypad_config,
 };
 
 static __init void tnetv107x_evm_board_init(void)
Signature · 1 line
1.7.0.4
#5 lore raw

PATCH v3 4/5 input: add driver for tnetv107x touchscreen controller

In reply to Cyril Chemparathy

This patch adds support for tnetv107x's on-chip touchscreen controller.

---
 drivers/input/touchscreen/Kconfig        |    9 +
 drivers/input/touchscreen/Makefile       |    1 +
 drivers/input/touchscreen/tnetv107x-ts.c |  396 ++++++++++++++++++++++++++++++
 3 files changed, 406 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/touchscreen/tnetv107x-ts.c
drivers/input/touchscreen/Kconfig +9 -0
index 0069d97..8d32028 100644
@@ -328,6 +328,15 @@ config TOUCHSCREEN_MIGOR
 	  To compile this driver as a module, choose M here: the
 	  module will be called migor_ts.
 
+config TOUCHSCREEN_TNETV107X
+	tristate "TI TNETV107X touchscreen support"
+	depends on ARCH_DAVINCI_TNETV107X
+	help
+	  Say Y here if you want to use the TNETV107X touchscreen.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called tnetv107x-ts.
+
 config TOUCHSCREEN_TOUCHRIGHT
 	tristate "Touchright serial touchscreen"
 	select SERIO
drivers/input/touchscreen/Makefile +1 -0
index 28217e1..d41a964 100644
@@ -37,6 +37,7 @@ obj-$(CONFIG_TOUCHSCREEN_PENMOUNT)	+= penmount.o
 obj-$(CONFIG_TOUCHSCREEN_QT602240)	+= qt602240_ts.o
 obj-$(CONFIG_TOUCHSCREEN_S3C2410)	+= s3c2410_ts.o
 obj-$(CONFIG_TOUCHSCREEN_STMPE)		+= stmpe-ts.o
+obj-$(CONFIG_TOUCHSCREEN_TNETV107X)	+= tnetv107x-ts.o
 obj-$(CONFIG_TOUCHSCREEN_TOUCHIT213)	+= touchit213.o
 obj-$(CONFIG_TOUCHSCREEN_TOUCHRIGHT)	+= touchright.o
 obj-$(CONFIG_TOUCHSCREEN_TOUCHWIN)	+= touchwin.o
drivers/input/touchscreen/tnetv107x-ts.c new file +396 -0

396 lines not on this page · raw message

Signature · 1 line
1.7.0.4
maintainer Acked-by on v3 4/5
#6 lore raw

Re: [PATCH v3 4/5] input: add driver for tnetv107x touchscreen controller

Quoted 2 lines · Cyril Chemparathy

This patch adds support for tnetv107x's on-chip touchscreen controller.

Thank you for makign the changes, looks good now.

Signature · 1 line
Dmitry
#7 lore raw

PATCH v3 5/5 davinci: add tnetv107x touchscreen platform device

In reply to Cyril Chemparathy

This patch adds a platform device definition for tnetv107x's touchscreen controller.

---
 arch/arm/mach-davinci/devices-tnetv107x.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/devices-tnetv107x.c +20 -0
index 086269f..c9a86d8 100644
@@ -31,6 +31,7 @@
 #define TNETV107X_TPTC0_BASE			0x01c10000
 #define TNETV107X_TPTC1_BASE			0x01c10400
 #define TNETV107X_WDOG_BASE			0x08086700
+#define TNETV107X_TSC_BASE			0x08088500
 #define TNETV107X_SDIO0_BASE			0x08088700
 #define TNETV107X_SDIO1_BASE			0x08088800
 #define TNETV107X_KEYPAD_BASE			0x08088a00
@@ -323,12 +324,31 @@ static struct platform_device keypad_device = {
 	.resource	= keypad_resources,
 };
 
+static struct resource tsc_resources[] = {
+	{
+		.start	= TNETV107X_TSC_BASE,
+		.end	= TNETV107X_TSC_BASE + 0xff,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.start	= IRQ_TNETV107X_TSC,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device tsc_device = {
+	.name		= "tnetv107x-ts",
+	.num_resources	= ARRAY_SIZE(tsc_resources),
+	.resource	= tsc_resources,
+};
+
 void __init tnetv107x_devices_init(struct tnetv107x_device_info *info)
 {
 	int i;
 
 	platform_device_register(&edma_device);
 	platform_device_register(&tnetv107x_wdt_device);
+	platform_device_register(&tsc_device);
 
 	if (info->serial_config)
 		davinci_serial_init(info->serial_config);
Signature · 1 line
1.7.0.4