Re: [PATCH v15 2/4] ASoC: tac5xx2-sdw: add soundwire based codec driver

From: Holalu Yogendra, Niranjan

Date: Tue May 05 2026 - 06:54:44 EST


> On 23:11-20260504, Pierre-Louis Bossart wrote:
> Subject: Re: [PATCH v15 2/4] ASoC: tac5xx2-sdw: add soundwire based codec driver
>
> On 5/4/26 15: 52, Mark Brown wrote:
> > On Mon, May 04, 2026 at 06:27:14PM +0530, Niranjan H Y wrote:
> >> Add codec driver for tac5xx2 family of devices.
> >
> >> +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;
> >
> >> +
> >> + /* Detect and set jack type for UAJ path before playback.
> >> + * This is required as jack detection does not trigger interrupt
> >> + * when device is in runtime_pm suspend with bus in clock stop mode.
> >> + */
> >> + if (tac_has_uaj_support(tac_dev))
> >> + tac5xx2_sdca_headset_detect(tac_dev);
> >> +
> >> +regmap_sync:
> >> + regcache_cache_only(tac_dev->regmap, false);
> >> + regcache_mark_dirty(tac_dev->regmap);
> >> + ret = regcache_sync(tac_dev->regmap);
> >> + if (ret < 0)
> >> + dev_warn(dev, "Failed to sync regcache: %d\n", ret);
> >
> > We do the jack detect before we reinitialise the registers, meaning the
> > device is still in cache only mode and volatile reads will all return
> > -EBUSY.
>
> Indeed, and there's also another set of initializations that won't happen in the
> io_init.
>
> It's a bit complicated because we have to deal with device attachment and
> suspend-resume, and the two parts aren't necessarily equivalent.
> - when resuming the bus the codec will also be resumed
> - but the device can go to runtime_pm suspend while still attached on the bus
> (e.g. if another device is active on the same bus).
>
> Other drivers have regcache_cache_only(tac_dev->regmap, false); in the two
> paths (io_init and resume) to make sure both cases are handled.

I will reorder and fix it in next patch.

The reason there was no error while testing is that, the callback always waited for
"attach" to finish. During attach we call regcache_cache_only(tac_dev->regmap, false) before calling io_init.

Regards
Niranjan