]> git.karo-electronics.de Git - karo-tx-linux.git/commit
ASoC: soc-pcm: add symmetry for channels and sample bits
authorNicolin Chen <b42378@freescale.com>
Wed, 13 Nov 2013 10:56:24 +0000 (18:56 +0800)
committerNicolin Chen <Guangyu.Chen@freescale.com>
Thu, 16 Jan 2014 11:27:46 +0000 (19:27 +0800)
commit7912f03c2b2a0c43eae9b758fa768796fa9095d3
tree19e5ab551fa170835ff55978c2682f28a0c5fc01
parent0634cdd84f904f80a1cb17fe869996a178ff59ab
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)
include/sound/soc-dai.h
include/sound/soc.h
sound/soc/soc-pcm.c