Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH v2 00/18] Add a new SoundWire enumeration helper
@ 2026-05-11 14:10 Charles Keepax
  2026-05-11 14:10 ` [PATCH v2 01/18] soundwire: Add a helper function to wait for device initialisation Charles Keepax
                   ` (17 more replies)
  0 siblings, 18 replies; 20+ messages in thread
From: Charles Keepax @ 2026-05-11 14:10 UTC (permalink / raw)
  To: broonie, vkoul
  Cc: lgirdwood, pierre-louis.bossart, yung-chuan.liao, peter.ujfalusi,
	oder_chiou, jack.yu, shumingf, niranjan.hy, shenghao-ding,
	kevin-lu, baojun.xu, sen, linux-sound, linux-kernel, patches

Add a new SoundWire enumeration helper function, many drivers have
almost identical code in runtime resume so it makes sense to move this
to the core.

It is worth noting this is really step one of a larger process, there
are a few drivers that do more custom things and are not covered by this
series. But this series picks up the low hanging fruit and moves things
in a good direction.

The next step is to look at drivers that also wait at probe time, where
the unattached_request flag is not going to be valid.

Thanks,
Charles

Changes since v1:
 - Add a stub for sdw_slave_wait_for_init()
 - Add kerneldoc for sdw_slave_wait_for_init()
 - Update cs35l56 as well
 - Correct bug in the update of cs42l42

Charles Keepax (18):
  soundwire: Add a helper function to wait for device initialisation
  ASoC: cs35l56: Use new SoundWire enumeration helper
  ASoC: cs42l42: Use new SoundWire enumeration helper
  ASoC: max98363: Use new SoundWire enumeration helper
  ASoC: max98373: Use new SoundWire enumeration helper
  ASoC: rt700: Use new SoundWire enumeration helper
  ASoC: rt711: Use new SoundWire enumeration helper
  ASoC: rt712: Use new SoundWire enumeration helper
  ASoC: rt715: Use new SoundWire enumeration helper
  ASoc: rt721: Use new SoundWire enumeration helper
  ASoC: rt722: Use new SoundWire enumeration helper
  ASoC: rt1017: Use new SoundWire enumeration helper
  ASoC: rt1308: Use new SoundWire enumeration helper
  ASoC: rt1316: Use new SoundWire enumeration helper
  ASoC: rt1318: Use new SoundWire enumeration helper
  ASoC: rt1320: Use new SoundWire enumeration helper
  ASoC: rt5682: Use new SoundWire enumeration helper
  ASoC: tas2783: Use new SoundWire enumeration helper

 drivers/soundwire/bus.c            | 31 ++++++++++++++++++++++++++++++
 include/linux/soundwire/sdw.h      |  8 ++++++++
 sound/soc/codecs/cs35l56-sdw.c     | 10 ++++------
 sound/soc/codecs/cs42l42-sdw.c     | 11 ++++-------
 sound/soc/codecs/max98363.c        | 17 ++++------------
 sound/soc/codecs/max98373-sdw.c    | 18 ++++-------------
 sound/soc/codecs/rt1017-sdca-sdw.c | 18 ++++-------------
 sound/soc/codecs/rt1308-sdw.c      | 18 ++++-------------
 sound/soc/codecs/rt1316-sdw.c      | 18 ++++-------------
 sound/soc/codecs/rt1318-sdw.c      | 16 ++++-----------
 sound/soc/codecs/rt1320-sdw.c      | 16 ++++-----------
 sound/soc/codecs/rt5682-sdw.c      | 16 ++++-----------
 sound/soc/codecs/rt700-sdw.c       | 18 ++++-------------
 sound/soc/codecs/rt711-sdca-sdw.c  | 16 ++++-----------
 sound/soc/codecs/rt711-sdw.c       | 14 ++++----------
 sound/soc/codecs/rt712-sdca-dmic.c | 19 ++++--------------
 sound/soc/codecs/rt712-sdca-sdw.c  | 16 ++++-----------
 sound/soc/codecs/rt715-sdca-sdw.c  | 18 ++++-------------
 sound/soc/codecs/rt715-sdw.c       | 18 ++++-------------
 sound/soc/codecs/rt721-sdca-sdw.c  | 16 ++++-----------
 sound/soc/codecs/rt722-sdca-sdw.c  | 16 ++++-----------
 sound/soc/codecs/tas2783-sdw.c     | 18 ++++-------------
 22 files changed, 119 insertions(+), 247 deletions(-)

-- 
2.47.3


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v2 01/18] soundwire: Add a helper function to wait for device initialisation
  2026-05-11 14:10 [PATCH v2 00/18] Add a new SoundWire enumeration helper Charles Keepax
@ 2026-05-11 14:10 ` Charles Keepax
  2026-05-11 16:21   ` Vinod Koul
  2026-05-11 14:10 ` [PATCH v2 02/18] ASoC: cs35l56: Use new SoundWire enumeration helper Charles Keepax
                   ` (16 subsequent siblings)
  17 siblings, 1 reply; 20+ messages in thread
From: Charles Keepax @ 2026-05-11 14:10 UTC (permalink / raw)
  To: broonie, vkoul
  Cc: lgirdwood, pierre-louis.bossart, yung-chuan.liao, peter.ujfalusi,
	oder_chiou, jack.yu, shumingf, niranjan.hy, shenghao-ding,
	kevin-lu, baojun.xu, sen, linux-sound, linux-kernel, patches

Add a new helper function to wait for the device to enumerate
and be initialised by the SoundWire core. Most of the SoundWire
drivers have very similar boiler plate code in their runtime
resume, and that boiler plate tends to access various internals
of the SoundWire structs which is a mild layering violation.

Adding a new core helper function greatly eases both of these
issues.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

Changes since v1:
 - Add stub for when soundwire not built in.
 - Add missing kerneldoc

 drivers/soundwire/bus.c       | 31 +++++++++++++++++++++++++++++++
 include/linux/soundwire/sdw.h |  8 ++++++++
 2 files changed, 39 insertions(+)

diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
index fe5316d93fefe..037c51a3874ea 100644
--- a/drivers/soundwire/bus.c
+++ b/drivers/soundwire/bus.c
@@ -1372,6 +1372,37 @@ int sdw_slave_get_current_bank(struct sdw_slave *slave)
 }
 EXPORT_SYMBOL_GPL(sdw_slave_get_current_bank);
 
+/**
+ * sdw_slave_wait_for_init - Wait for device initialisation
+ * @slave: Pointer to the SoundWire peripheral.
+ * @timeout_us: Timeout in microseconds.
+ *
+ * Wait for a peripheral device to enumerate and be initialised by the
+ * SoundWire core.
+ *
+ * Return: Zero on success, and a negative error code on failure.
+ */
+int sdw_slave_wait_for_init(struct sdw_slave *slave, int timeout_us)
+{
+	unsigned long time;
+
+	if (!slave->unattach_request)
+		return 0;
+
+	time = wait_for_completion_timeout(&slave->initialization_complete,
+					   msecs_to_jiffies(timeout_us));
+	if (!time) {
+		dev_err(&slave->dev, "Initialization not complete\n");
+		sdw_show_ping_status(slave->bus, true);
+		return -ETIMEDOUT;
+	}
+
+	slave->unattach_request = 0;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(sdw_slave_wait_for_init);
+
 static int sdw_slave_set_frequency(struct sdw_slave *slave)
 {
 	int scale_index;
diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h
index 6147eb1fb210d..7e5818d989294 100644
--- a/include/linux/soundwire/sdw.h
+++ b/include/linux/soundwire/sdw.h
@@ -1093,6 +1093,8 @@ int sdw_slave_get_current_bank(struct sdw_slave *sdev);
 
 int sdw_slave_get_scale_index(struct sdw_slave *slave, u8 *base);
 
+int sdw_slave_wait_for_init(struct sdw_slave *slave, int timeout);
+
 /* messaging and data APIs */
 int sdw_read(struct sdw_slave *slave, u32 addr);
 int sdw_write(struct sdw_slave *slave, u32 addr, u8 value);
@@ -1136,6 +1138,12 @@ static inline int sdw_slave_get_current_bank(struct sdw_slave *sdev)
 	return -EINVAL;
 }
 
+static inline int sdw_slave_wait_for_init(struct sdw_slave *slave, int timeout)
+{
+	WARN_ONCE(1, "SoundWire API is disabled");
+	return -EINVAL;
+}
+
 /* messaging and data APIs */
 static inline int sdw_read(struct sdw_slave *slave, u32 addr)
 {
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 02/18] ASoC: cs35l56: Use new SoundWire enumeration helper
  2026-05-11 14:10 [PATCH v2 00/18] Add a new SoundWire enumeration helper Charles Keepax
  2026-05-11 14:10 ` [PATCH v2 01/18] soundwire: Add a helper function to wait for device initialisation Charles Keepax
@ 2026-05-11 14:10 ` Charles Keepax
  2026-05-11 14:10 ` [PATCH v2 03/18] ASoC: cs42l42: " Charles Keepax
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Charles Keepax @ 2026-05-11 14:10 UTC (permalink / raw)
  To: broonie, vkoul
  Cc: lgirdwood, pierre-louis.bossart, yung-chuan.liao, peter.ujfalusi,
	oder_chiou, jack.yu, shumingf, niranjan.hy, shenghao-ding,
	kevin-lu, baojun.xu, sen, linux-sound, linux-kernel, patches

Update the driver to use the new core helper that waits for the device
to enumerate on SoundWire and be initialised by the SoundWire core.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

New since v1.

 sound/soc/codecs/cs35l56-sdw.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/sound/soc/codecs/cs35l56-sdw.c b/sound/soc/codecs/cs35l56-sdw.c
index 9dc47fec1ea04..105d38b1c1878 100644
--- a/sound/soc/codecs/cs35l56-sdw.c
+++ b/sound/soc/codecs/cs35l56-sdw.c
@@ -436,6 +436,7 @@ static const struct sdw_slave_ops cs35l56_sdw_ops = {
 static int __maybe_unused cs35l56_sdw_handle_unattach(struct cs35l56_private *cs35l56)
 {
 	struct sdw_slave *peripheral = cs35l56->sdw_peripheral;
+	int ret;
 
 	dev_dbg(cs35l56->base.dev, "attached:%u unattach_request:%u in_clock_stop_1:%u\n",
 		cs35l56->sdw_attached, peripheral->unattach_request, cs35l56->sdw_in_clock_stop_1);
@@ -443,13 +444,10 @@ static int __maybe_unused cs35l56_sdw_handle_unattach(struct cs35l56_private *cs
 	if (cs35l56->sdw_in_clock_stop_1 || peripheral->unattach_request) {
 		/* Cannot access registers until bus is re-initialized. */
 		dev_dbg(cs35l56->base.dev, "Wait for initialization_complete\n");
-		if (!wait_for_completion_timeout(&peripheral->initialization_complete,
-						 msecs_to_jiffies(5000))) {
-			dev_err(cs35l56->base.dev, "initialization_complete timed out\n");
-			return -ETIMEDOUT;
-		}
+		ret = sdw_slave_wait_for_init(peripheral, 5000);
+		if (ret)
+			return ret;
 
-		peripheral->unattach_request = 0;
 		cs35l56->sdw_in_clock_stop_1 = false;
 
 		/*
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 03/18] ASoC: cs42l42: Use new SoundWire enumeration helper
  2026-05-11 14:10 [PATCH v2 00/18] Add a new SoundWire enumeration helper Charles Keepax
  2026-05-11 14:10 ` [PATCH v2 01/18] soundwire: Add a helper function to wait for device initialisation Charles Keepax
  2026-05-11 14:10 ` [PATCH v2 02/18] ASoC: cs35l56: Use new SoundWire enumeration helper Charles Keepax
@ 2026-05-11 14:10 ` Charles Keepax
  2026-05-11 14:10 ` [PATCH v2 04/18] ASoC: max98363: " Charles Keepax
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Charles Keepax @ 2026-05-11 14:10 UTC (permalink / raw)
  To: broonie, vkoul
  Cc: lgirdwood, pierre-louis.bossart, yung-chuan.liao, peter.ujfalusi,
	oder_chiou, jack.yu, shumingf, niranjan.hy, shenghao-ding,
	kevin-lu, baojun.xu, sen, linux-sound, linux-kernel, patches

Update the driver to use the new core helper that waits for the device
to enumerate on SoundWire and be initialised by the SoundWire core.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

Changes since v1:
 - Leave in the if bailing on unattach_request so the code still skips
   the register transactions as the bottom of the function in that case.

 sound/soc/codecs/cs42l42-sdw.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/sound/soc/codecs/cs42l42-sdw.c b/sound/soc/codecs/cs42l42-sdw.c
index d5999ad9ff9b4..b8256ce0b8fbe 100644
--- a/sound/soc/codecs/cs42l42-sdw.c
+++ b/sound/soc/codecs/cs42l42-sdw.c
@@ -433,19 +433,16 @@ static const struct reg_sequence cs42l42_soft_reboot_seq[] = {
 static int cs42l42_sdw_handle_unattach(struct cs42l42_private *cs42l42)
 {
 	struct sdw_slave *peripheral = cs42l42->sdw_peripheral;
+	int ret;
 
 	if (!peripheral->unattach_request)
 		return 0;
 
 	/* Cannot access registers until master re-attaches. */
 	dev_dbg(&peripheral->dev, "Wait for initialization_complete\n");
-	if (!wait_for_completion_timeout(&peripheral->initialization_complete,
-					 msecs_to_jiffies(5000))) {
-		dev_err(&peripheral->dev, "initialization_complete timed out\n");
-		return -ETIMEDOUT;
-	}
-
-	peripheral->unattach_request = 0;
+	ret = sdw_slave_wait_for_init(peripheral, 5000);
+	if (ret)
+		return ret;
 
 	/*
 	 * After a bus reset there must be a reconfiguration reset to
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 04/18] ASoC: max98363: Use new SoundWire enumeration helper
  2026-05-11 14:10 [PATCH v2 00/18] Add a new SoundWire enumeration helper Charles Keepax
                   ` (2 preceding siblings ...)
  2026-05-11 14:10 ` [PATCH v2 03/18] ASoC: cs42l42: " Charles Keepax
@ 2026-05-11 14:10 ` Charles Keepax
  2026-05-11 14:10 ` [PATCH v2 05/18] ASoC: max98373: " Charles Keepax
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Charles Keepax @ 2026-05-11 14:10 UTC (permalink / raw)
  To: broonie, vkoul
  Cc: lgirdwood, pierre-louis.bossart, yung-chuan.liao, peter.ujfalusi,
	oder_chiou, jack.yu, shumingf, niranjan.hy, shenghao-ding,
	kevin-lu, baojun.xu, sen, linux-sound, linux-kernel, patches

Update the driver to use the new core helper that waits for the device
to enumerate on SoundWire and be initialised by the SoundWire core.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

No changes since v1.

 sound/soc/codecs/max98363.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/sound/soc/codecs/max98363.c b/sound/soc/codecs/max98363.c
index 25af78ab30d5c..099dc5bf6195f 100644
--- a/sound/soc/codecs/max98363.c
+++ b/sound/soc/codecs/max98363.c
@@ -90,24 +90,15 @@ static int max98363_resume(struct device *dev)
 {
 	struct sdw_slave *slave = dev_to_sdw_dev(dev);
 	struct max98363_priv *max98363 = dev_get_drvdata(dev);
-	unsigned long time;
+	int ret;
 
 	if (!max98363->first_hw_init)
 		return 0;
 
-	if (!slave->unattach_request)
-		goto regmap_sync;
-
-	time = wait_for_completion_timeout(&slave->initialization_complete,
-					   msecs_to_jiffies(MAX98363_PROBE_TIMEOUT));
-	if (!time) {
-		dev_err(dev, "Initialization not complete, timed out\n");
-		return -ETIMEDOUT;
-	}
-
-regmap_sync:
+	ret = sdw_slave_wait_for_init(slave, MAX98363_PROBE_TIMEOUT);
+	if (ret)
+		return ret;
 
-	slave->unattach_request = 0;
 	regcache_cache_only(max98363->regmap, false);
 	regcache_sync(max98363->regmap);
 
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 05/18] ASoC: max98373: Use new SoundWire enumeration helper
  2026-05-11 14:10 [PATCH v2 00/18] Add a new SoundWire enumeration helper Charles Keepax
                   ` (3 preceding siblings ...)
  2026-05-11 14:10 ` [PATCH v2 04/18] ASoC: max98363: " Charles Keepax
@ 2026-05-11 14:10 ` Charles Keepax
  2026-05-11 14:10 ` [PATCH v2 06/18] ASoC: rt700: " Charles Keepax
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Charles Keepax @ 2026-05-11 14:10 UTC (permalink / raw)
  To: broonie, vkoul
  Cc: lgirdwood, pierre-louis.bossart, yung-chuan.liao, peter.ujfalusi,
	oder_chiou, jack.yu, shumingf, niranjan.hy, shenghao-ding,
	kevin-lu, baojun.xu, sen, linux-sound, linux-kernel, patches

Update the driver to use the new core helper that waits for the device
to enumerate on SoundWire and be initialised by the SoundWire core.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

No changes since v1.

 sound/soc/codecs/max98373-sdw.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/sound/soc/codecs/max98373-sdw.c b/sound/soc/codecs/max98373-sdw.c
index 16673440218cb..6829fa07c9ecb 100644
--- a/sound/soc/codecs/max98373-sdw.c
+++ b/sound/soc/codecs/max98373-sdw.c
@@ -266,25 +266,15 @@ static int max98373_resume(struct device *dev)
 {
 	struct sdw_slave *slave = dev_to_sdw_dev(dev);
 	struct max98373_priv *max98373 = dev_get_drvdata(dev);
-	unsigned long time;
+	int ret;
 
 	if (!max98373->first_hw_init)
 		return 0;
 
-	if (!slave->unattach_request)
-		goto regmap_sync;
-
-	time = wait_for_completion_timeout(&slave->initialization_complete,
-					   msecs_to_jiffies(MAX98373_PROBE_TIMEOUT));
-	if (!time) {
-		dev_err(dev, "Initialization not complete, timed out\n");
-		sdw_show_ping_status(slave->bus, true);
-
-		return -ETIMEDOUT;
-	}
+	ret = sdw_slave_wait_for_init(slave, MAX98373_PROBE_TIMEOUT);
+	if (ret)
+		return ret;
 
-regmap_sync:
-	slave->unattach_request = 0;
 	regcache_cache_only(max98373->regmap, false);
 	regcache_sync(max98373->regmap);
 
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 06/18] ASoC: rt700: Use new SoundWire enumeration helper
  2026-05-11 14:10 [PATCH v2 00/18] Add a new SoundWire enumeration helper Charles Keepax
                   ` (4 preceding siblings ...)
  2026-05-11 14:10 ` [PATCH v2 05/18] ASoC: max98373: " Charles Keepax
@ 2026-05-11 14:10 ` Charles Keepax
  2026-05-11 14:10 ` [PATCH v2 07/18] ASoC: rt711: " Charles Keepax
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Charles Keepax @ 2026-05-11 14:10 UTC (permalink / raw)
  To: broonie, vkoul
  Cc: lgirdwood, pierre-louis.bossart, yung-chuan.liao, peter.ujfalusi,
	oder_chiou, jack.yu, shumingf, niranjan.hy, shenghao-ding,
	kevin-lu, baojun.xu, sen, linux-sound, linux-kernel, patches

Update the driver to use the new core helper that waits for the device
to enumerate on SoundWire and be initialised by the SoundWire core.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

No changes since v1.

 sound/soc/codecs/rt700-sdw.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/sound/soc/codecs/rt700-sdw.c b/sound/soc/codecs/rt700-sdw.c
index 9ce36a66fae1d..30fcca210f051 100644
--- a/sound/soc/codecs/rt700-sdw.c
+++ b/sound/soc/codecs/rt700-sdw.c
@@ -522,25 +522,15 @@ static int rt700_dev_resume(struct device *dev)
 {
 	struct sdw_slave *slave = dev_to_sdw_dev(dev);
 	struct rt700_priv *rt700 = dev_get_drvdata(dev);
-	unsigned long time;
+	int ret;
 
 	if (!rt700->first_hw_init)
 		return 0;
 
-	if (!slave->unattach_request)
-		goto regmap_sync;
-
-	time = wait_for_completion_timeout(&slave->initialization_complete,
-				msecs_to_jiffies(RT700_PROBE_TIMEOUT));
-	if (!time) {
-		dev_err(&slave->dev, "Initialization not complete, timed out\n");
-		sdw_show_ping_status(slave->bus, true);
-
-		return -ETIMEDOUT;
-	}
+	ret = sdw_slave_wait_for_init(slave, RT700_PROBE_TIMEOUT);
+	if (ret)
+		return ret;
 
-regmap_sync:
-	slave->unattach_request = 0;
 	regcache_cache_only(rt700->regmap, false);
 	regcache_sync_region(rt700->regmap, 0x3000, 0x8fff);
 	regcache_sync_region(rt700->regmap, 0x752010, 0x75206b);
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 07/18] ASoC: rt711: Use new SoundWire enumeration helper
  2026-05-11 14:10 [PATCH v2 00/18] Add a new SoundWire enumeration helper Charles Keepax
                   ` (5 preceding siblings ...)
  2026-05-11 14:10 ` [PATCH v2 06/18] ASoC: rt700: " Charles Keepax
@ 2026-05-11 14:10 ` Charles Keepax
  2026-05-11 14:10 ` [PATCH v2 08/18] ASoC: rt712: " Charles Keepax
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Charles Keepax @ 2026-05-11 14:10 UTC (permalink / raw)
  To: broonie, vkoul
  Cc: lgirdwood, pierre-louis.bossart, yung-chuan.liao, peter.ujfalusi,
	oder_chiou, jack.yu, shumingf, niranjan.hy, shenghao-ding,
	kevin-lu, baojun.xu, sen, linux-sound, linux-kernel, patches

Update the driver to use the new core helper that waits for the device
to enumerate on SoundWire and be initialised by the SoundWire core.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

No changes since v1.

 sound/soc/codecs/rt711-sdca-sdw.c | 16 ++++------------
 sound/soc/codecs/rt711-sdw.c      | 14 ++++----------
 2 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/sound/soc/codecs/rt711-sdca-sdw.c b/sound/soc/codecs/rt711-sdca-sdw.c
index 49dacceddf815..a8164fc3979ab 100644
--- a/sound/soc/codecs/rt711-sdca-sdw.c
+++ b/sound/soc/codecs/rt711-sdca-sdw.c
@@ -438,7 +438,7 @@ static int rt711_sdca_dev_resume(struct device *dev)
 {
 	struct sdw_slave *slave = dev_to_sdw_dev(dev);
 	struct rt711_sdca_priv *rt711 = dev_get_drvdata(dev);
-	unsigned long time;
+	int ret;
 
 	if (!rt711->first_hw_init)
 		return 0;
@@ -451,20 +451,12 @@ static int rt711_sdca_dev_resume(struct device *dev)
 			rt711->disable_irq = false;
 		}
 		mutex_unlock(&rt711->disable_irq_lock);
-		goto regmap_sync;
 	}
 
-	time = wait_for_completion_timeout(&slave->initialization_complete,
-				msecs_to_jiffies(RT711_PROBE_TIMEOUT));
-	if (!time) {
-		dev_err(&slave->dev, "%s: Initialization not complete, timed out\n", __func__);
-		sdw_show_ping_status(slave->bus, true);
+	ret = sdw_slave_wait_for_init(slave, RT711_PROBE_TIMEOUT);
+	if (ret)
+		return ret;
 
-		return -ETIMEDOUT;
-	}
-
-regmap_sync:
-	slave->unattach_request = 0;
 	regcache_cache_only(rt711->regmap, false);
 	regcache_sync(rt711->regmap);
 	regcache_cache_only(rt711->mbq_regmap, false);
diff --git a/sound/soc/codecs/rt711-sdw.c b/sound/soc/codecs/rt711-sdw.c
index 72ddf4cebdf36..df3c43f2ab6b8 100644
--- a/sound/soc/codecs/rt711-sdw.c
+++ b/sound/soc/codecs/rt711-sdw.c
@@ -530,7 +530,7 @@ static int rt711_dev_resume(struct device *dev)
 {
 	struct sdw_slave *slave = dev_to_sdw_dev(dev);
 	struct rt711_priv *rt711 = dev_get_drvdata(dev);
-	unsigned long time;
+	int ret;
 
 	if (!rt711->first_hw_init)
 		return 0;
@@ -542,18 +542,12 @@ static int rt711_dev_resume(struct device *dev)
 			rt711->disable_irq = false;
 		}
 		mutex_unlock(&rt711->disable_irq_lock);
-		goto regmap_sync;
 	}
 
-	time = wait_for_completion_timeout(&slave->initialization_complete,
-				msecs_to_jiffies(RT711_PROBE_TIMEOUT));
-	if (!time) {
-		dev_err(&slave->dev, "%s: Initialization not complete, timed out\n", __func__);
-		return -ETIMEDOUT;
-	}
+	ret = sdw_slave_wait_for_init(slave, RT711_PROBE_TIMEOUT);
+	if (ret)
+		return ret;
 
-regmap_sync:
-	slave->unattach_request = 0;
 	regcache_cache_only(rt711->regmap, false);
 	regcache_sync_region(rt711->regmap, 0x3000, 0x8fff);
 	regcache_sync_region(rt711->regmap, 0x752009, 0x752091);
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 08/18] ASoC: rt712: Use new SoundWire enumeration helper
  2026-05-11 14:10 [PATCH v2 00/18] Add a new SoundWire enumeration helper Charles Keepax
                   ` (6 preceding siblings ...)
  2026-05-11 14:10 ` [PATCH v2 07/18] ASoC: rt711: " Charles Keepax
@ 2026-05-11 14:10 ` Charles Keepax
  2026-05-11 14:10 ` [PATCH v2 09/18] ASoC: rt715: " Charles Keepax
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Charles Keepax @ 2026-05-11 14:10 UTC (permalink / raw)
  To: broonie, vkoul
  Cc: lgirdwood, pierre-louis.bossart, yung-chuan.liao, peter.ujfalusi,
	oder_chiou, jack.yu, shumingf, niranjan.hy, shenghao-ding,
	kevin-lu, baojun.xu, sen, linux-sound, linux-kernel, patches

Update the driver to use the new core helper that waits for the device
to enumerate on SoundWire and be initialised by the SoundWire core.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

No changes since v1.

 sound/soc/codecs/rt712-sdca-dmic.c | 19 ++++---------------
 sound/soc/codecs/rt712-sdca-sdw.c  | 16 ++++------------
 2 files changed, 8 insertions(+), 27 deletions(-)

diff --git a/sound/soc/codecs/rt712-sdca-dmic.c b/sound/soc/codecs/rt712-sdca-dmic.c
index 4d83544ef2049..4c5c2f5ba5edf 100644
--- a/sound/soc/codecs/rt712-sdca-dmic.c
+++ b/sound/soc/codecs/rt712-sdca-dmic.c
@@ -905,26 +905,15 @@ static int rt712_sdca_dmic_dev_resume(struct device *dev)
 {
 	struct sdw_slave *slave = dev_to_sdw_dev(dev);
 	struct rt712_sdca_dmic_priv *rt712 = dev_get_drvdata(dev);
-	unsigned long time;
+	int ret;
 
 	if (!rt712->first_hw_init)
 		return 0;
 
-	if (!slave->unattach_request)
-		goto regmap_sync;
-
-	time = wait_for_completion_timeout(&slave->initialization_complete,
-				msecs_to_jiffies(RT712_PROBE_TIMEOUT));
-	if (!time) {
-		dev_err(&slave->dev, "%s: Initialization not complete, timed out\n",
-			__func__);
-		sdw_show_ping_status(slave->bus, true);
-
-		return -ETIMEDOUT;
-	}
+	ret = sdw_slave_wait_for_init(slave, RT712_PROBE_TIMEOUT);
+	if (ret)
+		return ret;
 
-regmap_sync:
-	slave->unattach_request = 0;
 	regcache_cache_only(rt712->regmap, false);
 	regcache_sync(rt712->regmap);
 	regcache_cache_only(rt712->mbq_regmap, false);
diff --git a/sound/soc/codecs/rt712-sdca-sdw.c b/sound/soc/codecs/rt712-sdca-sdw.c
index 8c82887174db2..5817321804736 100644
--- a/sound/soc/codecs/rt712-sdca-sdw.c
+++ b/sound/soc/codecs/rt712-sdca-sdw.c
@@ -450,7 +450,7 @@ static int rt712_sdca_dev_resume(struct device *dev)
 {
 	struct sdw_slave *slave = dev_to_sdw_dev(dev);
 	struct rt712_sdca_priv *rt712 = dev_get_drvdata(dev);
-	unsigned long time;
+	int ret;
 
 	if (!rt712->first_hw_init)
 		return 0;
@@ -464,20 +464,12 @@ static int rt712_sdca_dev_resume(struct device *dev)
 			rt712->disable_irq = false;
 		}
 		mutex_unlock(&rt712->disable_irq_lock);
-		goto regmap_sync;
 	}
 
-	time = wait_for_completion_timeout(&slave->initialization_complete,
-				msecs_to_jiffies(RT712_PROBE_TIMEOUT));
-	if (!time) {
-		dev_err(&slave->dev, "%s: Initialization not complete, timed out\n", __func__);
-		sdw_show_ping_status(slave->bus, true);
+	ret = sdw_slave_wait_for_init(slave, RT712_PROBE_TIMEOUT);
+	if (ret)
+		return ret;
 
-		return -ETIMEDOUT;
-	}
-
-regmap_sync:
-	slave->unattach_request = 0;
 	regcache_cache_only(rt712->regmap, false);
 	regcache_sync(rt712->regmap);
 	regcache_cache_only(rt712->mbq_regmap, false);
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 09/18] ASoC: rt715: Use new SoundWire enumeration helper
  2026-05-11 14:10 [PATCH v2 00/18] Add a new SoundWire enumeration helper Charles Keepax
                   ` (7 preceding siblings ...)
  2026-05-11 14:10 ` [PATCH v2 08/18] ASoC: rt712: " Charles Keepax
@ 2026-05-11 14:10 ` Charles Keepax
  2026-05-11 14:10 ` [PATCH v2 10/18] ASoc: rt721: " Charles Keepax
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Charles Keepax @ 2026-05-11 14:10 UTC (permalink / raw)
  To: broonie, vkoul
  Cc: lgirdwood, pierre-louis.bossart, yung-chuan.liao, peter.ujfalusi,
	oder_chiou, jack.yu, shumingf, niranjan.hy, shenghao-ding,
	kevin-lu, baojun.xu, sen, linux-sound, linux-kernel, patches

Update the driver to use the new core helper that waits for the device
to enumerate on SoundWire and be initialised by the SoundWire core.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

No changes since v1.

 sound/soc/codecs/rt715-sdca-sdw.c | 18 ++++--------------
 sound/soc/codecs/rt715-sdw.c      | 18 ++++--------------
 2 files changed, 8 insertions(+), 28 deletions(-)

diff --git a/sound/soc/codecs/rt715-sdca-sdw.c b/sound/soc/codecs/rt715-sdca-sdw.c
index 968bc183b8d8c..4b9815b5628db 100644
--- a/sound/soc/codecs/rt715-sdca-sdw.c
+++ b/sound/soc/codecs/rt715-sdca-sdw.c
@@ -224,25 +224,15 @@ static int rt715_dev_resume(struct device *dev)
 {
 	struct sdw_slave *slave = dev_to_sdw_dev(dev);
 	struct rt715_sdca_priv *rt715 = dev_get_drvdata(dev);
-	unsigned long time;
+	int ret;
 
 	if (!rt715->first_hw_init)
 		return 0;
 
-	if (!slave->unattach_request)
-		goto regmap_sync;
+	ret = sdw_slave_wait_for_init(slave, RT715_PROBE_TIMEOUT);
+	if (ret)
+		return ret;
 
-	time = wait_for_completion_timeout(&slave->initialization_complete,
-					   msecs_to_jiffies(RT715_PROBE_TIMEOUT));
-	if (!time) {
-		dev_err(&slave->dev, "%s: Initialization not complete, timed out\n", __func__);
-		sdw_show_ping_status(slave->bus, true);
-
-		return -ETIMEDOUT;
-	}
-
-regmap_sync:
-	slave->unattach_request = 0;
 	regcache_cache_only(rt715->regmap, false);
 	regcache_sync_region(rt715->regmap,
 		SDW_SDCA_CTL(FUN_JACK_CODEC, RT715_SDCA_ST_EN, RT715_SDCA_ST_CTRL,
diff --git a/sound/soc/codecs/rt715-sdw.c b/sound/soc/codecs/rt715-sdw.c
index 49c91d015be4d..7f83a8f1a06e9 100644
--- a/sound/soc/codecs/rt715-sdw.c
+++ b/sound/soc/codecs/rt715-sdw.c
@@ -501,25 +501,15 @@ static int rt715_dev_resume(struct device *dev)
 {
 	struct sdw_slave *slave = dev_to_sdw_dev(dev);
 	struct rt715_priv *rt715 = dev_get_drvdata(dev);
-	unsigned long time;
+	int ret;
 
 	if (!rt715->first_hw_init)
 		return 0;
 
-	if (!slave->unattach_request)
-		goto regmap_sync;
-
-	time = wait_for_completion_timeout(&slave->initialization_complete,
-					   msecs_to_jiffies(RT715_PROBE_TIMEOUT));
-	if (!time) {
-		dev_err(&slave->dev, "%s: Initialization not complete, timed out\n", __func__);
-		sdw_show_ping_status(slave->bus, true);
-
-		return -ETIMEDOUT;
-	}
+	ret = sdw_slave_wait_for_init(slave, RT715_PROBE_TIMEOUT);
+	if (ret)
+		return ret;
 
-regmap_sync:
-	slave->unattach_request = 0;
 	regcache_cache_only(rt715->regmap, false);
 	regcache_sync_region(rt715->regmap, 0x3000, 0x8fff);
 	regcache_sync_region(rt715->regmap, 0x752039, 0x752039);
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 10/18] ASoc: rt721: Use new SoundWire enumeration helper
  2026-05-11 14:10 [PATCH v2 00/18] Add a new SoundWire enumeration helper Charles Keepax
                   ` (8 preceding siblings ...)
  2026-05-11 14:10 ` [PATCH v2 09/18] ASoC: rt715: " Charles Keepax
@ 2026-05-11 14:10 ` Charles Keepax
  2026-05-11 14:10 ` [PATCH v2 11/18] ASoC: rt722: " Charles Keepax
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Charles Keepax @ 2026-05-11 14:10 UTC (permalink / raw)
  To: broonie, vkoul
  Cc: lgirdwood, pierre-louis.bossart, yung-chuan.liao, peter.ujfalusi,
	oder_chiou, jack.yu, shumingf, niranjan.hy, shenghao-ding,
	kevin-lu, baojun.xu, sen, linux-sound, linux-kernel, patches

Update the driver to use the new core helper that waits for the device
to enumerate on SoundWire and be initialised by the SoundWire core.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

No changes since v1.

 sound/soc/codecs/rt721-sdca-sdw.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/sound/soc/codecs/rt721-sdca-sdw.c b/sound/soc/codecs/rt721-sdca-sdw.c
index 6eb8512975b85..58606209316a4 100644
--- a/sound/soc/codecs/rt721-sdca-sdw.c
+++ b/sound/soc/codecs/rt721-sdca-sdw.c
@@ -489,7 +489,7 @@ static int rt721_sdca_dev_resume(struct device *dev)
 {
 	struct sdw_slave *slave = dev_to_sdw_dev(dev);
 	struct rt721_sdca_priv *rt721 = dev_get_drvdata(dev);
-	unsigned long time;
+	int ret;
 
 	if (!rt721->first_hw_init)
 		return 0;
@@ -502,20 +502,12 @@ static int rt721_sdca_dev_resume(struct device *dev)
 			rt721->disable_irq = false;
 		}
 		mutex_unlock(&rt721->disable_irq_lock);
-		goto regmap_sync;
 	}
 
-	time = wait_for_completion_timeout(&slave->initialization_complete,
-				msecs_to_jiffies(RT721_PROBE_TIMEOUT));
-	if (!time) {
-		dev_err(&slave->dev, "Initialization not complete, timed out\n");
-		sdw_show_ping_status(slave->bus, true);
+	ret = sdw_slave_wait_for_init(slave, RT721_PROBE_TIMEOUT);
+	if (ret)
+		return ret;
 
-		return -ETIMEDOUT;
-	}
-
-regmap_sync:
-	slave->unattach_request = 0;
 	regcache_cache_only(rt721->regmap, false);
 	regcache_sync(rt721->regmap);
 	regcache_cache_only(rt721->mbq_regmap, false);
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 11/18] ASoC: rt722: Use new SoundWire enumeration helper
  2026-05-11 14:10 [PATCH v2 00/18] Add a new SoundWire enumeration helper Charles Keepax
                   ` (9 preceding siblings ...)
  2026-05-11 14:10 ` [PATCH v2 10/18] ASoc: rt721: " Charles Keepax
@ 2026-05-11 14:10 ` Charles Keepax
  2026-05-11 14:10 ` [PATCH v2 12/18] ASoC: rt1017: " Charles Keepax
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Charles Keepax @ 2026-05-11 14:10 UTC (permalink / raw)
  To: broonie, vkoul
  Cc: lgirdwood, pierre-louis.bossart, yung-chuan.liao, peter.ujfalusi,
	oder_chiou, jack.yu, shumingf, niranjan.hy, shenghao-ding,
	kevin-lu, baojun.xu, sen, linux-sound, linux-kernel, patches

Update the driver to use the new core helper that waits for the device
to enumerate on SoundWire and be initialised by the SoundWire core.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

No changes since v1.

 sound/soc/codecs/rt722-sdca-sdw.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/sound/soc/codecs/rt722-sdca-sdw.c b/sound/soc/codecs/rt722-sdca-sdw.c
index 0a5b3ffa90daf..a5feba3d0c182 100644
--- a/sound/soc/codecs/rt722-sdca-sdw.c
+++ b/sound/soc/codecs/rt722-sdca-sdw.c
@@ -501,7 +501,7 @@ static int rt722_sdca_dev_resume(struct device *dev)
 {
 	struct sdw_slave *slave = dev_to_sdw_dev(dev);
 	struct rt722_sdca_priv *rt722 = dev_get_drvdata(dev);
-	unsigned long time;
+	int ret;
 
 	if (!rt722->first_hw_init)
 		return 0;
@@ -514,20 +514,12 @@ static int rt722_sdca_dev_resume(struct device *dev)
 			rt722->disable_irq = false;
 		}
 		mutex_unlock(&rt722->disable_irq_lock);
-		goto regmap_sync;
 	}
 
-	time = wait_for_completion_timeout(&slave->initialization_complete,
-				msecs_to_jiffies(RT722_PROBE_TIMEOUT));
-	if (!time) {
-		dev_err(&slave->dev, "Initialization not complete, timed out\n");
-		sdw_show_ping_status(slave->bus, true);
+	ret = sdw_slave_wait_for_init(slave, RT722_PROBE_TIMEOUT);
+	if (ret)
+		return ret;
 
-		return -ETIMEDOUT;
-	}
-
-regmap_sync:
-	slave->unattach_request = 0;
 	regcache_cache_only(rt722->regmap, false);
 	regcache_sync(rt722->regmap);
 	return 0;
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 12/18] ASoC: rt1017: Use new SoundWire enumeration helper
  2026-05-11 14:10 [PATCH v2 00/18] Add a new SoundWire enumeration helper Charles Keepax
                   ` (10 preceding siblings ...)
  2026-05-11 14:10 ` [PATCH v2 11/18] ASoC: rt722: " Charles Keepax
@ 2026-05-11 14:10 ` Charles Keepax
  2026-05-11 14:10 ` [PATCH v2 13/18] ASoC: rt1308: " Charles Keepax
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Charles Keepax @ 2026-05-11 14:10 UTC (permalink / raw)
  To: broonie, vkoul
  Cc: lgirdwood, pierre-louis.bossart, yung-chuan.liao, peter.ujfalusi,
	oder_chiou, jack.yu, shumingf, niranjan.hy, shenghao-ding,
	kevin-lu, baojun.xu, sen, linux-sound, linux-kernel, patches

Update the driver to use the new core helper that waits for the device
to enumerate on SoundWire and be initialised by the SoundWire core.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

No changes since v1.

 sound/soc/codecs/rt1017-sdca-sdw.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/sound/soc/codecs/rt1017-sdca-sdw.c b/sound/soc/codecs/rt1017-sdca-sdw.c
index 148b36173a257..d62e8a2536767 100644
--- a/sound/soc/codecs/rt1017-sdca-sdw.c
+++ b/sound/soc/codecs/rt1017-sdca-sdw.c
@@ -773,25 +773,15 @@ static int rt1017_sdca_dev_resume(struct device *dev)
 {
 	struct sdw_slave *slave = dev_to_sdw_dev(dev);
 	struct rt1017_sdca_priv *rt1017 = dev_get_drvdata(dev);
-	unsigned long time;
+	int ret;
 
 	if (!rt1017->first_hw_init)
 		return 0;
 
-	if (!slave->unattach_request)
-		goto regmap_sync;
-
-	time = wait_for_completion_timeout(&slave->initialization_complete,
-				msecs_to_jiffies(RT1017_PROBE_TIMEOUT));
-	if (!time) {
-		dev_err(&slave->dev, "Initialization not complete, timed out\n");
-		sdw_show_ping_status(slave->bus, true);
-
-		return -ETIMEDOUT;
-	}
+	ret = sdw_slave_wait_for_init(slave, RT1017_PROBE_TIMEOUT);
+	if (ret)
+		return ret;
 
-regmap_sync:
-	slave->unattach_request = 0;
 	regcache_cache_only(rt1017->regmap, false);
 	regcache_sync(rt1017->regmap);
 
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 13/18] ASoC: rt1308: Use new SoundWire enumeration helper
  2026-05-11 14:10 [PATCH v2 00/18] Add a new SoundWire enumeration helper Charles Keepax
                   ` (11 preceding siblings ...)
  2026-05-11 14:10 ` [PATCH v2 12/18] ASoC: rt1017: " Charles Keepax
@ 2026-05-11 14:10 ` Charles Keepax
  2026-05-11 14:10 ` [PATCH v2 14/18] ASoC: rt1316: " Charles Keepax
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Charles Keepax @ 2026-05-11 14:10 UTC (permalink / raw)
  To: broonie, vkoul
  Cc: lgirdwood, pierre-louis.bossart, yung-chuan.liao, peter.ujfalusi,
	oder_chiou, jack.yu, shumingf, niranjan.hy, shenghao-ding,
	kevin-lu, baojun.xu, sen, linux-sound, linux-kernel, patches

Update the driver to use the new core helper that waits for the device
to enumerate on SoundWire and be initialised by the SoundWire core.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

No changes since v1.

 sound/soc/codecs/rt1308-sdw.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/sound/soc/codecs/rt1308-sdw.c b/sound/soc/codecs/rt1308-sdw.c
index e077d096bc239..39e06a3a75609 100644
--- a/sound/soc/codecs/rt1308-sdw.c
+++ b/sound/soc/codecs/rt1308-sdw.c
@@ -768,25 +768,15 @@ static int rt1308_dev_resume(struct device *dev)
 {
 	struct sdw_slave *slave = dev_to_sdw_dev(dev);
 	struct rt1308_sdw_priv *rt1308 = dev_get_drvdata(dev);
-	unsigned long time;
+	int ret;
 
 	if (!rt1308->first_hw_init)
 		return 0;
 
-	if (!slave->unattach_request)
-		goto regmap_sync;
-
-	time = wait_for_completion_timeout(&slave->initialization_complete,
-				msecs_to_jiffies(RT1308_PROBE_TIMEOUT));
-	if (!time) {
-		dev_err(&slave->dev, "Initialization not complete, timed out\n");
-		sdw_show_ping_status(slave->bus, true);
-
-		return -ETIMEDOUT;
-	}
+	ret = sdw_slave_wait_for_init(slave, RT1308_PROBE_TIMEOUT);
+	if (ret)
+		return ret;
 
-regmap_sync:
-	slave->unattach_request = 0;
 	regcache_cache_only(rt1308->regmap, false);
 	regcache_sync_region(rt1308->regmap, 0xc000, 0xcfff);
 
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 14/18] ASoC: rt1316: Use new SoundWire enumeration helper
  2026-05-11 14:10 [PATCH v2 00/18] Add a new SoundWire enumeration helper Charles Keepax
                   ` (12 preceding siblings ...)
  2026-05-11 14:10 ` [PATCH v2 13/18] ASoC: rt1308: " Charles Keepax
@ 2026-05-11 14:10 ` Charles Keepax
  2026-05-11 14:10 ` [PATCH v2 15/18] ASoC: rt1318: " Charles Keepax
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Charles Keepax @ 2026-05-11 14:10 UTC (permalink / raw)
  To: broonie, vkoul
  Cc: lgirdwood, pierre-louis.bossart, yung-chuan.liao, peter.ujfalusi,
	oder_chiou, jack.yu, shumingf, niranjan.hy, shenghao-ding,
	kevin-lu, baojun.xu, sen, linux-sound, linux-kernel, patches

Update the driver to use the new core helper that waits for the device
to enumerate on SoundWire and be initialised by the SoundWire core.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

No changes since v1.

 sound/soc/codecs/rt1316-sdw.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/sound/soc/codecs/rt1316-sdw.c b/sound/soc/codecs/rt1316-sdw.c
index 20fc1579eb9cf..1828fd9d5af6a 100644
--- a/sound/soc/codecs/rt1316-sdw.c
+++ b/sound/soc/codecs/rt1316-sdw.c
@@ -745,25 +745,15 @@ static int rt1316_dev_resume(struct device *dev)
 {
 	struct sdw_slave *slave = dev_to_sdw_dev(dev);
 	struct rt1316_sdw_priv *rt1316 = dev_get_drvdata(dev);
-	unsigned long time;
+	int ret;
 
 	if (!rt1316->first_hw_init)
 		return 0;
 
-	if (!slave->unattach_request)
-		goto regmap_sync;
-
-	time = wait_for_completion_timeout(&slave->initialization_complete,
-				msecs_to_jiffies(RT1316_PROBE_TIMEOUT));
-	if (!time) {
-		dev_err(&slave->dev, "%s: Initialization not complete, timed out\n", __func__);
-		sdw_show_ping_status(slave->bus, true);
-
-		return -ETIMEDOUT;
-	}
+	ret = sdw_slave_wait_for_init(slave, RT1316_PROBE_TIMEOUT);
+	if (ret)
+		return ret;
 
-regmap_sync:
-	slave->unattach_request = 0;
 	regcache_cache_only(rt1316->regmap, false);
 	regcache_sync(rt1316->regmap);
 
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 15/18] ASoC: rt1318: Use new SoundWire enumeration helper
  2026-05-11 14:10 [PATCH v2 00/18] Add a new SoundWire enumeration helper Charles Keepax
                   ` (13 preceding siblings ...)
  2026-05-11 14:10 ` [PATCH v2 14/18] ASoC: rt1316: " Charles Keepax
@ 2026-05-11 14:10 ` Charles Keepax
  2026-05-11 14:10 ` [PATCH v2 16/18] ASoC: rt1320: " Charles Keepax
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Charles Keepax @ 2026-05-11 14:10 UTC (permalink / raw)
  To: broonie, vkoul
  Cc: lgirdwood, pierre-louis.bossart, yung-chuan.liao, peter.ujfalusi,
	oder_chiou, jack.yu, shumingf, niranjan.hy, shenghao-ding,
	kevin-lu, baojun.xu, sen, linux-sound, linux-kernel, patches

Update the driver to use the new core helper that waits for the device
to enumerate on SoundWire and be initialised by the SoundWire core.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

No changes since v1.

 sound/soc/codecs/rt1318-sdw.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/sound/soc/codecs/rt1318-sdw.c b/sound/soc/codecs/rt1318-sdw.c
index d28f1afe68f18..51bd11b92a554 100644
--- a/sound/soc/codecs/rt1318-sdw.c
+++ b/sound/soc/codecs/rt1318-sdw.c
@@ -821,23 +821,15 @@ static int rt1318_dev_resume(struct device *dev)
 {
 	struct sdw_slave *slave = dev_to_sdw_dev(dev);
 	struct rt1318_sdw_priv *rt1318 = dev_get_drvdata(dev);
-	unsigned long time;
+	int ret;
 
 	if (!rt1318->first_hw_init)
 		return 0;
 
-	if (!slave->unattach_request)
-		goto regmap_sync;
-
-	time = wait_for_completion_timeout(&slave->initialization_complete,
-				msecs_to_jiffies(RT1318_PROBE_TIMEOUT));
-	if (!time) {
-		dev_err(&slave->dev, "%s: Initialization not complete, timed out\n", __func__);
-		return -ETIMEDOUT;
-	}
+	ret = sdw_slave_wait_for_init(slave, RT1318_PROBE_TIMEOUT);
+	if (ret)
+		return ret;
 
-regmap_sync:
-	slave->unattach_request = 0;
 	regcache_cache_only(rt1318->regmap, false);
 	regcache_sync(rt1318->regmap);
 
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 16/18] ASoC: rt1320: Use new SoundWire enumeration helper
  2026-05-11 14:10 [PATCH v2 00/18] Add a new SoundWire enumeration helper Charles Keepax
                   ` (14 preceding siblings ...)
  2026-05-11 14:10 ` [PATCH v2 15/18] ASoC: rt1318: " Charles Keepax
@ 2026-05-11 14:10 ` Charles Keepax
  2026-05-11 14:10 ` [PATCH v2 17/18] ASoC: rt5682: " Charles Keepax
  2026-05-11 14:10 ` [PATCH v2 18/18] ASoC: tas2783: " Charles Keepax
  17 siblings, 0 replies; 20+ messages in thread
From: Charles Keepax @ 2026-05-11 14:10 UTC (permalink / raw)
  To: broonie, vkoul
  Cc: lgirdwood, pierre-louis.bossart, yung-chuan.liao, peter.ujfalusi,
	oder_chiou, jack.yu, shumingf, niranjan.hy, shenghao-ding,
	kevin-lu, baojun.xu, sen, linux-sound, linux-kernel, patches

Update the driver to use the new core helper that waits for the device
to enumerate on SoundWire and be initialised by the SoundWire core.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

No changes since v1.

 sound/soc/codecs/rt1320-sdw.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/sound/soc/codecs/rt1320-sdw.c b/sound/soc/codecs/rt1320-sdw.c
index 192faa431b5e9..13493b85f3c95 100644
--- a/sound/soc/codecs/rt1320-sdw.c
+++ b/sound/soc/codecs/rt1320-sdw.c
@@ -3053,23 +3053,15 @@ static int rt1320_dev_resume(struct device *dev)
 {
 	struct sdw_slave *slave = dev_to_sdw_dev(dev);
 	struct rt1320_sdw_priv *rt1320 = dev_get_drvdata(dev);
-	unsigned long time;
+	int ret;
 
 	if (!rt1320->first_hw_init)
 		return 0;
 
-	if (!slave->unattach_request)
-		goto regmap_sync;
-
-	time = wait_for_completion_timeout(&slave->initialization_complete,
-				msecs_to_jiffies(RT1320_PROBE_TIMEOUT));
-	if (!time) {
-		dev_err(&slave->dev, "%s: Initialization not complete, timed out\n", __func__);
-		return -ETIMEDOUT;
-	}
+	ret = sdw_slave_wait_for_init(slave, RT1320_PROBE_TIMEOUT);
+	if (ret)
+		return ret;
 
-regmap_sync:
-	slave->unattach_request = 0;
 	regcache_cache_only(rt1320->regmap, false);
 	regcache_sync(rt1320->regmap);
 	regcache_cache_only(rt1320->mbq_regmap, false);
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 17/18] ASoC: rt5682: Use new SoundWire enumeration helper
  2026-05-11 14:10 [PATCH v2 00/18] Add a new SoundWire enumeration helper Charles Keepax
                   ` (15 preceding siblings ...)
  2026-05-11 14:10 ` [PATCH v2 16/18] ASoC: rt1320: " Charles Keepax
@ 2026-05-11 14:10 ` Charles Keepax
  2026-05-11 14:10 ` [PATCH v2 18/18] ASoC: tas2783: " Charles Keepax
  17 siblings, 0 replies; 20+ messages in thread
From: Charles Keepax @ 2026-05-11 14:10 UTC (permalink / raw)
  To: broonie, vkoul
  Cc: lgirdwood, pierre-louis.bossart, yung-chuan.liao, peter.ujfalusi,
	oder_chiou, jack.yu, shumingf, niranjan.hy, shenghao-ding,
	kevin-lu, baojun.xu, sen, linux-sound, linux-kernel, patches

Update the driver to use the new core helper that waits for the device
to enumerate on SoundWire and be initialised by the SoundWire core.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

No changes since v1.

 sound/soc/codecs/rt5682-sdw.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/sound/soc/codecs/rt5682-sdw.c b/sound/soc/codecs/rt5682-sdw.c
index fc464538ceffb..ec2a35a0cacde 100644
--- a/sound/soc/codecs/rt5682-sdw.c
+++ b/sound/soc/codecs/rt5682-sdw.c
@@ -754,7 +754,7 @@ static int rt5682_dev_resume(struct device *dev)
 {
 	struct sdw_slave *slave = dev_to_sdw_dev(dev);
 	struct rt5682_priv *rt5682 = dev_get_drvdata(dev);
-	unsigned long time;
+	int ret;
 
 	if (!rt5682->first_hw_init)
 		return 0;
@@ -766,20 +766,12 @@ static int rt5682_dev_resume(struct device *dev)
 			rt5682->disable_irq = false;
 		}
 		mutex_unlock(&rt5682->disable_irq_lock);
-		goto regmap_sync;
 	}
 
-	time = wait_for_completion_timeout(&slave->initialization_complete,
-				msecs_to_jiffies(RT5682_PROBE_TIMEOUT));
-	if (!time) {
-		dev_err(&slave->dev, "%s: Initialization not complete, timed out\n", __func__);
-		sdw_show_ping_status(slave->bus, true);
-
-		return -ETIMEDOUT;
-	}
+	ret = sdw_slave_wait_for_init(slave, RT5682_PROBE_TIMEOUT);
+	if (ret)
+		return ret;
 
-regmap_sync:
-	slave->unattach_request = 0;
 	regcache_cache_only(rt5682->sdw_regmap, false);
 	regcache_cache_only(rt5682->regmap, false);
 	regcache_sync(rt5682->regmap);
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 18/18] ASoC: tas2783: Use new SoundWire enumeration helper
  2026-05-11 14:10 [PATCH v2 00/18] Add a new SoundWire enumeration helper Charles Keepax
                   ` (16 preceding siblings ...)
  2026-05-11 14:10 ` [PATCH v2 17/18] ASoC: rt5682: " Charles Keepax
@ 2026-05-11 14:10 ` Charles Keepax
  17 siblings, 0 replies; 20+ messages in thread
From: Charles Keepax @ 2026-05-11 14:10 UTC (permalink / raw)
  To: broonie, vkoul
  Cc: lgirdwood, pierre-louis.bossart, yung-chuan.liao, peter.ujfalusi,
	oder_chiou, jack.yu, shumingf, niranjan.hy, shenghao-ding,
	kevin-lu, baojun.xu, sen, linux-sound, linux-kernel, patches

Update the driver to use the new core helper that waits for the device
to enumerate on SoundWire and be initialised by the SoundWire core.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

No changes since v1.

 sound/soc/codecs/tas2783-sdw.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/sound/soc/codecs/tas2783-sdw.c b/sound/soc/codecs/tas2783-sdw.c
index 38009168c5a11..69d03ddc7a0ba 100644
--- a/sound/soc/codecs/tas2783-sdw.c
+++ b/sound/soc/codecs/tas2783-sdw.c
@@ -1082,22 +1082,12 @@ static s32 tas2783_sdca_dev_resume(struct device *dev)
 {
 	struct sdw_slave *slave = dev_to_sdw_dev(dev);
 	struct tas2783_prv *tas_dev = dev_get_drvdata(dev);
-	unsigned long t;
-
-	if (!slave->unattach_request)
-		goto regmap_sync;
-
-	t = wait_for_completion_timeout(&slave->initialization_complete,
-					msecs_to_jiffies(TAS2783_PROBE_TIMEOUT));
-	if (!t) {
-		dev_err(&slave->dev, "resume: initialization timed out\n");
-		sdw_show_ping_status(slave->bus, true);
-		return -ETIMEDOUT;
-	}
+	int ret;
 
-	slave->unattach_request = 0;
+	ret = sdw_slave_wait_for_init(slave, TAS2783_PROBE_TIMEOUT);
+	if (ret)
+		return ret;
 
-regmap_sync:
 	regcache_cache_only(tas_dev->regmap, false);
 	regcache_sync(tas_dev->regmap);
 	return 0;
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 01/18] soundwire: Add a helper function to wait for device initialisation
  2026-05-11 14:10 ` [PATCH v2 01/18] soundwire: Add a helper function to wait for device initialisation Charles Keepax
@ 2026-05-11 16:21   ` Vinod Koul
  0 siblings, 0 replies; 20+ messages in thread
From: Vinod Koul @ 2026-05-11 16:21 UTC (permalink / raw)
  To: Charles Keepax
  Cc: broonie, lgirdwood, pierre-louis.bossart, yung-chuan.liao,
	peter.ujfalusi, oder_chiou, jack.yu, shumingf, niranjan.hy,
	shenghao-ding, kevin-lu, baojun.xu, sen, linux-sound,
	linux-kernel, patches

On 11-05-26, 15:10, Charles Keepax wrote:
> Add a new helper function to wait for the device to enumerate
> and be initialised by the SoundWire core. Most of the SoundWire
> drivers have very similar boiler plate code in their runtime
> resume, and that boiler plate tends to access various internals
> of the SoundWire structs which is a mild layering violation.
> 
> Adding a new core helper function greatly eases both of these
> issues.

Acked-by: Vinod Koul <vkoul@kernel.org>

-- 
~Vinod

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2026-05-11 16:21 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-11 14:10 [PATCH v2 00/18] Add a new SoundWire enumeration helper Charles Keepax
2026-05-11 14:10 ` [PATCH v2 01/18] soundwire: Add a helper function to wait for device initialisation Charles Keepax
2026-05-11 16:21   ` Vinod Koul
2026-05-11 14:10 ` [PATCH v2 02/18] ASoC: cs35l56: Use new SoundWire enumeration helper Charles Keepax
2026-05-11 14:10 ` [PATCH v2 03/18] ASoC: cs42l42: " Charles Keepax
2026-05-11 14:10 ` [PATCH v2 04/18] ASoC: max98363: " Charles Keepax
2026-05-11 14:10 ` [PATCH v2 05/18] ASoC: max98373: " Charles Keepax
2026-05-11 14:10 ` [PATCH v2 06/18] ASoC: rt700: " Charles Keepax
2026-05-11 14:10 ` [PATCH v2 07/18] ASoC: rt711: " Charles Keepax
2026-05-11 14:10 ` [PATCH v2 08/18] ASoC: rt712: " Charles Keepax
2026-05-11 14:10 ` [PATCH v2 09/18] ASoC: rt715: " Charles Keepax
2026-05-11 14:10 ` [PATCH v2 10/18] ASoc: rt721: " Charles Keepax
2026-05-11 14:10 ` [PATCH v2 11/18] ASoC: rt722: " Charles Keepax
2026-05-11 14:10 ` [PATCH v2 12/18] ASoC: rt1017: " Charles Keepax
2026-05-11 14:10 ` [PATCH v2 13/18] ASoC: rt1308: " Charles Keepax
2026-05-11 14:10 ` [PATCH v2 14/18] ASoC: rt1316: " Charles Keepax
2026-05-11 14:10 ` [PATCH v2 15/18] ASoC: rt1318: " Charles Keepax
2026-05-11 14:10 ` [PATCH v2 16/18] ASoC: rt1320: " Charles Keepax
2026-05-11 14:10 ` [PATCH v2 17/18] ASoC: rt5682: " Charles Keepax
2026-05-11 14:10 ` [PATCH v2 18/18] ASoC: tas2783: " Charles Keepax

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox