public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: linux-pm@lists.linux-foundation.org
Cc: Thomas Renninger <trenn@suse.de>, linux-acpi@vger.kernel.org
Subject: [patch 2.6.25-rc6 4/7] USB uses pci_choose_state()
Date: Thu, 20 Mar 2008 14:15:07 -0700	[thread overview]
Message-ID: <200803201415.07957.david-b@pacbell.net> (raw)
In-Reply-To: <200803201408.33466.david-b@pacbell.net>

Given a preceding patch that makes pci_choose_state() behave sanely,
use it to select the appropriate PCI_Dx state to use when suspending
a host controller.

USB hosts may now use states like PCI_D1 and PCI_D2, where appropriate.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
 drivers/usb/core/hcd-pci.c |   25 ++++++++-----------------
 1 file changed, 8 insertions(+), 17 deletions(-)

--- g26.orig/drivers/usb/core/hcd-pci.c	2008-02-24 02:02:45.000000000 -0800
+++ g26/drivers/usb/core/hcd-pci.c	2008-02-24 02:08:08.000000000 -0800
@@ -224,18 +224,6 @@ int usb_hcd_pci_suspend(struct pci_dev *
 	}
 	synchronize_irq(dev->irq);
 
-	/* FIXME until the generic PM interfaces change a lot more, this
-	 * can't use PCI D1 and D2 states.  For example, the confusion
-	 * between messages and states will need to vanish, and messages
-	 * will need to provide a target system state again.
-	 *
-	 * It'll be important to learn characteristics of the target state,
-	 * especially on embedded hardware where the HCD will often be in
-	 * charge of an external VBUS power supply and one or more clocks.
-	 * Some target system states will leave them active; others won't.
-	 * (With PCI, that's often handled by platform BIOS code.)
-	 */
-
 	/* even when the PCI layer rejects some of the PCI calls
 	 * below, HCs can try global suspend and reduce DMA traffic.
 	 * PM-sensitive HCDs may already have done this.
@@ -248,6 +236,7 @@ int usb_hcd_pci_suspend(struct pci_dev *
 	 * low power state, if the hardware allows.
 	 */
 	if (hcd->state == HC_STATE_SUSPENDED) {
+		pci_power_t		d_state;
 
 		/* no DMA or IRQs except when HC is active */
 		if (dev->current_state == PCI_D0) {
@@ -265,27 +254,29 @@ int usb_hcd_pci_suspend(struct pci_dev *
 			dev_dbg(hcd->self.controller, "--> PCI D0/legacy\n");
 			goto done;
 		}
+		d_state = pci_choose_state(dev, message);
 
-		/* NOTE:  dev->current_state becomes nonzero only here, and
-		 * only for devices that support PCI PM.  Also, exiting
+		/* NOTE:  dev->current_state becomes nonzero only here, using
+		 * D3hot unless the platform chooses D2 or D1.  Also, exiting
 		 * PCI_D3 (but not PCI_D1 or PCI_D2) is allowed to reset
 		 * some device state (e.g. as part of clock reinit).
 		 */
-		retval = pci_set_power_state(dev, PCI_D3hot);
+		retval = pci_set_power_state(dev, d_state);
 		suspend_report_result(pci_set_power_state, retval);
 		if (retval == 0) {
 			int wake = device_can_wakeup(&hcd->self.root_hub->dev);
 
 			wake = wake && device_may_wakeup(hcd->self.controller);
 
-			dev_dbg(hcd->self.controller, "--> PCI D3%s\n",
+			dev_dbg(hcd->self.controller, "--> PCI D%d%s\n",
+					d_state,
 					wake ? "/wakeup" : "");
 
 			/* Ignore these return values.  We rely on pci code to
 			 * reject requests the hardware can't implement, rather
 			 * than coding the same thing.
 			 */
-			(void) pci_enable_wake(dev, PCI_D3hot, wake);
+			(void) pci_enable_wake(dev, d_state, wake);
 			(void) pci_enable_wake(dev, PCI_D3cold, wake);
 		} else {
 			dev_dbg(&dev->dev, "PCI D3 suspend fail, %d\n",

  parent reply	other threads:[~2008-03-20 21:30 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-20 21:08 [patch 2.6.25-rc6 0/7] misc pm wake patches David Brownell
2008-03-20 21:09 ` [patch 2.6.25-rc6 1/7] crosslink ACPI and "real" device nodes David Brownell
2008-03-21  6:43   ` Zhao Yakui
2008-03-21  7:31     ` David Brownell
2008-03-21  8:34       ` Zhao Yakui
2008-03-21  9:04         ` David Brownell
2008-03-20 21:10 ` [patch 2.6.25-rc6 2/7] acpi_pm_device_sleep_state() cleanup David Brownell
2008-03-24 16:30   ` [linux-pm] " Pavel Machek
2008-04-19  4:11   ` [RESEND patch 2.6.25] " David Brownell
2008-04-29 20:33   ` [RE-RESEND patch 2.6.25-git] " David Brownell
2008-04-29 21:49     ` Rafael J. Wysocki
2008-04-29 22:12       ` David Brownell
2008-04-30 12:07         ` Rafael J. Wysocki
2008-03-20 21:12 ` [patch 2.6.25-rc6 3/7] pci_choose_state() cleanup and fixes David Brownell
2008-03-20 22:37   ` Rafael J. Wysocki
2008-03-20 23:03     ` David Brownell
2008-03-21  0:22       ` Rafael J. Wysocki
2008-03-21  0:55         ` [linux-pm] " Alan Stern
2008-03-21  1:47           ` Rafael J. Wysocki
2008-03-21  8:15             ` David Brownell
2008-03-21 16:23               ` Rafael J. Wysocki
2008-03-22 17:55                 ` David Brownell
2008-03-22 18:11                   ` Rafael J. Wysocki
2008-03-22 18:29                     ` David Brownell
2008-03-21  7:53         ` David Brownell
2008-03-21 16:38           ` Rafael J. Wysocki
2008-03-22 17:49             ` David Brownell
2008-03-22 18:34               ` Rafael J. Wysocki
2008-04-14  4:59                 ` David Brownell
2008-03-20 21:15 ` David Brownell [this message]
2008-03-20 21:20 ` [patch 2.6.25-rc6 5/7] ACPI sets up device.power.can_wakeup flags David Brownell
2008-03-21  7:43   ` Zhao Yakui
2008-04-19  4:14   ` [RESEND patch 2.6.25] " David Brownell
2008-04-22  2:48     ` Zhang Rui
2008-03-20 21:22 ` [patch 2.6.25-rc6 6/7] ACPI uses device_may_wakeup() policy inputs David Brownell
2008-04-19  4:18   ` [RESEND patch 2.6.25] " David Brownell
2008-04-22  2:42     ` Zhang Rui
2008-04-26 19:29       ` David Brownell
2008-04-22 13:30     ` Zhao Yakui
2008-04-26 19:37       ` David Brownell
2008-04-28 12:48         ` Zhao Yakui
2008-04-28  8:50           ` Zhang Rui
2008-04-28 13:43             ` [linux-pm] " Alan Stern
2008-04-29 23:38               ` David Brownell
2008-04-30 13:58                 ` Alan Stern
2008-05-14 14:56                   ` Pavel Machek
2008-04-28 22:28             ` David Brownell
2008-04-28 21:35           ` Henrique de Moraes Holschuh
2008-04-28 22:20             ` David Brownell
2008-04-28 22:54               ` Henrique de Moraes Holschuh
2008-04-29  0:20                 ` David Brownell
2008-04-29 20:32               ` David Brownell
2008-04-28 22:24           ` David Brownell
2008-04-28 22:26           ` David Brownell
2008-03-20 21:25 ` [patch 2.6.25-rc6 7/7] PCI set up device.power.can_wakeup flags David Brownell
2008-03-20 21:53   ` [linux-pm] " Alan Stern
2008-03-20 22:22     ` David Brownell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200803201415.07957.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=trenn@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox