kernel: clean up patch fuzz
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.4 / 950-0362-sound-soc-only-first-codec-is-master-in-multicodec-s.patch
1 From 3a0fad11000e1533c3132e024304cbe8b4f0f826 Mon Sep 17 00:00:00 2001
2 From: Johannes Krude <johannes@krude.de>
3 Date: Sat, 16 Nov 2019 12:41:06 +0100
4 Subject: [PATCH] sound/soc: only first codec is master in multicodec
5 setup
6
7 When using multiple codecs, at most one codec should generate the master
8 clock. All codecs except the first are therefore configured for slave
9 mode.
10
11 Signed-off-by: Johannes Krude <johannes@krude.de>
12 ---
13 sound/soc/soc-core.c | 10 +++++++++-
14 1 file changed, 9 insertions(+), 1 deletion(-)
15
16 --- a/sound/soc/soc-core.c
17 +++ b/sound/soc/soc-core.c
18 @@ -1656,7 +1656,15 @@ int snd_soc_runtime_set_dai_fmt(struct s
19 int ret;
20
21 for_each_rtd_codec_dai(rtd, i, codec_dai) {
22 - ret = snd_soc_dai_set_fmt(codec_dai, dai_fmt);
23 + unsigned int codec_dai_fmt = dai_fmt;
24 +
25 + // there can only be one master when using multiple codecs
26 + if (i && (codec_dai_fmt & SND_SOC_DAIFMT_MASTER_MASK)) {
27 + codec_dai_fmt &= ~SND_SOC_DAIFMT_MASTER_MASK;
28 + codec_dai_fmt |= SND_SOC_DAIFMT_CBS_CFS;
29 + }
30 +
31 + ret = snd_soc_dai_set_fmt(codec_dai, codec_dai_fmt);
32 if (ret != 0 && ret != -ENOTSUPP) {
33 dev_warn(codec_dai->dev,
34 "ASoC: Failed to set DAI format: %d\n", ret);