2 * arch/arm/mach-tegra/board-stingray-touch.c
4 * Copyright (C) 2010 Motorola, Inc.
5 * Copyright (C) 2010 Google, Inc.
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
18 #include <linux/resource.h>
19 #include <linux/platform_device.h>
20 #include <linux/delay.h>
21 #include <linux/gpio.h>
22 #include <linux/i2c.h>
23 #include <asm/mach-types.h>
24 #include <mach/irqs.h>
25 #include <mach/iomap.h>
26 #include <mach/pinmux.h>
27 #include <linux/qtouch_obp_ts.h>
28 #include <linux/interrupt.h>
29 #include <linux/input.h>
31 #include "board-stingray.h"
32 #include "gpio-names.h"
34 #define XMEGAT_BL_I2C_ADDR 0x35
35 #define STINGRAY_TOUCH_RESET_N_GPIO TEGRA_GPIO_PR4
36 #define STINGRAY_TOUCH_INT_N_GPIO TEGRA_GPIO_PV2
37 #define STINGRAY_TOUCH_WAKE_N_GPIO TEGRA_GPIO_PJ2
39 static int stingray_touch_reset(void)
41 gpio_set_value(STINGRAY_TOUCH_RESET_N_GPIO, 0);
43 gpio_set_value(STINGRAY_TOUCH_RESET_N_GPIO, 1);
44 msleep(100); /* value from moto */
49 struct qtouch_ts_platform_data stingray_touch_data_m1 = {
51 .flags = (QTOUCH_USE_MULTITOUCH |
53 .irqflags = (IRQF_TRIGGER_LOW),
64 .nv_checksum = 0x2c30,
69 .boot_i2c_addr = XMEGAT_BL_I2C_ADDR,
70 .hw_reset = stingray_touch_reset,
77 .fw_name = "mXT1386_08_E1.bin",
83 .base_fw_version = 0x00,
87 .active_acq_int = 0xff,
88 .active_idle_to = 0x00,
95 .touch_autocal = 0x00,
97 .atch_cal_suspend_time = 0,
98 .atch_cal_suspend_thres = 0,
99 .atch_cal_force_thres = 0x10,
100 .atch_cal_force_ratio = 0,
114 .mov_hyst_init = 0x05,
115 .mov_hyst_next = 0x02,
119 .merge_thresh = 0x0A,
133 .comms_config_cfg = {
137 .noise_suppression_cfg = {
156 .one_touch_gesture_proc_cfg = {
164 .short_press_time_out = 0,
165 .long_press_time_out = 0,
166 .repeat_press_time_out = 0,
167 .flick_threshold = 0,
170 .throw_threshold = 0,
175 .high_signal_limit_0 = 0,
176 .low_signal_limit_0 = 0,
177 .high_signal_limit_1 = 0,
178 .low_signal_limit_1 = 0,
179 .high_signal_limit_2 = 0,
180 .low_signal_limit_2 = 0,
182 .two_touch_gesture_proc_cfg = {
187 .rotate_threshold = 0,
194 .idle_gcaf_depth = 16,
195 .active_gcaf_depth = 16,
198 .gripsuppression_t40_cfg = {
205 .palm_suppression_cfg = {
213 .spt_digitizer_cfg = {
227 struct qtouch_ts_platform_data stingray_touch_data_p0 = {
229 .flags = (QTOUCH_USE_MULTITOUCH |
230 QTOUCH_CFG_BACKUPNV),
231 .irqflags = (IRQF_TRIGGER_LOW),
242 .nv_checksum = 0x6462cb,
247 .boot_i2c_addr = XMEGAT_BL_I2C_ADDR,
248 .hw_reset = stingray_touch_reset,
255 .fw_name = "mXT1386_09_AA.bin",
260 .boot_version = 0x20,
261 .base_fw_version = 0x00,
264 .idle_acq_int = 0xff,
265 .active_acq_int = 0xff,
266 .active_idle_to = 0x00,
273 .touch_autocal = 0x00,
275 .atch_cal_suspend_time = 0,
276 .atch_cal_suspend_thres = 0,
277 .atch_cal_force_thres = 0x10,
278 .atch_cal_force_ratio = 0,
292 .mov_hyst_init = 0x05,
293 .mov_hyst_next = 0x02,
297 .merge_thresh = 0x0A,
310 .tch_thres_hyst = 0x09,
314 .comms_config_cfg = {
318 .noise_suppression_cfg = {
337 .one_touch_gesture_proc_cfg = {
345 .short_press_time_out = 0,
346 .long_press_time_out = 0,
347 .repeat_press_time_out = 0,
348 .flick_threshold = 0,
351 .throw_threshold = 0,
356 .high_signal_limit_0 = 0,
357 .low_signal_limit_0 = 0,
358 .high_signal_limit_1 = 0,
359 .low_signal_limit_1 = 0,
360 .high_signal_limit_2 = 0,
361 .low_signal_limit_2 = 0,
363 .two_touch_gesture_proc_cfg = {
368 .rotate_threshold = 0,
375 .idle_gcaf_depth = 16,
376 .active_gcaf_depth = 16,
379 .gripsuppression_t40_cfg = {
386 .palm_suppression_cfg = {
394 .spt_digitizer_cfg = {
407 /* Portable P1 and P2 */
408 struct qtouch_ts_platform_data stingray_touch_data_p1p2 = {
410 .flags = (QTOUCH_USE_MULTITOUCH |
411 QTOUCH_CFG_BACKUPNV),
412 .irqflags = (IRQF_TRIGGER_LOW),
423 .nv_checksum = 0x6462cb,
428 .boot_i2c_addr = XMEGAT_BL_I2C_ADDR,
429 .hw_reset = stingray_touch_reset,
436 .fw_name = "mXT1386_09_AA.bin",
441 .boot_version = 0x20,
442 .base_fw_version = 0x00,
445 .idle_acq_int = 0xff,
446 .active_acq_int = 0xff,
447 .active_idle_to = 0x00,
454 .touch_autocal = 0x00,
456 .atch_cal_suspend_time = 0,
457 .atch_cal_suspend_thres = 0,
458 .atch_cal_force_thres = 0x10,
459 .atch_cal_force_ratio = 0,
473 .mov_hyst_init = 0x05,
474 .mov_hyst_next = 0x02,
478 .merge_thresh = 0x0A,
491 .tch_thres_hyst = 0x09,
495 .comms_config_cfg = {
499 .noise_suppression_cfg = {
518 .one_touch_gesture_proc_cfg = {
526 .short_press_time_out = 0,
527 .long_press_time_out = 0,
528 .repeat_press_time_out = 0,
529 .flick_threshold = 0,
532 .throw_threshold = 0,
537 .high_signal_limit_0 = 0,
538 .low_signal_limit_0 = 0,
539 .high_signal_limit_1 = 0,
540 .low_signal_limit_1 = 0,
541 .high_signal_limit_2 = 0,
542 .low_signal_limit_2 = 0,
544 .two_touch_gesture_proc_cfg = {
549 .rotate_threshold = 0,
556 .idle_gcaf_depth = 16,
557 .active_gcaf_depth = 16,
560 .gripsuppression_t40_cfg = {
567 .palm_suppression_cfg = {
575 .spt_digitizer_cfg = {
588 static struct i2c_board_info __initdata stingray_i2c_bus1_touch_info[] = {
590 I2C_BOARD_INFO(QTOUCH_TS_NAME, 0x5B),
591 .irq = TEGRA_GPIO_TO_IRQ(STINGRAY_TOUCH_INT_N_GPIO),
595 int __init stingray_touch_init(void)
597 tegra_gpio_enable(STINGRAY_TOUCH_INT_N_GPIO);
598 gpio_request(STINGRAY_TOUCH_INT_N_GPIO, "touch_irq");
599 gpio_direction_input(STINGRAY_TOUCH_INT_N_GPIO);
601 tegra_gpio_enable(STINGRAY_TOUCH_WAKE_N_GPIO);
602 gpio_request(STINGRAY_TOUCH_WAKE_N_GPIO, "touch_wake");
603 gpio_direction_output(STINGRAY_TOUCH_WAKE_N_GPIO, 0);
605 tegra_gpio_enable(STINGRAY_TOUCH_RESET_N_GPIO);
606 gpio_request(STINGRAY_TOUCH_RESET_N_GPIO, "touch_reset");
607 gpio_direction_output(STINGRAY_TOUCH_RESET_N_GPIO, 1);
609 if ((stingray_revision() == STINGRAY_REVISION_P1) ||
610 (stingray_revision() == STINGRAY_REVISION_P2))
611 stingray_i2c_bus1_touch_info[0].platform_data = &stingray_touch_data_p1p2;
612 else if (stingray_revision() == STINGRAY_REVISION_P0)
613 stingray_i2c_bus1_touch_info[0].platform_data = &stingray_touch_data_p0;
615 stingray_i2c_bus1_touch_info[0].platform_data = &stingray_touch_data_m1;
617 i2c_register_board_info(0, stingray_i2c_bus1_touch_info, 1);