Skip to content

Commit 90dc8b6

Browse files
committed
Merge tag 'pm-4.18-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management fixes from Rafael Wysocki: "These fix a PCI power management regression introduced during the 4.17 cycle and fix up the recently added support for devices in multiple power domains. Specifics: - Resume parallel PCI (non-PCIe) bridges on suspend-to-RAM (ACP S3) to avoid confusing the platform firmware which started to happen after a core power management regression fix that went in during the 4.17 cycle (Rafael Wysocki). - Fix up the recently added support for devices in multiple power domains by avoiding to power up the entire domain unnecessarily when attaching a device to it (Ulf Hansson)" * tag 'pm-4.18-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: PM / Domains: Don't power on at attach for the multi PM domain case PCI / ACPI / PM: Resume bridges w/o drivers on suspend-to-RAM
2 parents b19b928 + 88b9608 commit 90dc8b6

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

drivers/base/power/domain.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2235,7 +2235,7 @@ static void genpd_dev_pm_sync(struct device *dev)
22352235
}
22362236

22372237
static int __genpd_dev_pm_attach(struct device *dev, struct device_node *np,
2238-
unsigned int index)
2238+
unsigned int index, bool power_on)
22392239
{
22402240
struct of_phandle_args pd_args;
22412241
struct generic_pm_domain *pd;
@@ -2271,9 +2271,11 @@ static int __genpd_dev_pm_attach(struct device *dev, struct device_node *np,
22712271
dev->pm_domain->detach = genpd_dev_pm_detach;
22722272
dev->pm_domain->sync = genpd_dev_pm_sync;
22732273

2274-
genpd_lock(pd);
2275-
ret = genpd_power_on(pd, 0);
2276-
genpd_unlock(pd);
2274+
if (power_on) {
2275+
genpd_lock(pd);
2276+
ret = genpd_power_on(pd, 0);
2277+
genpd_unlock(pd);
2278+
}
22772279

22782280
if (ret)
22792281
genpd_remove_device(pd, dev);
@@ -2307,7 +2309,7 @@ int genpd_dev_pm_attach(struct device *dev)
23072309
"#power-domain-cells") != 1)
23082310
return 0;
23092311

2310-
return __genpd_dev_pm_attach(dev, dev->of_node, 0);
2312+
return __genpd_dev_pm_attach(dev, dev->of_node, 0, true);
23112313
}
23122314
EXPORT_SYMBOL_GPL(genpd_dev_pm_attach);
23132315

@@ -2359,14 +2361,14 @@ struct device *genpd_dev_pm_attach_by_id(struct device *dev,
23592361
}
23602362

23612363
/* Try to attach the device to the PM domain at the specified index. */
2362-
ret = __genpd_dev_pm_attach(genpd_dev, dev->of_node, index);
2364+
ret = __genpd_dev_pm_attach(genpd_dev, dev->of_node, index, false);
23632365
if (ret < 1) {
23642366
device_unregister(genpd_dev);
23652367
return ret ? ERR_PTR(ret) : NULL;
23662368
}
23672369

2368-
pm_runtime_set_active(genpd_dev);
23692370
pm_runtime_enable(genpd_dev);
2371+
genpd_queue_power_off_work(dev_to_genpd(genpd_dev));
23702372

23712373
return genpd_dev;
23722374
}

drivers/pci/pci-acpi.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,18 @@ static bool acpi_pci_need_resume(struct pci_dev *dev)
629629
{
630630
struct acpi_device *adev = ACPI_COMPANION(&dev->dev);
631631

632+
/*
633+
* In some cases (eg. Samsung 305V4A) leaving a bridge in suspend over
634+
* system-wide suspend/resume confuses the platform firmware, so avoid
635+
* doing that, unless the bridge has a driver that should take care of
636+
* the PM handling. According to Section 16.1.6 of ACPI 6.2, endpoint
637+
* devices are expected to be in D3 before invoking the S3 entry path
638+
* from the firmware, so they should not be affected by this issue.
639+
*/
640+
if (pci_is_bridge(dev) && !dev->driver &&
641+
acpi_target_system_state() != ACPI_STATE_S0)
642+
return true;
643+
632644
if (!adev || !acpi_device_power_manageable(adev))
633645
return false;
634646

0 commit comments

Comments
 (0)