aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@nokia.com>2010-12-22 03:45:18 -0500
committerLiam Girdwood <lrg@slimlogic.co.uk>2010-12-23 09:38:34 -0500
commit0d99d2b036974ed1160f9d10457b6054646fb7d6 (patch)
tree9f762e6a939d183f02785c351d9bd9d864fa01a5
parent549675ed658761b9a84cb579795c9ec1da227fea (diff)
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: Peter Ujfalusi <peter.ujfalusi@nokia.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
-rw-r--r--sound/soc/codecs/tlv320dac33.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c
index 05a4e9fade47..13d521cfe393 100644
--- a/sound/soc/codecs/tlv320dac33.c
+++ b/sound/soc/codecs/tlv320dac33.c
@@ -764,6 +764,8 @@ static int dac33_startup(struct snd_pcm_substream *substream,
764 /* Stream started, save the substream pointer */ 764 /* Stream started, save the substream pointer */
765 dac33->substream = substream; 765 dac33->substream = substream;
766 766
767 snd_pcm_hw_constraint_msbits(substream->runtime, 0, 32, 24);
768
767 return 0; 769 return 0;
768} 770}
769 771
@@ -803,6 +805,10 @@ static int dac33_hw_params(struct snd_pcm_substream *substream,
803 dac33->fifo_size = DAC33_FIFO_SIZE_16BIT; 805 dac33->fifo_size = DAC33_FIFO_SIZE_16BIT;
804 dac33->burst_rate = CALC_BURST_RATE(dac33->burst_bclkdiv, 32); 806 dac33->burst_rate = CALC_BURST_RATE(dac33->burst_bclkdiv, 32);
805 break; 807 break;
808 case SNDRV_PCM_FORMAT_S32_LE:
809 dac33->fifo_size = DAC33_FIFO_SIZE_24BIT;
810 dac33->burst_rate = CALC_BURST_RATE(dac33->burst_bclkdiv, 64);
811 break;
806 default: 812 default:
807 dev_err(codec->dev, "unsupported format %d\n", 813 dev_err(codec->dev, "unsupported format %d\n",
808 params_format(params)); 814 params_format(params));
@@ -856,6 +862,9 @@ static int dac33_prepare_chip(struct snd_pcm_substream *substream)
856 aictrl_a |= (DAC33_NCYCL_16 | DAC33_WLEN_16); 862 aictrl_a |= (DAC33_NCYCL_16 | DAC33_WLEN_16);
857 fifoctrl_a |= DAC33_WIDTH; 863 fifoctrl_a |= DAC33_WIDTH;
858 break; 864 break;
865 case SNDRV_PCM_FORMAT_S32_LE:
866 aictrl_a |= (DAC33_NCYCL_32 | DAC33_WLEN_24);
867 break;
859 default: 868 default:
860 dev_err(codec->dev, "unsupported format %d\n", 869 dev_err(codec->dev, "unsupported format %d\n",
861 substream->runtime->format); 870 substream->runtime->format);
@@ -990,7 +999,10 @@ static int dac33_prepare_chip(struct snd_pcm_substream *substream)
990 dac33_write(codec, DAC33_SER_AUDIOIF_CTRL_C, 999 dac33_write(codec, DAC33_SER_AUDIOIF_CTRL_C,
991 dac33->burst_bclkdiv); 1000 dac33->burst_bclkdiv);
992 else 1001 else
993 dac33_write(codec, DAC33_SER_AUDIOIF_CTRL_C, 32); 1002 if (substream->runtime->format == SNDRV_PCM_FORMAT_S16_LE)
1003 dac33_write(codec, DAC33_SER_AUDIOIF_CTRL_C, 32);
1004 else
1005 dac33_write(codec, DAC33_SER_AUDIOIF_CTRL_C, 16);
994 1006
995 switch (dac33->fifo_mode) { 1007 switch (dac33->fifo_mode) {
996 case DAC33_FIFO_MODE1: 1008 case DAC33_FIFO_MODE1:
@@ -1438,7 +1450,7 @@ static struct snd_soc_codec_driver soc_codec_dev_tlv320dac33 = {
1438 1450
1439#define DAC33_RATES (SNDRV_PCM_RATE_44100 | \ 1451#define DAC33_RATES (SNDRV_PCM_RATE_44100 | \
1440 SNDRV_PCM_RATE_48000) 1452 SNDRV_PCM_RATE_48000)
1441#define DAC33_FORMATS SNDRV_PCM_FMTBIT_S16_LE 1453#define DAC33_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE)
1442 1454
1443static struct snd_soc_dai_ops dac33_dai_ops = { 1455static struct snd_soc_dai_ops dac33_dai_ops = {
1444 .startup = dac33_startup, 1456 .startup = dac33_startup,