[PATCH v2 6/8] ASoC: qcom/common: Use snd-soc-dummy-dai when codec is not specified
From: Adam Serbinski
Date: Sun Feb 09 2020 - 10:48:42 EST
When not specifying a codec, use snd-soc-dummy-dai. This supports
the case where a fixed configuration codec is attached, such as
bluetooth hfp.
Signed-off-by: Adam Serbinski <adam@xxxxxxxxxxxxx>
CC: Andy Gross <agross@xxxxxxxxxx>
CC: Mark Rutland <mark.rutland@xxxxxxx>
CC: Liam Girdwood <lgirdwood@xxxxxxxxx>
CC: Patrick Lai <plai@xxxxxxxxxxxxxx>
CC: Banajit Goswami <bgoswami@xxxxxxxxxxxxxx>
CC: Jaroslav Kysela <perex@xxxxxxxx>
CC: Takashi Iwai <tiwai@xxxxxxxx>
CC: alsa-devel@xxxxxxxxxxxxxxxx
CC: linux-arm-msm@xxxxxxxxxxxxxxx
CC: devicetree@xxxxxxxxxxxxxxx
CC: linux-kernel@xxxxxxxxxxxxxxx
---
sound/soc/qcom/common.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c
index 6c20bdd850f3..aa2f2238aca0 100644
--- a/sound/soc/qcom/common.c
+++ b/sound/soc/qcom/common.c
@@ -84,7 +84,7 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
goto err;
}
- if (codec && platform) {
+ if (platform) {
link->platforms->of_node = of_parse_phandle(platform,
"sound-dai",
0);
@@ -94,10 +94,22 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
goto err;
}
- ret = snd_soc_of_get_dai_link_codecs(dev, codec, link);
- if (ret < 0) {
- dev_err(card->dev, "%s: codec dai not found\n", link->name);
- goto err;
+ if (codec) {
+ ret = snd_soc_of_get_dai_link_codecs(dev, codec, link);
+ if (ret < 0) {
+ dev_err(card->dev, "%s: codec dai not found\n", link->name);
+ goto err;
+ }
+ } else {
+ dlc = devm_kzalloc(dev,
+ sizeof(*dlc), GFP_KERNEL);
+ if (!dlc)
+ return -ENOMEM;
+
+ link->codecs = dlc;
+ link->num_codecs = 1;
+ link->codecs->dai_name = "snd-soc-dummy-dai";
+ link->codecs->name = "snd-soc-dummy";
}
link->no_pcm = 1;
link->ignore_pmdown_time = 1;
--
2.21.1