Constrain #1: The TDM mode only available in Option1 Constrain #2: The second stream has to have the same number of channels
Signed-off-by: Peter Ujfalusi peter.ujfalusi@nokia.com --- sound/soc/codecs/twl4030.c | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c index 927b876..a1ae6e7 100644 --- a/sound/soc/codecs/twl4030.c +++ b/sound/soc/codecs/twl4030.c @@ -1244,9 +1244,22 @@ static int twl4030_startup(struct snd_pcm_substream *substream) master_runtime->sample_bits, master_runtime->sample_bits);
+ snd_pcm_hw_constraint_minmax(substream->runtime, + SNDRV_PCM_HW_PARAM_CHANNELS, + master_runtime->channels, + master_runtime->channels); + twl4030->slave_substream = substream; - } else + } else { + if (!(twl4030_read_reg_cache(codec, TWL4030_REG_CODEC_MODE) & + TWL4030_OPT_MODE)) + /* In option2 4 channel is not supported */ + snd_pcm_hw_constraint_minmax(substream->runtime, + SNDRV_PCM_HW_PARAM_CHANNELS, + 2, 2); + twl4030->master_substream = substream; + }
return 0; }