2 * arch/arm/mach-tegra/board-olympus-i2c.c
4 * Copyright (C) 2010 Google, Inc.
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
17 #include <linux/resource.h>
18 #include <linux/platform_device.h>
19 #include <linux/delay.h>
20 #include <linux/gpio.h>
21 #include <linux/i2c.h>
22 #include <asm/mach-types.h>
23 #include <mach/irqs.h>
24 #include <mach/iomap.h>
25 #include <mach/pinmux.h>
26 #include <linux/qtouch_obp_ts.h>
27 #include <linux/interrupt.h>
28 #include <linux/input.h>
30 #include "board-olympus.h"
31 #include "gpio-names.h"
33 #define XMEGAT_BL_I2C_ADDR 0x24
34 #define OLYMPUS_TOUCH_IRQ_GPIO TEGRA_GPIO_PF5
35 #define OLYMPUS_TOUCH_RESET_GPIO TEGRA_GPIO_PF4
36 #define OLYMPUS_COMPASS_IRQ_GPIO TEGRA_GPIO_PE2
39 static int olympus_touch_reset(void)
41 gpio_set_value(OLYMPUS_TOUCH_RESET_GPIO, 0);
43 gpio_set_value(OLYMPUS_TOUCH_RESET_GPIO, 1);
49 static struct vkey sholes_touch_vkeys[] = {
64 static struct qtm_touch_keyarray_cfg sholes_key_array_data[] = {
93 struct qtouch_ts_platform_data olympus_touch_data = {
95 .flags = (QTOUCH_SWAP_XY |
96 QTOUCH_USE_MULTITOUCH |
98 QTOUCH_EEPROM_CHECKSUM),
99 .irqflags = (IRQF_TRIGGER_LOW),
110 .nv_checksum = 0xc240,
115 .boot_i2c_addr = XMEGAT_BL_I2C_ADDR,
116 .hw_reset = olympus_touch_reset,
123 .idle_acq_int = 0xff,
124 .active_acq_int = 0xff,
125 .active_idle_to = 0x01,
132 .touch_autocal = 0x00,
134 .atch_cal_suspend_time = 0,
135 .atch_cal_suspend_thres = 0,
149 .mov_hyst_init = 0x05,
150 .mov_hyst_next = 0x05,
154 .merge_thresh = 0x05,
172 0x00, 0x00, 0x00, 0x00,
173 0x00, 0x00, 0x00, 0x00,
174 0x00, 0x00, 0x00, 0x00,
175 0x00, 0x00, 0x00, 0x00
179 0x00, 0x00, 0x00, 0x00,
180 0x00, 0x00, 0x00, 0x00,
181 0x00, 0x00, 0x00, 0x00,
182 0x00, 0x00, 0x00, 0x00
185 .comms_config_cfg = {
193 .internal_pullup = 0,
207 .grip_face_suppression_cfg = {
221 .noise_suppression_cfg = {
240 .touch_proximity_cfg = {
254 .one_touch_gesture_proc_cfg = {
262 .short_press_time_out = 0,
263 .long_press_time_out = 0,
264 .repeat_press_time_out = 0,
265 .flick_threshold = 0,
268 .throw_threshold = 0,
273 .high_signal_limit_0 = 0,
274 .low_signal_limit_0 = 0,
275 .high_signal_limit_1 = 0,
276 .low_signal_limit_1 = 0,
277 .high_signal_limit_2 = 0,
278 .low_signal_limit_2 = 0,
280 .two_touch_gesture_proc_cfg = {
285 .rotate_threshold = 0,
292 .idle_gcaf_depth = 4,
293 .active_gcaf_depth = 8,
296 .noise1_suppression_cfg = {
308 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
309 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
310 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
311 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
312 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
313 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
314 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
315 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
316 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
317 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
318 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
319 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
320 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
321 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
322 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
323 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
324 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
325 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
326 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
327 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
328 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
331 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
342 static struct i2c_board_info __initdata sholes_i2c_bus1_board_info[] = {
344 I2C_BOARD_INFO(QTOUCH_TS_NAME, 0x4a),
345 .platform_data = &olympus_touch_data,
346 .irq = TEGRA_GPIO_TO_IRQ(OLYMPUS_TOUCH_IRQ_GPIO),
350 static struct i2c_board_info __initdata olympus_i2c_bus4_board_info[] = {
352 I2C_BOARD_INFO("akm8973", 0x0C),
353 .irq = TEGRA_GPIO_TO_IRQ(OLYMPUS_COMPASS_IRQ_GPIO),
357 void __init olympus_i2c_init(void)
359 tegra_gpio_enable(OLYMPUS_TOUCH_IRQ_GPIO);
360 gpio_request(OLYMPUS_TOUCH_IRQ_GPIO, "touch_irq");
361 gpio_direction_input(OLYMPUS_TOUCH_IRQ_GPIO);
363 tegra_gpio_enable(OLYMPUS_TOUCH_RESET_GPIO);
364 gpio_request(OLYMPUS_TOUCH_RESET_GPIO, "touch_reset");
365 gpio_direction_output(OLYMPUS_TOUCH_RESET_GPIO, 1);
368 i2c_register_board_info(0, sholes_i2c_bus1_board_info, 1);
370 i2c_register_board_info(3, olympus_i2c_bus4_board_info, 1);