[PATCH 5/6] ASoC: TWL4030: Add constraints for 4 channel mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux