Commit 47ea8848 authored by Stephan Gerhold's avatar Stephan Gerhold Committed by Mark Brown

ASoC: qcom: common: Support parsing links without DPCM

So far qcom_snd_parse_of() was only used to parse the device tree
for boards using the QDSP6 driver together with DPCM. apq8016_sbc
uses an almost identical version (apq8016_sbc_parse_of()) which
parses links without DPCM.

Given the similarity of the two functions it is useful to combine
these two. To allow using qcom_snd_parse_of() in apq8016_sbc we
need to support parsing links without DPCM as well.

This is pretty simple: A DPCM link in the device tree is defined using:

  - DPCM frontend: "cpu"
  - DPCM backend:  "cpu", "platform" and "codec"

... while a link without DPCM has "cpu" and "codec" (but no "platform").

Add a few more if conditions to handle links without DPCM correctly.
Signed-off-by: default avatarStephan Gerhold <stephan@gerhold.net>
Tested-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20200723183904.321040-5-stephan@gerhold.netSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 0a8c336a
...@@ -84,7 +84,7 @@ int qcom_snd_parse_of(struct snd_soc_card *card) ...@@ -84,7 +84,7 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
goto err; goto err;
} }
if (codec && platform) { if (platform) {
link->platforms->of_node = of_parse_phandle(platform, link->platforms->of_node = of_parse_phandle(platform,
"sound-dai", "sound-dai",
0); 0);
...@@ -93,15 +93,24 @@ int qcom_snd_parse_of(struct snd_soc_card *card) ...@@ -93,15 +93,24 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
ret = -EINVAL; ret = -EINVAL;
goto err; goto err;
} }
} else {
link->platforms->of_node = link->cpus->of_node;
}
if (codec) {
ret = snd_soc_of_get_dai_link_codecs(dev, codec, link); ret = snd_soc_of_get_dai_link_codecs(dev, codec, link);
if (ret < 0) { if (ret < 0) {
dev_err(card->dev, "%s: codec dai not found\n", link->name); dev_err(card->dev, "%s: codec dai not found\n", link->name);
goto err; goto err;
} }
link->no_pcm = 1;
link->ignore_pmdown_time = 1; if (platform) {
/* DPCM backend */
link->no_pcm = 1;
link->ignore_pmdown_time = 1;
}
} else { } else {
/* DPCM frontend */
dlc = devm_kzalloc(dev, sizeof(*dlc), GFP_KERNEL); dlc = devm_kzalloc(dev, sizeof(*dlc), GFP_KERNEL);
if (!dlc) if (!dlc)
return -ENOMEM; return -ENOMEM;
...@@ -109,15 +118,18 @@ int qcom_snd_parse_of(struct snd_soc_card *card) ...@@ -109,15 +118,18 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
link->codecs = dlc; link->codecs = dlc;
link->num_codecs = 1; link->num_codecs = 1;
link->platforms->of_node = link->cpus->of_node;
link->codecs->dai_name = "snd-soc-dummy-dai"; link->codecs->dai_name = "snd-soc-dummy-dai";
link->codecs->name = "snd-soc-dummy"; link->codecs->name = "snd-soc-dummy";
link->dynamic = 1; link->dynamic = 1;
} }
snd_soc_dai_link_set_capabilities(link); if (platform || !codec) {
link->ignore_suspend = 1; /* DPCM */
link->nonatomic = 1; snd_soc_dai_link_set_capabilities(link);
link->ignore_suspend = 1;
link->nonatomic = 1;
}
link->stream_name = link->name; link->stream_name = link->name;
link++; link++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment