linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Olivier MOYSAN <olivier.moysan@st.com>
Cc: "lars@metafoo.de" <lars@metafoo.de>,
	Alexandre TORGUE <alexandre.torgue@st.com>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"pmeerw@pmeerw.net" <pmeerw@pmeerw.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"mcoquelin.stm32@gmail.com" <mcoquelin.stm32@gmail.com>,
	"knaack.h@gmx.de" <knaack.h@gmx.de>,
	Fabrice GASNIER <fabrice.gasnier@st.com>,
	"linux-stm32@st-md-mailman.stormreply.com"
	<linux-stm32@st-md-mailman.stormreply.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Benjamin GAIGNARD <benjamin.gaignard@st.com>
Subject: Re: [PATCH v2] iio: adc: stm32-dfsdm: adapt sampling rate to oversampling ratio
Date: Mon, 13 Jan 2020 22:02:08 +0000	[thread overview]
Message-ID: <20200113220208.6471ba42@archlinux> (raw)
In-Reply-To: <9b7e2161-1a31-8d69-52f9-ae9dedc902e3@st.com>

On Fri, 10 Jan 2020 10:06:13 +0000
Olivier MOYSAN <olivier.moysan@st.com> wrote:

> Hi Jonathan, all,
> 
> Kind reminder on this patch.
Thanks!

Applied to the togreg branch of iio.git and pushed out of testing
to give the build bots a brief period to poke at it.

Sorry again for the delay

Thanks,

Jonathan


> Regards
> Olivier
> 
> On 11/27/19 2:10 PM, Olivier Moysan wrote:
> > Update sampling rate when oversampling ratio is changed
> > through the IIO ABI.
> >
> > Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
> > ---
> > changes in version 2:
> > - correct title
> > ---
> >   drivers/iio/adc/stm32-dfsdm-adc.c | 32 ++++++++++++++++++-------------
> >   1 file changed, 19 insertions(+), 13 deletions(-)
> >
> > diff --git a/drivers/iio/adc/stm32-dfsdm-adc.c b/drivers/iio/adc/stm32-dfsdm-adc.c
> > index 0339ecdd06bd..87a842507509 100644
> > --- a/drivers/iio/adc/stm32-dfsdm-adc.c
> > +++ b/drivers/iio/adc/stm32-dfsdm-adc.c
> > @@ -1221,14 +1221,32 @@ static int stm32_dfsdm_write_raw(struct iio_dev *indio_dev,
> >   	unsigned int spi_freq;
> >   	int ret = -EINVAL;
> >   
> > +	switch (ch->src) {
> > +	case DFSDM_CHANNEL_SPI_CLOCK_INTERNAL:
> > +		spi_freq = adc->dfsdm->spi_master_freq;
> > +		break;
> > +	case DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_FALLING:
> > +	case DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_RISING:
> > +		spi_freq = adc->dfsdm->spi_master_freq / 2;
> > +		break;
> > +	default:
> > +		spi_freq = adc->spi_freq;
> > +	}
> > +
> >   	switch (mask) {
> >   	case IIO_CHAN_INFO_OVERSAMPLING_RATIO:
> >   		ret = iio_device_claim_direct_mode(indio_dev);
> >   		if (ret)
> >   			return ret;
> > +
> >   		ret = stm32_dfsdm_compute_all_osrs(indio_dev, val);
> > -		if (!ret)
> > +		if (!ret) {
> > +			dev_dbg(&indio_dev->dev,
> > +				"Sampling rate changed from (%u) to (%u)\n",
> > +				adc->sample_freq, spi_freq / val);
> >   			adc->oversamp = val;
> > +			adc->sample_freq = spi_freq / val;
> > +		}
> >   		iio_device_release_direct_mode(indio_dev);
> >   		return ret;
> >   
> > @@ -1240,18 +1258,6 @@ static int stm32_dfsdm_write_raw(struct iio_dev *indio_dev,
> >   		if (ret)
> >   			return ret;
> >   
> > -		switch (ch->src) {
> > -		case DFSDM_CHANNEL_SPI_CLOCK_INTERNAL:
> > -			spi_freq = adc->dfsdm->spi_master_freq;
> > -			break;
> > -		case DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_FALLING:
> > -		case DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_RISING:
> > -			spi_freq = adc->dfsdm->spi_master_freq / 2;
> > -			break;
> > -		default:
> > -			spi_freq = adc->spi_freq;
> > -		}
> > -
> >   		ret = dfsdm_adc_set_samp_freq(indio_dev, val, spi_freq);
> >   		iio_device_release_direct_mode(indio_dev);
> >   		return ret;  


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

      reply	other threads:[~2020-01-13 22:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-27 13:10 [PATCH v2] iio: adc: stm32-dfsdm: adapt sampling rate to oversampling ratio Olivier Moysan
2019-11-27 16:13 ` Fabrice Gasnier
2020-01-10 10:06 ` Olivier MOYSAN
2020-01-13 22:02   ` 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=20200113220208.6471ba42@archlinux \
    --to=jic23@kernel.org \
    --cc=alexandre.torgue@st.com \
    --cc=benjamin.gaignard@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=mcoquelin.stm32@gmail.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).