Skip to content

[TEST v3] fix suspend/resume with SoundWire - #1327

Merged
plbossart merged 4 commits into
thesofproject:integration/soundwire-intelfrom
plbossart:integration/soundwire-20191016
Oct 18, 2019
Merged

plbossart merged 4 commits into
thesofproject:integration/soundwire-intelfrom
plbossart:integration/soundwire-20191016

Conversation

@plbossart

Copy link
Copy Markdown
Member

changes since v2:
Allow for transitions from/to DEPREPARED to/from PREPARED
Reset SHIM/ALH unconditionally.

Opens:

  • not sure why the same operations needs to be done both in .hw_params and .prepare. removing the operations done in .prepare from .hw_params was a fail.
  • errors with bad file descriptors, e.g. when resuming from a paused state I see this
root@jf-icl-rvp-hda-8:~# aplay -Dhw:0,0 chirp_5s.wav -i
Playing WAVE 'chirp_5s.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
=== PAUSE ===                                                             Suspended. Trying resume. Failed. Restarting stream. Done.
aplay: do_pause:1508: pause release error: File descriptor in bad state

plbossart and others added 4 commits October 16, 2019 14:53
The state machine and notes don't accurately explain or allow
transitions from STREAM_DEPREPARED and STREAM_DISABLED.

Add more explanations and allow for more transitions as a result of a
trigger_stop(), trigger_suspend() and prepare(), depending on the
ALSA/ASoC layer behavior defined by the INFO_RESUME and INFO_PAUSE
flags.

Also add basic checks to help debug inconsistent states and illegal
state machine transitions.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
…transition

After a system suspend, the ALSA/ASoC core will invoke the .prepare()
callback and a TRIGGER_START when INFO_RESUME is not supported.

Likewise, when an underflow occurs, the .prepare callback will be invoked.

In both cases, the stream can be in DISABLED mode, and will transition
into the PREPARED mode. We however don't want the bus bandwidth to be
recomputed.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
The .prepare() callback is invoked for normal streaming, underflows or
during the system resume transition. In the latter case, the context
for the ALH PDIs is lost, and the DSP is not initialized properly
either, but the bus parameters don't need to be recomputed.

To avoid keeping track of state variables, it's simpler to just
reinitialize the SHIM/ALH/Cadence/DSP settings in .prepare.

Open: somehow all this steps are still required in the .hw_params, not
sure why.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
@plbossart

Copy link
Copy Markdown
Member Author

I am going to go ahead and merge this, there hasn't been any reports of regressions. we can revisit specific points later.

@plbossart
plbossart merged commit 81d2033 into thesofproject:integration/soundwire-intel Oct 18, 2019
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.

2 participants