diff mbox series

[v11,1/7] ACPI: scan: Obtain device's desired enumeration power state

Message ID 20210210230800.30291-2-sakari.ailus@linux.intel.com
State Not Applicable
Headers show
Series Support running driver's probe for a device powered off | expand

Commit Message

Sakari Ailus Feb. 10, 2021, 11:07 p.m. UTC
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(+)

Comments

Rafael J. Wysocki Feb. 11, 2021, 7:10 p.m. UTC | #1
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
>
Rajat Jain Oct. 7, 2021, 2:25 a.m. UTC | #2
Hello,

Now that we have landed the ACPI object for _DSC in the spec:
https://lore.kernel.org/linux-acpi/CAJZ5v0gwDEjC9T7wfCqDr7R0q_ptz2nVU52_8i8noXHPEign1g@mail.gmail.com/T/

I was wondering what is happening with the corresponding kernel patchset:
https://lore.kernel.org/linux-acpi/20210210230800.30291-1-sakari.ailus@linux.intel.com/T/#m24e9f51119cbe6eb39f31c097ea3941d00a0baeb

I didn't see any pending comments, so is there a reason it did not land?

Thanks,

Rajat
Sakari Ailus Oct. 18, 2021, 8:23 p.m. UTC | #3
Hi Rajit,

On Wed, Oct 06, 2021 at 07:25:27PM -0700, Rajat Jain wrote:
> 
> Hello,
> 
> Now that we have landed the ACPI object for _DSC in the spec:
> https://lore.kernel.org/linux-acpi/CAJZ5v0gwDEjC9T7wfCqDr7R0q_ptz2nVU52_8i8noXHPEign1g@mail.gmail.com/T/
> 
> I was wondering what is happening with the corresponding kernel patchset:
> https://lore.kernel.org/linux-acpi/20210210230800.30291-1-sakari.ailus@linux.intel.com/T/#m24e9f51119cbe6eb39f31c097ea3941d00a0baeb
> 
> I didn't see any pending comments, so is there a reason it did not land?

Thanks for the ping.

I've rebased the set and switched to _DSC so I believe it is ready to be
merged now:

	<URL:https://lore.kernel.org/linux-media/20211018121729.6357-1-sakari.ailus@linux.intel.com/T/#t>

I dropped the ov5670 patch from the set to avoid a conflict, I'll get this
merged through the media tree when the rest have landed there.
Rajat Jain Oct. 19, 2021, 8:07 p.m. UTC | #4
Hello Sakari,

Thanks for the updated patchset.

On Mon, Oct 18, 2021 at 1:23 PM Sakari Ailus
<sakari.ailus@linux.intel.com> wrote:
>
> Hi Rajit,
>
> On Wed, Oct 06, 2021 at 07:25:27PM -0700, Rajat Jain wrote:
> >
> > Hello,
> >
> > Now that we have landed the ACPI object for _DSC in the spec:
> > https://lore.kernel.org/linux-acpi/CAJZ5v0gwDEjC9T7wfCqDr7R0q_ptz2nVU52_8i8noXHPEign1g@mail.gmail.com/T/
> >
> > I was wondering what is happening with the corresponding kernel patchset:
> > https://lore.kernel.org/linux-acpi/20210210230800.30291-1-sakari.ailus@linux.intel.com/T/#m24e9f51119cbe6eb39f31c097ea3941d00a0baeb
> >
> > I didn't see any pending comments, so is there a reason it did not land?
>
> Thanks for the ping.
>
> I've rebased the set and switched to _DSC so I believe it is ready to be
> merged now:
>
>         <URL:https://lore.kernel.org/linux-media/20211018121729.6357-1-sakari.ailus@linux.intel.com/T/#t>

I have 1 question. I see that these patches change the EEPROM and the
camera driver's probe routine to work around a device that is not
powered on (in D0 state). I2C core is also not powering it on now if
the ACPI says so. So how / when is the device actually getting powered
on now (being put in D0 state), after these patches?

Thanks,

Rajat

>
> I dropped the ov5670 patch from the set to avoid a conflict, I'll get this
> merged through the media tree when the rest have landed there.
>
> --
> Regards,
>
> Sakari Ailus
Rajat Jain Jan. 10, 2022, 6:55 p.m. UTC | #5
+Bingbu Cao +arec.kao@intel.com

Hello Sakari,

On Mon, Oct 18, 2021 at 1:23 PM Sakari Ailus
<sakari.ailus@linux.intel.com> wrote:
>
> Hi Rajit,
>
> On Wed, Oct 06, 2021 at 07:25:27PM -0700, Rajat Jain wrote:
> >
> > Hello,
> >
> > Now that we have landed the ACPI object for _DSC in the spec:
> > https://lore.kernel.org/linux-acpi/CAJZ5v0gwDEjC9T7wfCqDr7R0q_ptz2nVU52_8i8noXHPEign1g@mail.gmail.com/T/
> >
> > I was wondering what is happening with the corresponding kernel patchset:
> > https://lore.kernel.org/linux-acpi/20210210230800.30291-1-sakari.ailus@linux.intel.com/T/#m24e9f51119cbe6eb39f31c097ea3941d00a0baeb
> >
> > I didn't see any pending comments, so is there a reason it did not land?
>
> Thanks for the ping.
>
> I've rebased the set and switched to _DSC so I believe it is ready to be
> merged now:
>
>         <URL:https://lore.kernel.org/linux-media/20211018121729.6357-1-sakari.ailus@linux.intel.com/T/#t>
>
> I dropped the ov5670 patch from the set to avoid a conflict, I'll get this
> merged through the media tree when the rest have landed there.


Thanks, I see that your patches series has been merged. Can you please
also line up this follow up series by Bingbu for inclusion into the
mainline kernel?

https://patchwork.kernel.org/project/linux-media/list/?series=595925

Thanks,

Rajat


>
> --
> Regards,
>
> Sakari Ailus
Sakari Ailus Jan. 10, 2022, 10:31 p.m. UTC | #6
Hi Rajat,

On Mon, Jan 10, 2022 at 10:55:58AM -0800, Rajat Jain wrote:
> > > https://lore.kernel.org/linux-acpi/CAJZ5v0gwDEjC9T7wfCqDr7R0q_ptz2nVU52_8i8noXHPEign1g@mail.gmail.com/T/
> > >
> > > I was wondering what is happening with the corresponding kernel patchset:
> > > https://lore.kernel.org/linux-acpi/20210210230800.30291-1-sakari.ailus@linux.intel.com/T/#m24e9f51119cbe6eb39f31c097ea3941d00a0baeb
> > >
> > > I didn't see any pending comments, so is there a reason it did not land?
> >
> > Thanks for the ping.
> >
> > I've rebased the set and switched to _DSC so I believe it is ready to be
> > merged now:
> >
> >         <URL:https://lore.kernel.org/linux-media/20211018121729.6357-1-sakari.ailus@linux.intel.com/T/#t>
> >
> > I dropped the ov5670 patch from the set to avoid a conflict, I'll get this
> > merged through the media tree when the rest have landed there.
> 
> 
> Thanks, I see that your patches series has been merged. Can you please
> also line up this follow up series by Bingbu for inclusion into the
> mainline kernel?
> 
> https://patchwork.kernel.org/project/linux-media/list/?series=595925

These patches are in media tree master:

<URL:https://git.linuxtv.org/media_tree.git/log/>

I'd expect to see these in Linux 5.17.
diff mbox series

Patch

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);
+	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 */