ASoC: meson: cards: deal dpcm flag change
authorJerome Brunet <jbrunet@baylibre.com>
Fri, 31 Jul 2020 12:06:03 +0000 (14:06 +0200)
committerMark Brown <broonie@kernel.org>
Fri, 31 Jul 2020 18:06:52 +0000 (19:06 +0100)
Commit b73287f0b074 ("ASoC: soc-pcm: dpcm: fix playback/capture checks")
changed the meaning of dpcm_playback/dpcm_capture and now requires the
CPU DAI BE to aligned with those flags.

This broke all Amlogic cards with uni-directional backends (All gx and
most axg cards).

While I'm still confused as to how this change is an improvement, those
cards can't remain broken forever. Hopefully, next time an API change is
done like that, all the users will be updated as part of the change, and
not left to fend for themselves.

Fixes: b73287f0b074 ("ASoC: soc-pcm: dpcm: fix playback/capture checks")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/20200731120603.2243261-1-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/meson/axg-card.c
sound/soc/meson/gx-card.c
sound/soc/meson/meson-card-utils.c

index 47f2d93224fea963f851acff3d7e7db45985cc16..33058518c3da414b14758eca1e838ebf0e9d51e7 100644 (file)
@@ -327,20 +327,22 @@ static int axg_card_add_link(struct snd_soc_card *card, struct device_node *np,
                return ret;
 
        if (axg_card_cpu_is_playback_fe(dai_link->cpus->of_node))
-               ret = meson_card_set_fe_link(card, dai_link, np, true);
+               return meson_card_set_fe_link(card, dai_link, np, true);
        else if (axg_card_cpu_is_capture_fe(dai_link->cpus->of_node))
-               ret = meson_card_set_fe_link(card, dai_link, np, false);
-       else
-               ret = meson_card_set_be_link(card, dai_link, np);
+               return meson_card_set_fe_link(card, dai_link, np, false);
 
+
+       ret = meson_card_set_be_link(card, dai_link, np);
        if (ret)
                return ret;
 
-       if (axg_card_cpu_is_tdm_iface(dai_link->cpus->of_node))
-               ret = axg_card_parse_tdm(card, np, index);
-       else if (axg_card_cpu_is_codec(dai_link->cpus->of_node)) {
+       if (axg_card_cpu_is_codec(dai_link->cpus->of_node)) {
                dai_link->params = &codec_params;
-               dai_link->no_pcm = 0; /* link is not a DPCM BE */
+       } else {
+               dai_link->no_pcm = 1;
+               snd_soc_dai_link_set_capabilities(dai_link);
+               if (axg_card_cpu_is_tdm_iface(dai_link->cpus->of_node))
+                       ret = axg_card_parse_tdm(card, np, index);
        }
 
        return ret;
index 4abf7efb7eacc54442ad7c3a662050d427086bbc..fdd2d5303b2a71504bd33629b67b97d39398a945 100644 (file)
@@ -96,21 +96,21 @@ static int gx_card_add_link(struct snd_soc_card *card, struct device_node *np,
                return ret;
 
        if (gx_card_cpu_identify(dai_link->cpus, "FIFO"))
-               ret = meson_card_set_fe_link(card, dai_link, np, true);
-       else
-               ret = meson_card_set_be_link(card, dai_link, np);
+               return  meson_card_set_fe_link(card, dai_link, np, true);
 
+       ret = meson_card_set_be_link(card, dai_link, np);
        if (ret)
                return ret;
 
-       /* Check if the cpu is the i2s encoder and parse i2s data */
-       if (gx_card_cpu_identify(dai_link->cpus, "I2S Encoder"))
-               ret = gx_card_parse_i2s(card, np, index);
-
        /* Or apply codec to codec params if necessary */
-       else if (gx_card_cpu_identify(dai_link->cpus, "CODEC CTRL")) {
+       if (gx_card_cpu_identify(dai_link->cpus, "CODEC CTRL")) {
                dai_link->params = &codec_params;
-               dai_link->no_pcm = 0; /* link is not a DPCM BE */
+       } else {
+               dai_link->no_pcm = 1;
+               snd_soc_dai_link_set_capabilities(dai_link);
+               /* Check if the cpu is the i2s encoder and parse i2s data */
+               if (gx_card_cpu_identify(dai_link->cpus, "I2S Encoder"))
+                       ret = gx_card_parse_i2s(card, np, index);
        }
 
        return ret;
index 5a4a91c887347f5b37574cff2f9ada7c40ba0b5b..c734131ff0d62d114da6c0f175bffa966f4faad0 100644 (file)
@@ -147,10 +147,6 @@ int meson_card_set_be_link(struct snd_soc_card *card,
        struct device_node *np;
        int ret, num_codecs;
 
-       link->no_pcm = 1;
-       link->dpcm_playback = 1;
-       link->dpcm_capture = 1;
-
        num_codecs = of_get_child_count(node);
        if (!num_codecs) {
                dev_err(card->dev, "be link %s has no codec\n",