ACPI: scan: Obtain device's desired enumeration power state
authorSakari Ailus <sakari.ailus@linux.intel.com>
Mon, 18 Oct 2021 12:17:24 +0000 (15:17 +0300)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 3 Nov 2021 18:03:55 +0000 (19:03 +0100)
Store a device's desired enumeration power state in struct
acpi_device_power during acpi_device object's initialisation.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/scan.c
include/acpi/acpi_bus.h

index dce2c291b982b92fcbc0509a0e97a1a0a94cb336..a50f1967c73dcc381fdeaa7cc3ba28cba28b473b 100644 (file)
@@ -1017,6 +1017,7 @@ static void acpi_bus_init_power_state(struct acpi_device *device, int state)
 
 static void acpi_bus_get_power_flags(struct acpi_device *device)
 {
+       unsigned long long dsc = ACPI_STATE_D0;
        u32 i;
 
        /* Presence of _PS0|_PR0 indicates 'power manageable' */
@@ -1038,6 +1039,9 @@ static void acpi_bus_get_power_flags(struct acpi_device *device)
        if (acpi_has_method(device->handle, "_DSW"))
                device->power.flags.dsw_present = 1;
 
+       acpi_evaluate_integer(device->handle, "_DSC", NULL, &dsc);
+       device->power.state_for_enumeration = dsc;
+
        /*
         * Enumerate supported power management states
         */
index 53b6e9f9de7b4295563aec50e66bb6a2808da307..480f9207a4c6bcfdb065983281c2bc5e2b6071e0 100644 (file)
@@ -278,6 +278,7 @@ struct acpi_device_power {
        int state;              /* Current state */
        struct acpi_device_power_flags flags;
        struct acpi_device_power_state states[ACPI_D_STATE_COUNT];      /* Power states (D0-D3Cold) */
+       u8 state_for_enumeration; /* Deepest power state for enumeration */
 };
 
 struct acpi_dep_data {