[alsa-devel] [PATCH 5/6] ASoC: TWL4030: Add constraints for 4 channel mode
Peter Ujfalusi
peter.ujfalusi at nokia.com
Mon Apr 6 14:19:31 CEST 2009
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 at 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;
}
--
1.6.2.2
More information about the Alsa-devel
mailing list