static int __init grouper_touch_init(void)
{
	int touch_id;

    return elan_touch_init();	
	tegra_gpio_enable(GROUPER_TS_ID1);
	tegra_gpio_enable(GROUPER_TS_ID2);

	gpio_request(GROUPER_TS_ID1, "touch-id1");
	gpio_direction_input(GROUPER_TS_ID1);

	gpio_request(GROUPER_TS_ID2, "touch-id2");
	gpio_direction_input(GROUPER_TS_ID2);

	touch_id = gpio_get_value(GROUPER_TS_ID1) << 1;
	touch_id |= gpio_get_value(GROUPER_TS_ID2);

	pr_info("touch-id %d\n", touch_id);

	/* Disable TS_ID GPIO to save power */
	gpio_direction_output(GROUPER_TS_ID1, 0);
	tegra_pinmux_set_pullupdown(GROUPER_TS_ID1_PG, TEGRA_PUPD_NORMAL);
	tegra_pinmux_set_tristate(GROUPER_TS_ID1_PG, TEGRA_TRI_TRISTATE);
	gpio_direction_output(GROUPER_TS_ID2, 0);
	tegra_pinmux_set_pullupdown(GROUPER_TS_ID2_PG, TEGRA_PUPD_NORMAL);
	tegra_pinmux_set_tristate(GROUPER_TS_ID2_PG, TEGRA_TRI_TRISTATE);

	switch (touch_id) {
	case 0:
		pr_info("Raydium PCB based touch init\n");
		tegra_clk_init_from_table(spi_clk_init_table);
		touch_init_raydium(TEGRA_GPIO_PZ3, TEGRA_GPIO_PN5, 0);
		break;
	case 1:
		pr_info("Raydium On-Board touch init\n");
		tegra_clk_init_from_table(spi_clk_init_table);
		tegra_clk_init_from_table(touch_clk_init_table);
		clk_enable(tegra_get_clock_by_name("clk_out_3"));

		touch_init_raydium(TEGRA_GPIO_PZ3, TEGRA_GPIO_PN5, 1);
		break;
	case 3:
		pr_info("Synaptics PCB based touch init\n");
		touch_init_synaptics_grouper();
		break;
	default:
		pr_err("touch_id error, no touch %d\n", touch_id);
	}
	return 0;
}
static int __init loki_touch_init(void)
{
	struct board_info bi;
	tegra_get_board_info(&bi);
	if (bi.board_id == BOARD_P2530 && bi.sku == BOARD_SKU_FOSTER)
		return 0;

	if (tegra_get_touch_panel_id() == TOUCH_PANEL_THOR_WINTEK)
		rm31080a_loki_spi_board[0].platform_data =
					&rm31080ts_loki_data_t_1_95;

	/*
	** remove touch clock initialization for ffd fab a3, higher
	** Move clock from tegra clock to external xtal
	*/
	if (bi.board_id == BOARD_P2530 && bi.fab >= 0xa3) {
		rm31080ts_loki_data.name_of_clock = NULL;
		rm31080ts_loki_data.name_of_clock_con = NULL;
	} else
		tegra_clk_init_from_table(touch_clk_init_table);
	rm31080a_loki_spi_board[0].irq =
		gpio_to_irq(TOUCH_GPIO_IRQ_RAYDIUM_SPI);
	touch_init_raydium(TOUCH_GPIO_IRQ_RAYDIUM_SPI,
				TOUCH_GPIO_RST_RAYDIUM_SPI,
				&rm31080ts_loki_data,
				&rm31080a_loki_spi_board[0],
				ARRAY_SIZE(rm31080a_loki_spi_board));
	return 0;
}
static int __init cardhu_touch_init(void)
{
	struct board_info BoardInfo, DisplayBoardInfo;

	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);
	} else {
		gpio_request(TEGRA_GPIO_PH4, "atmel-irq");
		gpio_direction_input(TEGRA_GPIO_PH4);

		gpio_request(TEGRA_GPIO_PH6, "atmel-reset");
		gpio_direction_output(TEGRA_GPIO_PH6, 0);
		msleep(1);
		gpio_set_value(TEGRA_GPIO_PH6, 1);
		msleep(100);

		if ((BoardInfo.sku & SKU_TOUCH_MASK) == SKU_TOUCH_2000) {
			atmel_mxt_info.config = config_sku2000;
			atmel_mxt_info.config_crc = MXT_CONFIG_CRC_SKU2000;
		}

		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;
}
static int __init ardbeg_touch_init(void)
{
	tegra_get_board_info(&board_info);

	if (tegra_get_touch_vendor_id() == MAXIM_TOUCH) {
		pr_info("%s init maxim touch\n", __func__);
#if defined(CONFIG_TOUCHSCREEN_MAXIM_STI) || \
	defined(CONFIG_TOUCHSCREEN_MAXIM_STI_MODULE)
		if (tegra_get_touch_panel_id() == TOUCHPANEL_TN7)
			maxim_sti_spi_board.platform_data = &maxim_sti_pdata_rd;
		(void)touch_init_maxim_sti(&maxim_sti_spi_board);
#endif
	} else if (tegra_get_touch_vendor_id() == RAYDIUM_TOUCH) {
		pr_info("%s init raydium touch\n", __func__);
		tegra_clk_init_from_table(touch_clk_init_table);
		if (board_info.board_id == BOARD_PM374) {
			rm31080a_norrin_spi_board[0].irq =
				gpio_to_irq(TOUCH_GPIO_IRQ_RAYDIUM_SPI);
			touch_init_raydium(TOUCH_GPIO_IRQ_RAYDIUM_SPI,
					TOUCH_GPIO_RST_RAYDIUM_SPI,
					&rm31080ts_norrin_data,
					&rm31080a_norrin_spi_board[0],
					ARRAY_SIZE(rm31080a_norrin_spi_board));
		} else if (board_info.board_id == BOARD_P1761) {
			rm31080a_ardbeg_spi_board[0].irq =
				gpio_to_irq(TOUCH_GPIO_IRQ_RAYDIUM_SPI);
			touch_init_raydium(TOUCH_GPIO_IRQ_RAYDIUM_SPI,
					TOUCH_GPIO_RST_RAYDIUM_SPI,
					&rm31080ts_tn8_data,
					&rm31080a_tn8_spi_board[0],
					ARRAY_SIZE(rm31080a_tn8_spi_board));
		} else {
			rm31080a_ardbeg_spi_board[0].irq =
				gpio_to_irq(TOUCH_GPIO_IRQ_RAYDIUM_SPI);
			touch_init_raydium(TOUCH_GPIO_IRQ_RAYDIUM_SPI,
					TOUCH_GPIO_RST_RAYDIUM_SPI,
					&rm31080ts_ardbeg_data,
					&rm31080a_ardbeg_spi_board[0],
					ARRAY_SIZE(rm31080a_ardbeg_spi_board));
		}
	}
	return 0;
}
Exemple #5
0
static int __init pluto_touch_init(void)
{
	tegra_clk_init_from_table(touch_clk_init_table);
	rm31080a_pluto_spi_board[0].irq = gpio_to_irq(TOUCH_GPIO_IRQ_RAYDIUM_SPI);
	touch_init_raydium(TOUCH_GPIO_IRQ_RAYDIUM_SPI,
				TOUCH_GPIO_RST_RAYDIUM_SPI,
				&rm31080ts_pluto_data,
				&rm31080a_pluto_spi_board[0],
				ARRAY_SIZE(rm31080a_pluto_spi_board));
	return 0;
}
static int __init roth_touch_init(void)
{
	tegra_clk_init_from_table(touch_clk_init_table);
	rm31080ts_roth_data.platform_id = RM_PLATFORM_R005;
	rm31080a_roth_spi_board[0].irq =
		gpio_to_irq(TOUCH_GPIO_IRQ_RAYDIUM_SPI);
	touch_init_raydium(TOUCH_GPIO_IRQ_RAYDIUM_SPI,
				TOUCH_GPIO_RST_RAYDIUM_SPI,
				&rm31080ts_roth_data,
				&rm31080a_roth_spi_board[0],
				ARRAY_SIZE(rm31080a_roth_spi_board));
	return 0;
}
static int __init macallan_touch_init(void)
{
	tegra_clk_init_from_table(touch_clk_init_table);
	if (display_board_info.board_id == BOARD_E1582)
		rm31080ts_macallan_data.platform_id = RM_PLATFORM_P005;
	else
		rm31080ts_macallan_data.platform_id = RM_PLATFORM_D010;
	mdelay(20);
	rm31080a_macallan_spi_board[0].irq = gpio_to_irq(TOUCH_GPIO_IRQ_RAYDIUM_SPI);
	touch_init_raydium(TOUCH_GPIO_IRQ_RAYDIUM_SPI,
				TOUCH_GPIO_RST_RAYDIUM_SPI,
				&rm31080ts_macallan_data,
				&rm31080a_macallan_spi_board[0],
				ARRAY_SIZE(rm31080a_macallan_spi_board));
	return 0;
}
static int __init tegratab_touch_init(void)
{
	struct board_info board_info;

	tegra_get_display_board_info(&board_info);
	tegra_clk_init_from_table(touch_clk_init_table);
	rm31080ts_tegratab_data.platform_id = RM_PLATFORM_D010;
	mdelay(20);
	rm31080a_tegratab_spi_board[0].irq =
		gpio_to_irq(TOUCH_GPIO_IRQ_RAYDIUM_SPI);
	touch_init_raydium(TOUCH_GPIO_IRQ_RAYDIUM_SPI,
				TOUCH_GPIO_RST_RAYDIUM_SPI,
				&rm31080ts_tegratab_data,
				&rm31080a_tegratab_spi_board[0],
				ARRAY_SIZE(rm31080a_tegratab_spi_board));
	return 0;
}
static int __init tegranote7c_touch_init(void)
{
	if (get_androidboot_mode_charger())
		return 0;

#if defined(CONFIG_TOUCHSCREEN_MAXIM_STI) || \
	defined(CONFIG_TOUCHSCREEN_MAXIM_STI_MODULE)
	(void)touch_init_maxim_sti(&maxim_sti_spi_board);
#else
	tegra_clk_init_from_table(touch_clk_init_table);
	rm31080ts_tegranote7c_data.platform_id = RM_PLATFORM_D010;
	mdelay(20);
	rm31080a_tegranote7c_spi_board[0].irq =
		gpio_to_irq(TOUCH_GPIO_IRQ_RAYDIUM_SPI);
	touch_init_raydium(TOUCH_GPIO_IRQ_RAYDIUM_SPI,
				TOUCH_GPIO_RST_RAYDIUM_SPI,
				&rm31080ts_tegranote7c_data,
				&rm31080a_tegranote7c_spi_board[0],
				ARRAY_SIZE(rm31080a_tegranote7c_spi_board));
#endif
	return 0;
}
static int __init roth_touch_init(void)
{
	struct board_info board_info;

	tegra_get_board_info(&board_info);
	if (board_info.board_id == BOARD_P2560) {
		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
		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,
				TOUCH_GPIO_RST_RAYDIUM_SPI,
				&rm31080ts_roth_data,
				&rm31080a_roth_spi_board[0],
				ARRAY_SIZE(rm31080a_roth_spi_board));
	return 0;
}
Exemple #11
0
static int __init kai_touch_init(void)
{
	int touch_id;

	touch_id = gpio_request(KAI_TS_ID1, "touch-id1");
	if (touch_id < 0) {
		pr_err("%s: gpio_request failed %d\n",
			__func__, touch_id);
		return touch_id;
	}
	touch_id = gpio_direction_input(KAI_TS_ID1);
	if (touch_id < 0) {
		pr_err("%s: gpio_direction_input failed %d\n",
			__func__, touch_id);
		gpio_free(KAI_TS_ID1);
	}

	touch_id = gpio_request(KAI_TS_ID2, "touch-id2");
	if (touch_id < 0) {
		pr_err("%s: gpio_request failed %d\n",
			__func__, touch_id);
		return touch_id;
	}
	touch_id = gpio_direction_input(KAI_TS_ID2);
	if (touch_id < 0) {
		pr_err("%s: gpio_direction_input failed %d\n",
			__func__, touch_id);
		gpio_free(KAI_TS_ID2);
	}

	touch_id = gpio_get_value(KAI_TS_ID1) << 1;
	touch_id |= gpio_get_value(KAI_TS_ID2);

	pr_info("touch-id %d\n", touch_id);

	/* Disable TS_ID GPIO to save power */
	gpio_direction_output(KAI_TS_ID1, 0);
	tegra_pinmux_set_pullupdown(KAI_TS_ID1_PG, TEGRA_PUPD_NORMAL);
	tegra_pinmux_set_tristate(KAI_TS_ID1_PG, TEGRA_TRI_TRISTATE);
	gpio_direction_output(KAI_TS_ID2, 0);
	tegra_pinmux_set_pullupdown(KAI_TS_ID2_PG, TEGRA_PUPD_NORMAL);
	tegra_pinmux_set_tristate(KAI_TS_ID2_PG, TEGRA_TRI_TRISTATE);

	switch (touch_id) {
	case 0:
		pr_info("Raydium PCB based touch init\n");
		tegra_clk_init_from_table(spi_clk_init_table);
		rm31080a_kai_spi_board[0].platform_data =
			&rm31080ts_kai_007_data;
		rm31080a_kai_spi_board[0].irq =
			gpio_to_irq(TOUCH_GPIO_IRQ_RAYDIUM_SPI);
		touch_init_raydium(TOUCH_GPIO_IRQ_RAYDIUM_SPI,
					TOUCH_GPIO_RST_RAYDIUM_SPI,
					&rm31080ts_kai_007_data,
					&rm31080a_kai_spi_board[0],
					ARRAY_SIZE(rm31080a_kai_spi_board));
		break;
	case 1:
		pr_info("Raydium On-Board touch init\n");
		tegra_clk_init_from_table(spi_clk_init_table);
		tegra_clk_init_from_table(touch_clk_init_table);
		rm31080a_kai_spi_board[0].platform_data =
			&rm31080ts_kai_107_data;
		rm31080a_kai_spi_board[0].irq =
			gpio_to_irq(TOUCH_GPIO_IRQ_RAYDIUM_SPI);
		touch_init_raydium(TOUCH_GPIO_IRQ_RAYDIUM_SPI,
					TOUCH_GPIO_RST_RAYDIUM_SPI,
					&rm31080ts_kai_107_data,
					&rm31080a_kai_spi_board[0],
					ARRAY_SIZE(rm31080a_kai_spi_board));
		break;
	case 3:
		pr_info("Synaptics PCB based touch init\n");
		touch_init_synaptics_kai();
		break;
	default:
		pr_err("touch_id error, no touch %d\n", touch_id);
	}
	return 0;
}
static int __init cardhu_touch_init(void)
{
	struct board_info BoardInfo, DisplayBoardInfo;
	int ret;

	tegra_get_board_info(&BoardInfo);
	tegra_get_display_board_info(&DisplayBoardInfo);
	if ((DisplayBoardInfo.board_id == BOARD_DISPLAY_PM313)
						|| CARDHU_DT_PLATFORM) {
		tegra_clk_init_from_table(spi_clk_init_table);
		tegra_clk_init_from_table(touch_clk_init_table);
		tegra_clk_prepare_enable(tegra_get_clock_by_name("clk_out_3"));
		rm31080a_cardhu_spi_board[0].irq = gpio_to_irq(TOUCH_GPIO_IRQ_RAYDIUM_SPI);
		touch_init_raydium(TOUCH_GPIO_IRQ_RAYDIUM_SPI,
					TOUCH_GPIO_RST_RAYDIUM_SPI,
					&rm31080ts_cardhu_data,
					&rm31080a_cardhu_spi_board[0],
					ARRAY_SIZE(rm31080a_cardhu_spi_board));
	} else {
		ret = gpio_request(TEGRA_GPIO_PH4, "atmel-irq");
		if (ret < 0) {
			pr_err("%s() Error in gpio_request() for gpio %d\n",
					__func__, ret);
		}
		ret = gpio_direction_input(TEGRA_GPIO_PH4);
		if (ret < 0) {
			pr_err("%s() Error in setting gpio %d to in/out\n",
					 __func__, ret);
			gpio_free(TEGRA_GPIO_PH4);
		}
		ret = gpio_request(TEGRA_GPIO_PH6, "atmel-reset");
		if (ret < 0) {
			pr_err("%s() Error in gpio_request() for gpio %d\n",
					__func__, ret);
		}
		ret = gpio_direction_output(TEGRA_GPIO_PH6, 0);
		if (ret < 0) {
			pr_err("%s() Error in setting gpio %d to in/out\n",
					 __func__, ret);
			gpio_free(TEGRA_GPIO_PH6);
		}
		msleep(1);
		gpio_set_value(TEGRA_GPIO_PH6, 1);
		msleep(100);

		tegra_get_board_info(&BoardInfo);
		if ((BoardInfo.sku & SKU_TOUCH_MASK) == SKU_TOUCH_2000)
			strncpy(atmel_mxt_info.mxt_cfg_name,
				"Android_Cardhu_SKU2000_2012-12-18.cfg",
				CFG_NAME_SIZE);

		if (DisplayBoardInfo.board_id == BOARD_DISPLAY_E1506) {
			strncpy(atmel_mxt_info.mxt_cfg_name,
			"Android_Cardhu_Verbier_E1506_2012-12-18.cfg",
			CFG_NAME_SIZE);
			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;
}