summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAtif Niyaz <atifniyaz@google.com>2019-07-24 22:26:31 +0300
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2019-07-25 11:12:20 +0300
commit3b51c44bd6936e86a7180abd9aebc4387a479253 (patch)
tree307baa973004837a30e57d0a3dccc54f89e06604 /include
parentc2433827c1a149b72f1413f0151155f6fa4b3214 (diff)
downloadlinux-3b51c44bd6936e86a7180abd9aebc4387a479253.tar.xz
Input: allow drivers specify timestamp for input events
Currently, evdev stamps events with timestamps acquired in evdev_events() However, this timestamping may not be accurate in terms of measuring when the actual event happened. Let's allow individual drivers specify timestamp in order to provide a more accurate sense of time for the event. It is expected that drivers will set the timestamp in their hard interrupt routine. Signed-off-by: Atif Niyaz <atifniyaz@google.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/input.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/input.h b/include/linux/input.h
index 510e78558c10..e95a439d8bd5 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -33,6 +33,13 @@ struct input_value {
__s32 value;
};
+enum input_clock_type {
+ INPUT_CLK_REAL = 0,
+ INPUT_CLK_MONO,
+ INPUT_CLK_BOOT,
+ INPUT_CLK_MAX
+};
+
/**
* struct input_dev - represents an input device
* @name: name of the device
@@ -114,6 +121,8 @@ struct input_value {
* @vals: array of values queued in the current frame
* @devres_managed: indicates that devices is managed with devres framework
* and needs not be explicitly unregistered or freed.
+ * @timestamp: storage for a timestamp set by input_set_timestamp called
+ * by a driver
*/
struct input_dev {
const char *name;
@@ -184,6 +193,8 @@ struct input_dev {
struct input_value *vals;
bool devres_managed;
+
+ ktime_t timestamp[INPUT_CLK_MAX];
};
#define to_input_dev(d) container_of(d, struct input_dev, dev)
@@ -382,6 +393,9 @@ void input_close_device(struct input_handle *);
int input_flush_device(struct input_handle *handle, struct file *file);
+void input_set_timestamp(struct input_dev *dev, ktime_t timestamp);
+ktime_t *input_get_timestamp(struct input_dev *dev);
+
void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value);
void input_inject_event(struct input_handle *handle, unsigned int type, unsigned int code, int value);