summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Ekici <aekici@nvidia.com>2012-01-11 10:57:25 -0800
committerVarun Colbert <vcolbert@nvidia.com>2012-01-30 13:54:20 -0800
commit19093f32592017d2cf811db3a6cc332c6184fe06 (patch)
treefe8d181fe7ad8ae93f0a91981835a3c3fb9d69e8
parent2780d644bd2373de349e01631ed8af37dbdc7091 (diff)
arm: tegra: kai: Synaptics DirectTouch
Board file for Synaptics SPI touch connection which is used for DirectTouch initialization Bug 912775 Reviewed-on: http://git-master/r/74643 Change-Id: Ie296ddff5b9e1fbf9296d40fde2877598a13207e Signed-off-by: Peter Zu <pzu@nvidia.com> Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-on: http://git-master/r/77775 Reviewed-by: Automatic_Commit_Validation_User
-rw-r--r--arch/arm/mach-tegra/Makefile1
-rw-r--r--arch/arm/mach-tegra/board-kai.h1
-rw-r--r--arch/arm/mach-tegra/board-touch-kai-synaptics-spi.c103
3 files changed, 105 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile
index 33dbe8c782d9..d6e6fbb187d8 100644
--- a/arch/arm/mach-tegra/Makefile
+++ b/arch/arm/mach-tegra/Makefile
@@ -158,6 +158,7 @@ obj-${CONFIG_MACH_CARDHU} += board-cardhu-sensors.o
obj-${CONFIG_MACH_CARDHU} += board-cardhu-memory.o
obj-${CONFIG_MACH_CARDHU} += board-cardhu-powermon.o
+obj-${CONFIG_MACH_KAI} += board-touch-kai-synaptics-spi.o
obj-${CONFIG_MACH_KAI} += board-touch-kai-raydium_spi.o
obj-${CONFIG_MACH_TEGRA_ENTERPRISE} += board-enterprise.o
diff --git a/arch/arm/mach-tegra/board-kai.h b/arch/arm/mach-tegra/board-kai.h
index 98d7dc706e89..8804e5cb0b90 100644
--- a/arch/arm/mach-tegra/board-kai.h
+++ b/arch/arm/mach-tegra/board-kai.h
@@ -58,6 +58,7 @@ int kai_power_off_init(void);
int kai_edp_init(void);
void __init kai_tsensor_init(void);
int __init touch_init_raydium(void);
+int __init touch_init_synaptics_kai(void);
#define TDIODE_OFFSET (10000) /* in millicelsius */
diff --git a/arch/arm/mach-tegra/board-touch-kai-synaptics-spi.c b/arch/arm/mach-tegra/board-touch-kai-synaptics-spi.c
new file mode 100644
index 000000000000..b4052c277c3a
--- /dev/null
+++ b/arch/arm/mach-tegra/board-touch-kai-synaptics-spi.c
@@ -0,0 +1,103 @@
+/*
+ * arch/arm/mach-tegra/board-touch-synaptics-spi.c
+ *
+ * Copyright (C) 2010-2011 NVIDIA Corporation
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/spi/spi.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/spi/spi.h>
+#include <linux/rmi.h>
+#include "board.h"
+#include "board-kai.h"
+
+#define SYNAPTICS_SPI_CS 0
+#define SYNAPTICS_BUTTON_CODES {KEY_HOME, KEY_BACK,}
+
+static unsigned char synaptics_button_codes[] = SYNAPTICS_BUTTON_CODES;
+
+static struct rmi_f19_button_map synaptics_button_map = {
+ .nbuttons = ARRAY_SIZE(synaptics_button_codes),
+ .map = synaptics_button_codes,
+};
+
+static int synaptics_touchpad_gpio_setup(void)
+{
+ tegra_gpio_enable(SYNAPTICS_ATTN_GPIO);
+ gpio_request(SYNAPTICS_ATTN_GPIO, "synaptics-irq");
+ gpio_direction_input(SYNAPTICS_ATTN_GPIO);
+
+ tegra_gpio_enable(SYNAPTICS_RESET_GPIO);
+ gpio_request(SYNAPTICS_RESET_GPIO, "synaptics-reset");
+ gpio_direction_output(SYNAPTICS_RESET_GPIO, 0);
+
+ msleep(1);
+ gpio_set_value(SYNAPTICS_RESET_GPIO, 1);
+ msleep(100);
+
+ return 0;
+}
+
+static struct rmi_device_platform_data synaptics_platformdata = {
+ .driver_name = "rmi_generic",
+ .irq = SYNAPTICS_ATTN_GPIO,
+ .irq_polarity = RMI_IRQ_ACTIVE_LOW,
+ .gpio_config = synaptics_touchpad_gpio_setup,
+ .spi_data = {
+ .block_delay_us = 15,
+ .read_delay_us = 15,
+ .write_delay_us = 2,
+ },
+ .axis_align = {
+ .flip_y = true,
+ },
+ .button_map = &synaptics_button_map,
+};
+
+struct spi_board_info synaptics_2002_spi_board[] = {
+ {
+ .modalias = "rmi_spi",
+ .bus_num = 0,
+ .chip_select = 0,
+ .irq = 999, /* just to make sure this one is not being used */
+ .max_speed_hz = 1*1000*1000,
+ .mode = SPI_MODE_3,
+ .platform_data = &synaptics_platformdata,
+ },
+};
+
+int __init touch_init_synaptics_kai(void)
+{
+ pr_info("%s: registering synaptics_2002_spi_board\n", __func__);
+ pr_info(" modalias = %s\n",
+ synaptics_2002_spi_board->modalias);
+ pr_info(" bus_num = %d\n",
+ synaptics_2002_spi_board->bus_num);
+ pr_info(" chip_select = %d\n",
+ synaptics_2002_spi_board->chip_select);
+ pr_info(" irq = %d\n",
+ synaptics_2002_spi_board->irq);
+ pr_info(" max_speed_hz = %d\n",
+ synaptics_2002_spi_board->max_speed_hz);
+ pr_info(" mode = %d\n",
+ synaptics_2002_spi_board->mode);
+
+ msleep(100);
+ spi_register_board_info(synaptics_2002_spi_board,
+ ARRAY_SIZE(synaptics_2002_spi_board));
+ return 0;
+}