Commit 0d99d2b0 authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Liam Girdwood

ASoC: tlv320dac33: Add 32/24 bit audio support

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: default avatarPeter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
parent 549675ed
...@@ -764,6 +764,8 @@ static int dac33_startup(struct snd_pcm_substream *substream, ...@@ -764,6 +764,8 @@ static int dac33_startup(struct snd_pcm_substream *substream,
/* Stream started, save the substream pointer */ /* Stream started, save the substream pointer */
dac33->substream = substream; dac33->substream = substream;
snd_pcm_hw_constraint_msbits(substream->runtime, 0, 32, 24);
return 0; return 0;
} }
...@@ -803,6 +805,10 @@ static int dac33_hw_params(struct snd_pcm_substream *substream, ...@@ -803,6 +805,10 @@ static int dac33_hw_params(struct snd_pcm_substream *substream,
dac33->fifo_size = DAC33_FIFO_SIZE_16BIT; dac33->fifo_size = DAC33_FIFO_SIZE_16BIT;
dac33->burst_rate = CALC_BURST_RATE(dac33->burst_bclkdiv, 32); dac33->burst_rate = CALC_BURST_RATE(dac33->burst_bclkdiv, 32);
break; 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: default:
dev_err(codec->dev, "unsupported format %d\n", dev_err(codec->dev, "unsupported format %d\n",
params_format(params)); params_format(params));
...@@ -856,6 +862,9 @@ static int dac33_prepare_chip(struct snd_pcm_substream *substream) ...@@ -856,6 +862,9 @@ static int dac33_prepare_chip(struct snd_pcm_substream *substream)
aictrl_a |= (DAC33_NCYCL_16 | DAC33_WLEN_16); aictrl_a |= (DAC33_NCYCL_16 | DAC33_WLEN_16);
fifoctrl_a |= DAC33_WIDTH; fifoctrl_a |= DAC33_WIDTH;
break; break;
case SNDRV_PCM_FORMAT_S32_LE:
aictrl_a |= (DAC33_NCYCL_32 | DAC33_WLEN_24);
break;
default: default:
dev_err(codec->dev, "unsupported format %d\n", dev_err(codec->dev, "unsupported format %d\n",
substream->runtime->format); substream->runtime->format);
...@@ -990,7 +999,10 @@ static int dac33_prepare_chip(struct snd_pcm_substream *substream) ...@@ -990,7 +999,10 @@ static int dac33_prepare_chip(struct snd_pcm_substream *substream)
dac33_write(codec, DAC33_SER_AUDIOIF_CTRL_C, dac33_write(codec, DAC33_SER_AUDIOIF_CTRL_C,
dac33->burst_bclkdiv); dac33->burst_bclkdiv);
else 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) { switch (dac33->fifo_mode) {
case DAC33_FIFO_MODE1: case DAC33_FIFO_MODE1:
...@@ -1438,7 +1450,7 @@ static struct snd_soc_codec_driver soc_codec_dev_tlv320dac33 = { ...@@ -1438,7 +1450,7 @@ static struct snd_soc_codec_driver soc_codec_dev_tlv320dac33 = {
#define DAC33_RATES (SNDRV_PCM_RATE_44100 | \ #define DAC33_RATES (SNDRV_PCM_RATE_44100 | \
SNDRV_PCM_RATE_48000) 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 = { static struct snd_soc_dai_ops dac33_dai_ops = {
.startup = dac33_startup, .startup = dac33_startup,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment