Skip to content

Commit 8d6ae3a

Browse files
committed
Merge branch 'pm-sleep-fixes' into fixes
* pm-sleep-fixes: soundwire: intel_auxdevice: Fix system suspend/resume handling
2 parents 0aeb944 + 533a8a6 commit 8d6ae3a

1 file changed

Lines changed: 13 additions & 23 deletions

File tree

drivers/soundwire/intel_auxdevice.c

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -353,9 +353,6 @@ static int intel_link_probe(struct auxiliary_device *auxdev,
353353
/* use generic bandwidth allocation algorithm */
354354
sdw->cdns.bus.compute_params = sdw_compute_params;
355355

356-
/* avoid resuming from pm_runtime suspend if it's not required */
357-
dev_pm_set_driver_flags(dev, DPM_FLAG_SMART_SUSPEND);
358-
359356
ret = sdw_bus_master_add(bus, dev, dev->fwnode);
360357
if (ret) {
361358
dev_err(dev, "sdw_bus_master_add fail: %d\n", ret);
@@ -640,15 +637,18 @@ static int __maybe_unused intel_suspend(struct device *dev)
640637
return 0;
641638
}
642639

643-
if (pm_runtime_suspended(dev)) {
640+
/* Prevent runtime PM from racing with the code below. */
641+
pm_runtime_disable(dev);
642+
643+
if (pm_runtime_status_suspended(dev)) {
644644
dev_dbg(dev, "pm_runtime status: suspended\n");
645645

646646
clock_stop_quirks = sdw->link_res->clock_stop_quirks;
647647

648648
if ((clock_stop_quirks & SDW_INTEL_CLK_STOP_BUS_RESET) ||
649649
!clock_stop_quirks) {
650650

651-
if (pm_runtime_suspended(dev->parent)) {
651+
if (pm_runtime_status_suspended(dev->parent)) {
652652
/*
653653
* paranoia check: this should not happen with the .prepare
654654
* resume to full power
@@ -715,7 +715,6 @@ static int __maybe_unused intel_resume(struct device *dev)
715715
struct sdw_cdns *cdns = dev_get_drvdata(dev);
716716
struct sdw_intel *sdw = cdns_to_intel(cdns);
717717
struct sdw_bus *bus = &cdns->bus;
718-
int link_flags;
719718
int ret;
720719

721720
if (bus->prop.hw_disabled || !sdw->startup_done) {
@@ -724,23 +723,6 @@ static int __maybe_unused intel_resume(struct device *dev)
724723
return 0;
725724
}
726725

727-
if (pm_runtime_suspended(dev)) {
728-
dev_dbg(dev, "pm_runtime status was suspended, forcing active\n");
729-
730-
/* follow required sequence from runtime_pm.rst */
731-
pm_runtime_disable(dev);
732-
pm_runtime_set_active(dev);
733-
pm_runtime_mark_last_busy(dev);
734-
pm_runtime_enable(dev);
735-
736-
pm_runtime_resume(bus->dev);
737-
738-
link_flags = md_flags >> (bus->link_id * 8);
739-
740-
if (!(link_flags & SDW_INTEL_MASTER_DISABLE_PM_RUNTIME_IDLE))
741-
pm_runtime_idle(dev);
742-
}
743-
744726
ret = sdw_intel_link_power_up(sdw);
745727
if (ret) {
746728
dev_err(dev, "%s failed: %d\n", __func__, ret);
@@ -760,6 +742,14 @@ static int __maybe_unused intel_resume(struct device *dev)
760742
return ret;
761743
}
762744

745+
/*
746+
* Runtime PM has been disabled in intel_suspend(), so set the status
747+
* to active because the device has just been resumed and re-enable
748+
* runtime PM.
749+
*/
750+
pm_runtime_set_active(dev);
751+
pm_runtime_enable(dev);
752+
763753
/*
764754
* after system resume, the pm_runtime suspend() may kick in
765755
* during the enumeration, before any children device force the

0 commit comments

Comments
 (0)