The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
To: Ville Saarinen <wiza@saarinenkoti.fi>,
	Shenghao Ding <shenghao-ding@ti.com>, Kevin Lu <kevin-lu@ti.com>,
	Baojun Xu <baojun.xu@ti.com>, Sen Wang <sen@ti.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] ASoC: tas2783: let regmap-sdw-mbq poll for deferred transactions
Date: Sun, 9 Aug 2026 16:05:30 +0200	[thread overview]
Message-ID: <413bdfd6-e0b6-4a64-9e60-cfe25ac684be@linux.dev> (raw)
In-Reply-To: <20260809101541.4969-2-wiza@saarinenkoti.fi>

On 8/9/26 12:16, Ville Saarinen wrote:
> In SDCA, a Function answering COMMAND_IGNORED to a Control write has
> deferred the transaction rather than rejected it. regmap_sdw_mbq_write()
> handles that by calling regmap_sdw_mbq_poll_busy(), which waits for the
> Entity-0 Function Busy bit to clear and then retries once. Neither half
> of that works for this codec:
> 
>  - poll_busy only polls if ->readable_reg() accepts the Entity-0 Function
>    Status address. tas2783_readable_register() answers out of
>    tas2783_sdca_mbq_size(), which has no case for that address, so the
>    poll is skipped and the core falls through to a bare
>    fsleep(cfg.timeout_us).
> 
>  - tas2783_mbq_cfg sets only .mbq_size, so timeout_us and retry_us are
>    both 0. The fallback wait is fsleep(0) and the retry is therefore
>    instantaneous.
> 
> Every deferred write consequently fails by construction, returning
> -ENODATA and logging "Defer on undeferrable control".
> 
> Add the Function Status register to the mbq size table so the poll can
> run, and to the volatile table so a later regcache_sync() never writes
> back to a status register. Mark the UDMPU23 Cluster Index deferrable and
> give the mbq cfg a poll interval and a deadline.
> 
> Note the two cfg fields reach read_poll_timeout() as (sleep_us,
> timeout_us), i.e. .timeout_us is the poll interval and .retry_us the
> overall deadline -- the reverse of the kerneldoc on struct
> regmap_sdw_mbq_cfg. The values here follow the code, which is what runs.
> 
> Developed with AI assistance. The assistant traced the -ENODATA into
> regmap_sdw_mbq_poll_busy() and drafted the fix.
> 
> All hardware measurements quoted above were run by the submitter on the
> affected machine. The submitter has reviewed the change, understands it
> and takes responsibility for it.
> 
> Assisted-by: Claude:claude-opus-5
> Signed-off-by: Ville Saarinen <wiza@saarinenkoti.fi>
> ---
>  sound/soc/codecs/tas2783-sdw.c | 37 ++++++++++++++++++++++++++++++++++
>  1 file changed, 37 insertions(+)
> 
> diff --git a/sound/soc/codecs/tas2783-sdw.c b/sound/soc/codecs/tas2783-sdw.c
> index 3d0b11654..5a7ac6224 100644
> --- a/sound/soc/codecs/tas2783-sdw.c
> +++ b/sound/soc/codecs/tas2783-sdw.c
> @@ -423,6 +423,13 @@ static int tas2783_sdca_mbq_size(struct device *dev, u32 reg)
>  	case SDW_SDCA_CTL(1, TAS2783_SDCA_ENT_FU23, 0x01, 0):
>  	case SDW_SDCA_CTL(1, TAS2783_SDCA_ENT_FU23, 0x01, 1):
>  	case SDW_SDCA_CTL(1, TAS2783_SDCA_ENT_OT25, 0x04, 0):
> +	/*
> +	 * Entity 0 Function Status. regmap_sdw_mbq_poll_busy() only polls the
> +	 * Function Busy bit if ->readable_reg() accepts this address; without
> +	 * it the core drops into a bare fsleep(cfg.timeout_us) and, with that
> +	 * left at 0, retries a deferred transaction instantly and fails.
> +	 */
> +	case SDW_SDCA_CTL(1, 0, SDCA_CTL_ENTITY_0_FUNCTION_STATUS, 0):
>  		return 1;

I don't think this is correct, sorry.

This point has been discussed quite extensively in the SDCA group and
the net result is that accesses to the FUNCTION_STATUS *cannot* be
deferred. You cannot e.g. get a COMMAND_IGNORED response that would set
the Function_Busy bit while trying to read the Function_Busy bit...

Put differently, deferred access is only permitted in specific cases,
and Function-level controls/status are not in that list.

See 10.2.8.1 Rules About Which SDCA Resources Can and Cannot Use
Deferred Access


  reply	other threads:[~2026-08-09 14:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-09 10:15 [PATCH 0/3] ASoC: tas2783: fix stereo split and resume on a two-amp pair Ville Saarinen
2026-08-09 10:16 ` [PATCH 1/3] ASoC: tas2783: let regmap-sdw-mbq poll for deferred transactions Ville Saarinen
2026-08-09 14:05   ` Pierre-Louis Bossart [this message]
2026-08-09 17:41     ` Ville Saarinen
2026-08-09 10:16 ` [PATCH 2/3] ASoC: tas2783: add RX Single Channel Switch to split a two-amp stereo pair Ville Saarinen
2026-08-09 10:16 ` [PATCH 3/3] ASoC: tas2783: drop firmware-owned registers from the regmap cache Ville Saarinen
2026-08-09 10:36 ` [PATCH 0/3] ASoC: tas2783: fix stereo split and resume on a two-amp pair Ville Saarinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=413bdfd6-e0b6-4a64-9e60-cfe25ac684be@linux.dev \
    --to=pierre-louis.bossart@linux.dev \
    --cc=baojun.xu@ti.com \
    --cc=broonie@kernel.org \
    --cc=kevin-lu@ti.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=sen@ti.com \
    --cc=shenghao-ding@ti.com \
    --cc=tiwai@suse.com \
    --cc=wiza@saarinenkoti.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox