linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Fabrice Gasnier <fabrice.gasnier@st.com>
Cc: lars@metafoo.de, Olivier Moysan <olivier.moysan@st.com>,
	alexandre.torgue@st.com, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org, pmeerw@pmeerw.net, knaack.h@gmx.de,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] iio: adc: stm32-adc: dma transfers cleanup
Date: Sun, 8 Nov 2020 15:32:05 +0000	[thread overview]
Message-ID: <20201108153205.7aa4fa28@archlinux> (raw)
In-Reply-To: <8ed73130-57e7-4073-cdf2-5f31596e728c@st.com>

On Thu, 5 Nov 2020 18:38:27 +0100
Fabrice Gasnier <fabrice.gasnier@st.com> wrote:

> On 11/5/20 3:29 PM, Olivier Moysan wrote:
> > - Remove processing related to DMA in irq handler as this
> > data transfer is managed directly in DMA callback.
> > - Update comment in stm32_adc_set_watermark() function.
> > 
> > Signed-off-by: Olivier Moysan <olivier.moysan@st.com>  
> 
> Hi Olivier,
> 
> Reviewed-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to poke at it.

Thanks,

Jonathan

> 
> Thanks,
> Fabrice
> > ---
> >  drivers/iio/adc/stm32-adc.c | 29 ++++++-----------------------
> >  1 file changed, 6 insertions(+), 23 deletions(-)
> > 
> > diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
> > index b3f31f147347..08be826f1462 100644
> > --- a/drivers/iio/adc/stm32-adc.c
> > +++ b/drivers/iio/adc/stm32-adc.c
> > @@ -1310,7 +1310,7 @@ static int stm32_adc_set_watermark(struct iio_dev *indio_dev, unsigned int val)
> >  	 * dma cyclic transfers are used, buffer is split into two periods.
> >  	 * There should be :
> >  	 * - always one buffer (period) dma is working on
> > -	 * - one buffer (period) driver can push with iio_trigger_poll().
> > +	 * - one buffer (period) driver can push data.
> >  	 */
> >  	watermark = min(watermark, val * (unsigned)(sizeof(u16)));
> >  	adc->rx_buf_sz = min(rx_buf_sz, watermark * 2 * adc->num_conv);
> > @@ -1573,31 +1573,14 @@ static irqreturn_t stm32_adc_trigger_handler(int irq, void *p)
> >  
> >  	dev_dbg(&indio_dev->dev, "%s bufi=%d\n", __func__, adc->bufi);
> >  
> > -	if (!adc->dma_chan) {
> > -		/* reset buffer index */
> > -		adc->bufi = 0;
> > -		iio_push_to_buffers_with_timestamp(indio_dev, adc->buffer,
> > -						   pf->timestamp);
> > -	} else {
> > -		int residue = stm32_adc_dma_residue(adc);
> > -
> > -		while (residue >= indio_dev->scan_bytes) {
> > -			u16 *buffer = (u16 *)&adc->rx_buf[adc->bufi];
> > -
> > -			iio_push_to_buffers_with_timestamp(indio_dev, buffer,
> > -							   pf->timestamp);
> > -			residue -= indio_dev->scan_bytes;
> > -			adc->bufi += indio_dev->scan_bytes;
> > -			if (adc->bufi >= adc->rx_buf_sz)
> > -				adc->bufi = 0;
> > -		}
> > -	}
> > -
> > +	/* reset buffer index */
> > +	adc->bufi = 0;
> > +	iio_push_to_buffers_with_timestamp(indio_dev, adc->buffer,
> > +					   pf->timestamp);
> >  	iio_trigger_notify_done(indio_dev->trig);
> >  
> >  	/* re-enable eoc irq */
> > -	if (!adc->dma_chan)
> > -		stm32_adc_conv_irq_enable(adc);
> > +	stm32_adc_conv_irq_enable(adc);
> >  
> >  	return IRQ_HANDLED;
> >  }
> >   


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      reply	other threads:[~2020-11-08 15:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-05 14:29 [PATCH] iio: adc: stm32-adc: dma transfers cleanup Olivier Moysan
2020-11-05 17:38 ` Fabrice Gasnier
2020-11-08 15:32   ` Jonathan Cameron [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201108153205.7aa4fa28@archlinux \
    --to=jic23@kernel.org \
    --cc=alexandre.torgue@st.com \
    --cc=fabrice.gasnier@st.com \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=olivier.moysan@st.com \
    --cc=pmeerw@pmeerw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).