linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] ASoC: stm32: dfsdm: change rate limits
@ 2020-10-07 15:34 Olivier Moysan
  2020-10-07 15:34 ` [PATCH 1/2] " Olivier Moysan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Olivier Moysan @ 2020-10-07 15:34 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, alexandre.torgue,
	olivier.moysan, arnaud.pouliquen
  Cc: alsa-devel, linux-arm-kernel, linux-stm32, linux-kernel

Widening of the supported rate range in the STM32 DFSDM driver.
The rates were previously limited to 8kHz, 16kHz and 32kHz.
Allow rate capture in the whole range 8kHz-48kHz as there is no hardware
limitation to support it.
Actual sample resolution is dependent on audio rate and DFSDM configuration. 
Add a trace to allow simple check of sample resolution.

Olivier Moysan (2):
  ASoC: stm32: dfsdm: change rate limits
  ASoC: stm32: dfsdm: add actual resolution trace

 drivers/iio/adc/stm32-dfsdm-adc.c | 4 ++++
 drivers/iio/adc/stm32-dfsdm.h     | 2 ++
 sound/soc/stm/stm32_adfsdm.c      | 8 +++-----
 3 files changed, 9 insertions(+), 5 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] ASoC: stm32: dfsdm: change rate limits
  2020-10-07 15:34 [PATCH 0/2] ASoC: stm32: dfsdm: change rate limits Olivier Moysan
@ 2020-10-07 15:34 ` Olivier Moysan
  2020-10-07 15:34 ` [PATCH 2/2] ASoC: stm32: dfsdm: add actual resolution trace Olivier Moysan
  2020-10-08 22:01 ` [PATCH 0/2] ASoC: stm32: dfsdm: change rate limits Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Olivier Moysan @ 2020-10-07 15:34 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, alexandre.torgue,
	olivier.moysan, arnaud.pouliquen
  Cc: alsa-devel, linux-arm-kernel, linux-stm32, linux-kernel

The DFSDM can support a larger rate range than currently
supported in driver.
Increase rate upper limit to 48kHz and allow all rates
in the range 8kHz to 48kHz.

Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
---
 sound/soc/stm/stm32_adfsdm.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/sound/soc/stm/stm32_adfsdm.c b/sound/soc/stm/stm32_adfsdm.c
index ec27c13af04f..c4031988f981 100644
--- a/sound/soc/stm/stm32_adfsdm.c
+++ b/sound/soc/stm/stm32_adfsdm.c
@@ -47,9 +47,6 @@ static const struct snd_pcm_hardware stm32_adfsdm_pcm_hw = {
 		SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_PAUSE,
 	.formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE,
 
-	.rate_min = 8000,
-	.rate_max = 32000,
-
 	.channels_min = 1,
 	.channels_max = 1,
 
@@ -143,8 +140,9 @@ static const struct snd_soc_dai_driver stm32_adfsdm_dai = {
 		    .channels_max = 1,
 		    .formats = SNDRV_PCM_FMTBIT_S16_LE |
 			       SNDRV_PCM_FMTBIT_S32_LE,
-		    .rates = (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |
-			      SNDRV_PCM_RATE_32000),
+		    .rates = SNDRV_PCM_RATE_CONTINUOUS,
+		    .rate_min = 8000,
+		    .rate_max = 48000,
 		    },
 	.ops = &stm32_adfsdm_dai_ops,
 };
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] ASoC: stm32: dfsdm: add actual resolution trace
  2020-10-07 15:34 [PATCH 0/2] ASoC: stm32: dfsdm: change rate limits Olivier Moysan
  2020-10-07 15:34 ` [PATCH 1/2] " Olivier Moysan
@ 2020-10-07 15:34 ` Olivier Moysan
  2020-10-08 22:01 ` [PATCH 0/2] ASoC: stm32: dfsdm: change rate limits Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Olivier Moysan @ 2020-10-07 15:34 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, alexandre.torgue,
	olivier.moysan, arnaud.pouliquen
  Cc: alsa-devel, linux-arm-kernel, linux-stm32, linux-kernel

Add a trace to report actual resolution of audio samples.

Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
---
 drivers/iio/adc/stm32-dfsdm-adc.c | 4 ++++
 drivers/iio/adc/stm32-dfsdm.h     | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/drivers/iio/adc/stm32-dfsdm-adc.c b/drivers/iio/adc/stm32-dfsdm-adc.c
index 5e10fb4f3704..b7e9ef1a6eec 100644
--- a/drivers/iio/adc/stm32-dfsdm-adc.c
+++ b/drivers/iio/adc/stm32-dfsdm-adc.c
@@ -293,6 +293,7 @@ static int stm32_dfsdm_compute_osrs(struct stm32_dfsdm_filter *fl,
 					max >>= flo->rshift;
 				}
 				flo->max = (s32)max;
+				flo->bits = bits;
 
 				pr_debug("%s: fast %d, fosr %d, iosr %d, res 0x%llx/%d bits, rshift %d, lshift %d\n",
 					 __func__, fast, flo->fosr, flo->iosr,
@@ -476,6 +477,9 @@ static int stm32_dfsdm_channels_configure(struct iio_dev *indio_dev,
 	if (!flo->res)
 		return -EINVAL;
 
+	dev_dbg(&indio_dev->dev, "Samples actual resolution: %d bits",
+		min(flo->bits, (u32)DFSDM_DATA_RES - 1));
+
 	for_each_set_bit(bit, &adc->smask,
 			 sizeof(adc->smask) * BITS_PER_BYTE) {
 		chan = indio_dev->channels + bit;
diff --git a/drivers/iio/adc/stm32-dfsdm.h b/drivers/iio/adc/stm32-dfsdm.h
index 5dbdae4ed881..4afc1f528b78 100644
--- a/drivers/iio/adc/stm32-dfsdm.h
+++ b/drivers/iio/adc/stm32-dfsdm.h
@@ -249,6 +249,7 @@ enum stm32_dfsdm_sinc_order {
  * @rshift: output sample right shift (hardware shift)
  * @lshift: output sample left shift (software shift)
  * @res: output sample resolution
+ * @bits: output sample resolution in bits
  * @max: output sample maximum positive value
  */
 struct stm32_dfsdm_filter_osr {
@@ -257,6 +258,7 @@ struct stm32_dfsdm_filter_osr {
 	unsigned int rshift;
 	unsigned int lshift;
 	u64 res;
+	u32 bits;
 	s32 max;
 };
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] ASoC: stm32: dfsdm: change rate limits
  2020-10-07 15:34 [PATCH 0/2] ASoC: stm32: dfsdm: change rate limits Olivier Moysan
  2020-10-07 15:34 ` [PATCH 1/2] " Olivier Moysan
  2020-10-07 15:34 ` [PATCH 2/2] ASoC: stm32: dfsdm: add actual resolution trace Olivier Moysan
@ 2020-10-08 22:01 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2020-10-08 22:01 UTC (permalink / raw)
  To: Olivier Moysan, lgirdwood, arnaud.pouliquen, tiwai, perex,
	alexandre.torgue
  Cc: linux-kernel, alsa-devel, linux-arm-kernel, linux-stm32

On Wed, 7 Oct 2020 17:34:57 +0200, Olivier Moysan wrote:
> Widening of the supported rate range in the STM32 DFSDM driver.
> The rates were previously limited to 8kHz, 16kHz and 32kHz.
> Allow rate capture in the whole range 8kHz-48kHz as there is no hardware
> limitation to support it.
> Actual sample resolution is dependent on audio rate and DFSDM configuration.
> Add a trace to allow simple check of sample resolution.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/2] ASoC: stm32: dfsdm: change rate limits
      commit: 6101bf71192f543799a796274e160f7dfc10f2d2
[2/2] ASoC: stm32: dfsdm: add actual resolution trace
      commit: 41bceb1272164ee2a6fd1ac3bed97043c94b6636

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-08 22:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-07 15:34 [PATCH 0/2] ASoC: stm32: dfsdm: change rate limits Olivier Moysan
2020-10-07 15:34 ` [PATCH 1/2] " Olivier Moysan
2020-10-07 15:34 ` [PATCH 2/2] ASoC: stm32: dfsdm: add actual resolution trace Olivier Moysan
2020-10-08 22:01 ` [PATCH 0/2] ASoC: stm32: dfsdm: change rate limits Mark Brown

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).