[PATCH] ASoC: tac5xx2-sdw: Use SoundWire init wait helper

Cássio Gabriel posted 1 patch 4 weeks ago
sound/soc/codecs/tac5xx2-sdw.c | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
[PATCH] ASoC: tac5xx2-sdw: Use SoundWire init wait helper
Posted by Cássio Gabriel 4 weeks ago
The runtime-resume path open-codes the same SoundWire re-enumeration
wait now provided by sdw_slave_wait_for_init(): check whether an
unattach was requested, wait for initialization_complete, report timeout
status, and clear unattach_request on success.

Use the helper to match the other SoundWire codec drivers and keep the
runtime-resume unattach handling in the SoundWire core.

Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
---
 sound/soc/codecs/tac5xx2-sdw.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/sound/soc/codecs/tac5xx2-sdw.c b/sound/soc/codecs/tac5xx2-sdw.c
index 917b36ac1cd3..bb12cfb6da12 100644
--- a/sound/soc/codecs/tac5xx2-sdw.c
+++ b/sound/soc/codecs/tac5xx2-sdw.c
@@ -1437,7 +1437,6 @@ static s32 tac5xx2_sdca_dev_resume(struct device *dev)
 {
 	struct tac5xx2_prv *tac_dev = dev_get_drvdata(dev);
 	struct sdw_slave *slave = dev_to_sdw_dev(dev);
-	unsigned long t;
 	int ret;
 
 	if (!tac_dev->first_hw_init_done) {
@@ -1445,19 +1444,10 @@ static s32 tac5xx2_sdca_dev_resume(struct device *dev)
 		return 0;
 	}
 
-	if (!slave->unattach_request)
-		goto regmap_sync;
-
-	t = wait_for_completion_timeout(&slave->initialization_complete,
-					msecs_to_jiffies(TAC5XX2_PROBE_TIMEOUT_MS));
-	if (!t) {
-		dev_err(&slave->dev, "resume: initialization timed out\n");
-		sdw_show_ping_status(slave->bus, true);
-		return -ETIMEDOUT;
-	}
-	slave->unattach_request = 0;
+	ret = sdw_slave_wait_for_init(slave, TAC5XX2_PROBE_TIMEOUT_MS);
+	if (ret)
+		return ret;
 
-regmap_sync:
 	regcache_cache_only(tac_dev->regmap, false);
 	regcache_mark_dirty(tac_dev->regmap);
 	ret = regcache_sync(tac_dev->regmap);

---
base-commit: eeecc92a9f1dd213dd52d9b8f42d155595b1d278
change-id: 20260514-asoc-tac5xx2-sdw-init-helper-5c2363020069

Best regards,
--  
Cássio Gabriel <cassiogabrielcontato@gmail.com>

Re: [PATCH] ASoC: tac5xx2-sdw: Use SoundWire init wait helper
Posted by Cássio Gabriel Monteiro Pires 4 weeks ago
On 5/14/26 10:16, Cássio Gabriel wrote:
> The runtime-resume path open-codes the same SoundWire re-enumeration
> wait now provided by sdw_slave_wait_for_init(): check whether an
> unattach was requested, wait for initialization_complete, report timeout
> status, and clear unattach_request on success.
> 
> Use the helper to match the other SoundWire codec drivers and keep the
> runtime-resume unattach handling in the SoundWire core.
> 
> Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
> ---
>  sound/soc/codecs/tac5xx2-sdw.c | 16 +++-------------
>  1 file changed, 3 insertions(+), 13 deletions(-)
> 
> diff --git a/sound/soc/codecs/tac5xx2-sdw.c b/sound/soc/codecs/tac5xx2-sdw.c
> index 917b36ac1cd3..bb12cfb6da12 100644
> --- a/sound/soc/codecs/tac5xx2-sdw.c
> +++ b/sound/soc/codecs/tac5xx2-sdw.c
> @@ -1437,7 +1437,6 @@ static s32 tac5xx2_sdca_dev_resume(struct device *dev)
>  {
>  	struct tac5xx2_prv *tac_dev = dev_get_drvdata(dev);
>  	struct sdw_slave *slave = dev_to_sdw_dev(dev);
> -	unsigned long t;
>  	int ret;
>  
>  	if (!tac_dev->first_hw_init_done) {
> @@ -1445,19 +1444,10 @@ static s32 tac5xx2_sdca_dev_resume(struct device *dev)
>  		return 0;
>  	}
>  
> -	if (!slave->unattach_request)
> -		goto regmap_sync;
> -
> -	t = wait_for_completion_timeout(&slave->initialization_complete,
> -					msecs_to_jiffies(TAC5XX2_PROBE_TIMEOUT_MS));
> -	if (!t) {
> -		dev_err(&slave->dev, "resume: initialization timed out\n");
> -		sdw_show_ping_status(slave->bus, true);
> -		return -ETIMEDOUT;
> -	}
> -	slave->unattach_request = 0;
> +	ret = sdw_slave_wait_for_init(slave, TAC5XX2_PROBE_TIMEOUT_MS);
> +	if (ret)
> +		return ret;
>  
> -regmap_sync:
>  	regcache_cache_only(tac_dev->regmap, false);
>  	regcache_mark_dirty(tac_dev->regmap);
>  	ret = regcache_sync(tac_dev->regmap);
> 
> ---
> base-commit: eeecc92a9f1dd213dd52d9b8f42d155595b1d278
> change-id: 20260514-asoc-tac5xx2-sdw-init-helper-5c2363020069
> 
> Best regards,
> --  
> Cássio Gabriel <cassiogabrielcontato@gmail.com>

Sorry, please disregard this.

I just noticed that the patch changing this has already been sent.

-- 
Thanks,
Cássio