Skip to content

Conversation

@rfvirgil
Copy link

Always issue a bus reset when coming out of clock stop mode. This reverts commit 08abad9 ("soundwire: intel: refine runtime pm for SDW_INTEL_CLK_STOP_BUS_RESET").

When entering clock stop the bus link is actually powered-down to save more power. The SoundWire specification allows this but requires that the manager sends a bus reset on wakeup.

On Intel hardware before Lunarlake the audio controller can only power- down if all links are powered-down. Commit 08abad9 ("soundwire: intel: refine runtime pm for SDW_INTEL_CLK_STOP_BUS_RESET") added a special case to skip the bus reset and do a normal exit from clock stop if the link was not fully powered-down.

However, this shortcut is not safe. When powering the link up again there will be false edges on SCLK, which will cause the peripherals to clock in one or two false data bits. This causes the peripherals to lose sync and they will drop off the bus, as required by the SoundWire specification. It will take at least 17 frames for the peripherals to regain sync, and they are likely to need re-enumeration. But the core SoundWire code was told that this is an exit from clock stop 0, and unattach_request is not set, so the core code and the drivers are expecting to be able to talk to the peripherals immediately. This will cause read/write errors.

This is quite likely to occur when there are different types of peripheral on the links. For example, a headphone codec on one link and amplifiers on another link. While audio is playing to the headphones the amplifiers can runtime-suspend and the link can clock stop. This leaves one link (amps) stopped and the other (headphones) still active, creating the situation where resuming the amps would skip the bus reset because the active headphone link stops the audio controller from fully powering down.

On Lunarlake the links can power-down independently. So this shortcut situation does not occur and a bus reset was always sent when the link powers-up.

Fixes: 08abad9 ("soundwire: intel: refine runtime pm for SDW_INTEL_CLK_STOP_BUS_RESET")
Closes: #5495

Always issue a bus reset when coming out of clock stop mode. This
reverts commit 08abad9 ("soundwire: intel: refine runtime pm
for SDW_INTEL_CLK_STOP_BUS_RESET").

When entering clock stop the bus link is actually powered-down to save
more power. The SoundWire specification allows this but requires that
the manager sends a bus reset on wakeup.

On Intel hardware before Lunarlake the audio controller can only power-
down if all links are powered-down. Commit 08abad9
("soundwire: intel: refine runtime pm for SDW_INTEL_CLK_STOP_BUS_RESET")
added a special case to skip the bus reset and do a normal exit from
clock stop if the link was not fully powered-down.

However, this shortcut is not safe. When powering the link up again there
will be false edges on SCLK, which will cause the peripherals to clock in
one or two false data bits. This causes the peripherals to lose sync and
they will drop off the bus, as required by the SoundWire specification.
It will take at least 17 frames for the peripherals to regain sync, and
they are likely to need re-enumeration. But the core SoundWire code was
told that this is an exit from clock stop 0, and unattach_request is not
set, so the core code and the drivers are expecting to be able to talk to
the peripherals immediately. This will cause read/write errors.

This is quite likely to occur when there are different types of peripheral
on the links. For example, a headphone codec on one link and amplifiers on
another link. While audio is playing to the headphones the amplifiers can
runtime-suspend and the link can clock stop. This leaves one link (amps)
stopped and the other (headphones) still active, creating the situation
where resuming the amps would skip the bus reset because the active
headphone link stops the audio controller from fully powering down.

On Lunarlake the links can power-down independently. So this shortcut
situation does not occur and a bus reset was always sent when the link
powers-up.

Fixes: 08abad9 ("soundwire: intel: refine runtime pm for SDW_INTEL_CLK_STOP_BUS_RESET")
Closes: thesofproject#5495
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
* domain. Master can preserve its context for clock stop0, so
* there is no need to clear slave status and reset bus.
* make sure all Slaves are tagged as UNATTACHED and
* provide reason for reinitialization
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it is the right direction. The clock may remain active, and the peripherals may remain attached when bus stops. It seems not be necessary to reset in that case.

@rfvirgil rfvirgil closed this Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Intel SoundWire: Glitch on SDW_CLK causes peripherals to drop off bus during runtime resume

2 participants