[2/2] ASoC: qcom: defer probe if platform dai is not registered
diff mbox series

Message ID 1545642133-16120-3-git-send-email-rohitkr@codeaurora.org
State New, archived
Headers show
Series
  • ASoC: soc-core: add snd_soc_of_lookup_component()
Related show

Commit Message

Rohit Kumar Dec. 24, 2018, 9:02 a.m. UTC
From: Ajit Pandey <ajitp@codeaurora.org>

Platform DAI component probe is not called if it is not
present in component list during sound card registration.
Check if component is registered for platform dai before
soundcard registration.

Signed-off-by: Ajit Pandey <ajitp@codeaurora.org>
Signed-off-by: Rohit kumar <rohitkr@codeaurora.org>
---
 sound/soc/qcom/common.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Mark Brown Jan. 7, 2019, 6:27 p.m. UTC | #1
On Mon, Dec 24, 2018 at 02:32:13PM +0530, Rohit kumar wrote:
> From: Ajit Pandey <ajitp@codeaurora.org>
> 
> Platform DAI component probe is not called if it is not
> present in component list during sound card registration.
> Check if component is registered for platform dai before
> soundcard registration.

Why do we need to do this in the driver, I'd expect this to be something
that we need to do for everything not just this driver so I'd expect it
to be handled in the core?
Rohit Kumar Jan. 9, 2019, 8:35 a.m. UTC | #2
Thanks Mark for review.

On 1/7/2019 11:57 PM, Mark Brown wrote:
> On Mon, Dec 24, 2018 at 02:32:13PM +0530, Rohit kumar wrote:
>> From: Ajit Pandey <ajitp@codeaurora.org>
>>
>> Platform DAI component probe is not called if it is not
>> present in component list during sound card registration.
>> Check if component is registered for platform dai before
>> soundcard registration.
> Why do we need to do this in the driver, I'd expect this to be something
> that we need to do for everything not just this driver so I'd expect it
> to be handled in the core?
True. Will post generic change which will not need change in machine driver.

Patch
diff mbox series

diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c
index 4715527..9e98458 100644
--- a/sound/soc/qcom/common.c
+++ b/sound/soc/qcom/common.c
@@ -11,6 +11,7 @@  int qcom_snd_parse_of(struct snd_soc_card *card)
 	struct device_node *codec = NULL;
 	struct device_node *platform = NULL;
 	struct device_node *cpu = NULL;
+	struct snd_soc_component *component = NULL;
 	struct device *dev = card->dev;
 	struct snd_soc_dai_link *link;
 	struct of_phandle_args args;
@@ -75,6 +76,14 @@  int qcom_snd_parse_of(struct snd_soc_card *card)
 				goto err;
 			}
 
+			component = snd_soc_of_lookup_component
+						(link->platform_of_node);
+			if (!component) {
+				ret = -EPROBE_DEFER;
+				dev_err(card->dev, "platform DAI not registered\n");
+				goto err;
+			}
+
 			ret = snd_soc_of_get_dai_link_codecs(dev, codec, link);
 			if (ret < 0) {
 				dev_err(card->dev, "codec dai not found\n");