diff mbox

[3/4] ASoC: bcm2835: Support additional samplerates up to 384kHz

Message ID 20171108200332.28949-4-hias@horus.com (mailing list archive)
State Accepted
Headers show

Commit Message

Matthias Reichl Nov. 8, 2017, 8:03 p.m. UTC
Sample rates are only restricted by the capabilities of the
clock driver, so use SNDRV_PCM_RATE_CONTINUOUS instead of
SNDRV_PCM_RATE_8000_192000.

Tests (eg with pcm5122) have shown that bcm2835 works fine
in 384kHz/32bit stereo mode, so change the maximum allowed
rate from 192kHz to 384kHz.

Signed-off-by: Matthias Reichl <hias@horus.com>
---
 sound/soc/bcm/bcm2835-i2s.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Eric Anholt Nov. 8, 2017, 8:26 p.m. UTC | #1
Matthias Reichl <hias@horus.com> writes:

> Sample rates are only restricted by the capabilities of the
> clock driver, so use SNDRV_PCM_RATE_CONTINUOUS instead of
> SNDRV_PCM_RATE_8000_192000.
>
> Tests (eg with pcm5122) have shown that bcm2835 works fine
> in 384kHz/32bit stereo mode, so change the maximum allowed
> rate from 192kHz to 384kHz.

The docs I've got say the maximum PCM clock freq is 25Mhz, so if my math
is right then 384kHz should be fine.  This patch is:

Reviewed-by: Eric Anholt <eric@anholt.net>

(There's a note about needing to be careful that the mash filter doesn't
give you frequencies over 25mhz, but we should be doing limits like that
in the clock driver)

I'm going to give the alsa folks a chance to look at the modes patches
first, since I know they've got strong opinions about them and I don't
at all.
diff mbox

Patch

diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c
index 3a706fda4f39..43f5715a0d5d 100644
--- a/sound/soc/bcm/bcm2835-i2s.c
+++ b/sound/soc/bcm/bcm2835-i2s.c
@@ -765,7 +765,9 @@  static struct snd_soc_dai_driver bcm2835_i2s_dai = {
 	.playback = {
 		.channels_min = 2,
 		.channels_max = 2,
-		.rates =	SNDRV_PCM_RATE_8000_192000,
+		.rates =	SNDRV_PCM_RATE_CONTINUOUS,
+		.rate_min =	8000,
+		.rate_max =	384000,
 		.formats =	SNDRV_PCM_FMTBIT_S16_LE
 				| SNDRV_PCM_FMTBIT_S24_LE
 				| SNDRV_PCM_FMTBIT_S32_LE
@@ -773,7 +775,9 @@  static struct snd_soc_dai_driver bcm2835_i2s_dai = {
 	.capture = {
 		.channels_min = 2,
 		.channels_max = 2,
-		.rates =	SNDRV_PCM_RATE_8000_192000,
+		.rates =	SNDRV_PCM_RATE_CONTINUOUS,
+		.rate_min =	8000,
+		.rate_max =	384000,
 		.formats =	SNDRV_PCM_FMTBIT_S16_LE
 				| SNDRV_PCM_FMTBIT_S24_LE
 				| SNDRV_PCM_FMTBIT_S32_LE