summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongfang Shi <dshi@nvidia.com>2012-09-04 16:49:20 -0700
committerSimone Willett <swillett@nvidia.com>2012-10-22 13:52:51 -0700
commitb508bba3c863fe58d5b25ef096d695ea62cb6786 (patch)
tree3f405b3ba0b8371d35d886fb84744f7fd1bd96d3
parent21f3cd0cf543acf018bafad61ad85c9910683c27 (diff)
arm: tegra: e1853: add WXGA touch panel support
Support WXGA display and touch input for e1853. bug 1036173 Change-Id: Ia66119c1f05dd61a46346a1b7e5dc5bbbeb43495 Signed-off-by: Dongfang Shi <dshi@nvidia.com> Reviewed-on: http://git-master/r/129521 (cherry picked from commit a766194a31b6fe7e9834959a19c88d375c15d6de) Reviewed-on: http://git-master/r/143774 Reviewed-by: Simone Willett <swillett@nvidia.com> Tested-by: Simone Willett <swillett@nvidia.com>
-rw-r--r--arch/arm/mach-tegra/board-e1853-panel.c30
-rw-r--r--arch/arm/mach-tegra/board-e1853.c108
-rw-r--r--arch/arm/mach-tegra/board-e1853.h6
3 files changed, 144 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/board-e1853-panel.c b/arch/arm/mach-tegra/board-e1853-panel.c
index f500b66638c2..400534e41035 100644
--- a/arch/arm/mach-tegra/board-e1853-panel.c
+++ b/arch/arm/mach-tegra/board-e1853-panel.c
@@ -168,6 +168,34 @@ static int e1853_lvds_disable(void)
return 0;
}
+#ifdef CONFIG_TOUCHSCREEN_ATMEL_MXT
+
+static struct tegra_dc_mode e1853_panel_modes[] = {
+ {
+ /* 1366x768@60Hz */
+ .pclk = 74180000,
+ .h_ref_to_sync = 1,
+ .v_ref_to_sync = 1,
+ .h_sync_width = 30,
+ .v_sync_width = 5,
+ .h_back_porch = 52,
+ .v_back_porch = 20,
+ .h_active = 1366,
+ .v_active = 768,
+ .h_front_porch = 64,
+ .v_front_porch = 25,
+ },
+};
+
+static struct tegra_fb_data e1853_fb_data = {
+ .win = 0,
+ .xres = 1366,
+ .yres = 768,
+ .bits_per_pixel = 32,
+};
+
+#else
+
static struct tegra_dc_mode e1853_panel_modes[] = {
{
/* 800x480@60 */
@@ -192,6 +220,8 @@ static struct tegra_fb_data e1853_fb_data = {
.bits_per_pixel = 32,
};
+#endif
+
static struct tegra_dc_out e1853_ser_out = {
.align = TEGRA_DC_ALIGN_MSB,
.order = TEGRA_DC_ORDER_RED_BLUE,
diff --git a/arch/arm/mach-tegra/board-e1853.c b/arch/arm/mach-tegra/board-e1853.c
index 9481aa2f3249..e58d106ca8b5 100644
--- a/arch/arm/mach-tegra/board-e1853.c
+++ b/arch/arm/mach-tegra/board-e1853.c
@@ -35,6 +35,9 @@
#include <linux/platform_data/tegra_nor.h>
#include <linux/spi/spi.h>
#include <linux/mtd/partitions.h>
+#if defined(CONFIG_TOUCHSCREEN_ATMEL_MXT)
+#include <linux/i2c/atmel_mxt_ts.h>
+#endif
#include <mach/clk.h>
#include <mach/iomap.h>
#include <mach/irqs.h>
@@ -354,6 +357,107 @@ static struct platform_device *e1853_devices[] __initdata = {
&tegra_wdt0_device
};
+#ifdef CONFIG_TOUCHSCREEN_ATMEL_MXT
+
+#define MXT_CONFIG_CRC 0xD62DE8
+static const u8 config[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xFF, 0xFF, 0x32, 0x0A, 0x00, 0x14, 0x14, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x00, 0x00,
+ 0x1B, 0x2A, 0x00, 0x20, 0x3C, 0x04, 0x05, 0x00,
+ 0x02, 0x01, 0x00, 0x0A, 0x0A, 0x0A, 0x0A, 0xFF,
+ 0x02, 0x55, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x64, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23,
+ 0x00, 0x00, 0x00, 0x05, 0x0A, 0x15, 0x1E, 0x00,
+ 0x00, 0x04, 0xFF, 0x03, 0x3F, 0x64, 0x64, 0x01,
+ 0x0A, 0x14, 0x28, 0x4B, 0x00, 0x02, 0x00, 0x64,
+ 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x08, 0x10, 0x3C, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+#define MXT_CONFIG_CRC_SKU2000 0xA24D9A
+static const u8 config_sku2000[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xFF, 0xFF, 0x32, 0x0A, 0x00, 0x14, 0x14, 0x19,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x00, 0x00,
+ 0x1B, 0x2A, 0x00, 0x20, 0x3A, 0x04, 0x05, 0x00, /* 23=thr 2 di */
+ 0x04, 0x04, 0x41, 0x0A, 0x0A, 0x0A, 0x0A, 0xFF,
+ 0x02, 0x55, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, /* 0A=limit */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23,
+ 0x00, 0x00, 0x00, 0x05, 0x0A, 0x15, 0x1E, 0x00,
+ 0x00, 0x04, 0x00, 0x03, 0x3F, 0x64, 0x64, 0x01,
+ 0x0A, 0x14, 0x28, 0x4B, 0x00, 0x02, 0x00, 0x64,
+ 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x08, 0x10, 0x3C, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static struct mxt_platform_data atmel_mxt_info = {
+ .x_line = 27,
+ .y_line = 42,
+ .x_size = 768,
+ .y_size = 1366,
+ .blen = 0x20,
+ .threshold = 0x3C,
+ .voltage = 3300000, /* 3.3V */
+ .orient = 5,
+ .config = config,
+ .config_length = 157,
+ .config_crc = MXT_CONFIG_CRC,
+ .irqflags = IRQF_TRIGGER_FALLING,
+ .read_chg = NULL,
+};
+
+static struct i2c_board_info __initdata atmel_i2c_info[] = {
+ {
+ I2C_BOARD_INFO("atmel_mxt_ts", 0x5A),
+ .irq = TEGRA_GPIO_TO_IRQ(TOUCH_GPIO_IRQ_ATMEL_T9),
+ .platform_data = &atmel_mxt_info,
+ }
+};
+
+static __initdata struct tegra_clk_init_table spi_clk_init_table[] = {
+ /* name parent rate enabled */
+ { "sbc1", "pll_p", 52000000, true},
+ { NULL, NULL, 0, 0},
+};
+
+static int __init e1853_touch_init(void)
+{
+ gpio_request(TOUCH_GPIO_IRQ_ATMEL_T9, "atmel-irq");
+ gpio_direction_input(TOUCH_GPIO_IRQ_ATMEL_T9);
+
+ gpio_request(TOUCH_GPIO_RST_ATMEL_T9, "atmel-reset");
+ gpio_direction_output(TOUCH_GPIO_RST_ATMEL_T9, 0);
+ usleep_range(1000, 2000);
+ gpio_set_value(TOUCH_GPIO_RST_ATMEL_T9, 1);
+ msleep(100);
+
+ atmel_mxt_info.config = config_sku2000;
+ atmel_mxt_info.config_crc = MXT_CONFIG_CRC_SKU2000;
+
+ i2c_register_board_info(TOUCH_BUS_ATMEL_T9, atmel_i2c_info, 1);
+
+ return 0;
+}
+
+#endif /* CONFIG_TOUCHSCREEN_ATMEL_MXT */
+
#if defined(CONFIG_USB_G_ANDROID)
static struct tegra_usb_platform_data tegra_udc_pdata = {
.port_otg = false,
@@ -405,6 +509,7 @@ static struct tegra_usb_platform_data tegra_ehci1_utmi_pdata = {
},
};
#endif
+
static struct tegra_usb_platform_data tegra_ehci2_utmi_pdata = {
.port_otg = false,
.has_hostpc = true,
@@ -519,6 +624,9 @@ static void __init tegra_e1853_init(void)
e1853_sdhci_init();
e1853_spi_init();
platform_add_devices(e1853_devices, ARRAY_SIZE(e1853_devices));
+#ifdef CONFIG_TOUCHSCREEN_ATMEL_MXT
+ e1853_touch_init();
+#endif
e1853_panel_init();
e1853_nor_init();
e1853_pcie_init();
diff --git a/arch/arm/mach-tegra/board-e1853.h b/arch/arm/mach-tegra/board-e1853.h
index 58b8ab8725af..beb636ce9b5b 100644
--- a/arch/arm/mach-tegra/board-e1853.h
+++ b/arch/arm/mach-tegra/board-e1853.h
@@ -25,4 +25,10 @@ int e1853_panel_init(void);
int e1853_gpio_init(void);
int e1853_pins_state_init(void);
+#ifdef CONFIG_TOUCHSCREEN_ATMEL_MXT
+#define TOUCH_GPIO_IRQ_ATMEL_T9 TEGRA_GPIO_PEE1
+#define TOUCH_GPIO_RST_ATMEL_T9 TEGRA_GPIO_PR2
+#define TOUCH_BUS_ATMEL_T9 0
+#endif
+
#endif