diff --git a/drivers/input/touchscreen/ucb1400_ts.c b/drivers/input/touchscreen/ucb1400_ts.c index 1485c46df0e0aecf089f57e54d896d47404abbed..28be8139475418b5030436f4e32d4c131de924a2 100644 --- a/drivers/input/touchscreen/ucb1400_ts.c +++ b/drivers/input/touchscreen/ucb1400_ts.c @@ -25,14 +25,15 @@ #include <linux/ucb1400.h> #include <linux/seco_restouch_filter.h> -#define UCB1400_TS_POLL_PERIOD 10 /* ms */ +#define UCB1400_TS_SHORT_POLL_PERIOD 1 /* ms */ +#define UCB1400_TS_POLL_PERIOD 10 /* ms */ #define DEFAULT_PRESSURE 0xc0 static int enable_pressure = 0; static bool adcsync; static int ts_delay = 55; /* us */ -static int ts_delay_pressure; /* us */ +static int ts_delay_pressure; /* us */ /* Switch to interrupt mode. */ static void ucb1400_ts_mode_int(struct ucb1400_ts *ucb) @@ -205,11 +206,13 @@ static void ucb1400_clear_pending_irq(struct ucb1400_ts *ucb) static void ucb1400_poll_touch(struct ucb1400_ts *ucb, struct touch_data *data) { - bool penup, discard, retry, is_pendown = false, should_sleep = false; + bool penup, discard, retry, is_pendown = false, is_penup = false, report_pendown = false; int ret; int hys_down = SECO_INF_DOWN_HYSTERESIS; + unsigned next_sleep = 0; + /* Start with a small delay before checking pendown state */ msleep(UCB1400_TS_POLL_PERIOD); @@ -221,10 +224,10 @@ static void ucb1400_poll_touch(struct ucb1400_ts *ucb, struct touch_data *data) ucb1400_ts_mode_int(ucb); - if (should_sleep) { - should_sleep = false; + if (next_sleep > 0) { wait_event_timeout(ucb->ts_wait, ucb->stopped, - msecs_to_jiffies(UCB1400_TS_POLL_PERIOD)); + msecs_to_jiffies(next_sleep)); + next_sleep = 0; } penup = ucb1400_ts_pen_up(ucb); @@ -266,7 +269,7 @@ static void ucb1400_poll_touch(struct ucb1400_ts *ucb, struct touch_data *data) continue; /* Skip further processing during debounce period */ - should_sleep = true; + next_sleep = UCB1400_TS_POLL_PERIOD; continue; } @@ -280,13 +283,13 @@ static void ucb1400_poll_touch(struct ucb1400_ts *ucb, struct touch_data *data) if (hys_down) { hys_down--; - should_sleep = true; + next_sleep = UCB1400_TS_SHORT_POLL_PERIOD; continue; } ucb1400_ts_report_event(ucb->ts_idev, data); - should_sleep = true; + next_sleep = UCB1400_TS_POLL_PERIOD; } /*