From: Peter Ujfalusi Date: Mon, 1 Jun 2009 11:06:40 +0000 (+0300) Subject: ASoC: TWL4030: Check the interface format for 4 channel mode X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=eaf1ac8bb58888e0773c0b81dfedb9d7c0123a1d;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git 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 Signed-off-by: Mark Brown --- 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, /* 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;