Re: [PATCH 3/3] ASoC: tas2783: drop firmware-owned registers from the regmap cache

From: Mark Brown

Date: Wed Aug 12 2026 - 15:09:28 EST


On Sun, Aug 09, 2026 at 10:16:10AM +0000, Ville Saarinen wrote:

> The firmware image is downloaded with sdw_nwrite_no_pm(), which writes
> straight to the peripheral and bypasses the regmap cache. The cache keeps
> holding the tas2783_reg_default[] entries for every register the firmware
> image owns, so cache and device disagree from the moment the download
> completes.

> + /*
> + * The firmware image is written with sdw_nwrite_no_pm(), which
> + * bypasses the regmap cache. The cache therefore keeps holding
> + * the stale reg_defaults entries for every register the
> + * firmware owns, and the regcache_sync() done on resume writes
> + * those defaults back out over the firmware tuning. That wipes
> + * the per-amp configuration, including the channel assignment,
> + * and leaves the speakers silent until the next full re-init.
> + *
> + * Drop the firmware-owned registers from the cache so nothing
> + * stale can ever be synced over them. This is safe because a
> + * suspend deep enough to lose device state also takes the
> + * peripheral UNATTACHED, which clears hw_init and triggers a
> + * full firmware re-download on re-attach.
> + */
> + if (file->length)
> + regcache_drop_region(tas_dev->regmap, file->dest_addr,
> + file->dest_addr + file->length - 1);
> +

Are there any controls with values that come from the firmware, and
shouldn't we do this before rather than after the firmware download? In
general this feels like the wrong shape of fix, it feels like the
problem here is that we've got a register cache for the (somewhat)
dynamic values written by the firmware download but we never synchronize
those two. I think a more robust fix is probably a combination of
writing the firmware values into the cache and marking registers that
get programmed by firmware download but should never be cached for
whatever reason as volatile.

Attachment: signature.asc
Description: PGP signature