OSDN Git Service

iio: adc: stm32-adc: enable timestamping for non-DMA usage
authorAhmad Fatoum <a.fatoum@pengutronix.de>
Mon, 25 Jan 2021 19:48:23 +0000 (20:48 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Thu, 11 Mar 2021 20:46:57 +0000 (20:46 +0000)
commit8a09054f3e8afd0521309b15baab716fa7454785
tree5c48052247aaa80f7ff4d90bd0d036d133cfcef5
parent6c3b615379d7cd90d2f70b3cf9860c5a4910546a
iio: adc: stm32-adc: enable timestamping for non-DMA usage

For non-DMA usage, we have an easy way to associate a timestamp with a
sample: iio_pollfunc_store_time stores a timestamp in the primary
trigger IRQ handler and stm32_adc_trigger_handler runs in the IRQ thread
to push out the buffer along with the timestamp.

For this to work, the driver needs to register an IIO_TIMESTAMP channel.
Do this.

For DMA, it's not as easy, because we don't push the buffers out of
stm32_adc_trigger, but out of stm32_adc_dma_buffer_done, which runs in
a tasklet scheduled after a DMA completion.

Preferably, the DMA controller would copy us the timestamp into that buffer
as well. Until this is implemented, restrict timestamping support to
only PIO. For low-frequency sampling, PIO is probably good enough.

Cc: Holger Assmann <has@pengutronix.de>
Acked-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.kernel.org/r/20210125194824.30549-1-a.fatoum@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/stm32-adc.c