diff options
author | Peter Ujfalusi <peter.ujfalusi@nokia.com> | 2009-06-01 07:06:40 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-06-01 18:46:08 -0400 |
commit | eaf1ac8bb58888e0773c0b81dfedb9d7c0123a1d (patch) | |
tree | a12e7bf7e9a4d1b8a71444aaf70d5c4423b1fd31 /sound/soc | |
parent | 16a30fbb0d3aa4ee829a2dd3d0e314e2b5ae96a9 (diff) |
ASoC: TWL4030: Check the interface format for 4 channel mode
In addition to the operating mode check, also check the
codec's interface format in case of four channel mode.
If the codec is not in TDM (DSP_A) mode, return with error.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/codecs/twl4030.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c index df474a5dd357..c53c7cabbd27 100644 --- a/sound/soc/codecs/twl4030.c +++ b/sound/soc/codecs/twl4030.c | |||
@@ -1608,9 +1608,15 @@ static int twl4030_hw_params(struct snd_pcm_substream *substream, | |||
1608 | 1608 | ||
1609 | /* If the substream has 4 channel, do the necessary setup */ | 1609 | /* If the substream has 4 channel, do the necessary setup */ |
1610 | if (params_channels(params) == 4) { | 1610 | if (params_channels(params) == 4) { |
1611 | /* Safety check: are we in the correct operating mode? */ | 1611 | u8 format, mode; |
1612 | if ((twl4030_read_reg_cache(codec, TWL4030_REG_CODEC_MODE) & | 1612 | |
1613 | TWL4030_OPTION_1)) | 1613 | format = twl4030_read_reg_cache(codec, TWL4030_REG_AUDIO_IF); |
1614 | mode = twl4030_read_reg_cache(codec, TWL4030_REG_CODEC_MODE); | ||
1615 | |||
1616 | /* Safety check: are we in the correct operating mode and | ||
1617 | * the interface is in TDM mode? */ | ||
1618 | if ((mode & TWL4030_OPTION_1) && | ||
1619 | ((format & TWL4030_AIF_FORMAT) == TWL4030_AIF_FORMAT_TDM)) | ||
1614 | twl4030_tdm_enable(codec, substream->stream, 1); | 1620 | twl4030_tdm_enable(codec, substream->stream, 1); |
1615 | else | 1621 | else |
1616 | return -EINVAL; | 1622 | return -EINVAL; |