[alsa-devel] [PATCH 0/1] ASoC: TWL4030: Additional check for 4 channel mode
Hello,
the following patch adds additional check in case of four channel mode. The codec has to be configured for TDM (DSP_A) mode when using 4 channel audio. Without the patch boards which does not prepared for the four channel mode could try to play four channel audio, but configure the interface to be in I2S mode, which is not valid.
--- Peter Ujfalusi (1): ASoC: TWL4030: Check the interface format for 4 channel mode
sound/soc/codecs/twl4030.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-)
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 --- 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 df474a5..c53c7ca 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;
On Mon, Jun 01, 2009 at 02:06:40PM +0300, Peter Ujfalusi wrote:
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
Applied, thanks.
participants (2)
-
Mark Brown
-
Peter Ujfalusi