Guest User

Untitled

a guest
May 24th, 2018
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.44 KB | None | 0 0
  1. From f03d4e60dc72e8ad3971becb811c4097d0fbb651 Mon Sep 17 00:00:00 2001
  2. From: stlifey <stlifey@gmail.com>
  3. Date: Mon, 16 Jan 2012 12:15:36 +0800
  4. Subject: [PATCH] implement qtouch drivers rate limiting
  5.  
  6. ---
  7. drivers/input/touchscreen/Kconfig | 9 +++++++++
  8. drivers/input/touchscreen/qtouch_obp_ts.c | 16 ++++++++++++++++
  9. 2 files changed, 25 insertions(+), 0 deletions(-)
  10.  
  11. diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
  12. index 603f8bc..bf1d87a 100755
  13. --- a/drivers/input/touchscreen/Kconfig
  14. +++ b/drivers/input/touchscreen/Kconfig
  15. @@ -18,6 +18,15 @@ config TOUCHSCREEN_KEY08
  16. help
  17. This enables support for Quantum over I2C based touchscreens.
  18.  
  19. +config QTOUCH_RATELIMIT
  20. + bool "Limit events sent by the touchscreen driver"
  21. + depends on TOUCHSCREEN_QUANTUM_OBP
  22. + default y
  23. + help
  24. + This reduces the events produced by the touchscreen by half,
  25. + and takes care of always sending "finger up" and "first
  26. + touch" events.
  27. +
  28. config TOUCHSCREEN_ADS7846
  29. tristate "ADS7846/TSC2046 and ADS7843 based touchscreens"
  30. depends on SPI_MASTER
  31. diff --git a/drivers/input/touchscreen/qtouch_obp_ts.c b/drivers/input/touchscreen/qtouch_obp_ts.c
  32. index 40db02e..3231eb1 100755
  33. --- a/drivers/input/touchscreen/qtouch_obp_ts.c
  34. +++ b/drivers/input/touchscreen/qtouch_obp_ts.c
  35. @@ -108,6 +108,10 @@ static void qtouch_ts_early_suspend(struct early_suspend *handler);
  36. static void qtouch_ts_late_resume(struct early_suspend *handler);
  37. #endif
  38.  
  39. +#ifdef CONFIG_QTOUCH_RATELIMIT
  40. +bool qtouch_send_next = false;
  41. +#endif
  42. +
  43. static struct workqueue_struct *qtouch_ts_wq;
  44.  
  45. static uint32_t qtouch_tsdebug;
  46. @@ -765,6 +769,14 @@ static int do_touch_multi_msg(struct qtouch_ts_data *ts, struct qtm_object *obj,
  47. ts->finger_data[finger].down = down;
  48. }
  49.  
  50. +
  51. + #ifdef CONFIG_QTOUCH_RATELIMIT
  52. + qtouch_send_next = !down || !qtouch_send_next;
  53. + if (!qtouch_send_next) {
  54. + return 0;
  55. + }
  56. + #endif
  57. +
  58. for (i = 0; i < ts->pdata->multi_touch_cfg.num_touch; i++) {
  59. if (ts->finger_data[i].down == 0)
  60. continue;
  61. @@ -783,6 +795,10 @@ static int do_touch_multi_msg(struct qtouch_ts_data *ts, struct qtm_object *obj,
  62. if (!down) {
  63. memset(&ts->finger_data[finger], 0,
  64. sizeof(struct coordinate_map));
  65. + #ifdef CONFIG_QTOUCH_RATELIMIT
  66. + /* Send first down event */
  67. + qtouch_send_next = false;
  68. + #endif
  69. }
  70.  
  71. return 0;
  72. --
  73. 1.7.8.3
Add Comment
Please, Sign In to add comment