Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From f03d4e60dc72e8ad3971becb811c4097d0fbb651 Mon Sep 17 00:00:00 2001
- From: stlifey <stlifey@gmail.com>
- Date: Mon, 16 Jan 2012 12:15:36 +0800
- Subject: [PATCH] implement qtouch drivers rate limiting
- ---
- drivers/input/touchscreen/Kconfig | 9 +++++++++
- drivers/input/touchscreen/qtouch_obp_ts.c | 16 ++++++++++++++++
- 2 files changed, 25 insertions(+), 0 deletions(-)
- diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
- index 603f8bc..bf1d87a 100755
- --- a/drivers/input/touchscreen/Kconfig
- +++ b/drivers/input/touchscreen/Kconfig
- @@ -18,6 +18,15 @@ config TOUCHSCREEN_KEY08
- help
- This enables support for Quantum over I2C based touchscreens.
- +config QTOUCH_RATELIMIT
- + bool "Limit events sent by the touchscreen driver"
- + depends on TOUCHSCREEN_QUANTUM_OBP
- + default y
- + help
- + This reduces the events produced by the touchscreen by half,
- + and takes care of always sending "finger up" and "first
- + touch" events.
- +
- config TOUCHSCREEN_ADS7846
- tristate "ADS7846/TSC2046 and ADS7843 based touchscreens"
- depends on SPI_MASTER
- diff --git a/drivers/input/touchscreen/qtouch_obp_ts.c b/drivers/input/touchscreen/qtouch_obp_ts.c
- index 40db02e..3231eb1 100755
- --- a/drivers/input/touchscreen/qtouch_obp_ts.c
- +++ b/drivers/input/touchscreen/qtouch_obp_ts.c
- @@ -108,6 +108,10 @@ static void qtouch_ts_early_suspend(struct early_suspend *handler);
- static void qtouch_ts_late_resume(struct early_suspend *handler);
- #endif
- +#ifdef CONFIG_QTOUCH_RATELIMIT
- +bool qtouch_send_next = false;
- +#endif
- +
- static struct workqueue_struct *qtouch_ts_wq;
- static uint32_t qtouch_tsdebug;
- @@ -765,6 +769,14 @@ static int do_touch_multi_msg(struct qtouch_ts_data *ts, struct qtm_object *obj,
- ts->finger_data[finger].down = down;
- }
- +
- + #ifdef CONFIG_QTOUCH_RATELIMIT
- + qtouch_send_next = !down || !qtouch_send_next;
- + if (!qtouch_send_next) {
- + return 0;
- + }
- + #endif
- +
- for (i = 0; i < ts->pdata->multi_touch_cfg.num_touch; i++) {
- if (ts->finger_data[i].down == 0)
- continue;
- @@ -783,6 +795,10 @@ static int do_touch_multi_msg(struct qtouch_ts_data *ts, struct qtm_object *obj,
- if (!down) {
- memset(&ts->finger_data[finger], 0,
- sizeof(struct coordinate_map));
- + #ifdef CONFIG_QTOUCH_RATELIMIT
- + /* Send first down event */
- + qtouch_send_next = false;
- + #endif
- }
- return 0;
- --
- 1.7.8.3
Add Comment
Please, Sign In to add comment