mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v5 0/6] platform/chrome: cros_ec_sensorhub: Timestamp wrap and drift filter fixes
@ 2026-10-14  7:43 Satyam Gupta
  2026-10-14  7:43 ` [PATCH v5 1/6] platform/chrome: cros_ec_sensorhub: Fix AP/EC TS wrap Satyam Gupta
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Satyam Gupta @ 2026-10-14  7:43 UTC (permalink / raw)
  To: Benson Leung, Tzung-Bi Shih
  Cc: Guenter Roeck, Gwendal Grignou, Scott Collyer, chrome-platform,
	linux-kernel, Satyam Gupta

This series addresses 32-bit EC timestamp rollover across deep AP
suspend and updates the clock drift estimation and timestamp filtering
logic to prevent Out Of Order (OOO) timestamps and large timestamp gaps
during sensor batching:

1. Account for 32-bit EC hardware timestamp wraps across deep AP suspend
   and restrict overflow adjustments to forward wraps only.
2. Bound the history shift loop start index with min_t() so existing
   entries shift properly without array overrun.
3. Clamp the calculated drift slope (m) within +/- MAX_DRIFT_PPM (5000
   Parts Per Million (PPM)) to accommodate standalone EC clock drift
   while rejecting large interrupt jitter spikes.
4. Reset the timestamp filter history when the time delta (dx) changes
   by more than 10x across Output Data Rate (ODR) or streaming/batching
   mode transitions.
5. Increase TS_HISTORY_BORED_US from 0.5s to 2.0s so normal 1-2s batch
   flush intervals do not repeatedly reset the filter.
6. Rename cros_ec_sensor_ring_check_for_past_timestamp() to
   cros_ec_sensor_ring_is_past_timestamp() and drop strictly past
   samples instead of clamping them to last_ts.

Changes in v5:
- Split the clock drift estimation changes into 5 separate patches and
  include "platform/chrome: cros_ec_sensorhub: Fix AP/EC TS wrap" in the
  same 6-patch series as requested by Tzung-Bi Shih.
- Squash the MAX_DRIFT_PPM = 5000LL update directly into patch 3/6.
- Drop unrelated whitespace changes in cros_ec_sensorhub.c in patch 1/6.

Satyam Gupta (1):
  platform/chrome: cros_ec_sensorhub: Fix AP/EC TS wrap

Scott Collyer (5):
  platform/chrome: cros_ec_sensorhub: Fix TS filter history shift index
  platform/chrome: cros_ec_sensorhub: Clamp clock drift slope to
    MAX_DRIFT_PPM
  platform/chrome: cros_ec_sensorhub: Reset TS filter on ODR or mode
    changes
  platform/chrome: cros_ec_sensorhub: Increase TS_HISTORY_BORED_US to 2s
  platform/chrome: cros_ec_sensorhub: Drop sensor samples with past
    timestamps

 drivers/platform/chrome/cros_ec_sensorhub.c   |  37 ++++++-
 .../platform/chrome/cros_ec_sensorhub_ring.c  | 103 ++++++++++++++----
 .../linux/platform_data/cros_ec_sensorhub.h   |   2 +
 3 files changed, 117 insertions(+), 25 deletions(-)

-- 
2.56.0.385.gd3acb90ef8-goog


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-10-14  7:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-14  7:43 [PATCH v5 0/6] platform/chrome: cros_ec_sensorhub: Timestamp wrap and drift filter fixes Satyam Gupta
2026-10-14  7:43 ` [PATCH v5 1/6] platform/chrome: cros_ec_sensorhub: Fix AP/EC TS wrap Satyam Gupta
2026-10-14  7:43 ` [PATCH v5 2/6] platform/chrome: cros_ec_sensorhub: Fix TS filter history shift index Satyam Gupta
2026-10-14  7:43 ` [PATCH v5 3/6] platform/chrome: cros_ec_sensorhub: Clamp clock drift slope to MAX_DRIFT_PPM Satyam Gupta
2026-10-14  7:43 ` [PATCH v5 4/6] platform/chrome: cros_ec_sensorhub: Reset TS filter on ODR or mode changes Satyam Gupta
2026-10-14  7:43 ` [PATCH v5 5/6] platform/chrome: cros_ec_sensorhub: Increase TS_HISTORY_BORED_US to 2s Satyam Gupta
2026-10-14  7:43 ` [PATCH v5 6/6] platform/chrome: cros_ec_sensorhub: Drop sensor samples with past timestamps Satyam Gupta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®