patch "iio: adc: stm32: fix scan of multiple channels with DMA" added to staging-testing
Subsystems (3)
This is a note to let you know that I've just added the patch titled
iio: adc: stm32: fix scan of multiple channels with DMA
to my staging git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
in the staging-testing branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will be merged to the staging-next branch sometime soon, after it passes testing, and the merge window is open.
If you have any questions about this process, please let me know.
Quoted 1 line
From
69545dfbcaf7a346d87dc6fb6f847b51a1845852Mon Sep 17 00:00:00 2001
From: Fabrice Gasnier <[email protected]>
Date: Fri, 5 Jan 2018 15:34:54 +0100
Subject: iio: adc: stm32: fix scan of multiple channels with DMA
By default, watermark is set to '1'. Watermark is used to fine tune cyclic dma buffer period. In case watermark is left untouched (e.g. 1) and several channels are being scanned, buffer period is wrongly set (e.g. to 1 sample). As a consequence, data is never pushed to upper layer. Fix buffer period size, by taking scan channels number into account.
--- drivers/iio/adc/stm32-adc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/adc/stm32-adc.c +2 -1
@@ -1289,6 +1289,7 @@ static int stm32_adc_set_watermark(struct iio_dev *indio_dev, unsigned int val) {struct stm32_adc *adc =iio_priv (indio_dev);unsigned int watermark =STM32_DMA_BUFFER_SIZE /2 ; +unsigned int rx_buf_sz =STM32_DMA_BUFFER_SIZE ;/* * dma cyclic transfers are used, buffer is split into two periods.
@@ -1297,7 +1298,7 @@ static int stm32_adc_set_watermark(struct iio_dev *indio_dev, unsigned int val)* - one buffer (period) driver can push with iio_trigger_poll(). */ watermark =min (watermark, val * (unsigned )(sizeof (u16))); - adc->rx_buf_sz = watermark *2 ; + adc->rx_buf_sz =min (rx_buf_sz, watermark *2 * adc->num_conv);return 0 ; }
Signature · 1 line
2.15.1