arm: tegra: cardhu: enable touchscreen for E1506 panel
[linux-2.6.git] / arch / arm / mach-tegra / board-cardhu.c
index f65d8b8..2dde2c3 100644 (file)
@@ -720,6 +720,32 @@ static struct platform_device *cardhu_devices[] __initdata = {
 #endif
 };
 
+#define E1506_MXT_CONFIG_CRC 0x62F903
+static const u8 e1506_config[] = {
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0xFF, 0xFF, 0x32, 0x0A, 0x00, 0x05, 0x01, 0x00,
+       0x00, 0x1E, 0x0A, 0x8B, 0x00, 0x00, 0x13, 0x0B,
+       0x00, 0x10, 0x32, 0x03, 0x03, 0x00, 0x03, 0x01,
+       0x00, 0x0A, 0x0A, 0x0A, 0x0A, 0xBF, 0x03, 0x1B,
+       0x02, 0x00, 0x00, 0x37, 0x37, 0x00, 0x00, 0x00,
+       0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0xA9, 0x7F, 0x9A, 0x0E, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x03, 0x23, 0x00, 0x00, 0x00, 0x0A,
+       0x0F, 0x14, 0x19, 0x03, 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, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x08, 0x10,
+       0x00
+};
+
 #define MXT_CONFIG_CRC  0xD62DE8
 static const u8 config[] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -785,6 +811,23 @@ static struct mxt_platform_data atmel_mxt_info = {
        .read_chg       = NULL,
 };
 
+static struct mxt_platform_data e1506_atmel_mxt_info = {
+       .x_line         = 19,
+       .y_line         = 11,
+       .x_size         = 960,
+       .y_size         = 540,
+       .blen           = 0x10,
+       .threshold      = 0x32,
+       .voltage        = 3300000,              /* 3.3V */
+       .orient         = 3,
+       .config         = e1506_config,
+       .config_length  = 168,
+       .config_crc     = E1506_MXT_CONFIG_CRC,
+       .irqflags       = IRQF_TRIGGER_FALLING,
+/*     .read_chg       = &read_chg, */
+       .read_chg       = NULL,
+};
+
 static struct i2c_board_info __initdata atmel_i2c_info[] = {
        {
                I2C_BOARD_INFO("atmel_mxt_ts", 0x5A),
@@ -792,6 +835,13 @@ static struct i2c_board_info __initdata atmel_i2c_info[] = {
        }
 };
 
+static struct i2c_board_info __initdata e1506_atmel_i2c_info[] = {
+       {
+               I2C_BOARD_INFO("atmel_mxt_ts", 0x4A),
+               .platform_data = &e1506_atmel_mxt_info,
+       }
+};
+
 static __initdata struct tegra_clk_init_table spi_clk_init_table[] = {
        /* name         parent          rate            enabled */
        { "sbc1",       "pll_p",        52000000,       true},
@@ -800,10 +850,11 @@ static __initdata struct tegra_clk_init_table spi_clk_init_table[] = {
 
 static int __init cardhu_touch_init(void)
 {
-       struct board_info BoardInfo;
+       struct board_info BoardInfo, DisplayBoardInfo;
 
-       tegra_get_display_board_info(&BoardInfo);
-       if (BoardInfo.board_id == BOARD_DISPLAY_PM313) {
+       tegra_get_board_info(&BoardInfo);
+       tegra_get_display_board_info(&DisplayBoardInfo);
+       if (DisplayBoardInfo.board_id == BOARD_DISPLAY_PM313) {
                tegra_clk_init_from_table(spi_clk_init_table);
 
                touch_init_raydium(TEGRA_GPIO_PH4, TEGRA_GPIO_PH6, 2);
@@ -817,14 +868,18 @@ static int __init cardhu_touch_init(void)
                gpio_set_value(TEGRA_GPIO_PH6, 1);
                msleep(100);
 
-               tegra_get_board_info(&BoardInfo);
                if ((BoardInfo.sku & SKU_TOUCH_MASK) == SKU_TOUCH_2000) {
                        atmel_mxt_info.config = config_sku2000;
                        atmel_mxt_info.config_crc = MXT_CONFIG_CRC_SKU2000;
                }
 
-               atmel_i2c_info[0].irq = gpio_to_irq(TEGRA_GPIO_PH4);
-               i2c_register_board_info(1, atmel_i2c_info, 1);
+               if (DisplayBoardInfo.board_id == BOARD_DISPLAY_E1506) {
+                       e1506_atmel_i2c_info[0].irq = gpio_to_irq(TEGRA_GPIO_PH4);
+                       i2c_register_board_info(1, e1506_atmel_i2c_info, 1);
+               } else {
+                       atmel_i2c_info[0].irq = gpio_to_irq(TEGRA_GPIO_PH4);
+                       i2c_register_board_info(1, atmel_i2c_info, 1);
+               }
        }
 
        return 0;