[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b649a0fd-b229-8a54-b374-72ecedca9e64@pengutronix.de>
Date: Mon, 25 Jan 2021 12:49:07 +0100
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: Ahmad Fatoum <a.fatoum@...gutronix.de>,
Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Peter Meerwald-Stadler <pmeerw@...erw.net>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Alexandre Torgue <alexandre.torgue@...com>
Cc: linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
Fabrice Gasnier <fabrice.gasnier@...s.st.com>,
kernel@...gutronix.de, Holger Assmann <has@...gutronix.de>,
linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v3] iio: adc: stm32-adc: enable timestamping for non-DMA
usage
On 1/25/21 12:21 PM, Ahmad Fatoum wrote:
> 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@...gutronix.de>
> Acked-by: Fabrice Gasnier <fabrice.gasnier@...s.st.com>
> Signed-off-by: Ahmad Fatoum <a.fatoum@...gutronix.de>
> ---
> v2 -> v3:
> - explicitly specify alignment (Jonathan)
> - increase buffer size to hold additional timestamp
> v1 -> v2:
> - Added comment about timestamping being PIO only (Fabrice)
> - Added missing DMA resource clean up in error path (Fabrice)
> - Added Fabrice's Acked-by
> ---
> drivers/iio/adc/stm32-adc.c | 39 +++++++++++++++++++++++++++++--------
> 1 file changed, 31 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
> index c067c994dae2..ab2f440d7afb 100644
> --- a/drivers/iio/adc/stm32-adc.c
> +++ b/drivers/iio/adc/stm32-adc.c
> @@ -177,7 +177,7 @@ struct stm32_adc_cfg {
> * @offset: ADC instance register offset in ADC block
> * @cfg: compatible configuration data
> * @completion: end of single conversion completion
> - * @buffer: data buffer
> + * @buffer: data buffer + 8 bytes for timestamp if enabled
^
> * @clk: clock for this adc instance
> * @irq: interrupt for this adc instance
> * @lock: spinlock
> @@ -200,7 +200,7 @@ struct stm32_adc {
> u32 offset;
> const struct stm32_adc_cfg *cfg;
> struct completion completion;
> - u16 buffer[STM32_ADC_MAX_SQ];
> + u16 buffer[STM32_ADC_MAX_SQ + 8] __aligned(8);
^^ ^
How does that fit together?
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists