Commit 21a2f848 authored by Miguel Gómez Sexto's avatar Miguel Gómez Sexto Committed by Samuel Iglesias Gonsálvez

Changed valid pulse width calculation

Signed-off-by: Miguel Gómez Sexto's avatarMiguel Gomez <magomez@igalia.com>
Signed-off-by: Samuel Iglesias Gonsálvez's avatarSamuel Iglesias Gonsalvez <siglesias@igalia.com>
parent 945230c2
......@@ -97,31 +97,13 @@ static int tdc_fmc_check_lost_events(u32 curr_wr_ptr, u32 prev_wr_ptr, int *coun
static inline int tdc_is_valid_pulse_width(struct tdc_event rising, struct tdc_event falling)
{
int diff;
uint64_t up, down;
diff = falling.fine_time - rising.fine_time;
/* Check pulse width from smaller to bigger quantities. */
if (likely(diff > 124)) {
/* Valid pulse width (higher or equal to 100 ns) */
return 1;
}
else {
diff = falling.coarse_time - rising.coarse_time;
if (likely(diff > 13)) {
/* Valid pulse width (higher or equal to 100 ns) */
return 1;
}
else {
diff = falling.local_utc - rising.local_utc;
if (likely(diff > 1)) {
/* Valid pulse width (higher or equal to 100 ns) */
return 1;
}
}
}
up = rising.coarse_time * 8000000000 + rising.fine_time * 81;
down = (falling.local_utc - rising.local_utc) * 1000000000000 +
falling.coarse_time * 8000000000 + rising.fine_time * 81;
/* Invalid pulse width (less than 100 ns) */
return 0;
return (down - up > 100000);
}
static void tdc_fmc_irq_work(struct work_struct *work)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment