summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNicolin Chen <b42378@freescale.com>2013-11-13 18:56:24 +0800
committerNicolin Chen <Guangyu.Chen@freescale.com>2014-01-16 19:27:46 +0800
commit7912f03c2b2a0c43eae9b758fa768796fa9095d3 (patch)
tree19e5ab551fa170835ff55978c2682f28a0c5fc01 /include
parent0634cdd84f904f80a1cb17fe869996a178ff59ab (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> (cherry picked from commit 3635bf09a89cf92b80ac44198c5c8f0989624ea6) (cherry picked from commit bb3317659966b170d9481fad887df8808774c696)
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 ae9a227d35d3..cf22dd84e93a 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -210,6 +210,8 @@ struct snd_soc_dai_driver {
struct snd_soc_pcm_stream capture;
struct snd_soc_pcm_stream playback;
unsigned int symmetric_rates:1;
+ unsigned int symmetric_channels:1;
+ unsigned int symmetric_samplebits:1;
/* probe ordering - for components with runtime dependencies */
int probe_order;
@@ -234,6 +236,8 @@ struct snd_soc_dai {
unsigned int capture_active:1; /* stream is in use */
unsigned int playback_active:1; /* stream is in use */
unsigned int symmetric_rates:1;
+ unsigned int symmetric_channels:1;
+ unsigned int symmetric_samplebits:1;
struct snd_pcm_runtime *runtime;
unsigned int active;
unsigned char probed:1;
@@ -248,6 +252,8 @@ struct snd_soc_dai {
/* Symmetry data - only valid if symmetry is being enforced */
unsigned int rate;
+ unsigned int channels;
+ unsigned int sample_bits;
/* parent platform/codec */
struct snd_soc_platform *platform;
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 85c15226103b..0b379e829141 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -912,6 +912,8 @@ struct snd_soc_dai_link {
/* Symmetry requirements */
unsigned int symmetric_rates:1;
+ unsigned int symmetric_channels:1;
+ unsigned int symmetric_samplebits:1;
/* Do not create a PCM for this DAI link (Backend link) */
unsigned int no_pcm:1;