Skip to content

Commit

Permalink
ASoC: BCM2708: Add 24 bit support
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
koalo committed Dec 9, 2013
1 parent a1b99a6 commit 62c05a0
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions sound/soc/bcm/bcm2708-i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,10 @@ static int bcm2708_i2s_hw_params(struct snd_pcm_substream *substream,
data_length = 16;
bclk_ratio = 40;
break;
case SNDRV_PCM_FORMAT_S24_LE:
data_length = 24;
bclk_ratio = 40;
break;
case SNDRV_PCM_FORMAT_S32_LE:
data_length = 32;
bclk_ratio = 80;
Expand Down Expand Up @@ -424,7 +428,7 @@ static int bcm2708_i2s_hw_params(struct snd_pcm_substream *substream,
/* Setup the frame format */
format = BCM2708_I2S_CHEN;

if (data_length > 24)
if (data_length >= 24)
format |= BCM2708_I2S_CHWEX;

format |= BCM2708_I2S_CHWID((data_length-8)&0xf);
Expand Down Expand Up @@ -714,13 +718,15 @@ static struct snd_soc_dai_driver bcm2708_i2s_dai = {
.channels_max = 2,
.rates = SNDRV_PCM_RATE_8000_192000,
.formats = SNDRV_PCM_FMTBIT_S16_LE
| SNDRV_PCM_FMTBIT_S24_LE
| SNDRV_PCM_FMTBIT_S32_LE
},
.capture = {
.channels_min = 2,
.channels_max = 2,
.rates = SNDRV_PCM_RATE_8000_192000,
.formats = SNDRV_PCM_FMTBIT_S16_LE
| SNDRV_PCM_FMTBIT_S24_LE
| SNDRV_PCM_FMTBIT_S32_LE
},
.ops = &bcm2708_i2s_dai_ops,
Expand Down Expand Up @@ -810,11 +816,10 @@ static void bcm2708_i2s_setup_gpio(void)
}

static const struct snd_pcm_hardware bcm2708_pcm_hardware = {
.info = SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_INTERLEAVED |
.info = SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_JOINT_DUPLEX,
.formats = SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S32_LE,
.period_bytes_min = 32,
.period_bytes_max = 64 * PAGE_SIZE,
Expand Down

0 comments on commit 62c05a0

Please sign in to comment.