AT91: add touchscreen support for at91sam9g45ekes
authorNicolas Ferre <nicolas.ferre@atmel.com>
Thu, 19 Nov 2009 17:32:52 +0000 (09:32 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Fri, 20 Nov 2009 08:55:38 +0000 (00:55 -0800)
New at91sam9g45ekes board provides a LCD with resistive touchscreen.
This is the support of this feature by atmel_tsadcc driver. This also
sets up platform parameters to be passed to the driver.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Andrew Victor <linux@maxim.org.za>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
arch/arm/mach-at91/at91sam9g45_devices.c
arch/arm/mach-at91/board-sam9m10g45ek.c
drivers/input/touchscreen/Kconfig

index 332b784050b272592d402afddf077b0ec591d00b..a5a4eb19fbbec1a5e8f7adb3ec485bc439997ee6 100644 (file)
@@ -809,6 +809,57 @@ static void __init at91_add_device_rtc(void) {}
 #endif
 
 
+/* --------------------------------------------------------------------
+ *  Touchscreen
+ * -------------------------------------------------------------------- */
+
+#if defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) || defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC_MODULE)
+static u64 tsadcc_dmamask = DMA_BIT_MASK(32);
+static struct at91_tsadcc_data tsadcc_data;
+
+static struct resource tsadcc_resources[] = {
+       [0] = {
+               .start  = AT91SAM9G45_BASE_TSC,
+               .end    = AT91SAM9G45_BASE_TSC + SZ_16K - 1,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = AT91SAM9G45_ID_TSC,
+               .end    = AT91SAM9G45_ID_TSC,
+               .flags  = IORESOURCE_IRQ,
+       }
+};
+
+static struct platform_device at91sam9g45_tsadcc_device = {
+       .name           = "atmel_tsadcc",
+       .id             = -1,
+       .dev            = {
+                               .dma_mask               = &tsadcc_dmamask,
+                               .coherent_dma_mask      = DMA_BIT_MASK(32),
+                               .platform_data          = &tsadcc_data,
+       },
+       .resource       = tsadcc_resources,
+       .num_resources  = ARRAY_SIZE(tsadcc_resources),
+};
+
+void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data)
+{
+       if (!data)
+               return;
+
+       at91_set_gpio_input(AT91_PIN_PD20, 0);  /* AD0_XR */
+       at91_set_gpio_input(AT91_PIN_PD21, 0);  /* AD1_XL */
+       at91_set_gpio_input(AT91_PIN_PD22, 0);  /* AD2_YT */
+       at91_set_gpio_input(AT91_PIN_PD23, 0);  /* AD3_TB */
+
+       tsadcc_data = *data;
+       platform_device_register(&at91sam9g45_tsadcc_device);
+}
+#else
+void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data) {}
+#endif
+
+
 /* --------------------------------------------------------------------
  *  RTT
  * -------------------------------------------------------------------- */
index 64c3843f323df7e230ea5d1dfd080622998ea9e8..3d6764b3ad7ae7ffba9babcabd5f6aefc6880068 100644 (file)
@@ -228,6 +228,16 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data;
 #endif
 
 
+/*
+ * Touchscreen
+ */
+static struct at91_tsadcc_data ek_tsadcc_data = {
+       .adc_clock              = 300000,
+       .pendet_debounce        = 0x0d,
+       .ts_sample_hold_time    = 0x0a,
+};
+
+
 /*
  * GPIO Buttons
  */
@@ -378,6 +388,8 @@ static void __init ek_board_init(void)
        at91_add_device_i2c(0, NULL, 0);
        /* LCD Controller */
        at91_add_device_lcdc(&ek_lcdc_data);
+       /* Touch Screen */
+       at91_add_device_tsadcc(&ek_tsadcc_data);
        /* Push Buttons */
        ek_add_device_buttons();
        /* AC97 */
index 1cd9e8c8efb32883d65c741735a6acac295f7d73..aebea71ff02ae1aaac6832f05b645e2a4b15460f 100644 (file)
@@ -309,7 +309,7 @@ config TOUCHSCREEN_TOUCHWIN
 
 config TOUCHSCREEN_ATMEL_TSADCC
        tristate "Atmel Touchscreen Interface"
-       depends on ARCH_AT91SAM9RL
+       depends on ARCH_AT91SAM9RL || ARCH_AT91SAM9G45
        help
          Say Y here if you have a 4-wire touchscreen connected to the
           ADC Controller on your Atmel SoC (such as the AT91SAM9RL).