Skip to contentSkip to conversation

2430SDP touchscreen: use ads7846 instead of tsc2046

PATCH In review Kevin Hilman 2 participants 4 messages May 24, 2007 – May 25, 2007

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

cover 2430SDP touchscreen: use ads7846 instead of tsc2046

The tsc2046 is just updated silicon of ads7846, so instead of having a new driver for the tsc2046, use the ads7846 instead.

These also depend on David Brownell's recent McSPI cleanups.

Kevin

#1 lore raw

PATCH 1/2 ARM: OMAP: use SPI_MODE_0 for ads7846

Following on David Brownell's CPHA fixups/cleanups, Convert the ads7846 driver to SPI_MODE_0 also.

---
 drivers/input/touchscreen/ads7846.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/touchscreen/ads7846.c +1 -1
Index: dev/drivers/input/touchscreen/ads7846.c
===================================================================
@@ -848,7 +848,7 @@ static int __devinit ads7846_probe(struc
 	 * may not.  So we stick to very-portable 8 bit words, both RX and TX.
 	 */
 	spi->bits_per_word = 8;
-	spi->mode = SPI_MODE_1;
+	spi->mode = SPI_MODE_0;
 	err = spi_setup(spi);
 	if (err < 0)
 		return err;

--

#2 lore raw

PATCH 2/2 ARM: OMAP: 2430SDP: Use ads7846 for touchscreen driver

In reply to Kevin Hilman

Removes the tsc2046 specific driver, and changes the 2430SDP platform code to use the ads7846 instead.

---
 arch/arm/mach-omap2/board-2430sdp.c    |   33 +
 drivers/input/touchscreen/Kconfig      |    6 
 drivers/input/touchscreen/Makefile     |    1 
 drivers/input/touchscreen/tsc2046_ts.c |  564 ---------------------------------
 include/linux/spi/tsc2046.h            |   60 ---
 5 files changed, 27 insertions(+), 637 deletions(-)
arch/arm/mach-omap2/board-2430sdp.c +27 -6
Index: dev/arch/arm/mach-omap2/board-2430sdp.c
===================================================================
@@ -23,7 +23,7 @@
 #include <linux/err.h>
 #include <linux/clk.h>
 #include <linux/spi/spi.h>
-#include <linux/spi/tsc2046.h>
+#include <linux/spi/ads7846.h>
 
 #include <asm/hardware.h>
 #include <asm/mach-types.h>
@@ -45,7 +45,10 @@
 #define	SDP2430_FLASH_CS	0
 #define	SDP2430_SMC91X_CS	5
 
-/* TSC2046 (touchscreen) */
+/* GPIO used for TSC2046 (touchscreen)
+ *
+ * Also note that the tsc2046 is the same silicon as the ads7846, so
+ * that driver is used for the touchscreen. */
 #define TS_GPIO                 24
 
 static struct mtd_partition sdp2430_partitions[] = {
@@ -182,9 +185,25 @@ static struct platform_device *sdp2430_d
 	&sdp2430_kp_device,
 };
 
-static struct tsc2046_platform_data tsc2046_config = {
-	.dav_gpio       = TS_GPIO,
-	.gpio_debounce  = 0xa,
+static void ads7846_dev_init(void)
+{
+	if (omap_request_gpio(TS_GPIO) < 0)
+		printk(KERN_ERR "can't get ads746 pen down GPIO\n");
+
+	omap_set_gpio_direction(TS_GPIO, 1);
+
+	omap_set_gpio_debounce(TS_GPIO, 1);
+	omap_set_gpio_debounce_time(TS_GPIO, 0xa);
+}
+
+static int ads7846_get_pendown_state(void)
+{
+	return !omap_get_gpio_datain(TS_GPIO);
+}
+
+static struct ads7846_platform_data tsc2046_config __initdata = {
+	.get_pendown_state = ads7846_get_pendown_state,
+	.keep_vref_on	   = 1,
 };
 
 static struct omap2_mcspi_device_config tsc2046_mcspi_config = {
@@ -198,11 +217,12 @@ static struct spi_board_info sdp2430_spi
 		 * TSC2046 operates at a max freqency of 2MHz, so
 		 * operate slightly below at 1.5MHz
 		 */
-		.modalias	 = "tsc2046",
+		.modalias	 = "ads7846",
 		.bus_num	 = 1,
 		.chip_select	 = 0,
 		.max_speed_hz    = 1500000,
 		.controller_data = &tsc2046_mcspi_config,
+		.irq		 = OMAP_GPIO_IRQ(TS_GPIO),
 		.platform_data   = &tsc2046_config,
 	},
 };
@@ -367,6 +387,7 @@ static void __init omap_2430sdp_init(voi
 
 	spi_register_board_info(sdp2430_spi_board_info,
 				ARRAY_SIZE(sdp2430_spi_board_info));
+	ads7846_dev_init();
 }
 
 static void __init omap_2430sdp_map_io(void)
drivers/input/touchscreen/Kconfig +0 -6
Index: dev/drivers/input/touchscreen/Kconfig
===================================================================
@@ -170,12 +170,6 @@ 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
-
 config TOUCHSCREEN_USB_COMPOSITE
 	tristate "USB Touchscreen Driver"
 	depends on USB_ARCH_HAS_HCD
drivers/input/touchscreen/Makefile +0 -1
Index: dev/drivers/input/touchscreen/Makefile
===================================================================
@@ -20,4 +20,3 @@ 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
drivers/input/touchscreen/tsc2046_ts.c deleted +0 -564

564 lines not on this page · raw message

include/linux/spi/tsc2046.h deleted +0 -60

60 lines not on this page · raw message

--

maintainer
#3 lore raw

Re: [PATCH 2/2] ARM: OMAP: 2430SDP: Use ads7846 for touchscreen driver

Quoted 2 lines · Kevin Hilman

Removes the tsc2046 specific driver, and changes the 2430SDP platform code to use the ads7846 instead.

Pushing this today. Patch 1/2 is already applied.

Tony