On Fri, May 6, 2016 at 8:08 PM, Crestez Dan Leonard <leonard.crestez@xxxxxxxxx> wrote: >> In order to get the same precision in timestamps as >> previously, where samples would be timestamped in the >> poll function pf->timestamp when calling >> iio_trigger_generic_data_rdy_poll() we introduce a >> local timestamp in the sensor data, set it in the top half >> (fastpath) of the interrupt handler and provide that to the >> core when calling iio_push_to_buffers_with_timestamp(). > > This doesn't work correctly with software timers. sdata->timestamp won't > update because st_sensors_irq_handler doesn't get called in this mode. > > Easiest fix would be to set pollfunc->timestamp in > st_sensors_irq_handler. But I don't really know how this is supposed to > work. Aha so it is implicit from the construction that whether it is a hardware IRQ or a hrtimer, the top half must always update the timestamp in pollfunc-timestamp, that was kind of hard to see :D What the other threaded driver does is simply add the timestamp in the trigger handler, like this: iio_push_to_buffers_with_timestamp(indio_dev, buffer, iio_get_time_ns()); But that pushes the timestamp away from the sampling time (when the actual IRQ occurs) so I wanted to avoid that. But maybe it has no bigger effect on anything anyways... To updates pf->timestamp I probably need to patch a new function into the trigger core that does only that. Will look into it. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html