linux-stable/drivers/soundwire
Pierre-Louis Bossart 029bfd1cd5 soundwire: intel: conditionally exit clock stop mode on system suspend
Intel stress tests reported issues with the clock stop mode,
specifically when trying to do a system suspend while the link is
already pm_runtime suspended.

In this case, we need to disable the shim wake, but when the PCI
parent device is also pm_runtime suspended the SHIM registers are not
accessible.

Since this is an invalid corner case, this patch suggests a pm_runtime
resume of the entire bus to full power (parent+child devices) before
the system suspend so that the shim wake can be disabled.

Unlike the suspend operation, the .prepare callbacks are propagated
from root device to leaf devices. By adding a .prepare callback at the
SoundWire link level, we can double-check the pm_runtime status of the
device as well as its parent PCI device. When the problematic
configuration is detected, the device is pm_runtime resumed - which by
construction also resume its parent.

An additional loop is added to resume all child devices. In theory we
only need to restart the link, but doing so will also cause the
physical devices to synchronize and re-initialize, while their Linux
devices remain pm_runtime suspended. It's simpler to make sure the
codec devices are fully resumed so that we don't have to deal with
zombie states.

This additional loop could have been avoided by adding a .prepare
callback in SoundWire codec drivers. Functionally this would have been
equivalent. The rationale for implementing a loop at the link level is
only to reduce the amount of code required to deal at the codec level
with an Intel corner case - in other words keep codec drivers
independent from Intel platform-specific programming sequences.

BugLink: https://github.com/thesofproject/linux/issues/2606
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20210818024954.16873-4-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2021-08-23 17:40:33 +05:30
..
bus.c soundwire: bus: squelch error returned by mockup devices 2021-08-02 11:08:22 +05:30
bus.h soundwire: export sdw_update() and sdw_update_no_pm() 2021-06-21 13:00:42 +01:00
bus_type.c soundwire: bus: use correct driver name in error messages 2021-03-30 11:51:42 +05:30
cadence_master.c soundwire: cadence: override PDI configurations to create loopback 2021-08-02 11:08:22 +05:30
cadence_master.h soundwire: cadence: add debugfs interface for PDI loopbacks 2021-08-02 11:08:22 +05:30
debugfs.c soundwire: Revert "soundwire: debugfs: use controller id instead of link_id" 2021-02-06 15:52:21 +05:30
dmi-quirks.c soundwire: dmi-quirks: add quirk for Intel 'Bishop County' NUC M15 2021-07-23 11:36:49 +05:30
generic_bandwidth_allocation.c soundwire: bandwidth allocation: improve error messages 2021-05-11 17:34:07 +05:30
intel.c soundwire: intel: conditionally exit clock stop mode on system suspend 2021-08-23 17:40:33 +05:30
intel.h soundwire: intel: skip suspend/resume/wake when link was not started 2021-08-23 17:40:33 +05:30
intel_init.c soundwire: intel: move to auxiliary bus 2021-06-14 10:12:26 +05:30
Kconfig soundwire: intel: move to auxiliary bus 2021-06-14 10:12:26 +05:30
Makefile soundwire: Intel: introduce DMI quirks for HP Spectre x360 Convertible 2021-03-22 17:33:10 +05:30
master.c soundwire: master: use pm_runtime_set_active() on add 2020-12-02 12:49:34 +05:30
mipi_disco.c soundwire: fix port_ready[] dynamic allocation in mipi_disco 2020-09-03 16:02:29 +05:30
qcom.c soundwire: qcom: fix handling of qcom,ports-block-pack-mode 2021-05-13 11:14:13 +05:30
slave.c soundwire/ASoC: add leading zeroes in peripheral device name 2021-05-11 17:26:56 +05:30
stream.c soundwire: stream: don't program mockup device ports 2021-08-02 11:08:22 +05:30
sysfs_local.h soundwire: sysfs: add slave status and device number before probe 2020-09-28 11:17:43 +05:30
sysfs_slave.c soundwire: sysfs: Constify static struct attribute_group 2021-01-19 20:21:20 +05:30
sysfs_slave_dpn.c soundwire: Fix DEBUG_LOCKS_WARN_ON for uninitialized attribute 2020-11-24 14:08:51 +05:30