diff mbox series

[v3,9/9] soundwire: qcom: wait for enumeration to be complete in probe

Message ID 20210308134957.16024-10-srinivas.kandagatla@linaro.org
State New
Headers show
Series [v3,1/9] dt-bindings: soundwire: qcom: clarify data port bus parameters | expand

Commit Message

Srinivas Kandagatla March 8, 2021, 1:49 p.m. UTC
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/soundwire/qcom.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index 3109ec6c33ac..578a392bfbee 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -123,6 +123,7 @@  struct qcom_swrm_ctrl {
 	struct regmap *regmap;
 	void __iomem *mmio;
 	struct completion broadcast;
+	struct completion enumeration;
 	struct work_struct slave_work;
 	/* Port alloc/free lock */
 	struct mutex port_lock;
@@ -415,6 +416,7 @@  static int qcom_swrm_enumerate(struct sdw_bus *bus)
 			sdw_slave_add(bus, &id, NULL);
 	}
 
+	complete(&ctrl->enumeration);
 	return 0;
 }
 
@@ -1134,6 +1136,7 @@  static int qcom_swrm_probe(struct platform_device *pdev)
 	dev_set_drvdata(&pdev->dev, ctrl);
 	mutex_init(&ctrl->port_lock);
 	init_completion(&ctrl->broadcast);
+	init_completion(&ctrl->enumeration);
 
 	ctrl->bus.ops = &qcom_swrm_ops;
 	ctrl->bus.port_ops = &qcom_swrm_port_ops;
@@ -1180,6 +1183,8 @@  static int qcom_swrm_probe(struct platform_device *pdev)
 	}
 
 	qcom_swrm_init(ctrl);
+	wait_for_completion_timeout(&ctrl->enumeration,
+				    msecs_to_jiffies(TIMEOUT_MS));
 	ret = qcom_swrm_register_dais(ctrl);
 	if (ret)
 		goto err_master_add;