Skip to content

Commit

Permalink
platform/chrome: cros_ec_sensorhub: Fix EC timestamp overflow
Browse files Browse the repository at this point in the history
EC is using 32 bit timestamps (us), and before converting it to 64bit
they were not casted, so it would overflow every 4s.
Regular overflow every ~70 minutes was not taken into account either.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
  • Loading branch information
Gwendal Grignou authored and Enric Balletbo i Serra committed Jun 30, 2020
1 parent 20b7368 commit e48bc01
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/platform/chrome/cros_ec_sensorhub_ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,7 @@ cros_ec_sensor_ring_process_event(struct cros_ec_sensorhub *sensorhub,
* Disable filtering since we might add more jitter
* if b is in a random point in time.
*/
new_timestamp = fifo_timestamp -
fifo_info->timestamp * 1000 +
in->timestamp * 1000;
new_timestamp = c - b * 1000 + a * 1000;
/*
* The timestamp can be stale if we had to use the fifo
* info timestamp.
Expand Down

0 comments on commit e48bc01

Please sign in to comment.