Skip to content

Commit

Permalink
ASoC: tlv320dac33: Add 32/24 bit audio support
Browse files Browse the repository at this point in the history
Add support for 24 bit audio (with S32_LE msbits 24).
The reason to limit the msbits to 24, is that the FIFO
can be configured for 16 or 24 bit layout.
It is unknown how the codec would downsample from 32 to
24 bit, if the interface is configured to receive 32
bit data.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
  • Loading branch information
Peter Ujfalusi authored and Liam Girdwood committed Dec 23, 2010
1 parent 549675e commit 0d99d2b
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions sound/soc/codecs/tlv320dac33.c
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,8 @@ static int dac33_startup(struct snd_pcm_substream *substream,
/* Stream started, save the substream pointer */
dac33->substream = substream;

snd_pcm_hw_constraint_msbits(substream->runtime, 0, 32, 24);

return 0;
}

Expand Down Expand Up @@ -803,6 +805,10 @@ static int dac33_hw_params(struct snd_pcm_substream *substream,
dac33->fifo_size = DAC33_FIFO_SIZE_16BIT;
dac33->burst_rate = CALC_BURST_RATE(dac33->burst_bclkdiv, 32);
break;
case SNDRV_PCM_FORMAT_S32_LE:
dac33->fifo_size = DAC33_FIFO_SIZE_24BIT;
dac33->burst_rate = CALC_BURST_RATE(dac33->burst_bclkdiv, 64);
break;
default:
dev_err(codec->dev, "unsupported format %d\n",
params_format(params));
Expand Down Expand Up @@ -856,6 +862,9 @@ static int dac33_prepare_chip(struct snd_pcm_substream *substream)
aictrl_a |= (DAC33_NCYCL_16 | DAC33_WLEN_16);
fifoctrl_a |= DAC33_WIDTH;
break;
case SNDRV_PCM_FORMAT_S32_LE:
aictrl_a |= (DAC33_NCYCL_32 | DAC33_WLEN_24);
break;
default:
dev_err(codec->dev, "unsupported format %d\n",
substream->runtime->format);
Expand Down Expand Up @@ -990,7 +999,10 @@ static int dac33_prepare_chip(struct snd_pcm_substream *substream)
dac33_write(codec, DAC33_SER_AUDIOIF_CTRL_C,
dac33->burst_bclkdiv);
else
dac33_write(codec, DAC33_SER_AUDIOIF_CTRL_C, 32);
if (substream->runtime->format == SNDRV_PCM_FORMAT_S16_LE)
dac33_write(codec, DAC33_SER_AUDIOIF_CTRL_C, 32);
else
dac33_write(codec, DAC33_SER_AUDIOIF_CTRL_C, 16);

switch (dac33->fifo_mode) {
case DAC33_FIFO_MODE1:
Expand Down Expand Up @@ -1438,7 +1450,7 @@ static struct snd_soc_codec_driver soc_codec_dev_tlv320dac33 = {

#define DAC33_RATES (SNDRV_PCM_RATE_44100 | \
SNDRV_PCM_RATE_48000)
#define DAC33_FORMATS SNDRV_PCM_FMTBIT_S16_LE
#define DAC33_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE)

static struct snd_soc_dai_ops dac33_dai_ops = {
.startup = dac33_startup,
Expand Down

0 comments on commit 0d99d2b

Please sign in to comment.