Skip to content

Commit 62c05a0

Browse files
committed
ASoC: BCM2708: Add 24 bit support
This adds 24 bit support to the I2S driver of the BCM2708. Besides enabling the 24 bit flags, it includes two bug fixes: MMAP is not supported. Claiming this leads to strange issues when the format of driver and file do not match. The datasheet states that the width extension bit should be set for widths greater than 24, but greater or equal would be correct. This follows from the definition of the width field. Signed-off-by: Florian Meier <[email protected]>
1 parent a1b99a6 commit 62c05a0

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

sound/soc/bcm/bcm2708-i2s.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,10 @@ static int bcm2708_i2s_hw_params(struct snd_pcm_substream *substream,
346346
data_length = 16;
347347
bclk_ratio = 40;
348348
break;
349+
case SNDRV_PCM_FORMAT_S24_LE:
350+
data_length = 24;
351+
bclk_ratio = 40;
352+
break;
349353
case SNDRV_PCM_FORMAT_S32_LE:
350354
data_length = 32;
351355
bclk_ratio = 80;
@@ -424,7 +428,7 @@ static int bcm2708_i2s_hw_params(struct snd_pcm_substream *substream,
424428
/* Setup the frame format */
425429
format = BCM2708_I2S_CHEN;
426430

427-
if (data_length > 24)
431+
if (data_length >= 24)
428432
format |= BCM2708_I2S_CHWEX;
429433

430434
format |= BCM2708_I2S_CHWID((data_length-8)&0xf);
@@ -714,13 +718,15 @@ static struct snd_soc_dai_driver bcm2708_i2s_dai = {
714718
.channels_max = 2,
715719
.rates = SNDRV_PCM_RATE_8000_192000,
716720
.formats = SNDRV_PCM_FMTBIT_S16_LE
721+
| SNDRV_PCM_FMTBIT_S24_LE
717722
| SNDRV_PCM_FMTBIT_S32_LE
718723
},
719724
.capture = {
720725
.channels_min = 2,
721726
.channels_max = 2,
722727
.rates = SNDRV_PCM_RATE_8000_192000,
723728
.formats = SNDRV_PCM_FMTBIT_S16_LE
729+
| SNDRV_PCM_FMTBIT_S24_LE
724730
| SNDRV_PCM_FMTBIT_S32_LE
725731
},
726732
.ops = &bcm2708_i2s_dai_ops,
@@ -810,11 +816,10 @@ static void bcm2708_i2s_setup_gpio(void)
810816
}
811817

812818
static const struct snd_pcm_hardware bcm2708_pcm_hardware = {
813-
.info = SNDRV_PCM_INFO_MMAP |
814-
SNDRV_PCM_INFO_MMAP_VALID |
815-
SNDRV_PCM_INFO_INTERLEAVED |
819+
.info = SNDRV_PCM_INFO_INTERLEAVED |
816820
SNDRV_PCM_INFO_JOINT_DUPLEX,
817821
.formats = SNDRV_PCM_FMTBIT_S16_LE |
822+
SNDRV_PCM_FMTBIT_S24_LE |
818823
SNDRV_PCM_FMTBIT_S32_LE,
819824
.period_bytes_min = 32,
820825
.period_bytes_max = 64 * PAGE_SIZE,

0 commit comments

Comments
 (0)