patch "iio: adc: stm32-dfsdm: fix sample rate for div2 spi clock" added to staging-linus
Subsystems (3)
This is a note to let you know that I've just added the patch titled
iio: adc: stm32-dfsdm: fix sample rate for div2 spi clock
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-linus 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 hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
Quoted 1 line
From
d58109dcf37fc9baec354385ec9fdcd8878d174dMon Sep 17 00:00:00 2001
From: Fabrice Gasnier <[email protected]>
Date: Tue, 13 Mar 2018 15:23:06 +0100
Subject: iio: adc: stm32-dfsdm: fix sample rate for div2 spi clock
When channel clk source is set to "CLKOUT_F" or "CLKOUT_R" (e.g. div2), sample rate is currently set to half the requested value.
microphone")
--- drivers/iio/adc/stm32-dfsdm-adc.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/iio/adc/stm32-dfsdm-adc.c +12 -2
@@ -771,7 +771,7 @@ static int stm32_dfsdm_write_raw(struct iio_dev *indio_dev,struct stm32_dfsdm_adc *adc =iio_priv (indio_dev);struct stm32_dfsdm_filter *fl = &adc->dfsdm->fl_list[adc->fl_id];struct stm32_dfsdm_channel *ch = &adc->dfsdm->ch_list[chan->channel]; -unsigned int spi_freq = adc->spi_freq; +unsigned int spi_freq;int ret = -EINVAL ;switch (mask) {
@@ -785,8 +785,18 @@ static int stm32_dfsdm_write_raw(struct iio_dev *indio_dev,case IIO_CHAN_INFO_SAMP_FREQ :if (!val)return -EINVAL ; -if (ch->src !=DFSDM_CHANNEL_SPI_CLOCK_EXTERNAL ) + +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; + }if (spi_freq % val) dev_warn(&indio_dev->dev,
Signature · 1 line
2.17.0