Skip to content

Commit

Permalink
ASoC: TWL4030: Check the interface format for 4 channel mode
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Peter Ujfalusi authored and Mark Brown committed Jun 1, 2009
1 parent 16a30fb commit eaf1ac8
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions sound/soc/codecs/twl4030.c
Original file line number Diff line number Diff line change
Expand Up @@ -1608,9 +1608,15 @@ static int twl4030_hw_params(struct snd_pcm_substream *substream,

/* If the substream has 4 channel, do the necessary setup */
if (params_channels(params) == 4) {
/* Safety check: are we in the correct operating mode? */
if ((twl4030_read_reg_cache(codec, TWL4030_REG_CODEC_MODE) &
TWL4030_OPTION_1))
u8 format, mode;

format = twl4030_read_reg_cache(codec, TWL4030_REG_AUDIO_IF);
mode = twl4030_read_reg_cache(codec, TWL4030_REG_CODEC_MODE);

/* Safety check: are we in the correct operating mode and
* the interface is in TDM mode? */
if ((mode & TWL4030_OPTION_1) &&
((format & TWL4030_AIF_FORMAT) == TWL4030_AIF_FORMAT_TDM))
twl4030_tdm_enable(codec, substream->stream, 1);
else
return -EINVAL;
Expand Down

0 comments on commit eaf1ac8

Please sign in to comment.