blob: cb54bdbea1bc5827201e93c84c8a1308bf84f076 [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
Flemmard0810abc2014-01-07 16:33:21 -080028#define SYNAPTICS_FW_2IN1_PACKRAT 1396865
Flemmardce3c2c32013-05-23 16:53:44 -070029
30
31#define SYN_CONFIG_SIZE 32 * 16
32#define SYN_MAX_PAGE 4
33#define SYN_BL_PAGE 1
34#define SYN_F01DATA_BASEADDR 0x0013
35#define SYN_PROCESS_ERR -1
36
37#define SYN_AND_REPORT_TYPE_A 0
38#define SYN_AND_REPORT_TYPE_B 1
39#define SYN_AND_REPORT_TYPE_HTC 2
40
41#define TAP_DX_OUTER 0
42#define TAP_DY_OUTER 1
43#define TAP_TIMEOUT 2
44#define TAP_DX_INTER 3
45#define TAP_DY_INTER 4
46
47#define CUS_REG_SIZE 4
48#define CUS_REG_BASE 0
49#define CUS_BALLISTICS_CTRL 1
50#define CUS_LAND_CTRL 2
51#define CUS_LIFT_CTRL 3
52
53#define SENSOR_ID_CHECKING_EN 1 << 16
Flemmard0810abc2014-01-07 16:33:21 -080054#define PSENSOR_STATUS 0x03
55#define PHONE_STATUS 0x04
Arve Hjønnevåg46b612b2007-08-21 21:56:46 -070056
57enum {
58 SYNAPTICS_FLIP_X = 1UL << 0,
59 SYNAPTICS_FLIP_Y = 1UL << 1,
60 SYNAPTICS_SWAP_XY = 1UL << 2,
61 SYNAPTICS_SNAP_TO_INACTIVE_EDGE = 1UL << 3,
62};
63
Flemmardce3c2c32013-05-23 16:53:44 -070064enum {
65 FINGER_1_REPORT = 1 << 0,
66 FINGER_2_REPORT = 1 << 1,
67};
68
69#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_3K
70struct synaptics_virtual_key {
71 int index;
72 int keycode;
73 int x_range_min;
74 int x_range_max;
75 int y_range_min;
76 int y_range_max;
77};
78#endif
79
Arve Hjønnevåg46b612b2007-08-21 21:56:46 -070080struct synaptics_i2c_rmi_platform_data {
81 uint32_t version; /* Use this entry for panels with */
82 /* (major << 8 | minor) version or above. */
83 /* If non-zero another array entry follows */
84 int (*power)(int on); /* Only valid in first array entry */
Flemmardce3c2c32013-05-23 16:53:44 -070085#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_3K
Flemmard0810abc2014-01-07 16:33:21 -080086 int (*lpm_power)(int on);
Flemmardce3c2c32013-05-23 16:53:44 -070087 struct synaptics_virtual_key *virtual_key;
88 uint8_t virtual_key_num;
89 struct kobject *vk_obj;
90 struct kobj_attribute *vk2Use;
91 uint8_t sensitivity;
92 uint8_t finger_support;
93 uint32_t gap_area;
94 uint32_t key_area;
95#endif
Arve Hjønnevåg46b612b2007-08-21 21:56:46 -070096 uint32_t flags;
97 unsigned long irqflags;
98 uint32_t inactive_left; /* 0x10000 = screen width */
99 uint32_t inactive_right; /* 0x10000 = screen width */
100 uint32_t inactive_top; /* 0x10000 = screen height */
101 uint32_t inactive_bottom; /* 0x10000 = screen height */
102 uint32_t snap_left_on; /* 0x10000 = screen width */
103 uint32_t snap_left_off; /* 0x10000 = screen width */
104 uint32_t snap_right_on; /* 0x10000 = screen width */
105 uint32_t snap_right_off; /* 0x10000 = screen width */
106 uint32_t snap_top_on; /* 0x10000 = screen height */
107 uint32_t snap_top_off; /* 0x10000 = screen height */
108 uint32_t snap_bottom_on; /* 0x10000 = screen height */
109 uint32_t snap_bottom_off; /* 0x10000 = screen height */
110 uint32_t fuzz_x; /* 0x10000 = screen width */
111 uint32_t fuzz_y; /* 0x10000 = screen height */
Flemmardce3c2c32013-05-23 16:53:44 -0700112#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_3K
113 int abs_x_min;
114 int abs_x_max;
115 int abs_y_min;
116 int abs_y_max;
117#endif
Arve Hjønnevåg46b612b2007-08-21 21:56:46 -0700118 int fuzz_p;
119 int fuzz_w;
Flemmardce3c2c32013-05-23 16:53:44 -0700120#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_3K
121 uint32_t display_width;
122 uint32_t display_height;
123#endif
Arve Hjønnevåg46b612b2007-08-21 21:56:46 -0700124 int8_t sensitivity_adjust;
Flemmardce3c2c32013-05-23 16:53:44 -0700125#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_3K
126 uint32_t dup_threshold;
127 uint32_t margin_inactive_pixel[4];
128 uint16_t filter_level[4];
129 uint8_t reduce_report_level[5];
130 uint8_t noise_information;
131 uint8_t jumpfq_enable;
132 uint8_t cable_support;
133 uint8_t config[SYN_CONFIG_SIZE];
134 int gpio_irq;
135 int gpio_reset;
136 uint8_t default_config;
137 uint8_t report_type;
138 uint8_t large_obj_check;
139 uint16_t tw_pin_mask;
140 uint32_t sensor_id;
141 uint32_t packrat_number;
142 uint8_t support_htc_event;
143 uint8_t mfg_flag;
144 uint8_t customer_register[CUS_REG_SIZE];
145 uint8_t segmentation_bef_unlock;
146 uint8_t threshold_bef_unlock;
147 uint16_t saturation_bef_unlock;
148 uint8_t i2c_err_handler_en;
149 uint8_t energy_ratio_relaxation;
150 uint8_t multitouch_calibration;
151 uint8_t psensor_detection;
152 uint8_t PixelTouchThreshold_bef_unlock;
Flemmard0810abc2014-01-07 16:33:21 -0800153 uint8_t block_touch_time_near;
154 uint8_t block_touch_time_far;
Flemmardce3c2c32013-05-23 16:53:44 -0700155#endif
Arve Hjønnevåg46b612b2007-08-21 21:56:46 -0700156};
157
Flemmardce3c2c32013-05-23 16:53:44 -0700158#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_3K
159struct page_description {
160 uint8_t addr;
161 uint8_t value;
162};
163
164struct syn_finger_data {
165 int x;
166 int y;
167 int w;
168 int z;
169};
170
171struct function_t {
172 uint8_t function_type;
173 uint8_t interrupt_source;
174 uint16_t data_base;
175 uint16_t control_base;
176 uint16_t command_base;
177 uint16_t query_base;
178};
179enum {
180 QUERY_BASE,
181 COMMAND_BASE,
182 CONTROL_BASE,
183 DATA_BASE,
184 INTR_SOURCE,
185 FUNCTION
186};
187
188extern uint8_t getPowerKeyState(void);
189#endif /* CONFIG_TOUCHSCREEN_SYNAPTICS_3K */
Arve Hjønnevåg46b612b2007-08-21 21:56:46 -0700190#endif /* _LINUX_SYNAPTICS_I2C_RMI_H */