Skip to contentSkip to conversation

qcom: add Asus Vivobook 16 X1607QA DT + LPASS audio clock retry

PATCH In review yass27106 5 participants 28 messages Nov 13 – Nov 15

Subsystems (7)
lore
Share & tools
lore

yass27106

author
#0 lore raw

cover qcom: add Asus Vivobook 16 X1607QA DT + LPASS audio clock retry

Hi,

Two patches against v7.4-rc1 (also sent as pull request 1439 to qualcomm-linux/kernel, and to the Ubuntu kernel team):

[PATCH 1/2] arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA
Initial DT for this Snapdragon X X1P-42-100 (purwa) laptop, including sound nodes (WSA8845 speakers, WCD938x codec via SoundWire).

[PATCH 2/2] ASoC: qcom: lpass macro / soundwire: retry deferred clock acquisition
The LPASS WSA/RX/TX/VA macro and Qualcomm SoundWire drivers request clocks whose providers (va-macro fsgen, q6prm clock controller under the ADSP GPR service) can register after the consumers probe. Clock-provider registration does not trigger deferred-probe retries, so consumers stay deferred indefinitely. Adds a bounded retry
(60 x 500 ms) around the devm_clk_get calls in these drivers.

Both pass scripts/checkpatch.pl with no errors; the DTB builds cleanly. The DT addition is for the v7.5 merge window; patch 2 is a fix that could go into v7.4-rc if the maintainers see fit.

author
#1 lore raw

PATCH 1/2 arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA

arch/arm64/boot/dts/qcom/Makefile | 1 +

 .../x1p42100-asus-vivobook-16-x1607qa.dts     | 239 ++++++++++++++++++
 2 files changed, 240 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts
arch/arm64/boot/dts/qcom/Makefile +1 -0
index 88230c4e00e..7332a73dbac 100644
@@ -509,6 +509,7 @@ x1e80100-qcp-el2-dtbs	:= x1e80100-qcp.dtb x1-el2.dtbo
 dtb-$(CONFIG_ARCH_QCOM)	+= x1e80100-qcp.dtb x1e80100-qcp-el2.dtb
 x1p42100-asus-vivobook-s15-el2-dtbs	:= x1p42100-asus-vivobook-s15.dtb x1-el2.dtbo
 dtb-$(CONFIG_ARCH_QCOM)	+= x1p42100-asus-vivobook-s15.dtb x1p42100-asus-vivobook-s15-el2.dtb
+dtb-$(CONFIG_ARCH_QCOM)	+= x1p42100-asus-vivobook-16-x1607qa.dtb
 x1p42100-asus-zenbook-a14-el2-dtbs	:= x1p42100-asus-zenbook-a14.dtb x1-el2.dtbo
 dtb-$(CONFIG_ARCH_QCOM)	+= x1p42100-asus-zenbook-a14.dtb x1p42100-asus-zenbook-a14-el2.dtb
 x1p42100-asus-zenbook-a14-lcd-el2-dtbs	:= x1p42100-asus-zenbook-a14-lcd.dtb x1-el2.dtbo
arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts new file +239 -0

239 lines not on this page · raw message

Signature · 1 line
2.55.0
author
#2 lore raw

PATCH 2/2 ASoC: qcom: lpass macro / soundwire: retry deferred clock acquisition

drivers/soundwire/qcom.c | 37 +++++++++++++++++++++++-

 sound/soc/codecs/lpass-rx-macro.c  | 45 ++++++++++++++++++++++++++----
 sound/soc/codecs/lpass-tx-macro.c  | 45 ++++++++++++++++++++++++++----
 sound/soc/codecs/lpass-va-macro.c  | 43 +++++++++++++++++++++++++---
 sound/soc/codecs/lpass-wsa-macro.c | 45 ++++++++++++++++++++++++++----
 5 files changed, 195 insertions(+), 20 deletions(-)
drivers/soundwire/qcom.c +36 -1
index 6e0c5fb10ef..cb50cf239cd 100644
@@ -21,6 +21,41 @@
 #include <sound/pcm_params.h>
 #include <sound/soc.h>
 #include "bus.h"
+#include <linux/delay.h>
+
+/*
+ * Bounded retry for deferred clock providers. Clock-provider registration
+ * does not trigger deferred-probe retries, so a consumer that loses the
+ * probe-order race stays deferred forever. Wait up to 30 s for providers
+ * that are registered milliseconds later.
+ */
+static struct clk *clk_get_retry(struct device *dev, const char *id)
+{
+	struct clk *c;
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = devm_clk_get(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}
+
+static struct clk *clk_get_retry_optional(struct device *dev, const char *id)
+{
+	struct clk *c;
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = devm_clk_get_optional(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}
 
 #define SWRM_COMP_SW_RESET					0x008
 #define SWRM_COMP_STATUS					0x014
@@ -1669,7 +1704,7 @@ static int qcom_swrm_probe(struct platform_device *pdev)
 		goto err_init;
 	}
 
-	ctrl->hclk = devm_clk_get(dev, "iface");
+	ctrl->hclk = clk_get_retry(dev, "iface");
 	if (IS_ERR(ctrl->hclk)) {
 		ret = dev_err_probe(dev, PTR_ERR(ctrl->hclk), "unable to get iface clock\n");
 		goto err_init;
sound/soc/codecs/lpass-rx-macro.c +40 -5

71 lines not on this page · raw message

sound/soc/codecs/lpass-tx-macro.c +40 -5

71 lines not on this page · raw message

sound/soc/codecs/lpass-va-macro.c +39 -4

67 lines not on this page · raw message

sound/soc/codecs/lpass-wsa-macro.c +40 -5

71 lines not on this page · raw message

Signature · 1 line
2.55.0
#3 lore raw

Re: [PATCH 2/2] ASoC: qcom: lpass macro / soundwire: retry deferred clock acquisition

Thank you for your contribution! Sashiko AI review found 4 potential issues to consider: - [High] ASoC: qcom: 30s sleep in clk_get_retry() stalls sequential probe - [High] soundwire: qcom: unused…

Thank you for your contribution! Sashiko AI review found 4 potential issues to consider:
- [High] ASoC: qcom: 30s sleep in clk_get_retry() stalls sequential probe
- [High] soundwire: qcom: unused clk_get_retry_optional() breaks -Werror build
- [High] ASoC: qcom: missing Signed-off-by trailer and commit message body
- [Low] ASoC: qcom: duplicate clk_get_retry() helpers across five drivers
It also noticed 1 related pre-existing issue this patch does not introduce:
- [High] soundwire: qcom: ignored clk_prepare_enable() return values [1] --

commit e7d8a177bfe78eb7a13933e19bc2397f7ed88249
Author: yass27106 <[email protected]>

Quoted 8 lines

ASoC: qcom: lpass macro / soundwire: retry deferred clock acquisition

drivers/soundwire/qcom.c | 37 +++++++++++++++++++++++-

 sound/soc/codecs/lpass-rx-macro.c  | 45 ++++++++++++++++++++++++++----
 sound/soc/codecs/lpass-tx-macro.c  | 45 ++++++++++++++++++++++++++----
 sound/soc/codecs/lpass-va-macro.c  | 43 +++++++++++++++++++++++++---
 sound/soc/codecs/lpass-wsa-macro.c | 45 ++++++++++++++++++++++++++----
 5 files changed, 195 insertions(+), 20 deletions(-)

[Severity: High]
This commit is missing a Signed-off-by trailer and a changelog description explaining the problem and the reason for the change; the commit body only contains a diffstat.

Quoted 19 lines
drivers/soundwire/qcom.c +11 -0
index c31d921f679f9..afb71624dae2a 100644
@@ -21,6 +21,41 @@
 #include <sound/pcm_params.h>
 #include <sound/soc.h>
 #include "bus.h"
+#include <linux/delay.h>
+
+/*
+ * Bounded retry for deferred clock providers. Clock-provider registration
+ * does not trigger deferred-probe retries, so a consumer that loses the
+ * probe-order race stays deferred forever. Wait up to 30 s for providers
+ * that are registered milliseconds later.
+ */
+static struct clk *clk_get_retry(struct device *dev, const char *id)
+{
+	struct clk *c;

drivers/soundwire/qcom.c line 44

Quoted 10 lines
drivers/soundwire/qcom.c +10 -0
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = devm_clk_get(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}

[Severity: High]
Won't sleeping for 30 seconds in clk_get_retry() and clk_get_retry_optional() on -EPROBE_DEFER stall the same thread that needs to probe the clock provider?

When any clock provider finishes probing, really_probe() -> driver_bound() calls driver_deferred_probe_trigger() to schedule deferred_probe_work. Because none of these drivers set PROBE_PREFER_ASYNCHRONOUS, both initial probing in do_initcalls() and retries in deferred_probe_work_func() run sequentially on a single thread.

In both link order and Device Tree node order, consumers are queued before their suppliers: wsa_macro_probe(), rx_macro_probe(), and tx_macro_probe() request the fsgen clock registered by va_macro_probe(), and qcom_swrm_probe() requests the iface clock registered by the macro drivers. Sleeping inside the consumer's probe callback blocks the initcall or deferred_probe_work thread from advancing to probe the supplier, guaranteeing the clock cannot appear during the 30-second sleep while holding device_lock(dev) (and active power domains in va_macro_probe()).

Quoted 4 lines
drivers/soundwire/qcom.c +4 -0
+
+static struct clk *clk_get_retry_optional(struct device *dev, const char *id)
+{
+	struct clk *c;

drivers/soundwire/qcom.c line 58

Quoted 10 lines
drivers/soundwire/qcom.c +10 -0
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = devm_clk_get_optional(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}

[Severity: High]
Does clk_get_retry_optional() have any callers in drivers/soundwire/qcom.c? qcom_swrm_probe() only calls clk_get_retry(), so defining clk_get_retry_optional() here triggers a -Wunused-function warning and breaks builds with CONFIG_WERROR=y.

drivers/soundwire/qcom.c static int qcom_swrm_probe(struct platform_device *pdev) · line 1710

Quoted 9 lines
drivers/soundwire/qcom.c +1 -1
@@ -1669,7 +1704,7 @@ static int qcom_swrm_probe(struct platform_device *pdev)
 		goto err_init;
 	}
 
-	ctrl->hclk = devm_clk_get(dev, "iface");
+	ctrl->hclk = clk_get_retry(dev, "iface");
 	if (IS_ERR(ctrl->hclk)) {
 		ret = dev_err_probe(dev, PTR_ERR(ctrl->hclk), "unable to get iface clock\n");
 		goto err_init;

[Severity: High]
This problem wasn't introduced by this patch, but clk_prepare_enable() on ctrl->hclk is called without checking its return value in qcom_swrm_probe(), qcom_swrm_irq_handler(), and swrm_runtime_resume() [1]:

drivers/soundwire/qcom.c:qcom_swrm_irq_handler() {
	...
	clk_prepare_enable(ctrl->hclk);

	ctrl->reg_read(ctrl, ctrl->reg_layout[SWRM_REG_INTERRUPT_STATUS],
		       &intr_sts);
	...
}

If clk_prepare_enable() fails, subsequent MMIO reads and writes access unclocked SoundWire controller registers, triggering a synchronous external abort on Qualcomm platforms.

Quoted 33 lines
sound/soc/codecs/lpass-rx-macro.c +25 -0
index ab8a1c2b0489b..c953054eb7a38 100644
@@ -18,6 +18,41 @@
 #include <linux/clk-provider.h>
 
 #include "lpass-macro-common.h"
+#include <linux/delay.h>
+
+/*
+ * Bounded retry for deferred clock providers. Clock-provider registration
+ * does not trigger deferred-probe retries, so a consumer that loses the
+ * probe-order race stays deferred forever. Wait up to 30 s for providers
+ * that are registered milliseconds later.
+ */
+static struct clk *clk_get_retry(struct device *dev, const char *id)
+{
+	struct clk *c;
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = devm_clk_get(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}
+
+static struct clk *clk_get_retry_optional(struct device *dev, const char *id)
+{
+	struct clk *c;

sound/soc/codecs/lpass-rx-macro.c line 55

Quoted 10 lines
sound/soc/codecs/lpass-rx-macro.c +10 -0
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = devm_clk_get_optional(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}

[Severity: Low]
clk_get_retry() and clk_get_retry_optional() are duplicated verbatim across drivers/soundwire/qcom.c, lpass-rx-macro.c, lpass-tx-macro.c, lpass-va-macro.c, and lpass-wsa-macro.c, even though the four LPASS macro drivers already share lpass-macro-common.h.

[1] https://sashiko.dev/#/bug/linux-f65cddc9-08ff-4531-9acf-76981d74d914

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
maintainer
#4 lore raw

Re: [PATCH 2/2] ASoC: qcom: lpass macro / soundwire: retry deferred clock acquisition

In reply to yass27106
Quoted 6 lines

drivers/soundwire/qcom.c | 37 +++++++++++++++++++++++-

 sound/soc/codecs/lpass-rx-macro.c  | 45 ++++++++++++++++++++++++++----
 sound/soc/codecs/lpass-tx-macro.c  | 45 ++++++++++++++++++++++++++----
 sound/soc/codecs/lpass-va-macro.c  | 43 +++++++++++++++++++++++++---
 sound/soc/codecs/lpass-wsa-macro.c | 45 ++++++++++++++++++++++++++----
 5 files changed, 195 insertions(+), 20 deletions(-)

You've not provided a Signed-off-by for this so I can't do anything with it, please see Documentation/process/submitting-patches.rst for details on what this is and why it's important.

There's also no changelog here.

drivers/soundwire/qcom.c line 35

Quoted 10 lines
drivers/soundwire/qcom.c +10 -0
+/*
+ * Bounded retry for deferred clock providers. Clock-provider registration
+ * does not trigger deferred-probe retries, so a consumer that loses the
+ * probe-order race stays deferred forever. Wait up to 30 s for providers
+ * that are registered milliseconds later.
+ */
+static struct clk *clk_get_retry(struct device *dev, const char *id)
+{
+	struct clk *c;
+	int i;

This obviously isn't something that should be open coded in drivers, this is going to be happening all over the place. The clock API and driver core need to be adjusted so that we trigger deferred probe runs when new resources appear.

Signature · 1 line
Mark Brown <[email protected]>
#5 lore raw

Re: [PATCH 2/2] ASoC: qcom: lpass macro / soundwire: retry deferred clock acquisition

In reply to yass27106

On 11/13/26 1:24 PM, yass27106 wrote:

Please explain the problem, its hard to review this without a commit log.

--srini

Quoted 367 lines

drivers/soundwire/qcom.c | 37 +++++++++++++++++++++++-

 sound/soc/codecs/lpass-rx-macro.c  | 45 ++++++++++++++++++++++++++----
 sound/soc/codecs/lpass-tx-macro.c  | 45 ++++++++++++++++++++++++++----
 sound/soc/codecs/lpass-va-macro.c  | 43 +++++++++++++++++++++++++---
 sound/soc/codecs/lpass-wsa-macro.c | 45 ++++++++++++++++++++++++++----
 5 files changed, 195 insertions(+), 20 deletions(-)
drivers/soundwire/qcom.c +36 -1
index 6e0c5fb10ef..cb50cf239cd 100644
@@ -21,6 +21,41 @@
 #include <sound/pcm_params.h>
 #include <sound/soc.h>
 #include "bus.h"
+#include <linux/delay.h>
+
+/*
+ * Bounded retry for deferred clock providers. Clock-provider registration
+ * does not trigger deferred-probe retries, so a consumer that loses the
+ * probe-order race stays deferred forever. Wait up to 30 s for providers
+ * that are registered milliseconds later.
+ */
+static struct clk *clk_get_retry(struct device *dev, const char *id)
+{
+	struct clk *c;
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = devm_clk_get(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}
+
+static struct clk *clk_get_retry_optional(struct device *dev, const char *id)
+{
+	struct clk *c;
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = devm_clk_get_optional(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}
 
 #define SWRM_COMP_SW_RESET					0x008
 #define SWRM_COMP_STATUS					0x014
@@ -1669,7 +1704,7 @@ static int qcom_swrm_probe(struct platform_device *pdev)
 		goto err_init;
 	}
 
-	ctrl->hclk = devm_clk_get(dev, "iface");
+	ctrl->hclk = clk_get_retry(dev, "iface");
 	if (IS_ERR(ctrl->hclk)) {
 		ret = dev_err_probe(dev, PTR_ERR(ctrl->hclk), "unable to get iface clock\n");
 		goto err_init;
sound/soc/codecs/lpass-rx-macro.c +40 -5
index c41eb8de616..5d893960dd8 100644
@@ -18,6 +18,41 @@
 #include <linux/clk-provider.h>
 
 #include "lpass-macro-common.h"
+#include <linux/delay.h>
+
+/*
+ * Bounded retry for deferred clock providers. Clock-provider registration
+ * does not trigger deferred-probe retries, so a consumer that loses the
+ * probe-order race stays deferred forever. Wait up to 30 s for providers
+ * that are registered milliseconds later.
+ */
+static struct clk *clk_get_retry(struct device *dev, const char *id)
+{
+	struct clk *c;
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = devm_clk_get(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}
+
+static struct clk *clk_get_retry_optional(struct device *dev, const char *id)
+{
+	struct clk *c;
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = devm_clk_get_optional(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}
 
 #define CDC_RX_TOP_TOP_CFG0		(0x0000)
 #define CDC_RX_TOP_SWR_CTRL		(0x0008)
@@ -3780,25 +3815,25 @@ static int rx_macro_probe(struct platform_device *pdev)
 	if (!rx)
 		return -ENOMEM;
 
-	rx->macro = devm_clk_get_optional(dev, "macro");
+	rx->macro = clk_get_retry_optional(dev, "macro");
 	if (IS_ERR(rx->macro))
 		return dev_err_probe(dev, PTR_ERR(rx->macro), "unable to get macro clock\n");
 
-	rx->dcodec = devm_clk_get_optional(dev, "dcodec");
+	rx->dcodec = clk_get_retry_optional(dev, "dcodec");
 	if (IS_ERR(rx->dcodec))
 		return dev_err_probe(dev, PTR_ERR(rx->dcodec), "unable to get dcodec clock\n");
 
-	rx->mclk = devm_clk_get(dev, "mclk");
+	rx->mclk = clk_get_retry(dev, "mclk");
 	if (IS_ERR(rx->mclk))
 		return dev_err_probe(dev, PTR_ERR(rx->mclk), "unable to get mclk clock\n");
 
 	if (flags & LPASS_MACRO_FLAG_HAS_NPL_CLOCK) {
-		rx->npl = devm_clk_get(dev, "npl");
+		rx->npl = clk_get_retry(dev, "npl");
 		if (IS_ERR(rx->npl))
 			return dev_err_probe(dev, PTR_ERR(rx->npl), "unable to get npl clock\n");
 	}
 
-	rx->fsgen = devm_clk_get(dev, "fsgen");
+	rx->fsgen = clk_get_retry(dev, "fsgen");
 	if (IS_ERR(rx->fsgen))
 		return dev_err_probe(dev, PTR_ERR(rx->fsgen), "unable to get fsgen clock\n");
 
sound/soc/codecs/lpass-tx-macro.c +40 -5
index 6deaaabe43a..4b8635cc2b2 100644
@@ -16,6 +16,41 @@
 #include <linux/clk-provider.h>
 
 #include "lpass-macro-common.h"
+#include <linux/delay.h>
+
+/*
+ * Bounded retry for deferred clock providers. Clock-provider registration
+ * does not trigger deferred-probe retries, so a consumer that loses the
+ * probe-order race stays deferred forever. Wait up to 30 s for providers
+ * that are registered milliseconds later.
+ */
+static struct clk *clk_get_retry(struct device *dev, const char *id)
+{
+	struct clk *c;
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = devm_clk_get(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}
+
+static struct clk *clk_get_retry_optional(struct device *dev, const char *id)
+{
+	struct clk *c;
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = devm_clk_get_optional(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}
 
 #define CDC_TX_CLK_RST_CTRL_MCLK_CONTROL (0x0000)
 #define CDC_TX_MCLK_EN_MASK		BIT(0)
@@ -2258,25 +2293,25 @@ static int tx_macro_probe(struct platform_device *pdev)
 
 	tx->data = device_get_match_data(dev);
 
-	tx->macro = devm_clk_get_optional(dev, "macro");
+	tx->macro = clk_get_retry_optional(dev, "macro");
 	if (IS_ERR(tx->macro))
 		return dev_err_probe(dev, PTR_ERR(tx->macro), "unable to get macro clock\n");
 
-	tx->dcodec = devm_clk_get_optional(dev, "dcodec");
+	tx->dcodec = clk_get_retry_optional(dev, "dcodec");
 	if (IS_ERR(tx->dcodec))
 		return dev_err_probe(dev, PTR_ERR(tx->dcodec), "unable to get dcodec clock\n");
 
-	tx->mclk = devm_clk_get(dev, "mclk");
+	tx->mclk = clk_get_retry(dev, "mclk");
 	if (IS_ERR(tx->mclk))
 		return dev_err_probe(dev, PTR_ERR(tx->mclk), "unable to get mclk clock\n");
 
 	if (tx->data->flags & LPASS_MACRO_FLAG_HAS_NPL_CLOCK) {
-		tx->npl = devm_clk_get(dev, "npl");
+		tx->npl = clk_get_retry(dev, "npl");
 		if (IS_ERR(tx->npl))
 			return dev_err_probe(dev, PTR_ERR(tx->npl), "unable to get npl clock\n");
 	}
 
-	tx->fsgen = devm_clk_get(dev, "fsgen");
+	tx->fsgen = clk_get_retry(dev, "fsgen");
 	if (IS_ERR(tx->fsgen))
 		return dev_err_probe(dev, PTR_ERR(tx->fsgen), "unable to get fsgen clock\n");
 
sound/soc/codecs/lpass-va-macro.c +39 -4
index 03d6434a4a1..fda1bbada11 100644
@@ -19,6 +19,41 @@
 #include <sound/tlv.h>
 
 #include "lpass-macro-common.h"
+#include <linux/delay.h>
+
+/*
+ * Bounded retry for deferred clock providers. Clock-provider registration
+ * does not trigger deferred-probe retries, so a consumer that loses the
+ * probe-order race stays deferred forever. Wait up to 30 s for providers
+ * that are registered milliseconds later.
+ */
+static struct clk *clk_get_retry(struct device *dev, const char *id)
+{
+	struct clk *c;
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = devm_clk_get(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}
+
+static struct clk *clk_get_retry_optional(struct device *dev, const char *id)
+{
+	struct clk *c;
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = devm_clk_get_optional(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}
 
 /* VA macro registers */
 #define CDC_VA_CLK_RST_CTRL_MCLK_CONTROL	(0x0000)
@@ -1557,15 +1592,15 @@ static int va_macro_probe(struct platform_device *pdev)
 
 	va->dev = dev;
 
-	va->macro = devm_clk_get_optional(dev, "macro");
+	va->macro = clk_get_retry_optional(dev, "macro");
 	if (IS_ERR(va->macro))
 		return dev_err_probe(dev, PTR_ERR(va->macro), "unable to get macro clock\n");
 
-	va->dcodec = devm_clk_get_optional(dev, "dcodec");
+	va->dcodec = clk_get_retry_optional(dev, "dcodec");
 	if (IS_ERR(va->dcodec))
 		return dev_err_probe(dev, PTR_ERR(va->dcodec), "unable to get dcodec clock\n");
 
-	va->mclk = devm_clk_get(dev, "mclk");
+	va->mclk = clk_get_retry(dev, "mclk");
 	if (IS_ERR(va->mclk))
 		return dev_err_probe(dev, PTR_ERR(va->mclk), "unable to get mclk clock\n");
 
@@ -1610,7 +1645,7 @@ static int va_macro_probe(struct platform_device *pdev)
 		goto err;
 
 	if (va->has_npl_clk) {
-		va->npl = devm_clk_get(dev, "npl");
+		va->npl = clk_get_retry(dev, "npl");
 		if (IS_ERR(va->npl)) {
 			ret = PTR_ERR(va->npl);
 			goto err;
sound/soc/codecs/lpass-wsa-macro.c +40 -5
index 899c8bee464..437a0876a8b 100644
@@ -19,6 +19,41 @@
 
 #include "lpass-macro-common.h"
 #include "lpass-wsa-macro.h"
+#include <linux/delay.h>
+
+/*
+ * Bounded retry for deferred clock providers. Clock-provider registration
+ * does not trigger deferred-probe retries, so a consumer that loses the
+ * probe-order race stays deferred forever. Wait up to 30 s for providers
+ * that are registered milliseconds later.
+ */
+static struct clk *clk_get_retry(struct device *dev, const char *id)
+{
+	struct clk *c;
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = devm_clk_get(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}
+
+static struct clk *clk_get_retry_optional(struct device *dev, const char *id)
+{
+	struct clk *c;
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = devm_clk_get_optional(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}
 
 #define CDC_WSA_CLK_RST_CTRL_MCLK_CONTROL	(0x0000)
 #define CDC_WSA_MCLK_EN_MASK			BIT(0)
@@ -2701,25 +2736,25 @@ static int wsa_macro_probe(struct platform_device *pdev)
 	if (!wsa)
 		return -ENOMEM;
 
-	wsa->macro = devm_clk_get_optional(dev, "macro");
+	wsa->macro = clk_get_retry_optional(dev, "macro");
 	if (IS_ERR(wsa->macro))
 		return dev_err_probe(dev, PTR_ERR(wsa->macro), "unable to get macro clock\n");
 
-	wsa->dcodec = devm_clk_get_optional(dev, "dcodec");
+	wsa->dcodec = clk_get_retry_optional(dev, "dcodec");
 	if (IS_ERR(wsa->dcodec))
 		return dev_err_probe(dev, PTR_ERR(wsa->dcodec), "unable to get dcodec clock\n");
 
-	wsa->mclk = devm_clk_get(dev, "mclk");
+	wsa->mclk = clk_get_retry(dev, "mclk");
 	if (IS_ERR(wsa->mclk))
 		return dev_err_probe(dev, PTR_ERR(wsa->mclk), "unable to get mclk clock\n");
 
 	if (flags & LPASS_MACRO_FLAG_HAS_NPL_CLOCK) {
-		wsa->npl = devm_clk_get(dev, "npl");
+		wsa->npl = clk_get_retry(dev, "npl");
 		if (IS_ERR(wsa->npl))
 			return dev_err_probe(dev, PTR_ERR(wsa->npl), "unable to get npl clock\n");
 	}
 
-	wsa->fsgen = devm_clk_get(dev, "fsgen");
+	wsa->fsgen = clk_get_retry(dev, "fsgen");
 	if (IS_ERR(wsa->fsgen))
 		return dev_err_probe(dev, PTR_ERR(wsa->fsgen), "unable to get fsgen clock\n");
 
#6 lore raw

Re: [PATCH 1/2] arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA

In reply to yass27106
Thank you for your contribution! Sashiko AI review found 7 potential issues to consider: - [High] arm64: dts: qcom: missing Signed-off-by trailer and commit message body - [Medium] arm64: dts: qcom…

Thank you for your contribution! Sashiko AI review found 7 potential issues to consider:
- [High] arm64: dts: qcom: missing Signed-off-by trailer and commit message body
- [Medium] arm64: dts: qcom: missing /delete-node/ for pmc8380_6 on Purwa X1P42100
- [Medium] arm64: dts: qcom: missing dmic-sample-rate and vdd-micb-supply on lpass_vamacro
- [Medium] arm64: dts: qcom: Vivobook 16 DT inherits Vivobook S 15 panel and board dtsi
- [Medium] arm64: dts: qcom: Makefile missing x1-el2.dtbo target and alphabetical order
- [Low] arm64: dts: qcom: undocumented compatible asus,vivobook-16-x1607qa in bindings
- [Low] arm64: dts: qcom: split root nodes, unsorted labels, and gpu override style
--

commit 273985d644ee175b794950960be28ab5824da749
Author: yass27106 <[email protected]>

Quoted 6 lines

arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA

arch/arm64/boot/dts/qcom/Makefile | 1 +

 .../x1p42100-asus-vivobook-16-x1607qa.dts     | 239 ++++++++++++++++++
 2 files changed, 240 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts

[Severity: High]
This commit is missing a Signed-off-by: trailer, uses a handle instead of a real name in the Author header, and has a raw diffstat in place of a commit description explaining the hardware and supported components.

arch/arm64/boot/dts/qcom/Makefile x1e80100-qcp-el2-dtbs := x1e80100-qcp.dtb x1-el2.dtbo · line 515

Quoted 12 lines
arch/arm64/boot/dts/qcom/Makefile +1 -0
index 88230c4e00ea9..7332a73dbac71 100644
@@ -509,6 +509,7 @@ x1e80100-qcp-el2-dtbs	:= x1e80100-qcp.dtb x1-el2.dtbo
 dtb-$(CONFIG_ARCH_QCOM)	+= x1e80100-qcp.dtb x1e80100-qcp-el2.dtb
 x1p42100-asus-vivobook-s15-el2-dtbs	:= x1p42100-asus-vivobook-s15.dtb x1-el2.dtbo
 dtb-$(CONFIG_ARCH_QCOM)	+= x1p42100-asus-vivobook-s15.dtb x1p42100-asus-vivobook-s15-el2.dtb
+dtb-$(CONFIG_ARCH_QCOM)	+= x1p42100-asus-vivobook-16-x1607qa.dtb
 x1p42100-asus-zenbook-a14-el2-dtbs	:= x1p42100-asus-zenbook-a14.dtb x1-el2.dtbo
 dtb-$(CONFIG_ARCH_QCOM)	+= x1p42100-asus-zenbook-a14.dtb x1p42100-asus-zenbook-a14-el2.dtb
 x1p42100-asus-zenbook-a14-lcd-el2-dtbs	:= x1p42100-asus-zenbook-a14-lcd.dtb x1-el2.dtbo

[Severity: Medium]
Should this also define x1p42100-asus-vivobook-16-x1607qa-el2-dtbs and add x1p42100-asus-vivobook-16-x1607qa-el2.dtb like the other X1E/X1P boards? Without the composite rule, the build neither produces the -el2.dtb image nor compiles the base DTB with symbol metadata for x1-el2.dtbo, which is needed for EL2 boot. Also, x1p42100-asus-vivobook-16-x1607qa belongs before x1p42100-asus-vivobook-s15 in alphabetical order.

Quoted 7 lines
arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts new file +1 -0
new file mode 100644
index 0000000000000..fc572d779b311
@@ -0,0 +1,239 @@
+// SPDX-License-Identifier: BSD-3-Clause

arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts line 11

Quoted 10 lines
arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts new file +10 -0
+/* Hybrid device tree for ASUS Vivobook 16 X1607QA (X1P-42-100).
+ * Base: proven x1p42100-asus-vivobook-s15 (panel, USB, boot path).
+ * Transplanted from x126100-asus-vivobook-16: audio stack
+ * (WCD9385 codec, WSA8845 speakers, soundwire, sndcard) + firmware paths.
+ */
+
+/dts-v1/;
+
+#include "purwa.dtsi"
+#include "x1-asus-vivobook-s15.dtsi"

[Severity: Medium]
Does including x1-asus-vivobook-s15.dtsi without deleting &pmc8380_6, &pmc8380_6_thermal, and &pmc8380_6_die_temp leave the third CPU cluster's PMIC enabled on Purwa? x1-asus-vivobook-s15.dtsi pulls in hamoa-pmics.dtsi, so on 8-core X1P42100 where that PMIC is unpopulated, the SPMI, VADC, and thermal drivers will probe and poll a non-existent device at USID 6 unless those three nodes are deleted as in x1p42100-asus-vivobook-s15.dts.

[Severity: Medium]
Does including x1-asus-vivobook-s15.dtsi directly also leave the 16-inch 16:10 Vivobook 16 (X1607QA) configured with the Vivobook S 15's 15.6-inch 16:9 2880x1620 eDP panel ("samsung,atna56ac03", "samsung,atna33xc20") under &mdss_dp3 and other S5507-specific board definitions?

arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts line 15

Quoted 4 lines
arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts new file +4 -0
+
+/ {
+	model = "ASUS Vivobook 16 (X1607QA)";
+	compatible = "asus,vivobook-16-x1607qa", "qcom,x1p42100";

[Severity: Low]
"asus,vivobook-16-x1607qa" is not documented under the qcom,x1p42100 entry in Documentation/devicetree/bindings/arm/qcom.yaml, which causes make dtbs_check to fail.

[ ... ]

arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts line 55

Quoted 4 lines
arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts new file +4 -0
+&lpass_vamacro {
+	pinctrl-0 = <&dmic01_default>;
+	pinctrl-names = "default";
+};

[Severity: Medium]
Should &lpass_vamacro also specify qcom,dmic-sample-rate and vdd-micb-supply? Without them, va_macro_probe() logs an error ("qcom,dmic-sample-rate dt entry missing") and ASoC DAPM substitutes a dummy regulator for the vdd-micb widget instead of enabling the DMIC supply rail.

Quoted 4 lines
arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts new file +4 -0
+
+/ {
+	wcd938x: audio-codec {
+		compatible = "qcom,wcd9385-codec";

[ ... ]

arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts line 239

Quoted 7 lines

+&gpu {

arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts new file +6 -0
+	status = "okay";
+
+	zap-shader {
+		firmware-name = "qcom/x1p42100/ASUSTeK/vivobook-16-x1607qa/qcdxkmsucpurwa.mbn";
+	};
+};

[Severity: Low]
This isn't a bug, but the second / { ... }; block above should be merged into the root node at the top of the file, the &label overrides should be sorted alphabetically, and the zap shader override can reference &gpu_zap_shader directly instead of repeating status = "okay" on &gpu (which is already enabled in x1-asus-vivobook-s15.dtsi).

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#7 lore raw

Re: [PATCH 1/2] arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA

In reply to yass27106
Quoted 1 line · On 13/11/2026 14:24, yass27106 wrote:

arch/arm64/boot/dts/qcom/Makefile | 1 +

Please run scripts/checkpatch.pl on the patches and fix reported warnings. After that, run also 'scripts/checkpatch.pl --strict' on the patches and (probably) fix more warnings. Some warnings can be ignored, especially from --strict run, but the code here looks like it needs a fix. Feel free to get in touch if the warning is not clear.

Please read submitting patches document to understand DCO.

Looks like completely corrupted anonymous patch.

Quoted 27 lines
 .../x1p42100-asus-vivobook-16-x1607qa.dts     | 239 ++++++++++++++++++
 2 files changed, 240 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts
arch/arm64/boot/dts/qcom/Makefile +1 -0
index 88230c4e00e..7332a73dbac 100644
@@ -509,6 +509,7 @@ x1e80100-qcp-el2-dtbs	:= x1e80100-qcp.dtb x1-el2.dtbo
 dtb-$(CONFIG_ARCH_QCOM)	+= x1e80100-qcp.dtb x1e80100-qcp-el2.dtb
 x1p42100-asus-vivobook-s15-el2-dtbs	:= x1p42100-asus-vivobook-s15.dtb x1-el2.dtbo
 dtb-$(CONFIG_ARCH_QCOM)	+= x1p42100-asus-vivobook-s15.dtb x1p42100-asus-vivobook-s15-el2.dtb
+dtb-$(CONFIG_ARCH_QCOM)	+= x1p42100-asus-vivobook-16-x1607qa.dtb
 x1p42100-asus-zenbook-a14-el2-dtbs	:= x1p42100-asus-zenbook-a14.dtb x1-el2.dtbo
 dtb-$(CONFIG_ARCH_QCOM)	+= x1p42100-asus-zenbook-a14.dtb x1p42100-asus-zenbook-a14-el2.dtb
 x1p42100-asus-zenbook-a14-lcd-el2-dtbs	:= x1p42100-asus-zenbook-a14-lcd.dtb x1-el2.dtbo
arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts new file +5 -0
new file mode 100644
index 00000000000..fc572d779b3
@@ -0,0 +1,239 @@
+// SPDX-License-Identifier: BSD-3-Clause
+/* Hybrid device tree for ASUS Vivobook 16 X1607QA (X1P-42-100).
+ * Base: proven x1p42100-asus-vivobook-s15 (panel, USB, boot path).
+ * Transplanted from x126100-asus-vivobook-16: audio stack
+ * (WCD9385 codec, WSA8845 speakers, soundwire, sndcard) + firmware paths.

arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts line 15

Quoted 10 lines
arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts new file +10 -0
+ */
+
+/dts-v1/;
+
+#include "purwa.dtsi"
+#include "x1-asus-vivobook-s15.dtsi"
+
+/ {
+	model = "ASUS Vivobook 16 (X1607QA)";
+	compatible = "asus,vivobook-16-x1607qa", "qcom,x1p42100";

Missing bindings.

Best regards,
Krzysztof

#8 lore raw

Re: [PATCH 1/2] arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA — v2 series

Hi Krzysztof, hi all,

v2 of the series, addressing your review of v1:

- The binding documentation is now a separate patch (dt-bindings first), as required by Documentation/devicetree/bindings/submitting-patches.rst.
- The board compatible 'asus,vivobook-16-x1607qa' is documented in Documentation/devicetree/bindings/arm/qcom.yaml.
- scripts/checkpatch.pl passes with no errors on all patches; --strict leaves only the MAINTAINERS note on the new-file patch.
- The DCO sign-off is now a real-name sign-off; apologies for the pseudonymous v1.

Series:
[1/3] dt-bindings: qcom: document Asus Vivobook 16 X1607QA [2/3] arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA [3/3] ASoC: qcom: lpass macro / soundwire: retry deferred clock acquisition

Also open as pull request 1439 at github.com/qualcomm-linux/kernel.

Best regards,
Daniel Carter

#9 lore raw

PATCH v2 1/3 dt-bindings: qcom: document Asus Vivobook 16 X1607QA

Documentation/devicetree/bindings/arm/qcom.yaml | 1 +

 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/arm/qcom.yaml +1 -0
index 121ca557ce1..d22f1b0b4ef 100644
@@ -1306,6 +1306,7 @@ properties:
 
       - items:
           - enum:
+              - asus,vivobook-16-x1607qa
               - asus,vivobook-s15-x1p4
               - hp,omnibook-x14-fe1
               - lenovo,thinkbook-16
Signature · 1 line
2.55.0
#10 lore raw

PATCH v2 2/3 arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA

arch/arm64/boot/dts/qcom/Makefile | 1 +

 .../x1p42100-asus-vivobook-16-x1607qa.dts     | 237 ++++++++++++++++++
 2 files changed, 238 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts
arch/arm64/boot/dts/qcom/Makefile +1 -0
index 88230c4e00e..7332a73dbac 100644
@@ -509,6 +509,7 @@ x1e80100-qcp-el2-dtbs	:= x1e80100-qcp.dtb x1-el2.dtbo
 dtb-$(CONFIG_ARCH_QCOM)	+= x1e80100-qcp.dtb x1e80100-qcp-el2.dtb
 x1p42100-asus-vivobook-s15-el2-dtbs	:= x1p42100-asus-vivobook-s15.dtb x1-el2.dtbo
 dtb-$(CONFIG_ARCH_QCOM)	+= x1p42100-asus-vivobook-s15.dtb x1p42100-asus-vivobook-s15-el2.dtb
+dtb-$(CONFIG_ARCH_QCOM)	+= x1p42100-asus-vivobook-16-x1607qa.dtb
 x1p42100-asus-zenbook-a14-el2-dtbs	:= x1p42100-asus-zenbook-a14.dtb x1-el2.dtbo
 dtb-$(CONFIG_ARCH_QCOM)	+= x1p42100-asus-zenbook-a14.dtb x1p42100-asus-zenbook-a14-el2.dtb
 x1p42100-asus-zenbook-a14-lcd-el2-dtbs	:= x1p42100-asus-zenbook-a14-lcd.dtb x1-el2.dtbo
arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts new file +237 -0

237 lines not on this page · raw message

Signature · 1 line
2.55.0
#11 lore raw

PATCH v2 3/3 ASoC: qcom: lpass macro / soundwire: retry deferred clock acquisition

drivers/soundwire/qcom.c | 37 +++++++++++++++++++++++-

 sound/soc/codecs/lpass-rx-macro.c  | 45 ++++++++++++++++++++++++++----
 sound/soc/codecs/lpass-tx-macro.c  | 45 ++++++++++++++++++++++++++----
 sound/soc/codecs/lpass-va-macro.c  | 43 +++++++++++++++++++++++++---
 sound/soc/codecs/lpass-wsa-macro.c | 45 ++++++++++++++++++++++++++----
 5 files changed, 195 insertions(+), 20 deletions(-)
drivers/soundwire/qcom.c +36 -1
index 6e0c5fb10ef..cb50cf239cd 100644
@@ -21,6 +21,41 @@
 #include <sound/pcm_params.h>
 #include <sound/soc.h>
 #include "bus.h"
+#include <linux/delay.h>
+
+/*
+ * Bounded retry for deferred clock providers. Clock-provider registration
+ * does not trigger deferred-probe retries, so a consumer that loses the
+ * probe-order race stays deferred forever. Wait up to 30 s for providers
+ * that are registered milliseconds later.
+ */
+static struct clk *clk_get_retry(struct device *dev, const char *id)
+{
+	struct clk *c;
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = devm_clk_get(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}
+
+static struct clk *clk_get_retry_optional(struct device *dev, const char *id)
+{
+	struct clk *c;
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = devm_clk_get_optional(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}
 
 #define SWRM_COMP_SW_RESET					0x008
 #define SWRM_COMP_STATUS					0x014
@@ -1669,7 +1704,7 @@ static int qcom_swrm_probe(struct platform_device *pdev)
 		goto err_init;
 	}
 
-	ctrl->hclk = devm_clk_get(dev, "iface");
+	ctrl->hclk = clk_get_retry(dev, "iface");
 	if (IS_ERR(ctrl->hclk)) {
 		ret = dev_err_probe(dev, PTR_ERR(ctrl->hclk), "unable to get iface clock\n");
 		goto err_init;
sound/soc/codecs/lpass-rx-macro.c +40 -5

71 lines not on this page · raw message

sound/soc/codecs/lpass-tx-macro.c +40 -5

71 lines not on this page · raw message

sound/soc/codecs/lpass-va-macro.c +39 -4

67 lines not on this page · raw message

sound/soc/codecs/lpass-wsa-macro.c +40 -5

71 lines not on this page · raw message

Signature · 1 line
2.55.0
#12 lore raw

Re: [PATCH v2 3/3] ASoC: qcom: lpass macro / soundwire: retry deferred clock acquisition

Thank you for your contribution! Sashiko AI review found 4 potential issues to consider: - [High] ASoC: qcom: 30s msleep() retry in probe stalls deferred_probe_work - [High] soundwire: qcom: unused…

Thank you for your contribution! Sashiko AI review found 4 potential issues to consider:
- [High] ASoC: qcom: 30s msleep() retry in probe stalls deferred_probe_work
- [High] soundwire: qcom: unused static clk_get_retry_optional() breaks Werror build
- [High] ASoC: qcom: missing Signed-off-by trailer and commit message body
- [Low] ASoC: qcom: clk_get_retry() helpers duplicated across five driver files
--

commit 9ed54c71b350e8398fe1839f5ec457bda202d8b0
Author: Daniel Carter <[email protected]>

Quoted 8 lines

ASoC: qcom: lpass macro / soundwire: retry deferred clock acquisition

drivers/soundwire/qcom.c | 37 +++++++++++++++++++++++-

 sound/soc/codecs/lpass-rx-macro.c  | 45 ++++++++++++++++++++++++++----
 sound/soc/codecs/lpass-tx-macro.c  | 45 ++++++++++++++++++++++++++----
 sound/soc/codecs/lpass-va-macro.c  | 43 +++++++++++++++++++++++++---
 sound/soc/codecs/lpass-wsa-macro.c | 45 ++++++++++++++++++++++++++----
 5 files changed, 195 insertions(+), 20 deletions(-)

[Severity: High]
This commit is missing a Signed-off-by: trailer, and the commit message body contains only a diffstat without explaining why this change is needed.

Quoted 19 lines
drivers/soundwire/qcom.c +11 -0
index c31d921f679f9..afb71624dae2a 100644
@@ -21,6 +21,41 @@
 #include <sound/pcm_params.h>
 #include <sound/soc.h>
 #include "bus.h"
+#include <linux/delay.h>
+
+/*
+ * Bounded retry for deferred clock providers. Clock-provider registration
+ * does not trigger deferred-probe retries, so a consumer that loses the
+ * probe-order race stays deferred forever. Wait up to 30 s for providers
+ * that are registered milliseconds later.
+ */
+static struct clk *clk_get_retry(struct device *dev, const char *id)
+{
+	struct clk *c;

drivers/soundwire/qcom.c line 44

Quoted 10 lines
drivers/soundwire/qcom.c +10 -0
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = devm_clk_get(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}

[Severity: High]
Does sleeping for 30 seconds in clk_get_retry() and clk_get_retry_optional() block the very probe thread needed to register the supplier clocks?

None of these drivers sets PROBE_PREFER_ASYNCHRONOUS, so both initcalls and deferred_probe_work_func() run .probe() callbacks sequentially on a single thread. The modified drivers also supply clocks to one another:
va_macro_probe() registers the fsgen clock consumed by rx_macro_probe(), tx_macro_probe(), and wsa_macro_probe(), while the macro drivers register the mclk clock consumed as iface by qcom_swrm_probe().

Because drivers/soundwire/ and wsa-macro are linked and ordered in device trees before va-macro, a consumer probing before va_macro_probe() (or q6prmcc) sleeps for the full 30 seconds on that single thread, preventing the supplier from probing and registering the clock until the loop gives up and returns -EPROBE_DEFER anyway. This stalls boot or deferred probing for 30 seconds per device and can expire driver_deferred_probe_timeout, while in va_macro_probe() sleeping on va->npl also leaves the va->pds power domains powered on for 30 seconds.

In addition, clock suppliers registered from a driver .probe() callback do trigger deferred probe retries via really_probe() -> driver_bound() -> driver_deferred_probe_trigger().

Quoted 18 lines
drivers/soundwire/qcom.c +14 -0
+
+static struct clk *clk_get_retry_optional(struct device *dev, const char *id)
+{
+	struct clk *c;
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = devm_clk_get_optional(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}
 
 #define SWRM_COMP_SW_RESET					0x008
 #define SWRM_COMP_STATUS					0x014

drivers/soundwire/qcom.c static int qcom_swrm_probe(struct platform_device *pdev) · line 1707

Quoted 5 lines
drivers/soundwire/qcom.c +1 -1
@@ -1669,7 +1704,7 @@ static int qcom_swrm_probe(struct platform_device *pdev)
 		goto err_init;
 	}
 
-	ctrl->hclk = devm_clk_get(dev, "iface");
+	ctrl->hclk = clk_get_retry(dev, "iface");

[Severity: High]
Does defining clk_get_retry_optional() in drivers/soundwire/qcom.c without any callers trigger a -Wunused-function warning and break builds with CONFIG_WERROR=y?

Quoted 33 lines
sound/soc/codecs/lpass-rx-macro.c +25 -0
index ab8a1c2b0489b..c953054eb7a38 100644
@@ -18,6 +18,41 @@
 #include <linux/clk-provider.h>
 
 #include "lpass-macro-common.h"
+#include <linux/delay.h>
+
+/*
+ * Bounded retry for deferred clock providers. Clock-provider registration
+ * does not trigger deferred-probe retries, so a consumer that loses the
+ * probe-order race stays deferred forever. Wait up to 30 s for providers
+ * that are registered milliseconds later.
+ */
+static struct clk *clk_get_retry(struct device *dev, const char *id)
+{
+	struct clk *c;
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = devm_clk_get(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}
+
+static struct clk *clk_get_retry_optional(struct device *dev, const char *id)
+{
+	struct clk *c;

sound/soc/codecs/lpass-rx-macro.c line 55

Quoted 10 lines
sound/soc/codecs/lpass-rx-macro.c +10 -0
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = devm_clk_get_optional(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}

[Severity: Low]
This isn't a bug, but clk_get_retry() and clk_get_retry_optional() are duplicated verbatim across five source files, four of which already share sound/soc/codecs/lpass-macro-common.h.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
#13 lore raw

Re: [PATCH v2 2/3] arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA

In reply to Daniel Carter
Thank you for your contribution! Sashiko AI review found 6 potential issues to consider: - [High] arm64: dts: qcom: missing Signed-off-by trailer and commit message body - [Medium] arm64: dts: qcom…

Thank you for your contribution! Sashiko AI review found 6 potential issues to consider:
- [High] arm64: dts: qcom: missing Signed-off-by trailer and commit message body
- [Medium] arm64: dts: qcom: missing /delete-node/ for pmc8380_6 on Purwa X1607QA
- [Medium] arm64: dts: qcom: missing qcom,dmic-sample-rate and vdd-micb-supply on vamacro
- [Medium] arm64: dts: qcom: missing x1-el2.dtbo target and &gpu_zap_shader reference
- [Medium] arm64: dts: qcom: x1p42100-asus-vivobook-16-x1607qa: wrong inherited eDP panel
- [Low] arm64: dts: qcom: split root node, unsorted nodes, and style violations in DTS
--

commit 0106da8e8437e65f83503717cf06104fc06ff24c
Author: Daniel Carter <[email protected]>

Quoted 12 lines

arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA

arch/arm64/boot/dts/qcom/Makefile | 1 +

 .../x1p42100-asus-vivobook-16-x1607qa.dts     | 237 ++++++++++++++++++
 2 files changed, 238 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts
arch/arm64/boot/dts/qcom/Makefile +0 -0
index 88230c4e00ea9..7332a73dbac71 100644

arch/arm64/boot/dts/qcom/Makefile x1e80100-qcp-el2-dtbs := x1e80100-qcp.dtb x1-el2.dtbo · line 514

Quoted 6 lines
arch/arm64/boot/dts/qcom/Makefile +1 -0
@@ -509,6 +509,7 @@ x1e80100-qcp-el2-dtbs	:= x1e80100-qcp.dtb x1-el2.dtbo
 dtb-$(CONFIG_ARCH_QCOM)	+= x1e80100-qcp.dtb x1e80100-qcp-el2.dtb
 x1p42100-asus-vivobook-s15-el2-dtbs	:= x1p42100-asus-vivobook-s15.dtb x1-el2.dtbo
 dtb-$(CONFIG_ARCH_QCOM)	+= x1p42100-asus-vivobook-s15.dtb x1p42100-asus-vivobook-s15-el2.dtb
+dtb-$(CONFIG_ARCH_QCOM)	+= x1p42100-asus-vivobook-16-x1607qa.dtb
 x1p42100-asus-zenbook-a14-el2-dtbs	:= x1p42100-asus-zenbook-a14.dtb x1-el2.dtbo
 dtb-$(CONFIG_ARCH_QCOM)	+= x1p42100-asus-zenbook-a14.dtb x1p42100-asus-zenbook-a14-el2.dtb

[Severity: Medium]
Should this also define x1p42100-asus-vivobook-16-x1607qa-el2-dtbs with x1-el2.dtbo and build x1p42100-asus-vivobook-16-x1607qa-el2.dtb, sorted alphabetically before x1p42100-asus-vivobook-s15?

scripts/Makefile.dtbs only passes -@ to DTC for base DTBs referenced by a composite *-dtbs rule. Without the -el2-dtbs rule, neither the pre-merged -el2.dtb is built nor are __symbols__ emitted into the base DTB, so x1-el2.dtbo cannot be applied for EL2/KVM boot.

In addition, at the bottom of x1p42100-asus-vivobook-16-x1607qa.dts, the GPU zap-shader firmware is specified via a nested zap-shader child under &gpu (along with a redundant status = "okay" already set in x1-asus-vivobook-s15.dtsi) instead of referencing &gpu_zap_shader directly as x1p42100-asus-vivobook-s15.dts and x1-el2.dtso do.

arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts line 4

Quoted 10 lines
arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts new file +4 -0
new file mode 100644
index 0000000000000..0092ae3db9cc8
@@ -0,0 +1,237 @@
+// SPDX-License-Identifier: BSD-3-Clause
+/*
+ * Copyright (c) 2026, yass27106-hue <[email protected]>
+ */

[Severity: High]
The commit message is missing a Signed-off-by: trailer certifying the Developer's Certificate of Origin, and its body contains a pasted git diffstat instead of a description of the ASUS Vivobook 16 (X1607QA) hardware and why it shares x1-asus-vivobook-s15.dtsi. The copyright header here also uses a GitHub handle and noreply address rather than the author's name and routable email address.

arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts line 9

Quoted 5 lines
arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts new file +5 -0
+
+/dts-v1/;
+
+#include "purwa.dtsi"
+#include "x1-asus-vivobook-s15.dtsi"

[Severity: Medium]
Does this need to delete &pmc8380_6, &pmc8380_6_thermal, and &pmc8380_6_die_temp after including x1-asus-vivobook-s15.dtsi?

x1-asus-vivobook-s15.dtsi transitively includes hamoa-pmics.dtsi, which defines pmc8380_6 (SPMI USID 6), pmc8380_6_thermal, and pmc8380_6_die_temp for the third CPU cluster on 12-core X1E80100 SoCs. On 8-core X1P42100 (Purwa) platforms that cluster and its companion PMIC are unpopulated, so leaving these nodes enabled causes the SPMI PMIC, temp-alarm, GPIO, VADC, and thermal drivers to probe and poll absent hardware, just as x1p42100-asus-vivobook-s15.dts avoids with /delete-node/.

arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts line 9

Quoted 1 line
arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts new file +1 -0
+#include "x1-asus-vivobook-s15.dtsi"

[Severity: Medium]
Does the 16-inch Vivobook 16 (X1607QA) really use the 15.6-inch Samsung ATNA56AC03 panel inherited from x1-asus-vivobook-s15.dtsi?

x1-asus-vivobook-s15.dtsi configures the mdss_dp3 aux-bus panel node with:

arch/arm64/boot/dts/qcom/x1-asus-vivobook-s15.dtsi:

	aux-bus {
		panel {
			compatible = "samsung,atna56ac03", "samsung,atna33xc20";
			enable-gpios = <&pmc8380_3_gpios 4 GPIO_ACTIVE_HIGH>;
			power-supply = <&vreg_edp_3p3>;

Without overriding the panel node for this 16-inch (16:10) laptop, the board binds the panel-samsung-atna33xc20 driver for a 15.6-inch 2880x1620 (16:9) AMOLED panel with Samsung EL_ON3 power sequencing and DP AUX-only backlight control instead of the actual panel and backlight configuration.

[ ... ]

arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts line 53

Quoted 4 lines
arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts new file +4 -0
+&lpass_vamacro {
+	pinctrl-0 = <&dmic01_default>;
+	pinctrl-names = "default";
+};

[Severity: Medium]
Are qcom,dmic-sample-rate and vdd-micb-supply missing on &lpass_vamacro (along with the vreg_l1b_1p8 LDO1 definition in &apps_rsc regulators-0)?

va_macro_probe() logs "qcom,dmic-sample-rate dt entry missing" when qcom,dmic-sample-rate is omitted, and its "vdd-micb" DAPM regulator widget falls back to a dummy regulator without enabling the 1.8V LDO1 DMIC micbias rail unless vdd-micb-supply = <&vreg_l1b_1p8> is provided as on other X1 boards.

Quoted 3 lines
arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts new file +3 -0
+
+/ {
+	wcd938x: audio-codec {

[ ... ]

Quoted 5 lines
arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts new file +5 -0
+	sound {
+		compatible = "qcom,x1e80100-sndcard";
+		model = "X1E80100-ASUS-Vivobook-16";
+		audio-routing = "SpkrLeft IN", "WSA WSA_SPK1 OUT",
+						"SpkrRight IN", "WSA WSA_SPK2 OUT",

[ ... ]

arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts line 168

Quoted 5 lines

+&swr0 {

arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts new file +4 -0
+	status = "okay";
+
+	pinctrl-0 = <&wsa_swr_active>, <&spkr_01_sd_n_active>;
+	pinctrl-names = "default";

[Severity: Low]
This isn't a bug, but several parts of this file diverge from the devicetree coding style:

- The root node / { ... }; is split into two blocks with phandle references in between instead of a single root node block at the top of the file, and chassis-type = "laptop" duplicates x1-asus-vivobook-s15.dtsi.
- The top-level &label references, the DAI-link child nodes under sound, and the cpu/codec subnodes in wcd-playback-dai-link and wcd-capture-dai-link are not sorted alphabetically.
- In &swr0, status = "okay" is placed before pinctrl-0 and pinctrl-names instead of as the last property before child nodes.
- Multi-line property continuations in audio-routing, wsa-dai-link sound-dai, and the remoteproc firmware-name properties are aligned assuming 4-space tabs rather than 8-column kernel tabs.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
#14 lore raw

Re: [PATCH v2 1/3] dt-bindings: qcom: document Asus Vivobook 16 X1607QA

In reply to Daniel Carter
Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [High] dt-bindings: arm: qcom: missing Signed-off-by trailer in commit message - [Low] dt-bindings: arm…

Thank you for your contribution! Sashiko AI review found 2 potential issues to consider:
- [High] dt-bindings: arm: qcom: missing Signed-off-by trailer in commit message
- [Low] dt-bindings: arm: qcom: empty commit message body and wrong subject prefix
--

commit b00eb5a03440d334a1b8831281dccab415d1cb4c
Author: Daniel Carter <[email protected]>

Quoted 1 line

dt-bindings: qcom: document Asus Vivobook 16 X1607QA

[Severity: High]
This commit is missing a Signed-off-by trailer, which is required by Documentation/process/submitting-patches.rst before a patch can be merged.

[Severity: Low]
The commit message body is empty and omits a description of the Asus Vivobook 16 X1607QA and its Qualcomm X1P42100 platform. Also, commits touching Documentation/devicetree/bindings/arm/qcom.yaml normally use the "dt-bindings: arm: qcom:" subject prefix rather than "dt-bindings: qcom:".

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#15 lore raw

Re: [PATCH v2 1/3] dt-bindings: qcom: document Asus Vivobook 16 X1607QA

In reply to Daniel Carter
Quoted 3 lines · Daniel Carter

Documentation/devicetree/bindings/arm/qcom.yaml | 1 +

 1 file changed, 1 insertion(+)

Not much improved.

Best regards,
Krzysztof

#16 lore raw

Re: [PATCH v2 1/3] arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA - v3 series

In reply to Daniel Carter

Hi Krzysztof, hi all,

v3 of the series, addressing the Sashiko review of v2:

- arm64/dts: add /delete-node/ for pmc8380_6, pmc8380_6_thermal and pmc8380_6_die_temp, which are unpopulated on the X1P-42-100 (matching the Vivobook S15 device tree).
- arm64/dts: add the missing qcom,dmic-sample-rate and vdd-micb-supply properties on lpass_vamacro.
- arm64/dts: add the -el2 composite device tree blob target and fix the Makefile alphabetical ordering.
- arm64/dts: cosmetic cleanups (single root node, gpu_zap_shader used directly, sorted label overrides).
- ASoC/soundwire: mark the LPASS macro and Qualcomm SoundWire drivers PROBE_PREFER_ASYNCHRONOUS so the bounded clock-acquisition retry does not block the probe of the clock supplier on the single sequential probe thread, and share the retry helpers through lpass-macro-common.h instead of duplicating them per driver.
- soundwire: check clk_prepare_enable() return values (separate patch; pre-existing issue in the driver).

Series:
[1/4] dt-bindings: qcom: document Asus Vivobook 16 X1607QA
[2/4] arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA [3/4] ASoC: qcom: lpass macro / soundwire: asynchronous probe with clock retry [4/4] soundwire: qcom: check clk_prepare_enable() return values

Also open as pull request 1439 at github.com/qualcomm-linux/kernel.

Best regards,
Daniel Carter

#17 lore raw

PATCH v3 1/4 dt-bindings: qcom: document Asus Vivobook 16 X1607QA

Document the compatible for the Asus Vivobook 16 X1607QA laptop, based on the Qualcomm X1P42100 (purwa) SoC.

---
 Documentation/devicetree/bindings/arm/qcom.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/arm/qcom.yaml +1 -0
index 121ca557ce1..d22f1b0b4ef 100644
@@ -1306,6 +1306,7 @@ properties:
 
       - items:
           - enum:
+              - asus,vivobook-16-x1607qa
               - asus,vivobook-s15-x1p4
               - hp,omnibook-x14-fe1
               - lenovo,thinkbook-16
Signature · 1 line
2.55.0
#18 lore raw

PATCH v3 2/4 arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA

Add initial device tree for the Asus Vivobook 16 X1607QA laptop with the Snapdragon X X1P-42-100 (purwa) SoC, based on the Vivobook S15. Includes the sound nodes (WSA8845 speakers, WCD938x codec via SoundWire), the VA macro with its DMIC sample rate and mic bias supply, and the EL2 device tree blob target.

---
 arch/arm64/boot/dts/qcom/Makefile             |   2 +
 .../x1p42100-asus-vivobook-16-x1607qa.dts     | 238 ++++++++++++++++++
 2 files changed, 240 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts
arch/arm64/boot/dts/qcom/Makefile +2 -0
index 88230c4e00e..4405eaab62d 100644
@@ -507,6 +507,8 @@ x1e80100-microsoft-romulus15-el2-dtbs	:= x1e80100-microsoft-romulus15.dtb x1-el2
 dtb-$(CONFIG_ARCH_QCOM)	+= x1e80100-microsoft-romulus15.dtb x1e80100-microsoft-romulus15-el2.dtb
 x1e80100-qcp-el2-dtbs	:= x1e80100-qcp.dtb x1-el2.dtbo
 dtb-$(CONFIG_ARCH_QCOM)	+= x1e80100-qcp.dtb x1e80100-qcp-el2.dtb
+x1p42100-asus-vivobook-16-x1607qa-el2-dtbs	:= x1p42100-asus-vivobook-16-x1607qa.dtb x1-el2.dtbo
+dtb-$(CONFIG_ARCH_QCOM)	+= x1p42100-asus-vivobook-16-x1607qa.dtb x1p42100-asus-vivobook-16-x1607qa-el2.dtb
 x1p42100-asus-vivobook-s15-el2-dtbs	:= x1p42100-asus-vivobook-s15.dtb x1-el2.dtbo
 dtb-$(CONFIG_ARCH_QCOM)	+= x1p42100-asus-vivobook-s15.dtb x1p42100-asus-vivobook-s15-el2.dtb
 x1p42100-asus-zenbook-a14-el2-dtbs	:= x1p42100-asus-zenbook-a14.dtb x1-el2.dtbo
arch/arm64/boot/dts/qcom/x1p42100-asus-vivobook-16-x1607qa.dts new file +238 -0

238 lines not on this page · raw message

Signature · 1 line
2.55.0
#19 lore raw

PATCH v3 3/4 ASoC: qcom: lpass macro / soundwire: asynchronous probe with clock retry

The LPASS WSA/RX/TX/VA macro and Qualcomm SoundWire drivers request clocks whose providers (va-macro fsgen, the q6prm clock controller under the ADSP GPR service) can register after the consumers probe. Clock-provider registration does not trigger deferred-probe retries, so consumers stay deferred indefinitely.

Add a bounded retry (60 x 500 ms) around the clock acquisition in these drivers, share the retry helpers through lpass-macro-common.h, and mark the drivers PROBE_PREFER_ASYNCHRONOUS so a retrying consumer does not block the probe of the clock supplier it is waiting for.

---
 drivers/soundwire/qcom.c              | 24 +++++++++++++++-
 sound/soc/codecs/lpass-macro-common.h | 40 +++++++++++++++++++++++++++
 sound/soc/codecs/lpass-rx-macro.c     | 11 ++++----
 sound/soc/codecs/lpass-tx-macro.c     | 11 ++++----
 sound/soc/codecs/lpass-va-macro.c     |  9 +++---
 sound/soc/codecs/lpass-wsa-macro.c    | 11 ++++----
 6 files changed, 86 insertions(+), 20 deletions(-)
drivers/soundwire/qcom.c +23 -1
index 6e0c5fb10ef..473449dbdfa 100644
@@ -21,6 +21,27 @@
 #include <sound/pcm_params.h>
 #include <sound/soc.h>
 #include "bus.h"
+#include <linux/delay.h>
+
+/*
+ * Bounded retry for deferred clock providers. Clock-provider
+ * registration does not trigger deferred-probe retries, so a consumer
+ * that loses the probe-order race stays deferred forever. Wait up to
+ * 30 s for providers that are registered milliseconds later.
+ */
+static struct clk *clk_get_retry(struct device *dev, const char *id)
+{
+	struct clk *c;
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = clk_get_retry(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}
 
 #define SWRM_COMP_SW_RESET					0x008
 #define SWRM_COMP_STATUS					0x014
@@ -1669,7 +1690,7 @@ static int qcom_swrm_probe(struct platform_device *pdev)
 		goto err_init;
 	}
 
-	ctrl->hclk = devm_clk_get(dev, "iface");
+	ctrl->hclk = clk_get_retry(dev, "iface");
 	if (IS_ERR(ctrl->hclk)) {
 		ret = dev_err_probe(dev, PTR_ERR(ctrl->hclk), "unable to get iface clock\n");
 		goto err_init;
@@ -1921,6 +1942,7 @@ static struct platform_driver qcom_swrm_driver = {
 	.remove = qcom_swrm_remove,
 	.driver = {
 		.name	= "qcom-soundwire",
+		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
 		.of_match_table = qcom_swrm_of_match,
 		.pm = &swrm_dev_pm_ops,
 	}
sound/soc/codecs/lpass-macro-common.h +40 -0
index 10ad682019f..83bc7075a28 100644
@@ -6,6 +6,9 @@
 #ifndef __LPASS_MACRO_COMMON_H__
 #define __LPASS_MACRO_COMMON_H__
 
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/clk.h>
 /* NPL clock is expected */
 #define LPASS_MACRO_FLAG_HAS_NPL_CLOCK		BIT(0)
 /* The soundwire block should be internally reset at probe */
@@ -74,4 +77,41 @@ static inline const char *lpass_macro_get_codec_version_string(int version)
 	return "NA";
 }
 
+
+/*
+ * Bounded retry for deferred clock providers. Clock-provider
+ * registration does not trigger deferred-probe retries, so a consumer
+ * that loses the probe-order race stays deferred forever. Wait up to
+ * 30 s for providers that are registered milliseconds later.
+ */
+static inline struct clk *
+lpass_macro_clk_get_retry(struct device *dev, const char *id)
+{
+	struct clk *c;
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = devm_clk_get(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}
+
+static inline struct clk *
+lpass_macro_clk_get_retry_optional(struct device *dev, const char *id)
+{
+	struct clk *c;
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = devm_clk_get_optional(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}
+
 #endif /* __LPASS_MACRO_COMMON_H__ */
sound/soc/codecs/lpass-rx-macro.c +6 -5
index c41eb8de616..658bf947aac 100644
@@ -3780,25 +3780,25 @@ static int rx_macro_probe(struct platform_device *pdev)
 	if (!rx)
 		return -ENOMEM;
 
-	rx->macro = devm_clk_get_optional(dev, "macro");
+	rx->macro = lpass_macro_clk_get_retry_optional(dev, "macro");
 	if (IS_ERR(rx->macro))
 		return dev_err_probe(dev, PTR_ERR(rx->macro), "unable to get macro clock\n");
 
-	rx->dcodec = devm_clk_get_optional(dev, "dcodec");
+	rx->dcodec = lpass_macro_clk_get_retry_optional(dev, "dcodec");
 	if (IS_ERR(rx->dcodec))
 		return dev_err_probe(dev, PTR_ERR(rx->dcodec), "unable to get dcodec clock\n");
 
-	rx->mclk = devm_clk_get(dev, "mclk");
+	rx->mclk = lpass_macro_clk_get_retry(dev, "mclk");
 	if (IS_ERR(rx->mclk))
 		return dev_err_probe(dev, PTR_ERR(rx->mclk), "unable to get mclk clock\n");
 
 	if (flags & LPASS_MACRO_FLAG_HAS_NPL_CLOCK) {
-		rx->npl = devm_clk_get(dev, "npl");
+		rx->npl = lpass_macro_clk_get_retry(dev, "npl");
 		if (IS_ERR(rx->npl))
 			return dev_err_probe(dev, PTR_ERR(rx->npl), "unable to get npl clock\n");
 	}
 
-	rx->fsgen = devm_clk_get(dev, "fsgen");
+	rx->fsgen = lpass_macro_clk_get_retry(dev, "fsgen");
 	if (IS_ERR(rx->fsgen))
 		return dev_err_probe(dev, PTR_ERR(rx->fsgen), "unable to get fsgen clock\n");
 
@@ -4005,6 +4005,7 @@ static const struct dev_pm_ops rx_macro_pm_ops = {
 static struct platform_driver rx_macro_driver = {
 	.driver = {
 		.name = "rx_macro",
+		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
 		.of_match_table = rx_macro_dt_match,
 		.suppress_bind_attrs = true,
 		.pm = pm_ptr(&rx_macro_pm_ops),
sound/soc/codecs/lpass-tx-macro.c +6 -5
index 6deaaabe43a..329e1304b38 100644
@@ -2258,25 +2258,25 @@ static int tx_macro_probe(struct platform_device *pdev)
 
 	tx->data = device_get_match_data(dev);
 
-	tx->macro = devm_clk_get_optional(dev, "macro");
+	tx->macro = lpass_macro_clk_get_retry_optional(dev, "macro");
 	if (IS_ERR(tx->macro))
 		return dev_err_probe(dev, PTR_ERR(tx->macro), "unable to get macro clock\n");
 
-	tx->dcodec = devm_clk_get_optional(dev, "dcodec");
+	tx->dcodec = lpass_macro_clk_get_retry_optional(dev, "dcodec");
 	if (IS_ERR(tx->dcodec))
 		return dev_err_probe(dev, PTR_ERR(tx->dcodec), "unable to get dcodec clock\n");
 
-	tx->mclk = devm_clk_get(dev, "mclk");
+	tx->mclk = lpass_macro_clk_get_retry(dev, "mclk");
 	if (IS_ERR(tx->mclk))
 		return dev_err_probe(dev, PTR_ERR(tx->mclk), "unable to get mclk clock\n");
 
 	if (tx->data->flags & LPASS_MACRO_FLAG_HAS_NPL_CLOCK) {
-		tx->npl = devm_clk_get(dev, "npl");
+		tx->npl = lpass_macro_clk_get_retry(dev, "npl");
 		if (IS_ERR(tx->npl))
 			return dev_err_probe(dev, PTR_ERR(tx->npl), "unable to get npl clock\n");
 	}
 
-	tx->fsgen = devm_clk_get(dev, "fsgen");
+	tx->fsgen = lpass_macro_clk_get_retry(dev, "fsgen");
 	if (IS_ERR(tx->fsgen))
 		return dev_err_probe(dev, PTR_ERR(tx->fsgen), "unable to get fsgen clock\n");
 
@@ -2515,6 +2515,7 @@ MODULE_DEVICE_TABLE(of, tx_macro_dt_match);
 static struct platform_driver tx_macro_driver = {
 	.driver = {
 		.name = "tx_macro",
+		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
 		.of_match_table = tx_macro_dt_match,
 		.suppress_bind_attrs = true,
 		.pm = pm_ptr(&tx_macro_pm_ops),
sound/soc/codecs/lpass-va-macro.c +5 -4
index 03d6434a4a1..e718edd732e 100644
@@ -1557,15 +1557,15 @@ static int va_macro_probe(struct platform_device *pdev)
 
 	va->dev = dev;
 
-	va->macro = devm_clk_get_optional(dev, "macro");
+	va->macro = lpass_macro_clk_get_retry_optional(dev, "macro");
 	if (IS_ERR(va->macro))
 		return dev_err_probe(dev, PTR_ERR(va->macro), "unable to get macro clock\n");
 
-	va->dcodec = devm_clk_get_optional(dev, "dcodec");
+	va->dcodec = lpass_macro_clk_get_retry_optional(dev, "dcodec");
 	if (IS_ERR(va->dcodec))
 		return dev_err_probe(dev, PTR_ERR(va->dcodec), "unable to get dcodec clock\n");
 
-	va->mclk = devm_clk_get(dev, "mclk");
+	va->mclk = lpass_macro_clk_get_retry(dev, "mclk");
 	if (IS_ERR(va->mclk))
 		return dev_err_probe(dev, PTR_ERR(va->mclk), "unable to get mclk clock\n");
 
@@ -1610,7 +1610,7 @@ static int va_macro_probe(struct platform_device *pdev)
 		goto err;
 
 	if (va->has_npl_clk) {
-		va->npl = devm_clk_get(dev, "npl");
+		va->npl = lpass_macro_clk_get_retry(dev, "npl");
 		if (IS_ERR(va->npl)) {
 			ret = PTR_ERR(va->npl);
 			goto err;
@@ -1782,6 +1782,7 @@ MODULE_DEVICE_TABLE(of, va_macro_dt_match);
 static struct platform_driver va_macro_driver = {
 	.driver = {
 		.name = "va_macro",
+		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
 		.of_match_table = va_macro_dt_match,
 		.suppress_bind_attrs = true,
 		.pm = pm_ptr(&va_macro_pm_ops),
sound/soc/codecs/lpass-wsa-macro.c +6 -5
index 899c8bee464..02fca60edf4 100644
@@ -2701,25 +2701,25 @@ static int wsa_macro_probe(struct platform_device *pdev)
 	if (!wsa)
 		return -ENOMEM;
 
-	wsa->macro = devm_clk_get_optional(dev, "macro");
+	wsa->macro = lpass_macro_clk_get_retry_optional(dev, "macro");
 	if (IS_ERR(wsa->macro))
 		return dev_err_probe(dev, PTR_ERR(wsa->macro), "unable to get macro clock\n");
 
-	wsa->dcodec = devm_clk_get_optional(dev, "dcodec");
+	wsa->dcodec = lpass_macro_clk_get_retry_optional(dev, "dcodec");
 	if (IS_ERR(wsa->dcodec))
 		return dev_err_probe(dev, PTR_ERR(wsa->dcodec), "unable to get dcodec clock\n");
 
-	wsa->mclk = devm_clk_get(dev, "mclk");
+	wsa->mclk = lpass_macro_clk_get_retry(dev, "mclk");
 	if (IS_ERR(wsa->mclk))
 		return dev_err_probe(dev, PTR_ERR(wsa->mclk), "unable to get mclk clock\n");
 
 	if (flags & LPASS_MACRO_FLAG_HAS_NPL_CLOCK) {
-		wsa->npl = devm_clk_get(dev, "npl");
+		wsa->npl = lpass_macro_clk_get_retry(dev, "npl");
 		if (IS_ERR(wsa->npl))
 			return dev_err_probe(dev, PTR_ERR(wsa->npl), "unable to get npl clock\n");
 	}
 
-	wsa->fsgen = devm_clk_get(dev, "fsgen");
+	wsa->fsgen = lpass_macro_clk_get_retry(dev, "fsgen");
 	if (IS_ERR(wsa->fsgen))
 		return dev_err_probe(dev, PTR_ERR(wsa->fsgen), "unable to get fsgen clock\n");
 
@@ -2917,6 +2917,7 @@ MODULE_DEVICE_TABLE(of, wsa_macro_dt_match);
 static struct platform_driver wsa_macro_driver = {
 	.driver = {
 		.name = "wsa_macro",
+		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
 		.of_match_table = wsa_macro_dt_match,
 		.pm = pm_ptr(&wsa_macro_pm_ops),
 	},
Signature · 1 line
2.55.0
#20 lore raw

PATCH v3 4/4 soundwire: qcom: check clk_prepare_enable() return values

clk_prepare_enable() can fail; unchecked, the driver proceeds to touch registers with the interface clock off, which aborts on arm64. Check the return value in the interrupt handler, in probe and in the runtime resume path, re-enabling the wake IRQ on the resume error path.

---
 drivers/soundwire/qcom.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
drivers/soundwire/qcom.c +16 -3
index 473449dbdfa..c44bcd0f0cf 100644
@@ -799,7 +799,9 @@ static irqreturn_t qcom_swrm_irq_handler(int irq, void *dev_id)
 	u32 i;
 	int devnum;
 	int ret = IRQ_HANDLED;
-	clk_prepare_enable(ctrl->hclk);
+
+	if (clk_prepare_enable(ctrl->hclk))
+		return IRQ_HANDLED;
 
 	ctrl->reg_read(ctrl, ctrl->reg_layout[SWRM_REG_INTERRUPT_STATUS],
 		       &intr_sts);
@@ -1696,7 +1698,11 @@ static int qcom_swrm_probe(struct platform_device *pdev)
 		goto err_init;
 	}
 
-	clk_prepare_enable(ctrl->hclk);
+	ret = clk_prepare_enable(ctrl->hclk);
+	if (ret) {
+		dev_err(dev, "unable to enable iface clock\n");
+		goto err_init;
+	}
 
 	ctrl->dev = dev;
 	dev_set_drvdata(&pdev->dev, ctrl);
@@ -1821,7 +1827,14 @@ static int __maybe_unused swrm_runtime_resume(struct device *dev)
 			disable_irq_nosync(ctrl->wake_irq);
 	}
 
-	clk_prepare_enable(ctrl->hclk);
+	ret = clk_prepare_enable(ctrl->hclk);
+	if (ret) {
+		if (ctrl->wake_irq > 0) {
+			if (irqd_irq_disabled(irq_get_irq_data(ctrl->wake_irq)))
+				enable_irq(ctrl->wake_irq);
+		}
+		return ret;
+	}
 
 	if (ctrl->clock_stop_not_supported) {
 		reinit_completion(&ctrl->enumeration);
Signature · 1 line
2.55.0
#21 lore raw

Re: [PATCH v3 4/4] soundwire: qcom: check clk_prepare_enable() return values

Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Medium] soundwire: qcom: enable_irq() in swrm_runtime_resume() causes wake IRQ storm - [Low] soundwire…

Thank you for your contribution! Sashiko AI review found 3 potential issues to consider:
- [Medium] soundwire: qcom: enable_irq() in swrm_runtime_resume() causes wake IRQ storm
- [Low] soundwire: qcom: missing Fixes trailers for clk_prepare_enable() check
- [Low] soundwire: qcom: qcom_swrm_irq_handler() returns IRQ_HANDLED on clk error
--

commit 5c5235a561fc40c30680eee11304261327eab6cc
Author: Daniel Carter <[email protected]>

Quoted 9 lines

soundwire: qcom: check clk_prepare_enable() return values

clk_prepare_enable() can fail; unchecked, the driver proceeds to touch registers with the interface clock off, which aborts on arm64. Check the return value in the interrupt handler, in probe and in the runtime resume path, re-enabling the wake IRQ on the resume error path.

[Severity: Low]
Since this fixes unchecked clk_prepare_enable() calls introduced in two earlier commits, should this include Fixes: tags?

Fixes 02efb49aa805 ("soundwire: qcom: add support for SoundWire controller")
Fixes 74e79da9fd46 ("soundwire: qcom: add runtime pm support")

drivers/soundwire/qcom.c static irqreturn_t qcom_swrm_irq_handler(int irq, void *dev_id) · line 804

Quoted 12 lines
drivers/soundwire/qcom.c +3 -1
index 0bdeb076a2e0e..ec510809766bb 100644
@@ -799,7 +799,9 @@ static irqreturn_t qcom_swrm_irq_handler(int irq, void *dev_id)
 	u32 i;
 	int devnum;
 	int ret = IRQ_HANDLED;
-	clk_prepare_enable(ctrl->hclk);
+
+	if (clk_prepare_enable(ctrl->hclk))
+		return IRQ_HANDLED;

[Severity: Low]
Should this return IRQ_NONE instead of IRQ_HANDLED when clk_prepare_enable() fails? The interrupt status is neither read nor cleared, and returning IRQ_HANDLED causes irq_thread_fn() to mark the interrupt as handled, preventing the genirq spurious interrupt detector from disabling a stuck line.

[ ... ]

drivers/soundwire/qcom.c static int __maybe_unused swrm_runtime_resume(struct device *dev) · line 1837

Quoted 13 lines
drivers/soundwire/qcom.c +8 -1
@@ -1821,7 +1827,14 @@ static int __maybe_unused swrm_runtime_resume(struct device *dev)
 			disable_irq_nosync(ctrl->wake_irq);
 	}
 
-	clk_prepare_enable(ctrl->hclk);
+	ret = clk_prepare_enable(ctrl->hclk);
+	if (ret) {
+		if (ctrl->wake_irq > 0) {
+			if (irqd_irq_disabled(irq_get_irq_data(ctrl->wake_irq)))
+				enable_irq(ctrl->wake_irq);
+		}
+		return ret;
+	}

[Severity: Medium]
Can calling enable_irq(ctrl->wake_irq) here cause a level-high wake IRQ storm when swrm_runtime_resume() is invoked from qcom_swrm_wake_irq_handler()?

ctrl->wake_irq is registered with IRQF_TRIGGER_HIGH | IRQF_ONESHOT. During an in-band wakeup, the slave holds the line high until the bus exits clock stop, and qcom_swrm_wake_irq_handler() synchronously runs swrm_runtime_resume() via pm_runtime_get_sync():

drivers/soundwire/qcom.c:qcom_swrm_wake_irq_handler() {
	ret = pm_runtime_get_sync(ctrl->dev);
	if (ret < 0 && ret != -EACCES) {
		dev_err_ratelimited(ctrl->dev,
				    "pm_runtime_get_sync failed in %s, ret %d\n",
				    __func__, ret);
		pm_runtime_put_noidle(ctrl->dev);
		return ret;
	}

	if (ctrl->wake_irq > 0) {
		if (!irqd_irq_disabled(irq_get_irq_data(ctrl->wake_irq)))
			disable_irq_nosync(ctrl->wake_irq);
	}
    ...
}

When clk_prepare_enable() fails, enable_irq() unmasks ctrl->wake_irq at the irqchip (even while the oneshot threaded handler is running), and qcom_swrm_wake_irq_handler() returns early before its own disable_irq_nosync(ctrl->wake_irq). Because the bus never resumed to clear the wakeup condition, the slave continues driving the level-high line and ctrl->wake_irq immediately re-fires in a loop.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
#22 lore raw

Re: [PATCH v3 3/4] ASoC: qcom: lpass macro / soundwire: asynchronous probe with clock retry

In reply to Daniel Carter
Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [High] soundwire: qcom: infinite recursion in clk_get_retry() - [Medium] ASoC: qcom: 30s msleep() polling…

Thank you for your contribution! Sashiko AI review found 2 potential issues to consider:
- [High] soundwire: qcom: infinite recursion in clk_get_retry()
- [Medium] ASoC: qcom: 30s msleep() polling on -EPROBE_DEFER in lpass_macro_clk_get_retry()
--

commit 6bd2e1b16c32b85c538fe58be015563a596b1d7d
Author: Daniel Carter <[email protected]>

ASoC: qcom: lpass macro / soundwire: asynchronous probe with clock retry

This commit adds 30-second polling retry helpers around clock acquisition and sets PROBE_PREFER_ASYNCHRONOUS in the Qualcomm SoundWire and LPASS macro drivers.

Quoted 19 lines
drivers/soundwire/qcom.c +11 -0
index c31d921f679f9..0bdeb076a2e0e 100644
@@ -21,6 +21,27 @@
 #include <sound/pcm_params.h>
 #include <sound/soc.h>
 #include "bus.h"
+#include <linux/delay.h>
+
+/*
+ * Bounded retry for deferred clock providers. Clock-provider
+ * registration does not trigger deferred-probe retries, so a consumer
+ * that loses the probe-order race stays deferred forever. Wait up to
+ * 30 s for providers that are registered milliseconds later.
+ */
+static struct clk *clk_get_retry(struct device *dev, const char *id)
+{
+	struct clk *c;

drivers/soundwire/qcom.c line 44

Quoted 10 lines
drivers/soundwire/qcom.c +10 -0
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = clk_get_retry(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}

[Severity: High]
Does clk_get_retry() call itself instead of devm_clk_get(dev, id) here? When qcom_swrm_probe() calls clk_get_retry(dev, "iface"), this recurses infinitely and overflows the kernel stack. Also, the commit message says the retry helpers are shared through lpass-macro-common.h, whereas a separate copy is defined here.

Quoted 4 lines
sound/soc/codecs/lpass-macro-common.h +0 -0
index 10ad682019fa7..83bc7075a281c 100644

[ ... ]

Quoted 32 lines
sound/soc/codecs/lpass-macro-common.h +28 -0
@@ -74,4 +77,41 @@ static inline const char *lpass_macro_get_codec_version_string(int version)
 	return "NA";
 }
 
+
+/*
+ * Bounded retry for deferred clock providers. Clock-provider
+ * registration does not trigger deferred-probe retries, so a consumer
+ * that loses the probe-order race stays deferred forever. Wait up to
+ * 30 s for providers that are registered milliseconds later.
+ */
+static inline struct clk *
+lpass_macro_clk_get_retry(struct device *dev, const char *id)
+{
+	struct clk *c;
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = devm_clk_get(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}
+
+static inline struct clk *
+lpass_macro_clk_get_retry_optional(struct device *dev, const char *id)
+{
+	struct clk *c;
+	int i;
+

sound/soc/codecs/lpass-macro-common.h static inline const char *lpass_macro_get_codec_version_string(int version) · line 117

Quoted 10 lines
sound/soc/codecs/lpass-macro-common.h +9 -0
+	for (i = 0; i < 60; i++) {
+		c = devm_clk_get_optional(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}
+
 #endif /* __LPASS_MACRO_COMMON_H__ */

[Severity: Medium]
Why poll with msleep(500) for up to 30 seconds on -EPROBE_DEFER instead of returning -EPROBE_DEFER to the driver core?

Both suppliers mentioned in the commit message (q6dsp_clock_dev_probe() and va_macro_register_fsgen_output()) register their clock providers inside platform_driver probe callbacks, which trigger driver_deferred_probe_trigger() through really_probe() -> driver_bound() once bound. Even with PROBE_PREFER_ASYNCHRONOUS, sleeping for 30 seconds inside probe while holding device_lock(dev) stalls async_synchronize_full() and wait_for_device_probe() callers (such as do_init_module() and kernel_init()) whenever a clock supplier is delayed, missing firmware, or disabled in DT, and repeats the 30-second stall on subsequent deferred-probe passes.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
#23 lore raw

Re: [PATCH v3 3/4] ASoC: qcom: lpass macro / soundwire: asynchronous probe with clock retry

In reply to Daniel Carter
Quoted 3 lines · Daniel Carter

The LPASS WSA/RX/TX/VA macro and Qualcomm SoundWire drivers request clocks whose providers (va-macro fsgen, the q6prm clock controller under the ADSP GPR service) can register after the consumers probe.

Why?

Quoted 2 lines

Clock-provider registration does not trigger deferred-probe retries, so consumers stay deferred indefinitely.

Looks like we are fixing some generic issue in these patches if there is one.

Can you please explain the problem that you are hitting, are you seeing that the soundwire controller never reprobes if its defer probed?

Quoted 2 lines

Add a bounded retry (60 x 500 ms) around the clock acquisition in

This is a hack, and am sure it will break in no time.

Please fix the probe order bug rather than comming up with this hack.

Quoted 5 lines

these drivers, share the retry helpers through lpass-macro-common.h, and mark the drivers PROBE_PREFER_ASYNCHRONOUS so a retrying consumer does not block the probe of the clock supplier it is waiting for.

Quoted 8 lines
---
 drivers/soundwire/qcom.c              | 24 +++++++++++++++-
 sound/soc/codecs/lpass-macro-common.h | 40 +++++++++++++++++++++++++++
 sound/soc/codecs/lpass-rx-macro.c     | 11 ++++----
 sound/soc/codecs/lpass-tx-macro.c     | 11 ++++----
 sound/soc/codecs/lpass-va-macro.c     |  9 +++---
 sound/soc/codecs/lpass-wsa-macro.c    | 11 ++++----
 6 files changed, 86 insertions(+), 20 deletions(-)

Multiple changes and with multiple subsystems in single patch is not a good way to send patches, Please consider splitting the patches starting with subsystem level and patch per problem.

--srini

Quoted 275 lines
drivers/soundwire/qcom.c +23 -1
index 6e0c5fb10ef..473449dbdfa 100644
@@ -21,6 +21,27 @@
 #include <sound/pcm_params.h>
 #include <sound/soc.h>
 #include "bus.h"
+#include <linux/delay.h>
+
+/*
+ * Bounded retry for deferred clock providers. Clock-provider
+ * registration does not trigger deferred-probe retries, so a consumer
+ * that loses the probe-order race stays deferred forever. Wait up to
+ * 30 s for providers that are registered milliseconds later.
+ */
+static struct clk *clk_get_retry(struct device *dev, const char *id)
+{
+	struct clk *c;
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = clk_get_retry(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}
 
 #define SWRM_COMP_SW_RESET					0x008
 #define SWRM_COMP_STATUS					0x014
@@ -1669,7 +1690,7 @@ static int qcom_swrm_probe(struct platform_device *pdev)
 		goto err_init;
 	}
 
-	ctrl->hclk = devm_clk_get(dev, "iface");
+	ctrl->hclk = clk_get_retry(dev, "iface");
 	if (IS_ERR(ctrl->hclk)) {
 		ret = dev_err_probe(dev, PTR_ERR(ctrl->hclk), "unable to get iface clock\n");
 		goto err_init;
@@ -1921,6 +1942,7 @@ static struct platform_driver qcom_swrm_driver = {
 	.remove = qcom_swrm_remove,
 	.driver = {
 		.name	= "qcom-soundwire",
+		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
 		.of_match_table = qcom_swrm_of_match,
 		.pm = &swrm_dev_pm_ops,
 	}
sound/soc/codecs/lpass-macro-common.h +40 -0
index 10ad682019f..83bc7075a28 100644
@@ -6,6 +6,9 @@
 #ifndef __LPASS_MACRO_COMMON_H__
 #define __LPASS_MACRO_COMMON_H__
 
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/clk.h>
 /* NPL clock is expected */
 #define LPASS_MACRO_FLAG_HAS_NPL_CLOCK		BIT(0)
 /* The soundwire block should be internally reset at probe */
@@ -74,4 +77,41 @@ static inline const char *lpass_macro_get_codec_version_string(int version)
 	return "NA";
 }
 
+
+/*
+ * Bounded retry for deferred clock providers. Clock-provider
+ * registration does not trigger deferred-probe retries, so a consumer
+ * that loses the probe-order race stays deferred forever. Wait up to
+ * 30 s for providers that are registered milliseconds later.
+ */
+static inline struct clk *
+lpass_macro_clk_get_retry(struct device *dev, const char *id)
+{
+	struct clk *c;
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = devm_clk_get(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}
+
+static inline struct clk *
+lpass_macro_clk_get_retry_optional(struct device *dev, const char *id)
+{
+	struct clk *c;
+	int i;
+
+	for (i = 0; i < 60; i++) {
+		c = devm_clk_get_optional(dev, id);
+		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
+			return c;
+		msleep(500);
+	}
+	return c;
+}
+
 #endif /* __LPASS_MACRO_COMMON_H__ */
sound/soc/codecs/lpass-rx-macro.c +6 -5
index c41eb8de616..658bf947aac 100644
@@ -3780,25 +3780,25 @@ static int rx_macro_probe(struct platform_device *pdev)
 	if (!rx)
 		return -ENOMEM;
 
-	rx->macro = devm_clk_get_optional(dev, "macro");
+	rx->macro = lpass_macro_clk_get_retry_optional(dev, "macro");
 	if (IS_ERR(rx->macro))
 		return dev_err_probe(dev, PTR_ERR(rx->macro), "unable to get macro clock\n");
 
-	rx->dcodec = devm_clk_get_optional(dev, "dcodec");
+	rx->dcodec = lpass_macro_clk_get_retry_optional(dev, "dcodec");
 	if (IS_ERR(rx->dcodec))
 		return dev_err_probe(dev, PTR_ERR(rx->dcodec), "unable to get dcodec clock\n");
 
-	rx->mclk = devm_clk_get(dev, "mclk");
+	rx->mclk = lpass_macro_clk_get_retry(dev, "mclk");
 	if (IS_ERR(rx->mclk))
 		return dev_err_probe(dev, PTR_ERR(rx->mclk), "unable to get mclk clock\n");
 
 	if (flags & LPASS_MACRO_FLAG_HAS_NPL_CLOCK) {
-		rx->npl = devm_clk_get(dev, "npl");
+		rx->npl = lpass_macro_clk_get_retry(dev, "npl");
 		if (IS_ERR(rx->npl))
 			return dev_err_probe(dev, PTR_ERR(rx->npl), "unable to get npl clock\n");
 	}
 
-	rx->fsgen = devm_clk_get(dev, "fsgen");
+	rx->fsgen = lpass_macro_clk_get_retry(dev, "fsgen");
 	if (IS_ERR(rx->fsgen))
 		return dev_err_probe(dev, PTR_ERR(rx->fsgen), "unable to get fsgen clock\n");
 
@@ -4005,6 +4005,7 @@ static const struct dev_pm_ops rx_macro_pm_ops = {
 static struct platform_driver rx_macro_driver = {
 	.driver = {
 		.name = "rx_macro",
+		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
 		.of_match_table = rx_macro_dt_match,
 		.suppress_bind_attrs = true,
 		.pm = pm_ptr(&rx_macro_pm_ops),
sound/soc/codecs/lpass-tx-macro.c +6 -5
index 6deaaabe43a..329e1304b38 100644
@@ -2258,25 +2258,25 @@ static int tx_macro_probe(struct platform_device *pdev)
 
 	tx->data = device_get_match_data(dev);
 
-	tx->macro = devm_clk_get_optional(dev, "macro");
+	tx->macro = lpass_macro_clk_get_retry_optional(dev, "macro");
 	if (IS_ERR(tx->macro))
 		return dev_err_probe(dev, PTR_ERR(tx->macro), "unable to get macro clock\n");
 
-	tx->dcodec = devm_clk_get_optional(dev, "dcodec");
+	tx->dcodec = lpass_macro_clk_get_retry_optional(dev, "dcodec");
 	if (IS_ERR(tx->dcodec))
 		return dev_err_probe(dev, PTR_ERR(tx->dcodec), "unable to get dcodec clock\n");
 
-	tx->mclk = devm_clk_get(dev, "mclk");
+	tx->mclk = lpass_macro_clk_get_retry(dev, "mclk");
 	if (IS_ERR(tx->mclk))
 		return dev_err_probe(dev, PTR_ERR(tx->mclk), "unable to get mclk clock\n");
 
 	if (tx->data->flags & LPASS_MACRO_FLAG_HAS_NPL_CLOCK) {
-		tx->npl = devm_clk_get(dev, "npl");
+		tx->npl = lpass_macro_clk_get_retry(dev, "npl");
 		if (IS_ERR(tx->npl))
 			return dev_err_probe(dev, PTR_ERR(tx->npl), "unable to get npl clock\n");
 	}
 
-	tx->fsgen = devm_clk_get(dev, "fsgen");
+	tx->fsgen = lpass_macro_clk_get_retry(dev, "fsgen");
 	if (IS_ERR(tx->fsgen))
 		return dev_err_probe(dev, PTR_ERR(tx->fsgen), "unable to get fsgen clock\n");
 
@@ -2515,6 +2515,7 @@ MODULE_DEVICE_TABLE(of, tx_macro_dt_match);
 static struct platform_driver tx_macro_driver = {
 	.driver = {
 		.name = "tx_macro",
+		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
 		.of_match_table = tx_macro_dt_match,
 		.suppress_bind_attrs = true,
 		.pm = pm_ptr(&tx_macro_pm_ops),
sound/soc/codecs/lpass-va-macro.c +5 -4
index 03d6434a4a1..e718edd732e 100644
@@ -1557,15 +1557,15 @@ static int va_macro_probe(struct platform_device *pdev)
 
 	va->dev = dev;
 
-	va->macro = devm_clk_get_optional(dev, "macro");
+	va->macro = lpass_macro_clk_get_retry_optional(dev, "macro");
 	if (IS_ERR(va->macro))
 		return dev_err_probe(dev, PTR_ERR(va->macro), "unable to get macro clock\n");
 
-	va->dcodec = devm_clk_get_optional(dev, "dcodec");
+	va->dcodec = lpass_macro_clk_get_retry_optional(dev, "dcodec");
 	if (IS_ERR(va->dcodec))
 		return dev_err_probe(dev, PTR_ERR(va->dcodec), "unable to get dcodec clock\n");
 
-	va->mclk = devm_clk_get(dev, "mclk");
+	va->mclk = lpass_macro_clk_get_retry(dev, "mclk");
 	if (IS_ERR(va->mclk))
 		return dev_err_probe(dev, PTR_ERR(va->mclk), "unable to get mclk clock\n");
 
@@ -1610,7 +1610,7 @@ static int va_macro_probe(struct platform_device *pdev)
 		goto err;
 
 	if (va->has_npl_clk) {
-		va->npl = devm_clk_get(dev, "npl");
+		va->npl = lpass_macro_clk_get_retry(dev, "npl");
 		if (IS_ERR(va->npl)) {
 			ret = PTR_ERR(va->npl);
 			goto err;
@@ -1782,6 +1782,7 @@ MODULE_DEVICE_TABLE(of, va_macro_dt_match);
 static struct platform_driver va_macro_driver = {
 	.driver = {
 		.name = "va_macro",
+		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
 		.of_match_table = va_macro_dt_match,
 		.suppress_bind_attrs = true,
 		.pm = pm_ptr(&va_macro_pm_ops),
sound/soc/codecs/lpass-wsa-macro.c +6 -5
index 899c8bee464..02fca60edf4 100644
@@ -2701,25 +2701,25 @@ static int wsa_macro_probe(struct platform_device *pdev)
 	if (!wsa)
 		return -ENOMEM;
 
-	wsa->macro = devm_clk_get_optional(dev, "macro");
+	wsa->macro = lpass_macro_clk_get_retry_optional(dev, "macro");
 	if (IS_ERR(wsa->macro))
 		return dev_err_probe(dev, PTR_ERR(wsa->macro), "unable to get macro clock\n");
 
-	wsa->dcodec = devm_clk_get_optional(dev, "dcodec");
+	wsa->dcodec = lpass_macro_clk_get_retry_optional(dev, "dcodec");
 	if (IS_ERR(wsa->dcodec))
 		return dev_err_probe(dev, PTR_ERR(wsa->dcodec), "unable to get dcodec clock\n");
 
-	wsa->mclk = devm_clk_get(dev, "mclk");
+	wsa->mclk = lpass_macro_clk_get_retry(dev, "mclk");
 	if (IS_ERR(wsa->mclk))
 		return dev_err_probe(dev, PTR_ERR(wsa->mclk), "unable to get mclk clock\n");
 
 	if (flags & LPASS_MACRO_FLAG_HAS_NPL_CLOCK) {
-		wsa->npl = devm_clk_get(dev, "npl");
+		wsa->npl = lpass_macro_clk_get_retry(dev, "npl");
 		if (IS_ERR(wsa->npl))
 			return dev_err_probe(dev, PTR_ERR(wsa->npl), "unable to get npl clock\n");
 	}
 
-	wsa->fsgen = devm_clk_get(dev, "fsgen");
+	wsa->fsgen = lpass_macro_clk_get_retry(dev, "fsgen");
 	if (IS_ERR(wsa->fsgen))
 		return dev_err_probe(dev, PTR_ERR(wsa->fsgen), "unable to get fsgen clock\n");
 
@@ -2917,6 +2917,7 @@ MODULE_DEVICE_TABLE(of, wsa_macro_dt_match);
 static struct platform_driver wsa_macro_driver = {
 	.driver = {
 		.name = "wsa_macro",
+		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
 		.of_match_table = wsa_macro_dt_match,
 		.pm = pm_ptr(&wsa_macro_pm_ops),
 	},
maintainer
#24 lore raw

Re: [PATCH v3 1/4] dt-bindings: qcom: document Asus Vivobook 16 X1607QA

In reply to Daniel Carter
Quoted 2 lines · Daniel Carter

Document the compatible for the Asus Vivobook 16 X1607QA laptop, based on the Qualcomm X1P42100 (purwa) SoC.

Please don't send new patches in reply to old patches or serieses, this makes it harder for both people and tools to understand what is going on - it can bury things in mailboxes and make it difficult to keep track of what current patches are, both for the new patches and the old ones.

You might want to look at b4 to send the patches, especially it's web submission endpoint which avoids having to configure mail:

https://b4.docs.kernel.org/en/latest/contributor/overview.html

#25 lore raw

Re: [PATCH v3 1/4] dt-bindings: qcom: document Asus Vivobook 16 X1607QA

Hi Mark,

Thanks for the review.

Understood on threading - this was a reply in the old thread rather than a fresh one; the next revision will go out as a new thread. I'll set up b4 before then.

On the clock retry itself: agreed that the right fix is in the driver core / clock API so that deferred-probe runs are retriggered when new resources appear, rather than open-coding bounded retries in drivers. That is a much larger change than I can make alone, so my intention with this series was a stopgap for this laptop: without the retry the macro and SoundWire drivers stay deferred forever on X1P42100 because their clock providers register late.

Would you prefer that patch be dropped from this series until the core side is sorted, or is a bounded retry acceptable in the interim? Happy to follow either direction - the device tree patches (1/4 and 2/4) are independent of it.

Best regards,
Daniel Carter

maintainer
#26 lore raw

Re: [PATCH v3 1/4] dt-bindings: qcom: document Asus Vivobook 16 X1607QA

Quoted 8 lines · Daniel Carter

On the clock retry itself: agreed that the right fix is in the driver core / clock API so that deferred-probe runs are retriggered when new resources appear, rather than open-coding bounded retries in drivers. That is a much larger change than I can make alone, so my intention with this series was a stopgap for this laptop: without the retry the macro and SoundWire drivers stay deferred forever on X1P42100 because their clock providers register late.

Quoted 4 lines

Would you prefer that patch be dropped from this series until the core side is sorted, or is a bounded retry acceptable in the interim? Happy to follow either direction - the device tree patches (1/4 and 2/4) are independent of it.

I'm not going to take such a massive workaround as that unless absolutely needed.

#27 lore raw

Re: [PATCH 1/2] arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA — v2 series

In reply to Daniel Carter
Quoted 13 lines · Daniel Carter

Hi Krzysztof, hi all,

v2 of the series, addressing your review of v1:

- The binding documentation is now a separate patch (dt-bindings first), as required by Documentation/devicetree/bindings/submitting-patches.rst.
- The board compatible 'asus,vivobook-16-x1607qa' is documented in Documentation/devicetree/bindings/arm/qcom.yaml.
- scripts/checkpatch.pl passes with no errors on all patches; --strict leaves only the MAINTAINERS note on the new-file patch.
- The DCO sign-off is now a real-name sign-off; apologies for the pseudonymous v1.

Quoted 4 lines

Series:
[1/3] dt-bindings: qcom: document Asus Vivobook 16 X1607QA [2/3] arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA [3/3] ASoC: qcom: lpass macro / soundwire: retry deferred clock acquisition

You removed entire context and still did not fix issues you said you did.

Best regards,
Krzysztof