Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* Header file for: |
| 2 | * Cypress TrueTouch(TM) Standard Product touchscreen drivers. |
| 3 | * include/linux/cyttsp.h |
| 4 | * |
| 5 | * Copyright (C) 2009, 2010 Cypress Semiconductor, Inc. |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU General Public License |
| 9 | * version 2, and only version 2, as published by the |
| 10 | * Free Software Foundation. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License along |
| 18 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 20 | * |
| 21 | * Cypress reserves the right to make changes without further notice |
| 22 | * to the materials described herein. Cypress does not assume any |
| 23 | * liability arising out of the application described herein. |
| 24 | * |
| 25 | * Contact Cypress Semiconductor at www.cypress.com |
| 26 | * |
| 27 | */ |
| 28 | |
| 29 | |
| 30 | #ifndef __CYTTSP_H__ |
| 31 | #define __CYTTSP_H__ |
| 32 | |
| 33 | #include <linux/input.h> |
| 34 | #include <linux/timer.h> |
| 35 | #include <linux/workqueue.h> |
| 36 | #include <linux/kernel.h> |
| 37 | #include <linux/delay.h> |
| 38 | |
| 39 | #include <asm/mach-types.h> |
| 40 | |
| 41 | #define CYPRESS_TTSP_NAME "cyttsp" |
| 42 | #define CY_I2C_NAME "cyttsp-i2c" |
| 43 | #define CY_SPI_NAME "cyttsp-spi" |
| 44 | |
| 45 | #ifdef CY_DECLARE_GLOBALS |
| 46 | uint32_t cyttsp_tsdebug; |
| 47 | module_param_named(tsdebug, cyttsp_tsdebug, uint, 0664); |
| 48 | uint32_t cyttsp_tsxdebug; |
| 49 | module_param_named(tsxdebug, cyttsp_tsxdebug, uint, 0664); |
| 50 | |
| 51 | uint32_t cyttsp_disable_touch; |
| 52 | module_param_named(disable_touch, cyttsp_disable_touch, uint, 0664); |
| 53 | #else |
| 54 | extern uint32_t cyttsp_tsdebug; |
| 55 | extern uint32_t cyttsp_tsxdebug; |
| 56 | extern uint32_t cyttsp_disable_touch; |
| 57 | #endif |
| 58 | |
| 59 | |
| 60 | |
| 61 | /****************************************************************************** |
| 62 | * Global Control, Used to control the behavior of the driver |
| 63 | */ |
| 64 | |
| 65 | /* defines for Gen2 (Txx2xx); Gen3 (Txx3xx) |
| 66 | * use these defines to set cyttsp_platform_data.gen in board config file |
| 67 | */ |
| 68 | #define CY_GEN2 2 |
| 69 | #define CY_GEN3 3 |
| 70 | |
| 71 | /* define for using I2C driver |
| 72 | */ |
| 73 | #define CY_USE_I2C_DRIVER |
| 74 | |
| 75 | /* defines for using SPI driver */ |
| 76 | /* |
| 77 | #define CY_USE_SPI_DRIVER |
| 78 | */ |
| 79 | #define CY_SPI_DFLT_SPEED_HZ 1000000 |
| 80 | #define CY_SPI_MAX_SPEED_HZ 4000000 |
| 81 | #define CY_SPI_SPEED_HZ CY_SPI_DFLT_SPEED_HZ |
| 82 | #define CY_SPI_BITS_PER_WORD 8 |
| 83 | #define CY_SPI_DAV 139 /* set correct gpio id */ |
| 84 | #define CY_SPI_BUFSIZE 512 |
| 85 | |
| 86 | /* Voltage and Current ratings */ |
| 87 | #define CY_TMA300_VTG_MAX_UV 5500000 |
| 88 | #define CY_TMA300_VTG_MIN_UV 1710000 |
| 89 | #define CY_TMA300_CURR_24HZ_UA 17500 |
Anirudh Ghayal | f9929b1 | 2011-09-07 15:57:36 +0530 | [diff] [blame] | 90 | #define CY_TMA300_SLEEP_CURR_UA 10 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 91 | #define CY_I2C_VTG_MAX_UV 1800000 |
| 92 | #define CY_I2C_VTG_MIN_UV 1800000 |
| 93 | #define CY_I2C_CURR_UA 9630 |
Anirudh Ghayal | f9929b1 | 2011-09-07 15:57:36 +0530 | [diff] [blame] | 94 | #define CY_I2C_SLEEP_CURR_UA 10 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 95 | |
| 96 | |
| 97 | /* define for inclusion of TTSP App Update Load File |
| 98 | * use this define if update to the TTSP Device is desired |
| 99 | */ |
| 100 | /* |
| 101 | #define CY_INCLUDE_LOAD_FILE |
| 102 | */ |
| 103 | |
| 104 | /* define if force new load file for bootloader load */ |
| 105 | /* |
| 106 | #define CY_FORCE_FW_UPDATE |
| 107 | */ |
| 108 | |
| 109 | /* undef for production use */ |
| 110 | /* |
| 111 | #define CY_USE_DEBUG |
| 112 | */ |
| 113 | |
| 114 | /* undef for irq use; use this define in the board configuration file */ |
| 115 | /* |
| 116 | #define CY_USE_TIMER |
| 117 | */ |
| 118 | |
| 119 | /* undef to allow use of extra debug capability */ |
| 120 | /* |
| 121 | #define CY_ALLOW_EXTRA_DEBUG |
| 122 | */ |
| 123 | |
| 124 | /* undef to remove additional debug prints */ |
| 125 | /* |
| 126 | #define CY_USE_EXTRA_DEBUG |
| 127 | */ |
| 128 | |
| 129 | /* undef to remove additional debug prints */ |
| 130 | /* |
| 131 | #define CY_USE_EXTRA_DEBUG1 |
| 132 | */ |
| 133 | |
| 134 | /* undef to use operational touch timer jiffies; else use test jiffies */ |
| 135 | /* |
| 136 | */ |
| 137 | #define CY_USE_TIMER_DEBUG |
| 138 | |
| 139 | /* define to use canned test data */ |
| 140 | /* |
| 141 | #define CY_USE_TEST_DATA |
| 142 | */ |
| 143 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 144 | /* define if gesture signaling is used |
| 145 | * and which gesture groups to use |
| 146 | */ |
| 147 | /* |
| 148 | #define CY_USE_GEST |
| 149 | #define CY_USE_GEST_GRP1 |
| 150 | #define CY_USE_GEST_GRP2 |
| 151 | #define CY_USE_GEST_GRP3 |
| 152 | #define CY_USE_GEST_GRP4 |
| 153 | */ |
| 154 | /* Active distance in pixels for a gesture to be reported |
| 155 | * if set to 0, then all gesture movements are reported |
| 156 | */ |
| 157 | #define CY_ACT_DIST_DFLT 8 |
| 158 | #define CY_ACT_DIST CY_ACT_DIST_DFLT |
| 159 | |
| 160 | /* define if MT signals are desired */ |
| 161 | /* |
| 162 | */ |
| 163 | #define CY_USE_MT_SIGNALS |
| 164 | |
| 165 | /* define if MT tracking id signals are used */ |
| 166 | /* |
| 167 | #define CY_USE_MT_TRACK_ID |
| 168 | */ |
| 169 | |
| 170 | /* define if ST signals are required */ |
| 171 | /* |
| 172 | */ |
| 173 | #define CY_USE_ST_SIGNALS |
| 174 | |
| 175 | /* define to send handshake to device */ |
| 176 | /* |
| 177 | */ |
| 178 | #define CY_USE_HNDSHK |
| 179 | |
| 180 | /* define if log all raw motion signals to a sysfs file */ |
| 181 | /* |
| 182 | #define CY_LOG_TO_FILE |
| 183 | */ |
| 184 | |
| 185 | |
| 186 | /* End of the Global Control section |
| 187 | ****************************************************************************** |
| 188 | */ |
| 189 | #define CY_DIFF(m, n) ((m) != (n)) |
| 190 | |
| 191 | #ifdef CY_LOG_TO_FILE |
| 192 | #define cyttsp_openlog() /* use sysfs */ |
| 193 | #else |
| 194 | #define cyttsp_openlog() |
| 195 | #endif /* CY_LOG_TO_FILE */ |
| 196 | |
| 197 | /* see kernel.h for pr_xxx def'ns */ |
| 198 | #define cyttsp_info(f, a...) pr_info("%s:" f, __func__ , ## a) |
| 199 | #define cyttsp_error(f, a...) pr_err("%s:" f, __func__ , ## a) |
| 200 | #define cyttsp_alert(f, a...) pr_alert("%s:" f, __func__ , ## a) |
| 201 | |
| 202 | #ifdef CY_USE_DEBUG |
| 203 | #define cyttsp_debug(f, a...) pr_alert("%s:" f, __func__ , ## a) |
| 204 | #else |
| 205 | #define cyttsp_debug(f, a...) {if (cyttsp_tsdebug) \ |
| 206 | pr_alert("%s:" f, __func__ , ## a); } |
| 207 | #endif /* CY_USE_DEBUG */ |
| 208 | |
| 209 | #ifdef CY_ALLOW_EXTRA_DEBUG |
| 210 | #ifdef CY_USE_EXTRA_DEBUG |
| 211 | #define cyttsp_xdebug(f, a...) pr_alert("%s:" f, __func__ , ## a) |
| 212 | #else |
| 213 | #define cyttsp_xdebug(f, a...) {if (cyttsp_tsxdebug) \ |
| 214 | pr_alert("%s:" f, __func__ , ## a); } |
| 215 | #endif /* CY_USE_EXTRA_DEBUG */ |
| 216 | |
| 217 | #ifdef CY_USE_EXTRA_DEBUG1 |
| 218 | #define cyttsp_xdebug1(f, a...) pr_alert("%s:" f, __func__ , ## a) |
| 219 | #else |
| 220 | #define cyttsp_xdebug1(f, a...) |
| 221 | #endif /* CY_USE_EXTRA_DEBUG1 */ |
| 222 | #else |
| 223 | #define cyttsp_xdebug(f, a...) |
| 224 | #define cyttsp_xdebug1(f, a...) |
| 225 | #endif /* CY_ALLOW_EXTRA_DEBUG */ |
| 226 | |
| 227 | #ifdef CY_USE_TIMER_DEBUG |
| 228 | #define TOUCHSCREEN_TIMEOUT (msecs_to_jiffies(1000)) |
| 229 | #else |
| 230 | #define TOUCHSCREEN_TIMEOUT (msecs_to_jiffies(28)) |
| 231 | #endif |
| 232 | |
| 233 | /* reduce extra signals in MT only build |
| 234 | * be careful not to lose backward compatibility for pre-MT apps |
| 235 | */ |
| 236 | #ifdef CY_USE_ST_SIGNALS |
| 237 | #define CY_USE_ST 1 |
| 238 | #else |
| 239 | #define CY_USE_ST 0 |
| 240 | #endif /* CY_USE_ST_SIGNALS */ |
| 241 | |
| 242 | /* rely on kernel input.h to define Multi-Touch capability */ |
| 243 | /* if input.h defines the Multi-Touch signals, then use MT */ |
| 244 | #if defined(ABS_MT_TOUCH_MAJOR) && defined(CY_USE_MT_SIGNALS) |
| 245 | #define CY_USE_MT 1 |
| 246 | #define CY_MT_SYNC(input) input_mt_sync(input) |
| 247 | #else |
| 248 | #define CY_USE_MT 0 |
| 249 | #define CY_MT_SYNC(input) |
| 250 | /* the following includes are provided to ensure a compile; |
| 251 | * the code that compiles with these defines will not be executed if |
| 252 | * the CY_USE_MT is properly used in the platform structure init |
| 253 | */ |
| 254 | #ifndef ABS_MT_TOUCH_MAJOR |
| 255 | #define ABS_MT_TOUCH_MAJOR 0x30 /* touching ellipse */ |
| 256 | #define ABS_MT_TOUCH_MINOR 0x31 /* (omit if circular) */ |
| 257 | #define ABS_MT_WIDTH_MAJOR 0x32 /* approaching ellipse */ |
| 258 | #define ABS_MT_WIDTH_MINOR 0x33 /* (omit if circular) */ |
| 259 | #define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */ |
| 260 | #define ABS_MT_POSITION_X 0x35 /* Center X ellipse position */ |
| 261 | #define ABS_MT_POSITION_Y 0x36 /* Center Y ellipse position */ |
| 262 | #define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */ |
| 263 | #define ABS_MT_BLOB_ID 0x38 /* Group set of pkts as blob */ |
| 264 | #endif /* ABS_MT_TOUCH_MAJOR */ |
| 265 | #endif /* ABS_MT_TOUCH_MAJOR and CY_USE_MT_SIGNALS */ |
| 266 | #if defined(ABS_MT_TRACKING_ID) && defined(CY_USE_MT_TRACK_ID) |
| 267 | #define CY_USE_TRACKING_ID 1 |
| 268 | #else |
| 269 | #define CY_USE_TRACKING_ID 0 |
| 270 | /* define only if not defined already by system; |
| 271 | * value based on linux kernel 2.6.30.10 |
| 272 | */ |
| 273 | #ifndef ABS_MT_TRACKING_ID |
| 274 | #define ABS_MT_TRACKING_ID (ABS_MT_BLOB_ID+1) |
| 275 | #endif |
| 276 | #endif /* ABS_MT_TRACKING_ID */ |
| 277 | |
Anirudh Ghayal | 1518777 | 2011-06-22 17:39:41 +0530 | [diff] [blame] | 278 | #define CY_USE_DEEP_SLEEP_SEL 0x80 |
| 279 | #define CY_USE_LOW_POWER_SEL 0x01 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 280 | |
| 281 | #ifdef CY_USE_TEST_DATA |
| 282 | #define cyttsp_testdat(ray1, ray2, sizeofray) \ |
| 283 | { \ |
| 284 | int i; \ |
| 285 | u8 *up1 = (u8 *)ray1; \ |
| 286 | u8 *up2 = (u8 *)ray2; \ |
| 287 | for (i = 0; i < sizeofray; i++) { \ |
| 288 | up1[i] = up2[i]; \ |
| 289 | } \ |
| 290 | } |
| 291 | #else |
| 292 | #define cyttsp_testdat(xy, test_xy, sizeofray) |
| 293 | #endif /* CY_USE_TEST_DATA */ |
| 294 | |
| 295 | /* helper macros */ |
| 296 | #define GET_NUM_TOUCHES(x) ((x) & 0x0F) |
| 297 | #define GET_TOUCH1_ID(x) (((x) & 0xF0) >> 4) |
| 298 | #define GET_TOUCH2_ID(x) ((x) & 0x0F) |
| 299 | #define GET_TOUCH3_ID(x) (((x) & 0xF0) >> 4) |
| 300 | #define GET_TOUCH4_ID(x) ((x) & 0x0F) |
| 301 | #define IS_LARGE_AREA(x) (((x) & 0x10) >> 4) |
| 302 | #define FLIP_DATA_FLAG 0x01 |
| 303 | #define REVERSE_X_FLAG 0x02 |
| 304 | #define REVERSE_Y_FLAG 0x04 |
| 305 | #define FLIP_DATA(flags) ((flags) & FLIP_DATA_FLAG) |
| 306 | #define REVERSE_X(flags) ((flags) & REVERSE_X_FLAG) |
| 307 | #define REVERSE_Y(flags) ((flags) & REVERSE_Y_FLAG) |
| 308 | #define FLIP_XY(x, y) { \ |
| 309 | u16 tmp; \ |
| 310 | tmp = (x); \ |
| 311 | (x) = (y); \ |
| 312 | (y) = tmp; \ |
| 313 | } |
| 314 | #define INVERT_X(x, xmax) ((xmax) - (x)) |
| 315 | #define INVERT_Y(y, maxy) ((maxy) - (y)) |
| 316 | #define SET_HSTMODE(reg, mode) ((reg) & (mode)) |
| 317 | #define GET_HSTMODE(reg) ((reg & 0x70) >> 4) |
| 318 | #define GET_BOOTLOADERMODE(reg) ((reg & 0x10) >> 4) |
| 319 | |
| 320 | /* constant definitions */ |
| 321 | /* maximum number of concurrent ST track IDs */ |
| 322 | #define CY_NUM_ST_TCH_ID 2 |
| 323 | |
| 324 | /* maximum number of concurrent MT track IDs */ |
| 325 | #define CY_NUM_MT_TCH_ID 4 |
| 326 | |
| 327 | /* maximum number of track IDs */ |
| 328 | #define CY_NUM_TRK_ID 16 |
| 329 | |
| 330 | #define CY_NTCH 0 /* no touch (lift off) */ |
| 331 | #define CY_TCH 1 /* active touch (touchdown) */ |
| 332 | #define CY_ST_FNGR1_IDX 0 |
| 333 | #define CY_ST_FNGR2_IDX 1 |
| 334 | #define CY_MT_TCH1_IDX 0 |
| 335 | #define CY_MT_TCH2_IDX 1 |
| 336 | #define CY_MT_TCH3_IDX 2 |
| 337 | #define CY_MT_TCH4_IDX 3 |
| 338 | #define CY_XPOS 0 |
| 339 | #define CY_YPOS 1 |
| 340 | #define CY_IGNR_TCH (-1) |
| 341 | #define CY_SMALL_TOOL_WIDTH 10 |
| 342 | #define CY_LARGE_TOOL_WIDTH 255 |
| 343 | #define CY_REG_BASE 0x00 |
| 344 | #define CY_REG_GEST_SET 0x1E |
| 345 | #define CY_REG_ACT_INTRVL 0x1D |
| 346 | #define CY_REG_TCH_TMOUT (CY_REG_ACT_INTRVL+1) |
| 347 | #define CY_REG_LP_INTRVL (CY_REG_TCH_TMOUT+1) |
| 348 | #define CY_SOFT_RESET ((1 << 0)) |
| 349 | #define CY_DEEP_SLEEP ((1 << 1)) |
| 350 | #define CY_LOW_POWER ((1 << 2)) |
| 351 | #define CY_MAXZ 255 |
| 352 | #define CY_OK 0 |
| 353 | #define CY_INIT 1 |
| 354 | #define CY_DLY_DFLT 10 /* ms */ |
| 355 | #define CY_DLY_SYSINFO 20 /* ms */ |
| 356 | #define CY_DLY_BL 300 |
| 357 | #define CY_DLY_DNLOAD 100 /* ms */ |
| 358 | #define CY_NUM_RETRY 4 /* max num touch data read */ |
| 359 | |
| 360 | /* handshake bit in the hst_mode reg */ |
| 361 | #define CY_HNDSHK_BIT 0x80 |
| 362 | #ifdef CY_USE_HNDSHK |
| 363 | #define CY_SEND_HNDSHK 1 |
| 364 | #else |
| 365 | #define CY_SEND_HNDSHK 0 |
| 366 | #endif |
| 367 | |
| 368 | /* Bootloader File 0 offset */ |
| 369 | #define CY_BL_FILE0 0x00 |
| 370 | |
| 371 | /* Bootloader command directive */ |
| 372 | #define CY_BL_CMD 0xFF |
| 373 | |
| 374 | /* Bootloader Initiate Bootload */ |
| 375 | #define CY_BL_INIT_LOAD 0x38 |
| 376 | |
| 377 | /* Bootloader Write a Block */ |
| 378 | #define CY_BL_WRITE_BLK 0x39 |
| 379 | |
| 380 | /* Bootloader Terminate Bootload */ |
| 381 | #define CY_BL_TERMINATE 0x3B |
| 382 | |
| 383 | /* Bootloader Exit and Verify Checksum command */ |
| 384 | #define CY_BL_EXIT 0xA5 |
| 385 | |
| 386 | /* Bootloader default keys */ |
| 387 | #define CY_BL_KEY0 0x00 |
| 388 | #define CY_BL_KEY1 0x01 |
| 389 | #define CY_BL_KEY2 0x02 |
| 390 | #define CY_BL_KEY3 0x03 |
| 391 | #define CY_BL_KEY4 0x04 |
| 392 | #define CY_BL_KEY5 0x05 |
| 393 | #define CY_BL_KEY6 0x06 |
| 394 | #define CY_BL_KEY7 0x07 |
| 395 | |
| 396 | /* Active Power state scanning/processing refresh interval */ |
| 397 | #define CY_ACT_INTRVL_DFLT 0x00 |
| 398 | |
| 399 | /* touch timeout for the Active power */ |
| 400 | #define CY_TCH_TMOUT_DFLT 0xFF |
| 401 | |
| 402 | /* Low Power state scanning/processing refresh interval */ |
| 403 | #define CY_LP_INTRVL_DFLT 0x0A |
| 404 | |
| 405 | #define CY_IDLE_STATE 0 |
| 406 | #define CY_ACTIVE_STATE 1 |
| 407 | #define CY_LOW_PWR_STATE 2 |
| 408 | #define CY_SLEEP_STATE 3 |
| 409 | |
| 410 | /* device mode bits */ |
| 411 | #define CY_OP_MODE 0x00 |
| 412 | #define CY_SYSINFO_MODE 0x10 |
| 413 | |
| 414 | /* power mode select bits */ |
| 415 | #define CY_SOFT_RESET_MODE 0x01 /* return to Bootloader mode */ |
| 416 | #define CY_DEEP_SLEEP_MODE 0x02 |
| 417 | #define CY_LOW_PWR_MODE 0x04 |
| 418 | |
| 419 | #define CY_NUM_KEY 8 |
| 420 | |
| 421 | #ifdef CY_USE_GEST |
| 422 | #define CY_USE_GESTURES 1 |
| 423 | #else |
| 424 | #define CY_USE_GESTURES 0 |
| 425 | #endif /* CY_USE_GESTURE_SIGNALS */ |
| 426 | |
| 427 | #ifdef CY_USE_GEST_GRP1 |
| 428 | #define CY_GEST_GRP1 0x10 |
| 429 | #else |
| 430 | #define CY_GEST_GRP1 0x00 |
| 431 | #endif /* CY_USE_GEST_GRP1 */ |
| 432 | #ifdef CY_USE_GEST_GRP2 |
| 433 | #define CY_GEST_GRP2 0x20 |
| 434 | #else |
| 435 | #define CY_GEST_GRP2 0x00 |
| 436 | #endif /* CY_USE_GEST_GRP2 */ |
| 437 | #ifdef CY_USE_GEST_GRP3 |
| 438 | #define CY_GEST_GRP3 0x40 |
| 439 | #else |
| 440 | #define CY_GEST_GRP3 0x00 |
| 441 | #endif /* CY_USE_GEST_GRP3 */ |
| 442 | #ifdef CY_USE_GEST_GRP4 |
| 443 | #define CY_GEST_GRP4 0x80 |
| 444 | #else |
| 445 | #define CY_GEST_GRP4 0x00 |
| 446 | #endif /* CY_USE_GEST_GRP4 */ |
| 447 | |
| 448 | struct cyttsp_regulator { |
| 449 | const char *name; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 450 | u32 max_uV; |
Anirudh Ghayal | f9929b1 | 2011-09-07 15:57:36 +0530 | [diff] [blame] | 451 | u32 min_uV; |
| 452 | u32 hpm_load_uA; |
| 453 | u32 lpm_load_uA; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 454 | }; |
| 455 | |
| 456 | struct cyttsp_platform_data { |
| 457 | u32 panel_maxx; |
| 458 | u32 panel_maxy; |
| 459 | u32 disp_resx; |
| 460 | u32 disp_resy; |
| 461 | u32 disp_minx; |
| 462 | u32 disp_miny; |
| 463 | u32 disp_maxx; |
| 464 | u32 disp_maxy; |
| 465 | u8 correct_fw_ver; |
| 466 | u32 flags; |
| 467 | u8 gen; |
| 468 | u8 use_st; |
| 469 | u8 use_mt; |
| 470 | u8 use_hndshk; |
| 471 | u8 use_trk_id; |
| 472 | u8 use_sleep; |
| 473 | u8 use_gestures; |
| 474 | u8 gest_set; |
| 475 | u8 act_intrvl; |
| 476 | u8 tch_tmout; |
| 477 | u8 lp_intrvl; |
| 478 | u8 power_state; |
| 479 | bool wakeup; |
| 480 | int sleep_gpio; |
| 481 | int resout_gpio; |
| 482 | int irq_gpio; |
| 483 | struct cyttsp_regulator *regulator_info; |
| 484 | u8 num_regulators; |
| 485 | const char *fw_fname; |
Mohan Pallaka | 727225f | 2011-08-18 11:09:49 +0530 | [diff] [blame] | 486 | bool disable_ghost_det; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 487 | #ifdef CY_USE_I2C_DRIVER |
| 488 | s32 (*init)(struct i2c_client *client); |
| 489 | s32 (*resume)(struct i2c_client *client); |
Anirudh Ghayal | f9929b1 | 2011-09-07 15:57:36 +0530 | [diff] [blame] | 490 | s32 (*suspend)(struct i2c_client *client); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 491 | #endif |
| 492 | #ifdef CY_USE_SPI_DRIVER |
| 493 | s32 (*init)(struct spi_device *spi); |
| 494 | s32 (*resume)(struct spi_device *spi); |
| 495 | #endif |
| 496 | }; |
| 497 | |
| 498 | /* TrueTouch Standard Product Gen3 (Txx3xx) interface definition */ |
| 499 | struct cyttsp_gen3_xydata_t { |
| 500 | u8 hst_mode; |
| 501 | u8 tt_mode; |
| 502 | u8 tt_stat; |
| 503 | u16 x1 __attribute__ ((packed)); |
| 504 | u16 y1 __attribute__ ((packed)); |
| 505 | u8 z1; |
| 506 | u8 touch12_id; |
| 507 | u16 x2 __attribute__ ((packed)); |
| 508 | u16 y2 __attribute__ ((packed)); |
| 509 | u8 z2; |
| 510 | u8 gest_cnt; |
| 511 | u8 gest_id; |
| 512 | u16 x3 __attribute__ ((packed)); |
| 513 | u16 y3 __attribute__ ((packed)); |
| 514 | u8 z3; |
| 515 | u8 touch34_id; |
| 516 | u16 x4 __attribute__ ((packed)); |
| 517 | u16 y4 __attribute__ ((packed)); |
| 518 | u8 z4; |
| 519 | u8 tt_undef[3]; |
| 520 | u8 gest_set; |
| 521 | u8 tt_reserved; |
| 522 | }; |
| 523 | |
| 524 | /* TrueTouch Standard Product Gen2 (Txx2xx) interface definition */ |
| 525 | #define CY_GEN2_NOTOUCH 0x03 /* Both touches removed */ |
| 526 | #define CY_GEN2_GHOST 0x02 /* ghost */ |
| 527 | #define CY_GEN2_2TOUCH 0x03 /* 2 touch; no ghost */ |
| 528 | #define CY_GEN2_1TOUCH 0x01 /* 1 touch only */ |
| 529 | #define CY_GEN2_TOUCH2 0x01 /* 1st touch removed; |
| 530 | * 2nd touch remains */ |
| 531 | struct cyttsp_gen2_xydata_t { |
| 532 | u8 hst_mode; |
| 533 | u8 tt_mode; |
| 534 | u8 tt_stat; |
| 535 | u16 x1 __attribute__ ((packed)); |
| 536 | u16 y1 __attribute__ ((packed)); |
| 537 | u8 z1; |
| 538 | u8 evnt_idx; |
| 539 | u16 x2 __attribute__ ((packed)); |
| 540 | u16 y2 __attribute__ ((packed)); |
| 541 | u8 tt_undef1; |
| 542 | u8 gest_cnt; |
| 543 | u8 gest_id; |
| 544 | u8 tt_undef[14]; |
| 545 | u8 gest_set; |
| 546 | u8 tt_reserved; |
| 547 | }; |
| 548 | |
| 549 | /* TTSP System Information interface definition */ |
| 550 | struct cyttsp_sysinfo_data_t { |
| 551 | u8 hst_mode; |
| 552 | u8 mfg_cmd; |
| 553 | u8 mfg_stat; |
| 554 | u8 cid[3]; |
| 555 | u8 tt_undef1; |
| 556 | u8 uid[8]; |
| 557 | u8 bl_verh; |
| 558 | u8 bl_verl; |
| 559 | u8 tts_verh; |
| 560 | u8 tts_verl; |
| 561 | u8 app_idh; |
| 562 | u8 app_idl; |
| 563 | u8 app_verh; |
| 564 | u8 app_verl; |
| 565 | u8 tt_undef[6]; |
| 566 | u8 act_intrvl; |
| 567 | u8 tch_tmout; |
| 568 | u8 lp_intrvl; |
| 569 | }; |
| 570 | |
| 571 | /* TTSP Bootloader Register Map interface definition */ |
| 572 | #define CY_BL_CHKSUM_OK 0x01 |
| 573 | struct cyttsp_bootloader_data_t { |
| 574 | u8 bl_file; |
| 575 | u8 bl_status; |
| 576 | u8 bl_error; |
| 577 | u8 blver_hi; |
| 578 | u8 blver_lo; |
| 579 | u8 bld_blver_hi; |
| 580 | u8 bld_blver_lo; |
| 581 | u8 ttspver_hi; |
| 582 | u8 ttspver_lo; |
| 583 | u8 appid_hi; |
| 584 | u8 appid_lo; |
| 585 | u8 appver_hi; |
| 586 | u8 appver_lo; |
| 587 | u8 cid_0; |
| 588 | u8 cid_1; |
| 589 | u8 cid_2; |
| 590 | }; |
| 591 | |
| 592 | #define cyttsp_wake_data_t cyttsp_gen3_xydata_t |
| 593 | #ifdef CY_DECLARE_GLOBALS |
| 594 | #ifdef CY_INCLUDE_LOAD_FILE |
| 595 | /* this file declares: |
| 596 | * firmware download block array (cyttsp_fw[]), |
| 597 | * the number of command block records (cyttsp_fw_records), |
| 598 | * and the version variables |
| 599 | */ |
| 600 | #include "cyttsp_fw.h" /* imports cyttsp_fw[] array */ |
| 601 | #define cyttsp_app_load() 1 |
| 602 | #ifdef CY_FORCE_FW_UPDATE |
| 603 | #define cyttsp_force_fw_load() 1 |
| 604 | #else |
| 605 | #define cyttsp_force_fw_load() 0 |
| 606 | #endif |
| 607 | |
| 608 | #else |
| 609 | /* the following declarations are to allow |
| 610 | * some debugging capability |
| 611 | */ |
| 612 | unsigned char cyttsp_fw_tts_verh = 0x00; |
| 613 | unsigned char cyttsp_fw_tts_verl = 0x01; |
| 614 | unsigned char cyttsp_fw_app_idh = 0x02; |
| 615 | unsigned char cyttsp_fw_app_idl = 0x03; |
| 616 | unsigned char cyttsp_fw_app_verh = 0x04; |
| 617 | unsigned char cyttsp_fw_app_verl = 0x05; |
| 618 | unsigned char cyttsp_fw_cid_0 = 0x06; |
| 619 | unsigned char cyttsp_fw_cid_1 = 0x07; |
| 620 | unsigned char cyttsp_fw_cid_2 = 0x08; |
| 621 | #define cyttsp_app_load() 0 |
| 622 | #define cyttsp_force_fw_load() 0 |
| 623 | #endif |
| 624 | #define cyttsp_tts_verh() cyttsp_fw_tts_verh |
| 625 | #define cyttsp_tts_verl() cyttsp_fw_tts_verl |
| 626 | #define cyttsp_app_idh() cyttsp_fw_app_idh |
| 627 | #define cyttsp_app_idl() cyttsp_fw_app_idl |
| 628 | #define cyttsp_app_verh() cyttsp_fw_app_verh |
| 629 | #define cyttsp_app_verl() cyttsp_fw_app_verl |
| 630 | #define cyttsp_cid_0() cyttsp_fw_cid_0 |
| 631 | #define cyttsp_cid_1() cyttsp_fw_cid_1 |
| 632 | #define cyttsp_cid_2() cyttsp_fw_cid_2 |
| 633 | #ifdef CY_USE_TEST_DATA |
| 634 | static struct cyttsp_gen2_xydata_t tt_gen2_testray[] = { |
| 635 | {0x00}, {0x00}, {0x04}, |
| 636 | {0x4000}, {0x8000}, {0x80}, |
| 637 | {0x03}, |
| 638 | {0x2000}, {0x1000}, {0x00}, |
| 639 | {0x00}, |
| 640 | {0x00}, |
| 641 | {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 642 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, |
| 643 | {0x00}, |
| 644 | {0x00} |
| 645 | }; |
| 646 | |
| 647 | static struct cyttsp_gen3_xydata_t tt_gen3_testray[] = { |
| 648 | {0x00}, {0x00}, {0x04}, |
| 649 | {0x4000}, {0x8000}, {0x80}, |
| 650 | {0x12}, |
| 651 | {0x2000}, {0x1000}, {0xA0}, |
| 652 | {0x00}, {0x00}, |
| 653 | {0x8000}, {0x4000}, {0xB0}, |
| 654 | {0x34}, |
| 655 | {0x4000}, {0x1000}, {0xC0}, |
| 656 | {0x00, 0x00, 0x00}, |
| 657 | {0x00}, |
| 658 | {0x00} |
| 659 | }; |
| 660 | #endif /* CY_USE_TEST_DATA */ |
| 661 | |
| 662 | #else |
| 663 | extern u8 g_appload_ray[]; |
| 664 | #endif |
| 665 | |
| 666 | #endif /* __CYTTSP_H__ */ |