blob: e66d982f434bb03d1865e510b25924357f52a65f [file] [log] [blame]
Arve Hjønnevåg46b612b2007-08-21 21:56:46 -07001/*
2 * include/linux/synaptics_i2c_rmi.h - platform data structure for f75375s sensor
3 *
4 * Copyright (C) 2008 Google, Inc.
5 *
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.
9 *
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.
14 *
15 */
16
17#ifndef _LINUX_SYNAPTICS_I2C_RMI_H
18#define _LINUX_SYNAPTICS_I2C_RMI_H
19
20#define SYNAPTICS_I2C_RMI_NAME "synaptics-rmi-ts"
Flemmardce3c2c32013-05-23 16:53:44 -070021#define SYNAPTICS_T1007_NAME "synaptics-t1007"
22#define SYNAPTICS_T1021_NAME "synaptics-t1021"
23#define SYNAPTICS_3K_NAME "synaptics-3k"
24#define SYNAPTICS_3K_INCELL_NAME "synaptics-3k-incell"
25#define SYNAPTICS_3200_NAME "synaptics-3200"
26#define SYNAPTICS_FW_3_2_PACKRAT 1115999
27#define SYNAPTICS_FW_NOCAL_PACKRAT 1293981
28
29
30#define SYN_CONFIG_SIZE 32 * 16
31#define SYN_MAX_PAGE 4
32#define SYN_BL_PAGE 1
33#define SYN_F01DATA_BASEADDR 0x0013
34#define SYN_PROCESS_ERR -1
35
36#define SYN_AND_REPORT_TYPE_A 0
37#define SYN_AND_REPORT_TYPE_B 1
38#define SYN_AND_REPORT_TYPE_HTC 2
39
40#define TAP_DX_OUTER 0
41#define TAP_DY_OUTER 1
42#define TAP_TIMEOUT 2
43#define TAP_DX_INTER 3
44#define TAP_DY_INTER 4
45
46#define CUS_REG_SIZE 4
47#define CUS_REG_BASE 0
48#define CUS_BALLISTICS_CTRL 1
49#define CUS_LAND_CTRL 2
50#define CUS_LIFT_CTRL 3
51
52#define SENSOR_ID_CHECKING_EN 1 << 16
Arve Hjønnevåg46b612b2007-08-21 21:56:46 -070053
54enum {
55 SYNAPTICS_FLIP_X = 1UL << 0,
56 SYNAPTICS_FLIP_Y = 1UL << 1,
57 SYNAPTICS_SWAP_XY = 1UL << 2,
58 SYNAPTICS_SNAP_TO_INACTIVE_EDGE = 1UL << 3,
59};
60
Flemmardce3c2c32013-05-23 16:53:44 -070061enum {
62 FINGER_1_REPORT = 1 << 0,
63 FINGER_2_REPORT = 1 << 1,
64};
65
66#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_3K
67struct synaptics_virtual_key {
68 int index;
69 int keycode;
70 int x_range_min;
71 int x_range_max;
72 int y_range_min;
73 int y_range_max;
74};
75#endif
76
Arve Hjønnevåg46b612b2007-08-21 21:56:46 -070077struct synaptics_i2c_rmi_platform_data {
78 uint32_t version; /* Use this entry for panels with */
79 /* (major << 8 | minor) version or above. */
80 /* If non-zero another array entry follows */
81 int (*power)(int on); /* Only valid in first array entry */
Flemmardce3c2c32013-05-23 16:53:44 -070082#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_3K
83 struct synaptics_virtual_key *virtual_key;
84 uint8_t virtual_key_num;
85 struct kobject *vk_obj;
86 struct kobj_attribute *vk2Use;
87 uint8_t sensitivity;
88 uint8_t finger_support;
89 uint32_t gap_area;
90 uint32_t key_area;
91#endif
Arve Hjønnevåg46b612b2007-08-21 21:56:46 -070092 uint32_t flags;
93 unsigned long irqflags;
94 uint32_t inactive_left; /* 0x10000 = screen width */
95 uint32_t inactive_right; /* 0x10000 = screen width */
96 uint32_t inactive_top; /* 0x10000 = screen height */
97 uint32_t inactive_bottom; /* 0x10000 = screen height */
98 uint32_t snap_left_on; /* 0x10000 = screen width */
99 uint32_t snap_left_off; /* 0x10000 = screen width */
100 uint32_t snap_right_on; /* 0x10000 = screen width */
101 uint32_t snap_right_off; /* 0x10000 = screen width */
102 uint32_t snap_top_on; /* 0x10000 = screen height */
103 uint32_t snap_top_off; /* 0x10000 = screen height */
104 uint32_t snap_bottom_on; /* 0x10000 = screen height */
105 uint32_t snap_bottom_off; /* 0x10000 = screen height */
106 uint32_t fuzz_x; /* 0x10000 = screen width */
107 uint32_t fuzz_y; /* 0x10000 = screen height */
Flemmardce3c2c32013-05-23 16:53:44 -0700108#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_3K
109 int abs_x_min;
110 int abs_x_max;
111 int abs_y_min;
112 int abs_y_max;
113#endif
Arve Hjønnevåg46b612b2007-08-21 21:56:46 -0700114 int fuzz_p;
115 int fuzz_w;
Flemmardce3c2c32013-05-23 16:53:44 -0700116#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_3K
117 uint32_t display_width;
118 uint32_t display_height;
119#endif
Arve Hjønnevåg46b612b2007-08-21 21:56:46 -0700120 int8_t sensitivity_adjust;
Flemmardce3c2c32013-05-23 16:53:44 -0700121#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_3K
122 uint32_t dup_threshold;
123 uint32_t margin_inactive_pixel[4];
124 uint16_t filter_level[4];
125 uint8_t reduce_report_level[5];
126 uint8_t noise_information;
127 uint8_t jumpfq_enable;
128 uint8_t cable_support;
129 uint8_t config[SYN_CONFIG_SIZE];
130 int gpio_irq;
131 int gpio_reset;
132 uint8_t default_config;
133 uint8_t report_type;
134 uint8_t large_obj_check;
135 uint16_t tw_pin_mask;
136 uint32_t sensor_id;
137 uint32_t packrat_number;
138 uint8_t support_htc_event;
139 uint8_t mfg_flag;
140 uint8_t customer_register[CUS_REG_SIZE];
141 uint8_t segmentation_bef_unlock;
142 uint8_t threshold_bef_unlock;
143 uint16_t saturation_bef_unlock;
144 uint8_t i2c_err_handler_en;
145 uint8_t energy_ratio_relaxation;
146 uint8_t multitouch_calibration;
147 uint8_t psensor_detection;
148 uint8_t PixelTouchThreshold_bef_unlock;
149#endif
Arve Hjønnevåg46b612b2007-08-21 21:56:46 -0700150};
151
Flemmardce3c2c32013-05-23 16:53:44 -0700152#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_3K
153struct page_description {
154 uint8_t addr;
155 uint8_t value;
156};
157
158struct syn_finger_data {
159 int x;
160 int y;
161 int w;
162 int z;
163};
164
165struct function_t {
166 uint8_t function_type;
167 uint8_t interrupt_source;
168 uint16_t data_base;
169 uint16_t control_base;
170 uint16_t command_base;
171 uint16_t query_base;
172};
173enum {
174 QUERY_BASE,
175 COMMAND_BASE,
176 CONTROL_BASE,
177 DATA_BASE,
178 INTR_SOURCE,
179 FUNCTION
180};
181
182extern uint8_t getPowerKeyState(void);
183#endif /* CONFIG_TOUCHSCREEN_SYNAPTICS_3K */
Arve Hjønnevåg46b612b2007-08-21 21:56:46 -0700184#endif /* _LINUX_SYNAPTICS_I2C_RMI_H */