qcacmn: Time stamp WAR for spectral
Spectral HW time stamp gets reset when a reset happens in
within target. This can potentially result in unpredictable
behaviour during classification. To mitigate this calculated
offset is added to the time stamp value in the FFT report.
HT = Spectral HW timer
AT = Actual time stamp in spectral report
CF = Time stamp correction factor
CT = Corrected time stamp
L = Time stamp in the last FFT report before reset
F = Time stamp in the first FFT report after reset
D = Time gap between the last spectral report before reset
and the end of reset(This is provided by FW via direct
DMA framework)
***Target Reset***
^
|
|<---D---->| time line--->
_______________________________________________________
^ ^ ^ ^
| | | |
HT --> 0 L 0 F
AT --> 0 L F
CF --> 0 0 (L+D)
CT --> 0 L (F+L+D)
Spectral driver corrects the time stamp received from target
using the following formula and sends upwards.
CT(Corrected time stamp) = AT(Actual time stamp) +
CF(Correction Factor)
Calculation of Correction factor (CF):-
---------------------------------------
Initialization : CF = 0
CF += (L + D) (Done only for the first spectral report after reset)
This scheme takes care of the wrap around in the 32 bit time stamp
which would have occurred if the timer was not restarted due to
target reset.
CRs-Fixed: 2356382 2355486
Change-Id: I17b55d39eb91eb03b867bcfddaf3eb03d1fc5d1b
1 file changed