hwclock: drop all samples on reset

On some HW it seems it's possible to get an occasional bad reading of
the PHC (with normal delay), or in a worse case the clock can step due
to a HW/driver bug, which triggers reset of the HW clock instance. To
avoid having a bad estimate of the frequency when the next (good) sample
is accumulated, drop also the last sample which triggered the reset.
This commit is contained in:
Miroslav Lichvar
2017-08-22 13:13:45 +02:00
parent 27cbf20d23
commit 6dad2c24bf
2 changed files with 6 additions and 6 deletions

View File

@@ -65,7 +65,7 @@ test_unit(void)
if (HCL_NeedsNewSample(clock, &local_ts))
HCL_AccumulateSample(clock, &hw_ts, &local_ts, 2.0 * jitter);
TEST_CHECK(j < 20 || clock->valid_coefs);
TEST_CHECK(clock->valid_coefs || clock->n_samples < 2);
if (!clock->valid_coefs)
continue;