summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2019-08-29 16:55:26 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2019-09-05 17:56:32 -0700
commit4370b231d1001e0b560f82fd93616c7e54bd5fda (patch)
treeed0309fff54af1545630a32dfff981b36c5758d7 /drivers/input
parent4b6253fa736494346bab381114611e358afae545 (diff)
Input: reset device timestamp on sync
We need to reset input device's timestamp on input_sync(), otherwise drivers not using input_set_timestamp() will end up with a stale timestamp after their clients consume first input event. Fixes: 3b51c44bd693 ("Input: allow drivers specify timestamp for input events") Reported-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/input.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c
index c08aa3596144..55086279d044 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -397,6 +397,13 @@ static void input_handle_event(struct input_dev *dev,
if (dev->num_vals >= 2)
input_pass_values(dev, dev->vals, dev->num_vals);
dev->num_vals = 0;
+ /*
+ * Reset the timestamp on flush so we won't end up
+ * with a stale one. Note we only need to reset the
+ * monolithic one as we use its presence when deciding
+ * whether to generate a synthetic timestamp.
+ */
+ dev->timestamp[INPUT_CLK_MONO] = ktime_set(0, 0);
} else if (dev->num_vals >= dev->max_vals - 2) {
dev->vals[dev->num_vals++] = input_value_sync;
input_pass_values(dev, dev->vals, dev->num_vals);