summaryrefslogtreecommitdiff
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2021-06-14 09:56:54 +0900
committerMark Brown <broonie@kernel.org>2021-06-21 13:05:16 +0100
commitb44a67f89366597364693e07e814660d5df8c66f (patch)
tree9806ec6abcf34531a17fc465baa1e3725d242790 /sound/soc/soc-core.c
parent91ae447762517c814672e2e5ff2383348101a032 (diff)
ASoC: soc-core: add snd_soc_daifmt_clock_provider_fliped()
Sometimes we want to get CLOCK_PROVIDER fliped dai_fmt. This patch adds new snd_soc_daifmt_clock_provider_fliped() for it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/878s3dw9ex.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r--sound/soc/soc-core.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index bbbdf62b371b..6050f44d49b2 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1249,21 +1249,8 @@ int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd,
* Flip the polarity for the "CPU" end of a CODEC<->CODEC link
* the component which has non_legacy_dai_naming is Codec
*/
- inv_dai_fmt = dai_fmt & ~SND_SOC_DAIFMT_MASTER_MASK;
- switch (dai_fmt & SND_SOC_DAIFMT_MASTER_MASK) {
- case SND_SOC_DAIFMT_CBM_CFM:
- inv_dai_fmt |= SND_SOC_DAIFMT_CBS_CFS;
- break;
- case SND_SOC_DAIFMT_CBM_CFS:
- inv_dai_fmt |= SND_SOC_DAIFMT_CBS_CFM;
- break;
- case SND_SOC_DAIFMT_CBS_CFM:
- inv_dai_fmt |= SND_SOC_DAIFMT_CBM_CFS;
- break;
- case SND_SOC_DAIFMT_CBS_CFS:
- inv_dai_fmt |= SND_SOC_DAIFMT_CBM_CFM;
- break;
- }
+ inv_dai_fmt = snd_soc_daifmt_clock_provider_fliped(dai_fmt);
+
for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
unsigned int fmt = dai_fmt;
@@ -3017,6 +3004,29 @@ int snd_soc_of_parse_aux_devs(struct snd_soc_card *card, const char *propname)
}
EXPORT_SYMBOL_GPL(snd_soc_of_parse_aux_devs);
+unsigned int snd_soc_daifmt_clock_provider_fliped(unsigned int dai_fmt)
+{
+ unsigned int inv_dai_fmt = dai_fmt & ~SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK;
+
+ switch (dai_fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
+ case SND_SOC_DAIFMT_CBP_CFP:
+ inv_dai_fmt |= SND_SOC_DAIFMT_CBC_CFC;
+ break;
+ case SND_SOC_DAIFMT_CBP_CFC:
+ inv_dai_fmt |= SND_SOC_DAIFMT_CBC_CFP;
+ break;
+ case SND_SOC_DAIFMT_CBC_CFP:
+ inv_dai_fmt |= SND_SOC_DAIFMT_CBP_CFC;
+ break;
+ case SND_SOC_DAIFMT_CBC_CFC:
+ inv_dai_fmt |= SND_SOC_DAIFMT_CBP_CFP;
+ break;
+ }
+
+ return inv_dai_fmt;
+}
+EXPORT_SYMBOL_GPL(snd_soc_daifmt_clock_provider_fliped);
+
unsigned int snd_soc_daifmt_clock_provider_from_bitmap(unsigned int bit_frame)
{
/* Codec base */