aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorNicolin Chen <b42378@freescale.com>2013-11-13 05:56:24 -0500
committerMark Brown <broonie@linaro.org>2013-11-24 08:32:50 -0500
commit3635bf09a89cf92b80ac44198c5c8f0989624ea6 (patch)
treed17b0f527cd2282e032f4820c15554ab2d8248a6 /include
parent6ce4eac1f600b34f2f7f58f9cd8f0503d79e42ae (diff)
ASoC: soc-pcm: add symmetry for channels and sample bits
Some SoCs can only work in mono or stereo mode at one time. So if we let them capture a mono stream while playing a stereo stream, there might be a problem occur to one of these two streams: double paced or slowed down. In soc-pcm.c, we have soc_pcm_apply_symmetry() to apply the rate symmetry. But we don't have one for channels. Likewise, we can treat symmetric_rate as a solution for those SoCs or CODECs which can not handle asymmetrical LRCLK. But it's also impossible for them to handle asymmetrical BCLK. And accodring to BCLK = LRCLK * channel number * slot size(fixed or sample bits), sample bits might also be a problem if they are not using a fixed slot size. Thus, this patch applys symmetry for channels and sample bits. Meanwhile, there might be a race between two substreams if starting simultaneously. Previously, we only added warning to compalin but still using conservative way to let it carry on. However, this patch rejects the second stream with any unmatched parameter to make sure the first existing stream won't be broken. Signed-off-by: Nicolin Chen <b42378@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'include')
-rw-r--r--include/sound/soc-dai.h6
-rw-r--r--include/sound/soc.h2
2 files changed, 8 insertions, 0 deletions
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 800c101bb096..243d3b689699 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -220,6 +220,8 @@ struct snd_soc_dai_driver {
220 struct snd_soc_pcm_stream capture; 220 struct snd_soc_pcm_stream capture;
221 struct snd_soc_pcm_stream playback; 221 struct snd_soc_pcm_stream playback;
222 unsigned int symmetric_rates:1; 222 unsigned int symmetric_rates:1;
223 unsigned int symmetric_channels:1;
224 unsigned int symmetric_samplebits:1;
223 225
224 /* probe ordering - for components with runtime dependencies */ 226 /* probe ordering - for components with runtime dependencies */
225 int probe_order; 227 int probe_order;
@@ -244,6 +246,8 @@ struct snd_soc_dai {
244 unsigned int capture_active:1; /* stream is in use */ 246 unsigned int capture_active:1; /* stream is in use */
245 unsigned int playback_active:1; /* stream is in use */ 247 unsigned int playback_active:1; /* stream is in use */
246 unsigned int symmetric_rates:1; 248 unsigned int symmetric_rates:1;
249 unsigned int symmetric_channels:1;
250 unsigned int symmetric_samplebits:1;
247 struct snd_pcm_runtime *runtime; 251 struct snd_pcm_runtime *runtime;
248 unsigned int active; 252 unsigned int active;
249 unsigned char probed:1; 253 unsigned char probed:1;
@@ -258,6 +262,8 @@ struct snd_soc_dai {
258 262
259 /* Symmetry data - only valid if symmetry is being enforced */ 263 /* Symmetry data - only valid if symmetry is being enforced */
260 unsigned int rate; 264 unsigned int rate;
265 unsigned int channels;
266 unsigned int sample_bits;
261 267
262 /* parent platform/codec */ 268 /* parent platform/codec */
263 struct snd_soc_platform *platform; 269 struct snd_soc_platform *platform;
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 1f741cb24f33..1cda7d343d16 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -879,6 +879,8 @@ struct snd_soc_dai_link {
879 879
880 /* Symmetry requirements */ 880 /* Symmetry requirements */
881 unsigned int symmetric_rates:1; 881 unsigned int symmetric_rates:1;
882 unsigned int symmetric_channels:1;
883 unsigned int symmetric_samplebits:1;
882 884
883 /* Do not create a PCM for this DAI link (Backend link) */ 885 /* Do not create a PCM for this DAI link (Backend link) */
884 unsigned int no_pcm:1; 886 unsigned int no_pcm:1;