2430中tsc2046的触摸驱动(参考)
arch/arm/mach-omap2/board-2430sdp.c | 32 +
drivers/input/touchscreen/Kconfig | 6
drivers/input/touchscreen/Makefile | 1
drivers/input/touchscreen/tsc2046_ts.c | 555 +++++++++++++++++++++++++++++++++
include/linux/spi/tsc2046.h | 60 +++
5 files changed, 654 insertions(+)
Index: dev/arch/arm/mach-omap2/board-2430sdp.c ===================================================================
--- dev.orig/arch/arm/mach-omap2/board-2430sdp.c +++ dev/arch/arm/mach-omap2/board-2430sdp.c @@ -21,6 +21,8 @@
#include
#include
#include
+#include
+#include
#include
#include
@@ -33,6 +35,7 @@
#include
#include
#include
+#include
#include "prcm-regs.h"
#include
@@ -40,6 +43,9 @@
#define SDP2430_FLASH_CS 0
#define SDP2430_SMC91X_CS 5
+/* TSC2046 (touchscreen) */
+#define TS_GPIO 24
+
static struct mtd_partition sdp2430_partitions[] = {
/* bootloader (U-Boot, etc) in first sector */
{
@@ -119,6 +125,29 @@ static struct platform_device *sdp2430_d
&sdp2430_flash_device,
};
+static struct tsc2046_platform_data tsc2046_config = { + .dav_gpio = TS_GPIO,
+ .gpio_debounce = 0xa,
+};
+
+static struct omap2_mcspi_device_config tsc2046_mcspi_config = { + .turbo_mode = 0,
+ .single_channel = 0, /* 0: slave, 1: master */ +};
+
+static struct spi_board_info sdp2430_spi_board_info[] __initdata = {
+ [0] = {
+ /* TSC2046 operates at a max freqency of 2MHz, so + * operate slightly below at 1.5MHz */
+ .modalias = "tsc2046",
+ .bus_num = 1,
+ .chip_select = 0,
+ .max_speed_hz = 1500000,
+ .controller_data= &tsc2046_mcspi_config,
+ .platform_data = &tsc2046_config,
+ },
+};
+
static inline void __init sdp2430_init_smc91x(void)
{
int eth_cs;
@@ -198,6 +227,9 @@ static void __init omap_2430sdp_init(voi
omap_board_config = sdp2430_config;
omap_board_config_size = ARRAY_SIZE(sdp2430_config);
omap_serial_init();
+
+ spi_register_board_info(omap3devkit9100_spi_board_info, + ARRAY_SIZE(omap3devkit9100_spi_board_info));
}
static void __init omap_2430sdp_map_io(void) Index: dev/drivers/input/touchscreen/Kconfig
===================================================================
--- dev.orig/drivers/input/touchscreen/Kconfig +++ dev/drivers/input/touchscreen/Kconfig
@@ -165,4 +165,10 @@ config TOUCHSCREEN_TSC2301
help
Say Y here for if you are using the touchscreen features of TSC2301.
+config TOUCHSCREEN_TSC2046
+ tristate "TSC2046 touchscreen support"
+ default MACH_OMAP2430SDP
+ help
+ Say Y here for if you are using the touchscreen features of TSC2046
+
endif
Index: dev/drivers/input/touchscreen/Makefile
=================================================================== --- dev.orig/drivers/input/touchscreen/Makefile +++ dev/drivers/input/touchscreen/Makefile
@@ -19,3 +19,4 @@ obj-$(CONFIG_TOUCHSCREEN_UCB1400) += ucb
obj-$(CONFIG_TOUCHSCREEN_TSC2102) += tsc2102_ts.o
obj-$(CONFIG_TOUCHSCREEN_OMAP) += omap/
obj-$(CONFIG_TOUCHSCREEN_TSC2301) += tsc2301_ts.o +obj-$(CONFIG_TOUCHSCREEN_TSC2046) += tsc2046_ts.o Index: dev/drivers/input/touchscreen/tsc2046_ts.c =================================================================== --- /dev/null
+++ dev/drivers/input/touchscreen/tsc2046_ts.c
@@ -0,0 +1,555 @@
+/*
+ * TSC2046 Touchscreen driver
+ *
+ * Author: Kevin Hilman, MontaVista Software, Inc.