linux/drivers/soundwire
Rafael J. Wysocki 533a8a67cc soundwire: intel_auxdevice: Fix system suspend/resume handling
Before commit bca84a7b93 ("PM: sleep: Use DPM_FLAG_SMART_SUSPEND
conditionally") the runtime PM status of the device in intel_resume()
had always been RPM_ACTIVE because setting DPM_FLAG_SMART_SUSPEND had
caused the core to call pm_runtime_set_active() for that device during
the "noirq" resume phase.  For this reason, the pm_runtime_suspended()
check in intel_resume() had never triggered and the code depending on
it had never run.  That had not caused any observable functional issues
to appear, so effectively the code in question had never been needed.

After commit bca84a7b93 the core does not call pm_runtime_set_active()
for all devices with DPM_FLAG_SMART_SUSPEND set any more and the code
depending on the pm_runtime_suspended() check in intel_resume() runs if
the device is runtime-suspended prior to a system-wide suspend
transition.  Unfortunately, when it runs, it breaks things due to the
attempt to runtime-resume bus->dev which most likely is not ready for a
runtime resume at that point.

It also does other more-or-less questionable things.  Namely, it
calls pm_runtime_idle() for a device with a nonzero runtime PM usage
counter which has no effect (all devices have nonzero runtime PM
usage counters during system-wide suspend and resume).  It also calls
pm_runtime_mark_last_busy() for the device even though devices cannot
runtime-suspend during system-wide suspend and resume (because their
runtime PM usage counters are nonzero) and an analogous call is made
in the same function later.  Moreover, it sets the runtime PM status
of the device to RPM_ACTIVE before activating it.

For the reasons listed above, remove that code altogether.

On top of that, add a pm_runtime_disable() call to intel_suspend() to
prevent the device from being runtime-resumed at any point after
intel_suspend() has started to manipulate it because the changes
made by that function would be undone by a runtime-suspend of the
device.

Next, once runtime PM has been disabled, the runtime PM status of the
device cannot change, so pm_runtime_status_suspended() can be used
instead of pm_runtime_suspended() in intel_suspend().

Finally, make intel_resume() call pm_runtime_set_active() at the end to
set the runtime PM status of the device to "active" because it has just
been activated and re-enable runtime PM for it after that.

Additionally, drop the setting of DPM_FLAG_SMART_SUSPEND from the
driver because it has no effect on devices handled by it.

Fixes: bca84a7b93 ("PM: sleep: Use DPM_FLAG_SMART_SUSPEND conditionally")
Reported-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Tested-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://patch.msgid.link/12680420.O9o76ZdvQC@rjwysocki.net
2025-04-30 16:23:37 +02:00
..
Kconfig soundwire: cadence: add BTP/BRA helpers to format data 2025-03-10 12:31:19 +05:30
Makefile soundwire: amd: refactor amd soundwire manager device node creation 2024-01-30 16:06:34 +00:00
amd_init.c module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
amd_init.h soundwire: amd: use inline function for register update 2024-03-28 23:39:50 +05:30
amd_manager.c soundwire: amd: change the log level for command response log 2025-02-27 12:30:44 +05:30
amd_manager.h soundwire: amd: add soundwire host wake interrupt enable/disable sequence 2025-02-13 21:51:07 +05:30
bus.c soundwire: bus: add send_async/wait APIs for BPT protocol 2025-03-10 12:31:18 +05:30
bus.h soundwire: bus: add send_async/wait APIs for BPT protocol 2025-03-10 12:31:18 +05:30
bus_type.c soundwire: bus: Move irq mapping cleanup into devres 2024-12-23 11:41:09 +05:30
cadence_master.c soundwire: cadence: add BTP/BRA helpers to format data 2025-03-10 12:31:19 +05:30
cadence_master.h soundwire: cadence: add BTP/BRA helpers to format data 2025-03-10 12:31:19 +05:30
debugfs.c soundwire: debugfs: add interface for BPT/BRA transfers 2025-03-10 12:31:19 +05:30
dmi-quirks.c ASoC: Intel: common: DMI remap for rebranded Intel NUC M15 (LAPRC710) laptops 2024-02-08 21:23:19 +00:00
generic_bandwidth_allocation.c soundwire: take in count the bandwidth of a prepared stream 2025-03-11 01:51:58 +05:30
intel.c module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
intel.h soundwire: intel: add BPT context definition 2025-03-10 12:31:19 +05:30
intel_ace2x.c soundwire: intel_ace2x: add BPT send_async/wait callbacks 2025-03-10 12:31:19 +05:30
intel_ace2x_debugfs.c soundwire: Intel: clarify Copyright information 2024-06-21 15:26:02 +05:30
intel_auxdevice.c soundwire: intel_auxdevice: Fix system suspend/resume handling 2025-04-30 16:23:37 +02:00
intel_auxdevice.h soundwire: intel: export intel_resume_child_device 2024-04-11 22:52:51 +05:30
intel_bus_common.c soundwire: cadence: add soft-reset on startup 2024-10-10 17:44:41 +05:30
intel_init.c module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
irq.c soundwire: bus: Move irq mapping cleanup into devres 2024-12-23 11:41:09 +05:30
irq.h soundwire: bus: Move irq mapping cleanup into devres 2024-12-23 11:41:09 +05:30
master.c soundwire: constify the struct device_type usage 2024-03-03 19:28:06 +05:30
mipi_disco.c soundwire: mipi_disco: read lane mapping properties from ACPI 2024-12-23 12:00:33 +05:30
qcom.c soundwire: qcom: Add set_channel_map api support 2025-02-06 11:49:22 +00:00
slave.c soundwire: slave: fix an OF node reference leak in soundwire slave device 2025-02-13 21:55:57 +05:30
stream.c soundwire: bus: add send_async/wait APIs for BPT protocol 2025-03-10 12:31:18 +05:30
sysfs_local.h soundwire: sysfs: remove sdw_slave_sysfs_init() 2024-03-28 23:38:47 +05:30
sysfs_slave.c soundwire: Correct some typos in comments 2024-10-03 12:46:23 +05:30
sysfs_slave_dpn.c soundwire: sysfs: remove sdw_slave_sysfs_init() 2024-03-28 23:38:47 +05:30