mbox series

[SRU,R,v2,0/5] ASoC: tas2783-sdw: drop stale regcache + SDW init helper

Message ID 20260826034835.661988-1-chris.chiu@canonical.com
Headers show
Series ASoC: tas2783-sdw: drop stale regcache + SDW init helper | expand

Message

Chris Chiu Aug. 26, 2026, 3:48 a.m. UTC
BugLink: https://bugs.launchpad.net/bugs/2164967

[Impact]

TAS2783 SoundWire smart amplifiers add >5s to resume on systems with
AMD ACP (e.g., ASUS ProArt PX13, HP EliteBook X G2i). Each TAS2783
device waits up to 5s (TAS2783_PROBE_TIMEOUT) for
slave->initialization_complete during resume. The SoundWire slaves
do not re-enumerate after s2idle on AMD ACP, so the timeout fires
for each device sequentially, causing ~15s slow resume on systems
with 2-3 TAS2783 amps.

After resume, speakers stay silent even though firmware re-downloads
successfully. The regcache holds stale pre-suspend values, so
subsequent read-modify-write updates (DAPM power-up, SDCA PDE
transitions) see "no change" and skip the hardware write. Audio
runs without errors while the amplifier remains muted.

Error log:
  slave-tas2783 sdw:0:1:0102:0000:01:8: resume: initialization timed out
  slave-tas2783 sdw:0:1:0102:0000:01:8: PM: dpm_run_callback(): acpi_subsys_resume returns -110
  slave-tas2783 sdw:0:1:0102:0000:01:8: PM: failed to resume: error -110

[Fix]

Five patches from upstream sound tree:

1. Commit: 3492e8b494c1 ("soundwire: Add a helper function to wait
   for device initialisation")
   Upstream: v7.2-rc1

2. Commit: ac6d4f298160 ("ASoC: tas2783: Use new SoundWire
   enumeration helper")
   Upstream: v7.2-rc1

3. Commit: 5714c8359f4f ("soundwire: Move wait for initialisation
   helper to header")
   Upstream: v7.2-rc1

4. Commit: 0d6b2d6f93a6 ("ASoC: codecs: tas2783-sdw: Propagate
   regcache_sync() errors")
   Upstream: v7.3-rc1

5. Commit: b627da430357 ("ASoC: tas2783-sdw: drop stale regcache
   on uninitialized re-attach")
   Upstream: linux-next / sound-7.3-rc1 (not yet in released tag)
   Fixes: 4cc9bd8d7b32 ("ASoc: tas2783A: Add soundwire based
   codec driver")

[Test Plan]

Suspend 30 times:
  $ sudo rtcwake -m mem -s 20

Without patches: resume takes >5s per TAS2783 device, speakers
produce no audio after resume, dmesg shows "resume: initialization
timed out" and "PM: failed to resume: error -110".

With patches: resume completes in <1s, speakers work after resume,
no timeout errors in dmesg.

[Where problems could occur]

Could break TAS2783 SoundWire driver resume and device initialization.

The sdw_slave_wait_for_init() helper changes how the driver waits
for SoundWire enumeration. If the helper has a bug, resume could
hang or return an error for all SoundWire slaves, not just TAS2783.

The regcache_drop_region() call removes all cached register values.
If the device does not actually lose power during suspend (e.g.,
S3 instead of S0i3), dropping the cache forces a full re-initialization
that is unnecessary and could cause a brief audio glitch on resume.

Andrey Golovko (1):
  ASoC: tas2783-sdw: drop stale regcache on uninitialized re-attach

Charles Keepax (3):
  soundwire: Add a helper function to wait for device initialisation
  ASoC: tas2783: Use new SoundWire enumeration helper
  soundwire: Move wait for initialisation helper to header

Pengpeng Hou (1):
  ASoC: codecs: tas2783-sdw: Propagate regcache_sync() errors

 drivers/soundwire/bus.c        |  1 +
 include/linux/soundwire/sdw.h  | 30 ++++++++++++++++++++++++
 sound/soc/codecs/tas2783-sdw.c | 42 +++++++++++++++++++++-------------
 3 files changed, 57 insertions(+), 16 deletions(-)

v2 changes:
- Added commit 3492e8b494c1 which adds sdw_slave_wait_for_init()
  to drivers/soundwire/bus.c
- Added commit 5714c8359f4f which moves the helper to sdw.h and
  removes it from bus.c (resolves build conflict)

Comments

Mehmet Basaran Aug. 26, 2026, 9:58 a.m. UTC | #1
Acked-by: Mehmet Basaran <mehmet.basaran@canonical.com>
Chris Chiu via kernel-team <kernel-team@lists.ubuntu.com> writes:

> BugLink: https://bugs.launchpad.net/bugs/2164967
>
> [Impact]
>
> TAS2783 SoundWire smart amplifiers add >5s to resume on systems with
> AMD ACP (e.g., ASUS ProArt PX13, HP EliteBook X G2i). Each TAS2783
> device waits up to 5s (TAS2783_PROBE_TIMEOUT) for
> slave->initialization_complete during resume. The SoundWire slaves
> do not re-enumerate after s2idle on AMD ACP, so the timeout fires
> for each device sequentially, causing ~15s slow resume on systems
> with 2-3 TAS2783 amps.
>
> After resume, speakers stay silent even though firmware re-downloads
> successfully. The regcache holds stale pre-suspend values, so
> subsequent read-modify-write updates (DAPM power-up, SDCA PDE
> transitions) see "no change" and skip the hardware write. Audio
> runs without errors while the amplifier remains muted.
>
> Error log:
>   slave-tas2783 sdw:0:1:0102:0000:01:8: resume: initialization timed out
>   slave-tas2783 sdw:0:1:0102:0000:01:8: PM: dpm_run_callback(): acpi_subsys_resume returns -110
>   slave-tas2783 sdw:0:1:0102:0000:01:8: PM: failed to resume: error -110
>
> [Fix]
>
> Five patches from upstream sound tree:
>
> 1. Commit: 3492e8b494c1 ("soundwire: Add a helper function to wait
>    for device initialisation")
>    Upstream: v7.2-rc1
>
> 2. Commit: ac6d4f298160 ("ASoC: tas2783: Use new SoundWire
>    enumeration helper")
>    Upstream: v7.2-rc1
>
> 3. Commit: 5714c8359f4f ("soundwire: Move wait for initialisation
>    helper to header")
>    Upstream: v7.2-rc1
>
> 4. Commit: 0d6b2d6f93a6 ("ASoC: codecs: tas2783-sdw: Propagate
>    regcache_sync() errors")
>    Upstream: v7.3-rc1
>
> 5. Commit: b627da430357 ("ASoC: tas2783-sdw: drop stale regcache
>    on uninitialized re-attach")
>    Upstream: linux-next / sound-7.3-rc1 (not yet in released tag)
>    Fixes: 4cc9bd8d7b32 ("ASoc: tas2783A: Add soundwire based
>    codec driver")
>
> [Test Plan]
>
> Suspend 30 times:
>   $ sudo rtcwake -m mem -s 20
>
> Without patches: resume takes >5s per TAS2783 device, speakers
> produce no audio after resume, dmesg shows "resume: initialization
> timed out" and "PM: failed to resume: error -110".
>
> With patches: resume completes in <1s, speakers work after resume,
> no timeout errors in dmesg.
>
> [Where problems could occur]
>
> Could break TAS2783 SoundWire driver resume and device initialization.
>
> The sdw_slave_wait_for_init() helper changes how the driver waits
> for SoundWire enumeration. If the helper has a bug, resume could
> hang or return an error for all SoundWire slaves, not just TAS2783.
>
> The regcache_drop_region() call removes all cached register values.
> If the device does not actually lose power during suspend (e.g.,
> S3 instead of S0i3), dropping the cache forces a full re-initialization
> that is unnecessary and could cause a brief audio glitch on resume.
>
> Andrey Golovko (1):
>   ASoC: tas2783-sdw: drop stale regcache on uninitialized re-attach
>
> Charles Keepax (3):
>   soundwire: Add a helper function to wait for device initialisation
>   ASoC: tas2783: Use new SoundWire enumeration helper
>   soundwire: Move wait for initialisation helper to header
>
> Pengpeng Hou (1):
>   ASoC: codecs: tas2783-sdw: Propagate regcache_sync() errors
>
>  drivers/soundwire/bus.c        |  1 +
>  include/linux/soundwire/sdw.h  | 30 ++++++++++++++++++++++++
>  sound/soc/codecs/tas2783-sdw.c | 42 +++++++++++++++++++++-------------
>  3 files changed, 57 insertions(+), 16 deletions(-)
>
> v2 changes:
> - Added commit 3492e8b494c1 which adds sdw_slave_wait_for_init()
>   to drivers/soundwire/bus.c
> - Added commit 5714c8359f4f which moves the helper to sdw.h and
>   removes it from bus.c (resolves build conflict)
>
> --
> 2.43.0
>
>
> --
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
Rickey Castillo Valenzuela Aug. 26, 2026, 3:24 p.m. UTC | #2
On 8/25/26 21:48, Chris Chiu via kernel-team wrote:
> BugLink: https://bugs.launchpad.net/bugs/2164967
>
> [Impact]
>
> TAS2783 SoundWire smart amplifiers add >5s to resume on systems with
> AMD ACP (e.g., ASUS ProArt PX13, HP EliteBook X G2i). Each TAS2783
> device waits up to 5s (TAS2783_PROBE_TIMEOUT) for
> slave->initialization_complete during resume. The SoundWire slaves
> do not re-enumerate after s2idle on AMD ACP, so the timeout fires
> for each device sequentially, causing ~15s slow resume on systems
> with 2-3 TAS2783 amps.
>
> After resume, speakers stay silent even though firmware re-downloads
> successfully. The regcache holds stale pre-suspend values, so
> subsequent read-modify-write updates (DAPM power-up, SDCA PDE
> transitions) see "no change" and skip the hardware write. Audio
> runs without errors while the amplifier remains muted.
>
> Error log:
>    slave-tas2783 sdw:0:1:0102:0000:01:8: resume: initialization timed out
>    slave-tas2783 sdw:0:1:0102:0000:01:8: PM: dpm_run_callback(): acpi_subsys_resume returns -110
>    slave-tas2783 sdw:0:1:0102:0000:01:8: PM: failed to resume: error -110
>
> [Fix]
>
> Five patches from upstream sound tree:
>
> 1. Commit: 3492e8b494c1 ("soundwire: Add a helper function to wait
>     for device initialisation")
>     Upstream: v7.2-rc1
>
> 2. Commit: ac6d4f298160 ("ASoC: tas2783: Use new SoundWire
>     enumeration helper")
>     Upstream: v7.2-rc1
>
> 3. Commit: 5714c8359f4f ("soundwire: Move wait for initialisation
>     helper to header")
>     Upstream: v7.2-rc1
>
> 4. Commit: 0d6b2d6f93a6 ("ASoC: codecs: tas2783-sdw: Propagate
>     regcache_sync() errors")
>     Upstream: v7.3-rc1
>
> 5. Commit: b627da430357 ("ASoC: tas2783-sdw: drop stale regcache
>     on uninitialized re-attach")
>     Upstream: linux-next / sound-7.3-rc1 (not yet in released tag)
>     Fixes: 4cc9bd8d7b32 ("ASoc: tas2783A: Add soundwire based
>     codec driver")
>
> [Test Plan]
>
> Suspend 30 times:
>    $ sudo rtcwake -m mem -s 20
>
> Without patches: resume takes >5s per TAS2783 device, speakers
> produce no audio after resume, dmesg shows "resume: initialization
> timed out" and "PM: failed to resume: error -110".
>
> With patches: resume completes in <1s, speakers work after resume,
> no timeout errors in dmesg.
>
> [Where problems could occur]
>
> Could break TAS2783 SoundWire driver resume and device initialization.
>
> The sdw_slave_wait_for_init() helper changes how the driver waits
> for SoundWire enumeration. If the helper has a bug, resume could
> hang or return an error for all SoundWire slaves, not just TAS2783.
>
> The regcache_drop_region() call removes all cached register values.
> If the device does not actually lose power during suspend (e.g.,
> S3 instead of S0i3), dropping the cache forces a full re-initialization
> that is unnecessary and could cause a brief audio glitch on resume.
>
> Andrey Golovko (1):
>    ASoC: tas2783-sdw: drop stale regcache on uninitialized re-attach
>
> Charles Keepax (3):
>    soundwire: Add a helper function to wait for device initialisation
>    ASoC: tas2783: Use new SoundWire enumeration helper
>    soundwire: Move wait for initialisation helper to header
>
> Pengpeng Hou (1):
>    ASoC: codecs: tas2783-sdw: Propagate regcache_sync() errors
>
>   drivers/soundwire/bus.c        |  1 +
>   include/linux/soundwire/sdw.h  | 30 ++++++++++++++++++++++++
>   sound/soc/codecs/tas2783-sdw.c | 42 +++++++++++++++++++++-------------
>   3 files changed, 57 insertions(+), 16 deletions(-)
>
> v2 changes:
> - Added commit 3492e8b494c1 which adds sdw_slave_wait_for_init()
>    to drivers/soundwire/bus.c
> - Added commit 5714c8359f4f which moves the helper to sdw.h and
>    removes it from bus.c (resolves build conflict)
>

Please update the LP bug description to add the 2 extra commits info.

Acked-by: Rickey Castillo <rickey.castillo.valenzuela@canonical.com>
Edoardo Canepa Aug. 28, 2026, 8:30 a.m. UTC | #3
Applied to R:linux/master-next. Thanks.

On 8/26/26 06:48, Chris Chiu via kernel-team wrote:
> BugLink: https://bugs.launchpad.net/bugs/2164967
>
> [Impact]
>
> TAS2783 SoundWire smart amplifiers add >5s to resume on systems with
> AMD ACP (e.g., ASUS ProArt PX13, HP EliteBook X G2i). Each TAS2783
> device waits up to 5s (TAS2783_PROBE_TIMEOUT) for
> slave->initialization_complete during resume. The SoundWire slaves
> do not re-enumerate after s2idle on AMD ACP, so the timeout fires
> for each device sequentially, causing ~15s slow resume on systems
> with 2-3 TAS2783 amps.
>
> After resume, speakers stay silent even though firmware re-downloads
> successfully. The regcache holds stale pre-suspend values, so
> subsequent read-modify-write updates (DAPM power-up, SDCA PDE
> transitions) see "no change" and skip the hardware write. Audio
> runs without errors while the amplifier remains muted.
>
> Error log:
>    slave-tas2783 sdw:0:1:0102:0000:01:8: resume: initialization timed out
>    slave-tas2783 sdw:0:1:0102:0000:01:8: PM: dpm_run_callback(): acpi_subsys_resume returns -110
>    slave-tas2783 sdw:0:1:0102:0000:01:8: PM: failed to resume: error -110
>
> [Fix]
>
> Five patches from upstream sound tree:
>
> 1. Commit: 3492e8b494c1 ("soundwire: Add a helper function to wait
>     for device initialisation")
>     Upstream: v7.2-rc1
>
> 2. Commit: ac6d4f298160 ("ASoC: tas2783: Use new SoundWire
>     enumeration helper")
>     Upstream: v7.2-rc1
>
> 3. Commit: 5714c8359f4f ("soundwire: Move wait for initialisation
>     helper to header")
>     Upstream: v7.2-rc1
>
> 4. Commit: 0d6b2d6f93a6 ("ASoC: codecs: tas2783-sdw: Propagate
>     regcache_sync() errors")
>     Upstream: v7.3-rc1
>
> 5. Commit: b627da430357 ("ASoC: tas2783-sdw: drop stale regcache
>     on uninitialized re-attach")
>     Upstream: linux-next / sound-7.3-rc1 (not yet in released tag)
>     Fixes: 4cc9bd8d7b32 ("ASoc: tas2783A: Add soundwire based
>     codec driver")
>
> [Test Plan]
>
> Suspend 30 times:
>    $ sudo rtcwake -m mem -s 20
>
> Without patches: resume takes >5s per TAS2783 device, speakers
> produce no audio after resume, dmesg shows "resume: initialization
> timed out" and "PM: failed to resume: error -110".
>
> With patches: resume completes in <1s, speakers work after resume,
> no timeout errors in dmesg.
>
> [Where problems could occur]
>
> Could break TAS2783 SoundWire driver resume and device initialization.
>
> The sdw_slave_wait_for_init() helper changes how the driver waits
> for SoundWire enumeration. If the helper has a bug, resume could
> hang or return an error for all SoundWire slaves, not just TAS2783.
>
> The regcache_drop_region() call removes all cached register values.
> If the device does not actually lose power during suspend (e.g.,
> S3 instead of S0i3), dropping the cache forces a full re-initialization
> that is unnecessary and could cause a brief audio glitch on resume.
>
> Andrey Golovko (1):
>    ASoC: tas2783-sdw: drop stale regcache on uninitialized re-attach
>
> Charles Keepax (3):
>    soundwire: Add a helper function to wait for device initialisation
>    ASoC: tas2783: Use new SoundWire enumeration helper
>    soundwire: Move wait for initialisation helper to header
>
> Pengpeng Hou (1):
>    ASoC: codecs: tas2783-sdw: Propagate regcache_sync() errors
>
>   drivers/soundwire/bus.c        |  1 +
>   include/linux/soundwire/sdw.h  | 30 ++++++++++++++++++++++++
>   sound/soc/codecs/tas2783-sdw.c | 42 +++++++++++++++++++++-------------
>   3 files changed, 57 insertions(+), 16 deletions(-)
>
> v2 changes:
> - Added commit 3492e8b494c1 which adds sdw_slave_wait_for_init()
>    to drivers/soundwire/bus.c
> - Added commit 5714c8359f4f which moves the helper to sdw.h and
>    removes it from bus.c (resolves build conflict)
>