public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hook acpi d-state to pnp suspend/resume
@ 2007-07-20  2:03 Shaohua Li
  2007-07-21 19:38 ` David Brownell
  2007-07-22  6:14 ` Len Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Shaohua Li @ 2007-07-20  2:03 UTC (permalink / raw)
  To: linux acpi; +Cc: Adam Belay, Rafael J. Wysocki, Len Brown, David Brownell

applied after Rafel's 'PM: Update global suspend and hibernation operations framework' patch set

Hook acpi d-state to pnp suspend/resume.
Signed-off-by: Shaohua Li <shaohua.li@intel.com>

Index: lgit/include/linux/pnp.h
===================================================================
--- lgit.orig/include/linux/pnp.h	2007-07-19 09:38:25.000000000 +0800
+++ lgit/include/linux/pnp.h	2007-07-19 14:24:30.000000000 +0800
@@ -335,6 +335,10 @@ struct pnp_protocol {
 	int (*set)(struct pnp_dev *dev, struct pnp_resource_table *res);
 	int (*disable)(struct pnp_dev *dev);
 
+	/* protocol specific suspend/resume */
+	int (*suspend)(struct pnp_dev *dev, pm_message_t state);
+	int (*resume)(struct pnp_dev *dev);
+
 	/* used by pnp layer only (look but don't touch) */
 	unsigned char		number;		/* protocol number*/
 	struct device		dev;		/* link to driver model */
Index: lgit/drivers/pnp/driver.c
===================================================================
--- lgit.orig/drivers/pnp/driver.c	2007-07-19 09:38:25.000000000 +0800
+++ lgit/drivers/pnp/driver.c	2007-07-19 14:49:47.000000000 +0800
@@ -167,6 +167,8 @@ static int pnp_bus_suspend(struct device
 	    		return error;
 	}
 
+	if (pnp_dev->protocol && pnp_dev->protocol->suspend)
+		pnp_dev->protocol->suspend(pnp_dev, state);
 	return 0;
 }
 
@@ -179,6 +181,9 @@ static int pnp_bus_resume(struct device 
 	if (!pnp_drv)
 		return 0;
 
+	if (pnp_dev->protocol && pnp_dev->protocol->resume)
+		pnp_dev->protocol->resume(pnp_dev);
+
 	if (!(pnp_drv->flags & PNP_DRIVER_RES_DO_NOT_CHANGE)) {
 		error = pnp_start_dev(pnp_dev);
 		if (error)
Index: lgit/drivers/pnp/pnpacpi/core.c
===================================================================
--- lgit.orig/drivers/pnp/pnpacpi/core.c	2007-07-19 09:38:25.000000000 +0800
+++ lgit/drivers/pnp/pnpacpi/core.c	2007-07-19 14:50:13.000000000 +0800
@@ -119,11 +119,25 @@ static int pnpacpi_disable_resources(str
 	return ACPI_FAILURE(status) ? -ENODEV : 0;
 }
 
+static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state)
+{
+	return acpi_bus_set_power((acpi_handle)dev->data,
+		acpi_pm_device_sleep_state(&dev->dev,
+		device_may_wakeup(&dev->dev), NULL));
+}
+
+static int pnpacpi_resume(struct pnp_dev *dev)
+{
+	return acpi_bus_set_power((acpi_handle)dev->data, ACPI_STATE_D0);
+}
+
 static struct pnp_protocol pnpacpi_protocol = {
 	.name	= "Plug and Play ACPI",
 	.get	= pnpacpi_get_resources,
 	.set	= pnpacpi_set_resources,
 	.disable = pnpacpi_disable_resources,
+	.suspend = pnpacpi_suspend,
+	.resume = pnpacpi_resume,
 };
 
 static int __init pnpacpi_add_device(struct acpi_device *device)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] hook acpi d-state to pnp suspend/resume
  2007-07-20  2:03 [PATCH] hook acpi d-state to pnp suspend/resume Shaohua Li
@ 2007-07-21 19:38 ` David Brownell
  2007-07-23  5:43   ` Shaohua Li
  2007-07-22  6:14 ` Len Brown
  1 sibling, 1 reply; 4+ messages in thread
From: David Brownell @ 2007-07-21 19:38 UTC (permalink / raw)
  To: Shaohua Li; +Cc: linux acpi, Adam Belay, Rafael J. Wysocki, Len Brown

On Thursday 19 July 2007, Shaohua Li wrote:
> 
> applied after Rafel's 'PM: Update global suspend and hibernation
> operations framework' patch set 
> 
> Hook acpi d-state to pnp suspend/resume.
> Signed-off-by: Shaohua Li <shaohua.li@intel.com>

Looks about right, and I know the "punt to the PNP protocol
handler" approach will make Dmitry happy (for input devices);
it's very "hands-off".

How much has this been tested?  Have you verified that, for
example, PS/2 keyboards and mice now pay proper attention
to the driver model wakeup flags?

Unfortunately I don't have any system available for testing
this patch.

- Dave


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] hook acpi d-state to pnp suspend/resume
  2007-07-20  2:03 [PATCH] hook acpi d-state to pnp suspend/resume Shaohua Li
  2007-07-21 19:38 ` David Brownell
@ 2007-07-22  6:14 ` Len Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Len Brown @ 2007-07-22  6:14 UTC (permalink / raw)
  To: Shaohua Li; +Cc: linux acpi, Adam Belay, Rafael J. Wysocki, David Brownell

previous version (it was checked into acpi-test on Jun-6) reverted,
this version applied.

thanks,
-Len

On Thursday 19 July 2007 22:03, Shaohua Li wrote:
> applied after Rafel's 'PM: Update global suspend and hibernation operations framework' patch set
> 
> Hook acpi d-state to pnp suspend/resume.
> Signed-off-by: Shaohua Li <shaohua.li@intel.com>
> 
> Index: lgit/include/linux/pnp.h
> ===================================================================
> --- lgit.orig/include/linux/pnp.h	2007-07-19 09:38:25.000000000 +0800
> +++ lgit/include/linux/pnp.h	2007-07-19 14:24:30.000000000 +0800
> @@ -335,6 +335,10 @@ struct pnp_protocol {
>  	int (*set)(struct pnp_dev *dev, struct pnp_resource_table *res);
>  	int (*disable)(struct pnp_dev *dev);
>  
> +	/* protocol specific suspend/resume */
> +	int (*suspend)(struct pnp_dev *dev, pm_message_t state);
> +	int (*resume)(struct pnp_dev *dev);
> +
>  	/* used by pnp layer only (look but don't touch) */
>  	unsigned char		number;		/* protocol number*/
>  	struct device		dev;		/* link to driver model */
> Index: lgit/drivers/pnp/driver.c
> ===================================================================
> --- lgit.orig/drivers/pnp/driver.c	2007-07-19 09:38:25.000000000 +0800
> +++ lgit/drivers/pnp/driver.c	2007-07-19 14:49:47.000000000 +0800
> @@ -167,6 +167,8 @@ static int pnp_bus_suspend(struct device
>  	    		return error;
>  	}
>  
> +	if (pnp_dev->protocol && pnp_dev->protocol->suspend)
> +		pnp_dev->protocol->suspend(pnp_dev, state);
>  	return 0;
>  }
>  
> @@ -179,6 +181,9 @@ static int pnp_bus_resume(struct device 
>  	if (!pnp_drv)
>  		return 0;
>  
> +	if (pnp_dev->protocol && pnp_dev->protocol->resume)
> +		pnp_dev->protocol->resume(pnp_dev);
> +
>  	if (!(pnp_drv->flags & PNP_DRIVER_RES_DO_NOT_CHANGE)) {
>  		error = pnp_start_dev(pnp_dev);
>  		if (error)
> Index: lgit/drivers/pnp/pnpacpi/core.c
> ===================================================================
> --- lgit.orig/drivers/pnp/pnpacpi/core.c	2007-07-19 09:38:25.000000000 +0800
> +++ lgit/drivers/pnp/pnpacpi/core.c	2007-07-19 14:50:13.000000000 +0800
> @@ -119,11 +119,25 @@ static int pnpacpi_disable_resources(str
>  	return ACPI_FAILURE(status) ? -ENODEV : 0;
>  }
>  
> +static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state)
> +{
> +	return acpi_bus_set_power((acpi_handle)dev->data,
> +		acpi_pm_device_sleep_state(&dev->dev,
> +		device_may_wakeup(&dev->dev), NULL));
> +}
> +
> +static int pnpacpi_resume(struct pnp_dev *dev)
> +{
> +	return acpi_bus_set_power((acpi_handle)dev->data, ACPI_STATE_D0);
> +}
> +
>  static struct pnp_protocol pnpacpi_protocol = {
>  	.name	= "Plug and Play ACPI",
>  	.get	= pnpacpi_get_resources,
>  	.set	= pnpacpi_set_resources,
>  	.disable = pnpacpi_disable_resources,
> +	.suspend = pnpacpi_suspend,
> +	.resume = pnpacpi_resume,
>  };
>  
>  static int __init pnpacpi_add_device(struct acpi_device *device)
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] hook acpi d-state to pnp suspend/resume
  2007-07-21 19:38 ` David Brownell
@ 2007-07-23  5:43   ` Shaohua Li
  0 siblings, 0 replies; 4+ messages in thread
From: Shaohua Li @ 2007-07-23  5:43 UTC (permalink / raw)
  To: David Brownell; +Cc: linux acpi, Adam Belay, Rafael J. Wysocki, Len Brown

On Sat, 2007-07-21 at 12:38 -0700, David Brownell wrote:
> On Thursday 19 July 2007, Shaohua Li wrote:
> > 
> > applied after Rafel's 'PM: Update global suspend and hibernation
> > operations framework' patch set 
> > 
> > Hook acpi d-state to pnp suspend/resume.
> > Signed-off-by: Shaohua Li <shaohua.li@intel.com>
> 
> Looks about right, and I know the "punt to the PNP protocol
> handler" approach will make Dmitry happy (for input devices);
> it's very "hands-off".
> 
> How much has this been tested?  Have you verified that, for
> example, PS/2 keyboards and mice now pay proper attention
> to the driver model wakeup flags?
> 
> Unfortunately I don't have any system available for testing
> this patch.
Not too much. I tested in a laptop. This highly depends on BIOS.

Thanks,
Shaohua

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-07-23  5:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-20  2:03 [PATCH] hook acpi d-state to pnp suspend/resume Shaohua Li
2007-07-21 19:38 ` David Brownell
2007-07-23  5:43   ` Shaohua Li
2007-07-22  6:14 ` Len Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox