Message ID | 20210210230800.30291-1-sakari.ailus@linux.intel.com |
---|---|
Headers | show |
Series | Support running driver's probe for a device powered off | expand |
On Thu, Feb 11, 2021 at 12:08 AM Sakari Ailus <sakari.ailus@linux.intel.com> wrote: > > In certain use cases (where the chip is part of a camera module, and the > camera module is wired together with a camera privacy LED), powering on > the device during probe is undesirable. Add support for the at24 to > execute probe while being in ACPI D state other than 0 (which means fully > powered on). > > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> > Reviewed-by: Tomasz Figa <tfiga@chromium.org> > --- I like this much better now, thanks! Acked-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
On Thu, Feb 11, 2021 at 12:08 AM Sakari Ailus <sakari.ailus@linux.intel.com> wrote: > > 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> > --- > drivers/acpi/scan.c | 4 ++++ > include/acpi/acpi_bus.h | 1 + > 2 files changed, 5 insertions(+) > > diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c > index a184529d8fa40..6a9b4a92c4f66 100644 > --- a/drivers/acpi/scan.c > +++ b/drivers/acpi/scan.c > @@ -987,6 +987,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 dse = ACPI_STATE_D0; > u32 i; > > /* Presence of _PS0|_PR0 indicates 'power manageable' */ > @@ -1008,6 +1009,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, "_DSE", NULL, &dse); As a matter of notice, it is likely that this object will be called _DSC (Deepest State for Configuration) which better reflects its function. The ACPI ECR introducing it will be sent next week if all goes well. Thanks! > + device->power.state_for_enumeration = dse; > + > /* > * Enumerate supported power management states > */ > diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h > index 02a716a0af5d4..becfc9f57002b 100644 > --- a/include/acpi/acpi_bus.h > +++ b/include/acpi/acpi_bus.h > @@ -276,6 +276,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; /* Maximum power state for enumeration */ > }; > > /* Performance Management */ > -- > 2.20.1 >