aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/platform_data
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2019-11-19 13:45:46 +0100
committerEnric Balletbo i Serra <enric.balletbo@collabora.com>2019-11-21 11:23:14 +0100
commit05a3c420eaa6857cb20afe7e3a3c39ed94a3b2c1 (patch)
tree759954afc73e37fecba299388f1d6be0909a529e /include/linux/platform_data
parentmfd / platform / iio: cros_ec: Register sensor through sensorhub (diff)
downloadlinux-dev-05a3c420eaa6857cb20afe7e3a3c39ed94a3b2c1.tar.xz
linux-dev-05a3c420eaa6857cb20afe7e3a3c39ed94a3b2c1.zip
platform/chrome: cros-ec: Record event timestamp in the hard irq
To improve sensor timestamp precision, given EC and AP are in different time domains, the AP needs to try to record the exact moment an event was signalled to the AP by the EC as soon as possible after it happens. First thing in the hard irq is the best place for this. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Acked-by: Jonathan Cameron <Jonathan.Cameron@kernel.org> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Diffstat (limited to 'include/linux/platform_data')
-rw-r--r--include/linux/platform_data/cros_ec_proto.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/platform_data/cros_ec_proto.h b/include/linux/platform_data/cros_ec_proto.h
index 691f9e953a96..02dc34f366d7 100644
--- a/include/linux/platform_data/cros_ec_proto.h
+++ b/include/linux/platform_data/cros_ec_proto.h
@@ -122,6 +122,8 @@ struct cros_ec_command {
* @event_data: Raw payload transferred with the MKBP event.
* @event_size: Size in bytes of the event data.
* @host_event_wake_mask: Mask of host events that cause wake from suspend.
+ * @last_event_time: exact time from the hard irq when we got notified of
+ * a new event.
* @ec: The platform_device used by the mfd driver to interface with the
* main EC.
* @pd: The platform_device used by the mfd driver to interface with the
@@ -162,6 +164,7 @@ struct cros_ec_device {
int event_size;
u32 host_event_wake_mask;
u32 last_resume_result;
+ ktime_t last_event_time;
/* The platform devices used by the mfd driver */
struct platform_device *ec;
@@ -210,4 +213,17 @@ int cros_ec_check_features(struct cros_ec_dev *ec, int feature);
int cros_ec_get_sensor_count(struct cros_ec_dev *ec);
+/**
+ * cros_ec_get_time_ns() - Return time in ns.
+ *
+ * This is the function used to record the time for last_event_time in struct
+ * cros_ec_device during the hard irq.
+ *
+ * Return: ktime_t format since boot.
+ */
+static inline ktime_t cros_ec_get_time_ns(void)
+{
+ return ktime_get_boottime_ns();
+}
+
#endif /* __LINUX_CROS_EC_PROTO_H */