Re: [PATCH] ASoC: tas2783-sdw: power the Function up before preparing the port

Mark Brown <[email protected]>
Newsgroups org.kernel.vger.linux-sound,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Thu, Aug 13, 2026 at 12:28:10AM +0300, Andrey Golovko wrote:

> A Data Port cannot complete channel preparation while the SDCA Function
> is powered down: the peripheral raises the channel's bit in
> DPn_PrepareStatus and never clears it.

...

> Power the Function up in the PRE_PREP callback, immediately before the
> PrepareCtrl write it already performs, so that preparation has what it
> needs on every path that prepares a port.

>  	case SDW_OPS_PORT_PRE_PREP:
> +		/*
> +		 * The Function has to be powered before the port can complete
> +		 * channel preparation.  hw_params() does that when a stream is
> +		 * set up, but a stream that is only re-prepared - as userspace
> +		 * does after the peripheral lost power in S0i3 - does not go
> +		 * through hw_params() again, and the peripheral is back at its
> +		 * PS3 reset default.  Power it up here, where it is needed.
> +		 */
> +		scoped_guard(mutex, &tas_dev->pde_lock)
> +			ret = regmap_write(tas_dev->regmap,
> +					   SDW_SDCA_CTL(1, TAS2783_SDCA_ENT_PDE23,
> +							TAS2783_SDCA_CTL_REQ_POW_STATE, 0),
> +					   TAS2783_SDCA_POW_STATE_ON);
> +		if (ret) {
> +			dev_err(dev, "power up failed for port %d, err=%d\n",
> +				prep_ch->num, ret);
> +			return ret;
> +		}

Does this DTRT if userspace restartss the stream by directly calling
SNDRV_PCM_IOCTL_RESUME (AMD adverise SNDR_PCM_INFO_RESUME...)?
Similarly we can suspend while prepared.  Either something needs to
force us to prepare again or this needs to be moved somewhere that's
always called.

> +
>  		ret = sdw_write_no_pm(slave, addr, prep_ch->ch_mask);
>  		if (ret)
>  			dev_err(dev, "prep failed for port %d, err=%d\n",
> 
> base-commit: 6f6fb37f9f9a8ae88faa1b5b1978e57381488502
> -- 
> 2.53.0
>
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmp9xSsACgkQJNaLcl1U
h9AaTgf/dt1SUkgojEtim0WU7g1RuptYHb6PEEeQKjTy3DjQ5P5pintbG9PbB/EM
orr3lbUKTHOg6kbsL4L3N6/gDGF+eBILhNsaCa+d5gJuGfIqi+PnPHTaRsHbwExv
glspKvJO0EPWhy0jGMtfvneatLhat2gZfGWKao6HHxS6fPkePdUyovDFvhMX55aN
FtGutRX7tJ/mnHv8yCNBJTofGplX2hNa0FPR31Wh0VgxlfGAMIwvB5pbfIS5k/aQ
0eFBpusAN8VjvMGDsAr9EoWjg5UbEus70AbPXhpjGSfkYaonveoMjAopdeJmv4Yu
Dg17Sxr33bxuvRWBncpIG4rS+3/POw==
=KRHp
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.