• Gwendal Grignou's avatar
    platform/chrome: cros_ec_sensorhub: Simplify legacy timestamp spreading · 7f4784f1
    Gwendal Grignou authored
    On some machines (nami), interrupt latency cause samples to appear
    to be from the future and are pegged to the current time.
    We would see samples with this pattern:
    
    [t, t + ~5ms, t + ~10ms, t + ~10ms + 100us, t + ~10ms + 200us],
                                 (current now)      (current now)
    (t is the last timestamp time)
    
    Last 2 samples would be barely spread, causing applications to
    complain.
    
    We now spread the entire sequence. This is not great: in the example
    the sensor was supposed to send samples every 5ms, it now appears to
    send one every 2.5ms, but it is slightly closer to reality:
    
    sampling time in the example above
    At sensor level
    
    1             2             3             4            5
    +-----5ms-----+-----5ms-----+-----5ms-----+----5ms-----+---> t
    
    Before, at host level
                           1             2             3 4 5
    --interrupt delay------+-----5ms-----+-----5ms-----+-+-+---> t
    
    Afer, at host level
                           1       2       3       4       5
    --interrupt delay------+-2.5ms-+-2.5ms-+-2.5ms-+-2.5ms-+---> t
    Signed-off-by: default avatarGwendal Grignou <gwendal@chromium.org>
    Signed-off-by: default avatarEnric Balletbo i Serra <enric.balletbo@collabora.com>
    7f4784f1
cros_ec_sensorhub_ring.c 30.1 KB