Skip to content

Commit a472d41

Browse files
committed
bcm2835-i2s: add 24bit support, update bclk_ratio to more correct values
Original commits: commit 62c05a0 Author: Florian Meier <[email protected]> Date: Fri Dec 6 18:55:53 2013 +0100 ASoC: BCM2708: Add 24 bit support commit 3e8c672 Author: popcornmix <[email protected]> Date: Sat Sep 13 10:52:04 2014 +0100 bcm2708-i2s: Update bclk_ratio to more correct values Discussion about blck_ratio affecting sound quality: raspberrypi#681
1 parent 8ef8cf9 commit a472d41

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

sound/soc/bcm/bcm2835-i2s.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,11 +340,15 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream,
340340
switch (params_format(params)) {
341341
case SNDRV_PCM_FORMAT_S16_LE:
342342
data_length = 16;
343-
bclk_ratio = 40;
343+
bclk_ratio = 50;
344+
break;
345+
case SNDRV_PCM_FORMAT_S24_LE:
346+
data_length = 24;
347+
bclk_ratio = 50;
344348
break;
345349
case SNDRV_PCM_FORMAT_S32_LE:
346350
data_length = 32;
347-
bclk_ratio = 80;
351+
bclk_ratio = 100;
348352
break;
349353
default:
350354
return -EINVAL;
@@ -420,7 +424,7 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream,
420424
/* Setup the frame format */
421425
format = BCM2835_I2S_CHEN;
422426

423-
if (data_length > 24)
427+
if (data_length >= 24)
424428
format |= BCM2835_I2S_CHWEX;
425429

426430
format |= BCM2835_I2S_CHWID((data_length-8)&0xf);
@@ -711,13 +715,15 @@ static struct snd_soc_dai_driver bcm2835_i2s_dai = {
711715
.channels_max = 2,
712716
.rates = SNDRV_PCM_RATE_8000_192000,
713717
.formats = SNDRV_PCM_FMTBIT_S16_LE
718+
| SNDRV_PCM_FMTBIT_S24_LE
714719
| SNDRV_PCM_FMTBIT_S32_LE
715720
},
716721
.capture = {
717722
.channels_min = 2,
718723
.channels_max = 2,
719724
.rates = SNDRV_PCM_RATE_8000_192000,
720725
.formats = SNDRV_PCM_FMTBIT_S16_LE
726+
| SNDRV_PCM_FMTBIT_S24_LE
721727
| SNDRV_PCM_FMTBIT_S32_LE
722728
},
723729
.ops = &bcm2835_i2s_dai_ops,

0 commit comments

Comments
 (0)