Advertisement
t0mm13b

drivers/input/touchscreen/synapics_i2c_rmi_patch.c

Mar 15th, 2011
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.69 KB | None | 0 0
  1. --- kernel_zte_blade/drivers/input/touchscreen/synaptics_i2c_rmi.c 2011-03-09 13:44:23.511883155 +0000
  2. +++ sven.killig.de/drivers/input/touchscreen/synaptics_i2c_rmi.c 2010-12-13 12:51:44.000000000 +0000
  3. @@ -12,6 +12,25 @@
  4. * GNU General Public License for more details.
  5. *
  6. */
  7. +/* ========================================================================================
  8. +when who what, where, why comment tag
  9. +-------- ---- ------------------------------------- --------------------------
  10. +2010-07-29 wly disable polling mode,only use irq ZTE_WLY_CRDB00533288
  11. +2010-06-22 wly config 8 bit adress ZTE_WLY_CRDB00512790
  12. +2010-06-10 wly touchscreen firmware information ZTE_WLY_CRDB00509514
  13. +2010-05-24 wly change pressure value ZTE_PRESS_WLY_0524
  14. +2010-05-20 zt modified the y axis for P727A1 ZTE_TS_ZT_20100520_001
  15. +2010-05-13 zt modified the ts configuration for R750 ZTE_TS_ZT_20100513_002
  16. +2010-05-18 wly config set bit ZTE_SET_BIT_WLY_0518
  17. +2010-3-18 wly add gesture and resume timer ZTE_WLY_RESUME_001
  18. +2010-2-27 wly add for limo ZTE_WLY_LOCK_001
  19. +2010-02-04 chj protect two timer booming at the same time ZTE_TOUCH_CHJ_010
  20. +2010-02-03 chj moving polling process into the interrpt ZTE_TOUCH_CHJ_009
  21. +2010-01-19 wly add proc interface ZTE_TOUCH_WLY_008
  22. +2010-01-19 wly down cpu use ZTE_TOUCH_WLY_007
  23. +2010-01-06 wly add synaptics gesture ZTE_TOUCH_WLY_006
  24. +2009-12-19 wly change synaptics driver ZTE_TOUCH_WLY_005
  25. +========================================================================================*/
  26. #include <linux/module.h>
  27. #include <linux/delay.h>
  28. #include <linux/earlysuspend.h>
  29. @@ -23,40 +42,32 @@
  30. #include <linux/proc_fs.h>
  31. #include <linux/platform_device.h>
  32. #include <linux/synaptics_i2c_rmi.h>
  33. +#if 1 //wly
  34. #include <mach/gpio.h>
  35. +#endif
  36.  
  37. -#if defined(CONFIG_MACH_BLADE)
  38. +//ZTE_TS_ZT_20100513_002 begin
  39. +#if defined(CONFIG_MACH_BLADE)//P729B touchscreen enable
  40. #define GPIO_TOUCH_EN_OUT 31
  41. -#elif defined(CONFIG_MACH_R750)
  42. +#elif defined(CONFIG_MACH_R750)//R750 touchscreen enable
  43. #define GPIO_TOUCH_EN_OUT 33
  44. -#else
  45. +#else//other projects
  46. #define GPIO_TOUCH_EN_OUT 31
  47. #endif
  48. +//ZTE_TS_ZT_20100513_002 end
  49.  
  50. -#if defined(CONFIG_MACH_R750)
  51. -#define LCD_MAX_X 320
  52. -#define LCD_MAX_Y 480
  53. -#elif defined(CONFIG_MACH_JOE)
  54. -#define LCD_MAX_X 240
  55. -#define LCD_MAX_Y 400
  56. -#elif defined(CONFIG_MACH_BLADE)
  57. -#define TOUCHSCREEN_DUPLICATED_FILTER
  58. -#define LCD_MAX_X 480
  59. -#define LCD_MAX_Y 800
  60. -#endif
  61. -
  62. -
  63. -#if defined(CONFIG_MACH_R750)
  64. +#if defined(CONFIG_MACH_R750)//ZTE_TS_ZT_20100513_002
  65. #define TS_KEY_REPORT
  66. #endif
  67.  
  68. -#define ABS_SINGLE_TAP 0x21 /* Major axis of touching ellipse */
  69. -#define ABS_TAP_HOLD 0x22 /* Minor axis (omit if circular) */
  70. -#define ABS_DOUBLE_TAP 0x23 /* Major axis of approaching ellipse */
  71. -#define ABS_EARLY_TAP 0x24 /* Minor axis (omit if circular) */
  72. -#define ABS_FLICK 0x25 /* Ellipse orientation */
  73. -#define ABS_PRESS 0x26 /* Major axis of touching ellipse */
  74. -#define ABS_PINCH 0x27 /* Minor axis (omit if circular) */
  75. +/*ZTE_TOUCH_WLY_006,@2010-01-06,begin*/
  76. +#define ABS_SINGLE_TAP 0x21
  77. +#define ABS_TAP_HOLD 0x22
  78. +#define ABS_DOUBLE_TAP 0x23
  79. +#define ABS_EARLY_TAP 0x24
  80. +#define ABS_FLICK 0x25
  81. +#define ABS_PRESS 0x26
  82. +#define ABS_PINCH 0x27
  83. #define sigle_tap (1 << 0)
  84. #define tap_hold (1 << 1)
  85. #define double_tap (1 << 2)
  86. @@ -64,14 +75,20 @@
  87. #define flick (1 << 4)
  88. #define press (1 << 5)
  89. #define pinch (1 << 6)
  90. -unsigned long polling_time = 12500000;
  91. +/*ZTE_TOUCH_WLY_006,@2010-01-06,end*/
  92. +/*ZTE_TOUCH_WLY_007,@2010-01-19,begin*/
  93. +unsigned long polling_time = 30000000;
  94. +/*ZTE_TOUCH_WLY_007,@2010-01-19,end*/
  95.  
  96. static struct workqueue_struct *synaptics_wq;
  97. static struct i2c_driver synaptics_ts_driver;
  98. +//#define swap(x, y) do { typeof(x) z = x; x = y; y = z; } while (0)
  99. +//ZTE_TOUCH_CHJ_009,moving polling process into the interrpt,@2010-02-03,begin
  100. #define POLL_IN_INT
  101. #if defined (POLL_IN_INT)
  102. -#undef POLL_IN_INT
  103. +#undef POLL_IN_INT //ZTE_WLY_CRDB00533288
  104. #endif
  105. +//ZTE_TOUCH_CHJ_009,moving polling process into the interrpt,@2010-02-03,end
  106.  
  107. struct synaptics_ts_data
  108. {
  109. @@ -83,7 +100,6 @@
  110. struct work_struct work;
  111. uint16_t max[2];
  112. struct early_suspend early_suspend;
  113. - uint32_t dup_threshold;
  114. };
  115.  
  116. #ifdef CONFIG_HAS_EARLYSUSPEND
  117. @@ -91,7 +107,7 @@
  118. static void synaptics_ts_late_resume(struct early_suspend *h);
  119. #endif
  120.  
  121. -#ifdef TS_KEY_REPORT
  122. +#ifdef TS_KEY_REPORT//ZTE_TS_ZT_20100513_002
  123. const char ts_keys_size_synaptics[] = "0x01:102:51:503:102:1007:0x01:139:158:503:102:1007:0x01:158:266:503:102:1007";
  124. struct attribute ts_key_report_attr_synaptics = {
  125. .name = "virtualkeys.synaptics-rmi-touchscreen",
  126. @@ -141,7 +157,7 @@
  127. printk(KERN_ERR "ts_key_report_init: Unable to init and add the kobject\n");
  128. }
  129. #endif
  130. -
  131. +#if 1 //ZTE_WLY_CRDB00512790,BEGIN
  132. static int synaptics_i2c_read(struct i2c_client *client, int reg, u8 * buf, int count)
  133. {
  134. int rc;
  135. @@ -181,7 +197,65 @@
  136. }
  137. return ret;
  138. }
  139. +#else
  140. +
  141. +static int synaptics_i2c_read(struct i2c_client *client, int reg, u8 * buf, int count)
  142. +{
  143. + int rc;
  144. + int ret = 0;
  145. +
  146. + buf[0] = 0xff;
  147. + buf[1] = reg >> 8;
  148. + rc = i2c_master_send(client, buf, 2);
  149. + if (rc != 2)
  150. +{
  151. + dev_err(&client->dev, "synaptics_i2c_read FAILED: failed of page select %d\n", rc);
  152. + ret = -1;
  153. + goto tp_i2c_rd_exit;
  154. + }
  155. + buf[0] = 0xff & reg;
  156. + rc = i2c_master_send(client, buf, 1);
  157. + if (rc != 1)
  158. + {
  159. + dev_err(&client->dev, "synaptics_i2c_read FAILED: read of register %d\n", reg);
  160. + ret = -1;
  161. + goto tp_i2c_rd_exit;
  162. + }
  163. + rc = i2c_master_recv(client, buf, count);
  164. + if (rc != count)
  165. + {
  166. + dev_err(&client->dev, "synaptics_i2c_read FAILED: read %d bytes from reg %d\n", count, reg);
  167. + ret = -1;
  168. + }
  169.  
  170. + tp_i2c_rd_exit:
  171. + return ret;
  172. + }
  173. +static int synaptics_i2c_write(struct i2c_client *client, int reg, u8 data)
  174. +{
  175. + u8 buf[2];
  176. + int rc;
  177. + int ret = 0;
  178. +
  179. + buf[0] = 0xff;
  180. + buf[1] = reg >> 8;
  181. + rc = i2c_master_send(client, buf, 2);
  182. + if (rc != 2)
  183. + {
  184. + dev_err(&client->dev, "synaptics_i2c_write FAILED: writing to reg %d\n", reg);
  185. + ret = -1;
  186. + }
  187. + buf[0] = 0xff & reg;
  188. + buf[1] = data;
  189. + rc = i2c_master_send(client, buf, 2);
  190. + if (rc != 2)
  191. + {
  192. + dev_err(&client->dev, "synaptics_i2c_write FAILED: writing to reg %d\n", reg);
  193. + ret = -1;
  194. + }
  195. + return ret;
  196. +}
  197. +#endif ////ZTE_WLY_CRDB00512790,END
  198.  
  199. static int
  200. proc_read_val(char *page, char **start, off_t off, int count, int *eof,
  201. @@ -211,6 +285,7 @@
  202. *start = page + off;
  203. return ((count < len - off) ? count : len - off);
  204. }
  205. +//ZTE_WLY_CRDB00509514,END
  206.  
  207. static int proc_write_val(struct file *file, const char *buffer,
  208. unsigned long count, void *data)
  209. @@ -223,55 +298,17 @@
  210. }
  211. return -EINVAL;
  212. }
  213. -
  214. -
  215. -#ifdef TOUCHSCREEN_DUPLICATED_FILTER
  216. -static int duplicated_filter(struct synaptics_ts_data *ts, int x,int y,int x2,int y2,
  217. - const int finger2, const int z)
  218. -{
  219. - int drift_x[2];
  220. - int drift_y[2];
  221. - static int ref_x[2], ref_y[2];
  222. - uint8_t discard[2] = {0, 0};
  223. -
  224. - drift_x[0] = abs(ref_x[0] - x);
  225. - drift_y[0] = abs(ref_y[0] - y);
  226. - if (finger2) {
  227. - drift_x[1] = abs(ref_x[1] - x2);
  228. - drift_y[1] = abs(ref_y[1] - y2);
  229. - }
  230. - if (drift_x[0] < ts->dup_threshold && drift_y[0] < ts->dup_threshold && z != 0) {
  231. - discard[0] = 1;
  232. - }
  233. - if (!finger2 || (drift_x[1] < ts->dup_threshold && drift_y[1] < ts->dup_threshold)) {
  234. - discard[1] = 1;
  235. - }
  236. - if (discard[0] && discard[1]) {
  237. - return 1;
  238. - }
  239. - ref_x[0] = x;
  240. - ref_y[0] = y;
  241. - if (finger2) {
  242. - ref_x[1] = x2;
  243. - ref_y[1] = y2;
  244. - }
  245. - if (z == 0) {
  246. - ref_x[0] = ref_y[0] = 0;
  247. - ref_x[1] = ref_y[1] = 0;
  248. - }
  249. -
  250. - return 0;
  251. -}
  252. -#endif
  253. -
  254. +/*ZTE_TOUCH_WLY_008,@2010-01-19,end*/
  255. static void synaptics_ts_work_func(struct work_struct *work)
  256. {
  257. + /*ZTE_TOUCH_WLY_007,@2010-01-19,begin*/
  258. int ret, x, y, z, finger, w, x2, y2,w2,z2,finger2,pressure,pressure2;
  259. + /*ZTE_TOUCH_WLY_006,@2010-01-06,begin*/
  260. __s8 gesture, flick_y, flick_x, direction = 0;
  261. uint8_t buf[16];
  262. struct synaptics_ts_data *ts = container_of(work, struct synaptics_ts_data, work);
  263. - finger=0;
  264. - ret = synaptics_i2c_read(ts->client, 0x14, buf, 16);
  265. + finger=0;//initializing the status
  266. + ret = synaptics_i2c_read(ts->client, 0x14, buf, 16); //ZTE_WLY_CRDB00512790
  267. if (ret < 0){
  268. printk(KERN_ERR "synaptics_ts_work_func: synaptics_i2c_write failed, go to poweroff.\n");
  269. gpio_direction_output(GPIO_TOUCH_EN_OUT, 0);
  270. @@ -281,6 +318,12 @@
  271. }
  272. else
  273. {
  274. + /*printk(KERN_WARNING "synaptics_ts_work_func:"
  275. + "%x %x %x %x %x %x %x %x %x"
  276. + " %x %x %x %x %x %x, ret %d\n",
  277. + buf[0], buf[1], buf[2], buf[3],
  278. + buf[4], buf[5], buf[6], buf[7],
  279. + buf[8], buf[9], buf[10], buf[11], buf[12], buf[13], buf[14], ret);*/
  280. x = (uint16_t) buf[2] << 4| (buf[4] & 0x0f) ;
  281. y = (uint16_t) buf[3] << 4| ((buf[4] & 0xf0) >> 4);
  282. pressure = buf[6];
  283. @@ -291,7 +334,7 @@
  284. x2 = (uint16_t) buf[7] << 4| (buf[9] & 0x0f) ;
  285. y2 = (uint16_t) buf[8] << 4| ((buf[9] & 0xf0) >> 4);
  286.  
  287. - #ifdef CONFIG_MACH_JOE
  288. + #ifdef CONFIG_MACH_JOE//ZTE_TS_ZT_20100520_001
  289. y = 2787 - y;
  290. y2 = 2787 - y2;
  291. #endif
  292. @@ -299,49 +342,58 @@
  293. pressure2 = buf[11];
  294. w2 = buf[10] >> 4;
  295. z2 = buf[10] & 0x0f;
  296. + /*ZTE_TOUCH_WLY_006,@2010-01-06,begin*/
  297. finger2 = buf[1] & 0xc;
  298. + //printk("wly: finger=%d, finger2=%d, buf[1]=%d\n", finger, finger2, buf[1]);
  299. gesture = buf[12];
  300. -
  301. flick_x = buf[14];
  302. flick_y = buf[15];
  303. + //printk("wly: gesture=%d,flick_x=%d,flick_y=%d\n",gesture,flick_x,flick_y);
  304. if((16==gesture)||(flick_x)||(flick_y))
  305. {
  306. if ((flick_x >0 )&& (abs(flick_x) > abs(flick_y)))
  307. direction = 1;
  308. - else if((flick_x <0 )&& (abs(flick_x) > abs(flick_y)))
  309. + else if((flick_x <0 )&& (abs(flick_x) > abs(flick_y)))
  310. direction = 2;
  311. - else if ((flick_y >0 )&& (abs(flick_x) < abs(flick_y)))
  312. + else if ((flick_y >0 )&& (abs(flick_x) < abs(flick_y)))
  313. direction = 3;
  314. - else if ((flick_y <0 )&& (abs(flick_x) < abs(flick_y)))
  315. + else if ((flick_y <0 )&& (abs(flick_x) < abs(flick_y)))
  316. direction = 4;
  317.  
  318. }
  319. -
  320. -#ifdef TOUCHSCREEN_DUPLICATED_FILTER
  321. - ret = duplicated_filter(ts, x,y,x2,y2, finger2, pressure);
  322. - if (ret == 0)
  323. - {
  324. -#endif
  325. - input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, pressure);
  326. - input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, 10);
  327. + if(finger)
  328. + {
  329. +// input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, 255);//ZTE_PRESS_WLY_0524
  330. + pressure *= 2;
  331. + if (pressure > 255)
  332. + pressure = 255;
  333. + input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, pressure);//ZTE_PRESS_WLY_0524
  334. input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x);
  335. input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y);
  336. + input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, 10);//ZTE_PRESS_WLY_0524
  337. input_mt_sync(ts->input_dev);
  338.  
  339. + }
  340. if(finger2)
  341. {
  342. - input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, pressure2);
  343. - input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, 10);
  344. +// input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, 255);//ZTE_PRESS_WLY_0524
  345. + pressure2 *= 2;
  346. + if (pressure2 > 255)
  347. + pressure2 = 255;
  348. + input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, pressure2);//ZTE_PRESS_WLY_0524
  349. input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x2);
  350. input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y2);
  351. + input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, 10);//ZTE_PRESS_WLY_0524
  352. input_mt_sync(ts->input_dev);
  353. }
  354. -
  355. - input_sync(ts->input_dev);
  356. + input_sync(ts->input_dev);
  357. + input_report_abs(ts->input_dev, ABS_PINCH, flick_x);
  358. + input_report_key(ts->input_dev, BTN_TOUCH, !!finger);
  359. + input_sync(ts->input_dev);
  360. }
  361. -#ifdef TOUCHSCREEN_DUPLICATED_FILTER
  362. - }
  363. -#endif
  364. + /*ZTE_WLY_LOCK_001,2009-12-07 END*/
  365. +
  366. + //ZTE_TOUCH_CHJ_010,protect two timer booming in the same time,@2010-02-04,begin
  367. #ifdef POLL_IN_INT
  368. if(finger)
  369. {
  370. @@ -356,29 +408,40 @@
  371. if (ts->use_irq)
  372. enable_irq(ts->client->irq);
  373. #endif
  374. + //ZTE_TOUCH_CHJ_010,protect two timer booming in the same time,@2010-02-04,end
  375. }
  376.  
  377. static enum hrtimer_restart synaptics_ts_timer_func(struct hrtimer *timer)
  378. {
  379. struct synaptics_ts_data *ts = container_of(timer, struct synaptics_ts_data, timer);
  380.  
  381. + /* printk("synaptics_ts_timer_func\n"); */
  382. +
  383. queue_work(synaptics_wq, &ts->work);
  384. + //ZTE_TOUCH_CHJ_010,protect two timer booming in the same time,@2010-02-04,begin
  385. #ifndef POLL_IN_INT
  386. + /*ZTE_TOUCH_WLY_007,@2010-01-19,begin*/
  387. hrtimer_start(&ts->timer, ktime_set(0, polling_time), HRTIMER_MODE_REL);
  388. + /*ZTE_TOUCH_WLY_007,@2010-01-19,end*/
  389. #endif
  390. + //ZTE_TOUCH_CHJ_010,protect two timer booming in the same time,@2010-02-04,end
  391. return HRTIMER_NORESTART;
  392. }
  393.  
  394. +
  395. static irqreturn_t synaptics_ts_irq_handler(int irq, void *dev_id)
  396. {
  397. struct synaptics_ts_data *ts = dev_id;
  398.  
  399. + /* printk("synaptics_ts_irq_handler\n"); */
  400. disable_irq_nosync(ts->client->irq);
  401. + //ZTE_TOUCH_CHJ_009,moving polling process into the interrpt,@2010-02-03,begin
  402. #ifdef POLL_IN_INT
  403. hrtimer_start(&ts->timer, ktime_set(0, 0), HRTIMER_MODE_REL);
  404. #else
  405. queue_work(synaptics_wq, &ts->work);
  406. #endif
  407. + //ZTE_TOUCH_CHJ_009,moving polling process into the interrpt,@2010-02-03,end
  408. return IRQ_HANDLED;
  409. }
  410.  
  411. @@ -387,15 +450,12 @@
  412. {
  413. struct synaptics_ts_data *ts;
  414. uint8_t buf1[9];
  415. + //struct i2c_msg msg[2];
  416. int ret = 0;
  417. uint16_t max_x, max_y;
  418. - struct proc_dir_entry *dir, *refresh;
  419. - ret = gpio_request(GPIO_TOUCH_EN_OUT, "touch voltage");
  420. - if (ret)
  421. - {
  422. - printk("gpio 31 request is error!\n");
  423. - goto err_check_functionality_failed;
  424. - }
  425. + /*ZTE_TOUCH_WLY_008,@2010-01-19,begin*/
  426. + struct proc_dir_entry *dir, *refresh;//ZTE_WLY_CRDB00509514
  427. + /*ZTE_TOUCH_WLY_008,@2010-01-19,end*/
  428. gpio_direction_output(GPIO_TOUCH_EN_OUT, 1);
  429. msleep(250);
  430. if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
  431. @@ -413,39 +473,51 @@
  432.  
  433. INIT_WORK(&ts->work, synaptics_ts_work_func);
  434. ts->client = client;
  435. -
  436. i2c_set_clientdata(client, ts);
  437. client->driver = &synaptics_ts_driver;
  438. + //pdata = client->dev.platform_data;
  439. + //printk("wly:%s, ts->client->addr=%x\n", __FUNCTION__, ts->client->addr);
  440. {
  441. int retry = 3;
  442. while (retry-- > 0)
  443. {
  444. - ret = synaptics_i2c_read(ts->client, 0x78, buf1, 9);
  445. +
  446. + ret = synaptics_i2c_read(ts->client, 0x78, buf1, 9);//ZTE_WLY_CRDB00512790,BEGIN
  447. + printk("wly: synaptics_i2c_read, %c, %d,%d,%d,%d,%d,%d,%d,%d\n",
  448. + buf1[0],buf1[1],buf1[2],buf1[3],buf1[4],buf1[5],buf1[6],buf1[7],buf1[8]);
  449. + //ZTE_TOUCH_WLY_009,2010-05-10, BEGIN
  450. if (ret >= 0)
  451. break;
  452. msleep(10);
  453. - }
  454. +//ZTE_TOUCH_WLY_009,2010-05-10, END
  455. +
  456. + }
  457. + /*ZTE_TOUCH_WLY_005,@2009-12-19,begin*/
  458. if (retry < 0)
  459. {
  460. ret = -1;
  461. goto err_detect_failed;
  462. }
  463. + /*ZTE_TOUCH_WLY_005,@2009-12-19,begin*/
  464. }
  465. - ret = synaptics_i2c_write(ts->client, 0x25, 0x00);
  466. +//ZTE_WLY_CRDB00512790,BEGIN
  467. + ret = synaptics_i2c_write(ts->client, 0x25, 0x00); /*wly set nomal operation*/
  468. ret = synaptics_i2c_read(ts->client, 0x2D, buf1, 2);
  469. +//ZTE_WLY_CRDB00512790,END
  470. if (ret < 0)
  471. {
  472. printk(KERN_ERR "synaptics_i2c_read failed\n");
  473. goto err_detect_failed;
  474. }
  475. ts->max[0] = max_x = buf1[0] | ((buf1[1] & 0x0f) << 8);
  476. - ret = synaptics_i2c_read(ts->client, 0x2F, buf1, 2);
  477. + ret = synaptics_i2c_read(ts->client, 0x2F, buf1, 2); //ZTE_WLY_CRDB00512790
  478. if (ret < 0)
  479. {
  480. printk(KERN_ERR "synaptics_i2c_read failed\n");
  481. goto err_detect_failed;
  482. }
  483. ts->max[1] = max_y = buf1[0] | ((buf1[1] & 0x0f) << 8);
  484. + printk("wly: synaptics_ts_probe,max_x=%d, max_y=%d\n", max_x, max_y);
  485. ts->input_dev = input_allocate_device();
  486. if (ts->input_dev == NULL) {
  487. ret = -ENOMEM;
  488. @@ -454,15 +526,11 @@
  489. }
  490. ts->input_dev->name = "synaptics-rmi-touchscreen";
  491. ts->input_dev->phys = "synaptics-rmi-touchscreen/input0";
  492. -
  493. - #ifdef TOUCHSCREEN_DUPLICATED_FILTER
  494. - ts->dup_threshold=max_y/LCD_MAX_Y;
  495. - #endif
  496. -
  497. set_bit(EV_SYN, ts->input_dev->evbit);
  498. set_bit(EV_KEY, ts->input_dev->evbit);
  499. set_bit(BTN_TOUCH, ts->input_dev->keybit);
  500. set_bit(EV_ABS, ts->input_dev->evbit);
  501. + //ZTE_SET_BIT_WLY_0518,BEGIN
  502. set_bit(ABS_SINGLE_TAP, ts->input_dev->absbit);
  503. set_bit(ABS_TAP_HOLD, ts->input_dev->absbit);
  504. set_bit(ABS_EARLY_TAP, ts->input_dev->absbit);
  505. @@ -475,21 +543,21 @@
  506. set_bit(ABS_MT_POSITION_Y, ts->input_dev->absbit);
  507. set_bit(ABS_MT_WIDTH_MAJOR, ts->input_dev->absbit);
  508.  
  509. -#ifdef TS_KEY_REPORT
  510. +#ifdef TS_KEY_REPORT//ZTE_TS_ZT_20100513_002
  511. max_y = 2739;
  512. #endif
  513.  
  514. input_set_abs_params(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0);
  515. - input_set_abs_params(ts->input_dev, ABS_MT_POSITION_X, 0, max_x, 0, 0);
  516. - input_set_abs_params(ts->input_dev, ABS_MT_POSITION_Y, 0, max_y, 0, 0);
  517. + input_set_abs_params(ts->input_dev, ABS_MT_POSITION_X, 0, max_x, 0, 0);
  518. + input_set_abs_params(ts->input_dev, ABS_MT_POSITION_Y, 0, max_y, 0, 0);
  519. input_set_abs_params(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0, 255, 0, 0);
  520. - input_set_abs_params(ts->input_dev, ABS_SINGLE_TAP, 0, 5, 0, 0);
  521. - input_set_abs_params(ts->input_dev, ABS_TAP_HOLD, 0, 5, 0, 0);
  522. + input_set_abs_params(ts->input_dev, ABS_SINGLE_TAP, 0, 5, 0, 0);
  523. + input_set_abs_params(ts->input_dev, ABS_TAP_HOLD, 0, 5, 0, 0);
  524. input_set_abs_params(ts->input_dev, ABS_EARLY_TAP, 0, 5, 0, 0);
  525. - input_set_abs_params(ts->input_dev, ABS_FLICK, 0, 5, 0, 0);
  526. + input_set_abs_params(ts->input_dev, ABS_FLICK, 0, 5, 0, 0);
  527. input_set_abs_params(ts->input_dev, ABS_PRESS, 0, 5, 0, 0);
  528. input_set_abs_params(ts->input_dev, ABS_DOUBLE_TAP, 0, 5, 0, 0);
  529. - input_set_abs_params(ts->input_dev, ABS_PINCH, -255, 255, 0, 0);
  530. + input_set_abs_params(ts->input_dev, ABS_PINCH, -255, 255, 0, 0);
  531. ret = input_register_device(ts->input_dev);
  532. if (ret)
  533. {
  534. @@ -502,7 +570,7 @@
  535. ret = request_irq(client->irq, synaptics_ts_irq_handler, IRQF_TRIGGER_FALLING, "synaptics_touch", ts);
  536. if(ret == 0)
  537. {
  538. - ret = synaptics_i2c_write(ts->client, 0x26, 0x07);
  539. + ret = synaptics_i2c_write(ts->client, 0x26, 0x07); /* enable abs int ZTE_WLY_CRDB00512790*/
  540. if (ret)
  541. free_irq(client->irq, ts);
  542. }
  543. @@ -511,11 +579,13 @@
  544. else
  545. dev_err(&client->dev, "request_irq failed\n");
  546. #else
  547. + //ZTE_TOUCH_CHJ_009,moving polling process into the interrpt,@2010-02-03,end
  548. + /*ZTE_TOUCH_WLY_007,@2010-01-19,begin*/
  549. if (client->irq)
  550. {
  551. ret = request_irq(client->irq, synaptics_ts_irq_handler, IRQF_TRIGGER_FALLING, "synaptics_touch", ts);
  552. if (ret == 0) {
  553. - ret = synaptics_i2c_write(ts->client, 0x26, 0x07);
  554. + ret = synaptics_i2c_write(ts->client, 0x26, 0x07); /* enable abs int,ZTE_WLY_CRDB00512790 */
  555. if (ret)
  556. free_irq(client->irq, ts);
  557. }
  558. @@ -524,29 +594,36 @@
  559. else
  560. dev_err(&client->dev, "request_irq failed\n");
  561. }
  562. + /*ZTE_TOUCH_WLY_007,@2010-01-19,end*/
  563. if (!ts->use_irq)
  564. {
  565. hrtimer_init(&ts->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
  566. ts->timer.function = synaptics_ts_timer_func;
  567. hrtimer_start(&ts->timer, ktime_set(1, 0), HRTIMER_MODE_REL);
  568. }
  569. + //ZTE_TOUCH_CHJ_009,moving polling process into the interrpt,@2010-02-03,begin
  570. #endif
  571. + //ZTE_TOUCH_CHJ_009,moving polling process into the interrpt,@2010-02-03,end
  572. #ifdef CONFIG_HAS_EARLYSUSPEND
  573. ts->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1;
  574. ts->early_suspend.suspend = synaptics_ts_early_suspend;
  575. ts->early_suspend.resume = synaptics_ts_late_resume;
  576. register_early_suspend(&ts->early_suspend);
  577. #endif
  578. +/*ZTE_TOUCH_WLY_008,@2010-01-19,begin*/
  579. +//ZTE_WLY_CRDB00509514,BEGIN
  580. dir = proc_mkdir("touchscreen", NULL);
  581. refresh = create_proc_entry("ts_information", 0644, dir);
  582. +//ZTE_WLY_CRDB00509514,END
  583. if (refresh) {
  584. refresh->data = NULL;
  585. refresh->read_proc = proc_read_val;
  586. refresh->write_proc = proc_write_val;
  587. }
  588. +/*ZTE_TOUCH_WLY_008,@2010-01-19,end*/
  589. printk(KERN_INFO "synaptics_ts_probe: Start touchscreen %s in %s mode\n", ts->input_dev->name, ts->use_irq ? "interrupt" : "polling");
  590.  
  591. -#ifdef TS_KEY_REPORT
  592. +#ifdef TS_KEY_REPORT//ZTE_TS_ZT_20100513_002
  593. ts_key_report_synaptics_init();
  594. #endif
  595.  
  596. @@ -561,7 +638,6 @@
  597. kfree(ts);
  598. err_alloc_data_failed:
  599. err_check_functionality_failed:
  600. - gpio_free(GPIO_TOUCH_EN_OUT);
  601. return ret;
  602. }
  603.  
  604. @@ -588,16 +664,21 @@
  605. disable_irq(client->irq);
  606. else
  607. hrtimer_cancel(&ts->timer);
  608. + /*ZTE_WLY_RESUME_001,2010-3-18 START*/
  609. + //hrtimer_cancel(&ts->timer); //wly
  610. + //hrtimer_cancel(&ts->resume_timer);
  611. + /*ZTE_WLY_RESUME_001,2010-3-18 END*/
  612. ret = cancel_work_sync(&ts->work);
  613. - if (ret && ts->use_irq)
  614. + if (ret && ts->use_irq) /* if work was pending disable-count is now 2 */
  615. enable_irq(client->irq);
  616. - ret = synaptics_i2c_write(ts->client, 0x26, 0);
  617. + ret = synaptics_i2c_write(ts->client, 0x26, 0); /* disable interrupt,ZTE_WLY_CRDB00512790 */
  618. if (ret < 0)
  619. printk(KERN_ERR "synaptics_ts_suspend: synaptics_i2c_write failed\n");
  620.  
  621. - ret = synaptics_i2c_write(client, 0x25, 0x01);
  622. + ret = synaptics_i2c_write(client, 0x25, 0x01); /* deep sleep *//*wly value need change, ZTE_WLY_CRDB00512790*/
  623. if (ret < 0)
  624. printk(KERN_ERR "synaptics_ts_suspend: synaptics_i2c_write failed\n");
  625. + //gpio_direction_output(GPIO_TOUCH_EN_OUT, 0);
  626.  
  627. return 0;
  628. }
  629. @@ -607,7 +688,7 @@
  630. int ret;
  631. struct synaptics_ts_data *ts = i2c_get_clientdata(client);
  632. gpio_direction_output(GPIO_TOUCH_EN_OUT, 1);
  633. - ret = synaptics_i2c_write(ts->client, 0x25, 0x00);
  634. + ret = synaptics_i2c_write(ts->client, 0x25, 0x00); /*wly set nomal operation,ZTE_WLY_CRDB00512790*/
  635. if (ts->use_irq)
  636. enable_irq(client->irq);
  637.  
  638. @@ -615,8 +696,8 @@
  639. hrtimer_start(&ts->timer, ktime_set(1, 0), HRTIMER_MODE_REL);
  640. else
  641. {
  642. - synaptics_i2c_write(ts->client, 0x26, 0x07);
  643. - synaptics_i2c_write(ts->client, 0x31, 0x7F);
  644. + synaptics_i2c_write(ts->client, 0x26, 0x07); /* enable abs int,ZTE_WLY_CRDB00512790 */
  645. + synaptics_i2c_write(ts->client, 0x31, 0x7F); /*wly set 2D gesture enable,ZTE_WLY_CRDB00512790*/
  646. }
  647. return 0;
  648. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement