summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorXiaohui Tao <xtao@nvidia.com>2013-04-11 17:22:17 -0700
committerSimone Willett <swillett@nvidia.com>2013-04-24 14:30:43 -0700
commit29178237b3073b45569dcec2fc85bdd7491a1f25 (patch)
treef87aab802f14e121e2b7e51e8bd0931c9b6c1675 /arch
parentc83f17c54d07253ca11b95898958559ce82e31f1 (diff)
ARM:tegra: Modify to detect panel id and choose clk
TPK panel uses the external clock. Modify code to choose clock source based on the panel id. Bug 1253012 Change-Id: Ife85c2173693d339ef1f94cc4285009408975c44 Signed-off-by: Xiaohui Tao <xtao@nvidia.com> Reviewed-on: http://git-master/r/218964 Reviewed-by: Tao Xie <txie@nvidia.com> Reviewed-by: Matt Wagner <mwagner@nvidia.com> Reviewed-by: Robert Collins <rcollins@nvidia.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-tegra/board-roth-pinmux-t11x.h2
-rw-r--r--arch/arm/mach-tegra/board-roth.c54
-rw-r--r--arch/arm/mach-tegra/board-roth.h10
3 files changed, 36 insertions, 30 deletions
diff --git a/arch/arm/mach-tegra/board-roth-pinmux-t11x.h b/arch/arm/mach-tegra/board-roth-pinmux-t11x.h
index 2685f631713a..20e43b7ba24a 100644
--- a/arch/arm/mach-tegra/board-roth-pinmux-t11x.h
+++ b/arch/arm/mach-tegra/board-roth-pinmux-t11x.h
@@ -85,7 +85,7 @@ static __initdata struct tegra_pingroup_config roth_pinmux_common[] = {
DEFAULT_PINMUX(GMI_AD6, SPI4, PULL_UP, NORMAL, INPUT),
DEFAULT_PINMUX(GMI_AD7, SPI4, PULL_UP, NORMAL, INPUT),
DEFAULT_PINMUX(GMI_AD12, RSVD1, NORMAL, NORMAL, OUTPUT),
- DEFAULT_PINMUX(GMI_CS6_N, SPI4, NORMAL, NORMAL, INPUT),
+ DEFAULT_PINMUX(GMI_CS6_N, NAND, NORMAL, TRISTATE, OUTPUT),
DEFAULT_PINMUX(GMI_WR_N, SPI4, NORMAL, NORMAL, INPUT),
/* PWM1 pinmux */
diff --git a/arch/arm/mach-tegra/board-roth.c b/arch/arm/mach-tegra/board-roth.c
index 2e28d925277c..55e50cc18cf5 100644
--- a/arch/arm/mach-tegra/board-roth.c
+++ b/arch/arm/mach-tegra/board-roth.c
@@ -626,7 +626,7 @@ static __initdata struct tegra_clk_init_table touch_clk_init_table[] = {
struct rm_spi_ts_platform_data rm31080ts_roth_data = {
.gpio_reset = 0,
.config = 0,
- .platform_id = RM_PLATFORM_D010,
+ .platform_id = RM_PLATFORM_R005,
.name_of_clock = "clk_out_2",
.name_of_clock_con = "extern2",
};
@@ -648,40 +648,36 @@ struct spi_board_info rm31080a_roth_spi_board[1] = {
},
};
-static int __init roth_touch_get_platform_id(void)
+static int __init roth_touch_init(void)
{
- int platform_id;
- int strap1, strap2;
struct board_info board_info;
tegra_get_board_info(&board_info);
-
if (board_info.board_id == BOARD_P2560) {
- /* touch panel has straps on PI3 and PW5 for vendor */
- strap1 = gpio_get_value(TEGRA_GPIO_PI3);
- strap2 = gpio_get_value(TEGRA_GPIO_PW5);
-
- switch (strap1 | (strap2 << 1)) {
- case 0x00:
- case 0x01:
- case 0x10:
- case 0x11:
- default:
- platform_id = RM_PLATFORM_R005;
- break;
- }
-
+ int touch_id = tegra_get_touch_panel_id();
+ if (touch_id == PANEL_TPK || touch_id == PANEL_WINTEK) {
+ int err;
+ err = gpio_request(TOUCH_GPIO_CLK, "touch-gpio-clk");
+ if (err < 0)
+ pr_err("%s: gpio_request failed %d\n",
+ __func__, err);
+ else {
+ err = gpio_direction_output(TOUCH_GPIO_CLK, 0);
+ if (err < 0)
+ pr_err("%s: set output failed %d\n",
+ __func__, err);
+ gpio_free(TOUCH_GPIO_CLK);
+ }
+ tegra_pinmux_set_pullupdown(TOUCH_GPIO_CLK_PG,
+ TEGRA_PUPD_NORMAL);
+ tegra_pinmux_set_tristate(TOUCH_GPIO_CLK_PG,
+ TEGRA_TRI_TRISTATE);
+ rm31080ts_roth_data.name_of_clock = NULL;
+ rm31080ts_roth_data.name_of_clock_con = NULL;
+ } else
+ tegra_clk_init_from_table(touch_clk_init_table);
} else
- platform_id = RM_PLATFORM_R005;
-
-
- return platform_id;
-}
-
-static int __init roth_touch_init(void)
-{
- tegra_clk_init_from_table(touch_clk_init_table);
- rm31080ts_roth_data.platform_id = roth_touch_get_platform_id();
+ tegra_clk_init_from_table(touch_clk_init_table);
rm31080a_roth_spi_board[0].irq =
gpio_to_irq(TOUCH_GPIO_IRQ_RAYDIUM_SPI);
touch_init_raydium(TOUCH_GPIO_IRQ_RAYDIUM_SPI,
diff --git a/arch/arm/mach-tegra/board-roth.h b/arch/arm/mach-tegra/board-roth.h
index bb221e347dc9..9351c102bced 100644
--- a/arch/arm/mach-tegra/board-roth.h
+++ b/arch/arm/mach-tegra/board-roth.h
@@ -76,6 +76,16 @@
#define TOUCH_GPIO_IRQ_RAYDIUM_SPI TEGRA_GPIO_PK2
#define TOUCH_GPIO_RST_RAYDIUM_SPI TEGRA_GPIO_PK4
+#define TOUCH_GPIO_CLK TEGRA_GPIO_PW5
+#define TOUCH_GPIO_CLK_PG TEGRA_PINGROUP_CLK2_OUT
+
+enum panel_id {
+ PANEL_RESERVED = 0,
+ PANEL_WINTEK,
+ PANEL_TPK,
+ PANEL_TOUCH_TURNS,
+};
+
/* Invensense MPU Definitions */
#define MPU_GYRO_NAME "mpu6050"
#define MPU_GYRO_IRQ_GPIO TEGRA_GPIO_PR3