From: Rakesh Iyer Date: Sun, 27 May 2012 18:58:56 +0000 (-0700) Subject: arm: tegra: cardhu: enable touchscreen for E1506 panel X-Git-Tag: tegra-l4t-r16-rc~260^2~37 X-Git-Url: https://nv-tegra.nvidia.com/r/gitweb?p=linux-2.6.git;a=commitdiff_plain;h=5ab4d80783c17a48652f4e9d8932ffea31a4000b arm: tegra: cardhu: enable touchscreen for E1506 panel Enable Atmel Mxt touchscreen for E1506 panel. Bug 978305. Change-Id: I57b02e4a9b3180e8114a96d5f9a8e075df166260 Signed-off-by: Rakesh Iyer Reviewed-on: http://git-master/r/104895 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Robert Collins Reviewed-by: Dan Willemsen --- diff --git a/arch/arm/mach-tegra/board-cardhu.c b/arch/arm/mach-tegra/board-cardhu.c index 4480ab3ef47..458053d56fc 100644 --- a/arch/arm/mach-tegra/board-cardhu.c +++ b/arch/arm/mach-tegra/board-cardhu.c @@ -717,6 +717,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, @@ -782,6 +808,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), @@ -790,6 +833,14 @@ 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), + .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PH4), + .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}, @@ -798,10 +849,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); @@ -815,13 +867,15 @@ 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; } - i2c_register_board_info(1, atmel_i2c_info, 1); + if (DisplayBoardInfo.board_id == BOARD_DISPLAY_E1506) + i2c_register_board_info(1, e1506_atmel_i2c_info, 1); + else + i2c_register_board_info(1, atmel_i2c_info, 1); } return 0; diff --git a/arch/arm/mach-tegra/board-cardhu.h b/arch/arm/mach-tegra/board-cardhu.h index 27d9e473991..cde2993f7b7 100644 --- a/arch/arm/mach-tegra/board-cardhu.h +++ b/arch/arm/mach-tegra/board-cardhu.h @@ -82,6 +82,7 @@ /* Display Board ID */ #define BOARD_DISPLAY_PM313 0x030D #define BOARD_DISPLAY_E1247 0x0C2F +#define BOARD_DISPLAY_E1506 0x0F06 /* External peripheral act as gpio */ /* TPS6591x GPIOs */