@@ -807,6 +807,17 @@ int acpi_power_get_inferred_state(struct acpi_device *device, int *state)
if (!device || !state)
return -EINVAL;
+ /*
+ * Some devices do not have a power-resource-list for D0, but do
+ * have a power-resource-lists for e.g. D3 so we do end up here.
+ * In this case we can never infer that the device is in D0 even
+ * though it might very well be in D0, so return ACPI_STATE_UNKNOWN.
+ */
+ if (list_empty(&device->power.states[ACPI_STATE_D0].resources)) {
+ *state = ACPI_STATE_UNKNOWN;
+ return 0;
+ }
+
/*
* We know a device's inferred power state when all the resources
* required for a given D-state are 'on'.
Some devices do not have a power-resource-list for D0, but do have a power-resource-lists for e.g. D3 (_PR3). On these devices the "if (device->power.flags.power_resources)" check in acpi_device_get_power() succeeds because of the presence of the _PR3 resources, so the code used to try and infer the power-state. In this case since there is no power-resource-list for D0, we can never infer that the device is in D0 even though it very well might be in D0. This results in the code inferring that the device is in D3HOT and on the first suspend acpi_device_set_power() skips calling _PS3 for the device because it thinks the device is already in D3. An example of a family of devices which are affected by this are Bay Trail based devices. The ACPI device for the XHCI controller on these devices does not have a _PR0 method, but it does have a _PR3 method. The problem described above causes the XHCI controller's _PS3 method not getting called on the first suspend of the device, which causes these devices to not reach the S0i3 power-state during suspend. Since we cannot infer if the device is in D0 or not when there is no power-resource-list for D0, the best thing to do is to change acpi_power_get_inferred_state() to return ACPI_STATE_UNKNOWN in this case. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=205057 Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- drivers/acpi/power.c | 11 +++++++++++ 1 file changed, 11 insertions(+)