ASoC: SoundWire codecs: improve pm_runtime handling
authorMark Brown <broonie@kernel.org>
Mon, 7 Aug 2023 18:51:32 +0000 (19:51 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 7 Aug 2023 18:51:32 +0000 (19:51 +0100)
commit5a119551b6c5c81875d377f2fa28b70c5ffd7f51
treea5d25b2b88aba29a41828d0256206503b54f0690
parent1ec6dffdedae4cbbd6e33b1d9be0e5a3dbb31804
parentb48f324f89ab8ee62c3448ef19445a1b292e02d3
ASoC: SoundWire codecs: improve pm_runtime handling

Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

This patchset improves the pm_runtime behavior in rare corner cases
identified by the Intel CI in the last 6 months.

a) in stress-tests, it's not uncommon to see the following type of
warnings when the codec reports as ATTACHED

    "rt711 sdw:0:025d:0711:00: runtime PM trying to activate child device
    sdw:0:025d:0711:00 but parent (sdw-master-0) is not active"

This warning was not correlated with any functional issue, but it
exposed a design issue on when to enable pm_runtime. The recommended
practice in the pm_runtime documentation is to keep the devices in
'suspended' mode and mark them as 'active' when they are really
functional.

b) enabling pm_runtime when the codec reports as ATTACHED also creates
a problematic case when the ASoC pm_runtime_get_sync() will silently
fail due to the -EACCESS error handling. This can happen when playback
starts before the codec is enumerated.

This patchset modifies the initial stages so that codecs are
pm_runtime enabled in the .probe() callback, but become pm_runtime
'active' only when they report present. This is better aligned with
the design of the pm_runtime helpers and improved CI results
significantly.

This patchset modifies all existing SoundWire codecs (except Qualcomm
ones), but the pattern of changes is exactly the same in all patches.