diff --git a/drivers/input/touchscreen/ucb1400_ts.c b/drivers/input/touchscreen/ucb1400_ts.c index 2743eb728e900311bf99b5b9db33ec21766fea29..1485c46df0e0aecf089f57e54d896d47404abbed 100644 --- a/drivers/input/touchscreen/ucb1400_ts.c +++ b/drivers/input/touchscreen/ucb1400_ts.c @@ -205,7 +205,7 @@ 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; + bool penup, discard, retry, is_pendown = false, should_sleep = false; int ret; int hys_down = SECO_INF_DOWN_HYSTERESIS; @@ -219,6 +219,14 @@ static void ucb1400_poll_touch(struct ucb1400_ts *ucb, struct touch_data *data) discard = false; retry = false; + ucb1400_ts_mode_int(ucb); + + if (should_sleep) { + should_sleep = false; + wait_event_timeout(ucb->ts_wait, ucb->stopped, + msecs_to_jiffies(UCB1400_TS_POLL_PERIOD)); + } + penup = ucb1400_ts_pen_up(ucb); if (!penup) { @@ -258,8 +266,7 @@ static void ucb1400_poll_touch(struct ucb1400_ts *ucb, struct touch_data *data) continue; /* Skip further processing during debounce period */ - wait_event_timeout(ucb->ts_wait, ucb->stopped, - msecs_to_jiffies(UCB1400_TS_POLL_PERIOD)); + should_sleep = true; continue; } @@ -273,15 +280,13 @@ static void ucb1400_poll_touch(struct ucb1400_ts *ucb, struct touch_data *data) if (hys_down) { hys_down--; - wait_event_timeout(ucb->ts_wait, ucb->stopped, - msecs_to_jiffies(UCB1400_TS_POLL_PERIOD)); + should_sleep = true; continue; } ucb1400_ts_report_event(ucb->ts_idev, data); - wait_event_timeout(ucb->ts_wait, ucb->stopped, - msecs_to_jiffies(UCB1400_TS_POLL_PERIOD)); + should_sleep = true; } /*