diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2008-04-14 12:17:10 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-04-25 00:16:53 -0400 |
commit | 58a97ffeb2297f154659f339d77eb3f32c4d8b3e (patch) | |
tree | 2ca171b7f720769007f9c9624b74ca4ad3442f02 /drivers/usb/host/ehci-hub.c | |
parent | b950bdbc67041412cb042e404938667204c7902c (diff) |
USB: HCDs use the do_remote_wakeup flag
When a USB device is suspended, whether or not it is enabled for
remote wakeup depends on the device_may_wakeup() setting. The setting
is then saved in the do_remote_wakeup flag.
Later on, however, the device_may_wakeup() value can change because of
user activity. So when testing whether a suspended device is or
should be enabled for remote wakeup, we should always test
do_remote_wakeup instead of device_may_wakeup(). This patch (as1076)
makes that change for root hubs in several places.
The patch also adjusts uhci-hcd so that when an autostopped controller
is suspended, the remote wakeup setting agrees with the value recorded
in the root hub's do_remote_wakeup flag.
And the patch adjusts ehci-hcd so that wakeup events on selectively
suspended ports (i.e., the bus itself isn't suspended) don't turn on
the PME# wakeup signal.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/ehci-hub.c')
-rw-r--r-- | drivers/usb/host/ehci-hub.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 21ac3781f21a..536b433d24f7 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
@@ -30,6 +30,8 @@ | |||
30 | 30 | ||
31 | #ifdef CONFIG_PM | 31 | #ifdef CONFIG_PM |
32 | 32 | ||
33 | #define PORT_WAKE_BITS (PORT_WKOC_E|PORT_WKDISC_E|PORT_WKCONN_E) | ||
34 | |||
33 | static int ehci_hub_control( | 35 | static int ehci_hub_control( |
34 | struct usb_hcd *hcd, | 36 | struct usb_hcd *hcd, |
35 | u16 typeReq, | 37 | u16 typeReq, |
@@ -149,10 +151,10 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) | |||
149 | } | 151 | } |
150 | 152 | ||
151 | /* enable remote wakeup on all ports */ | 153 | /* enable remote wakeup on all ports */ |
152 | if (device_may_wakeup(&hcd->self.root_hub->dev)) | 154 | if (hcd->self.root_hub->do_remote_wakeup) |
153 | t2 |= PORT_WKOC_E|PORT_WKDISC_E|PORT_WKCONN_E; | 155 | t2 |= PORT_WAKE_BITS; |
154 | else | 156 | else |
155 | t2 &= ~(PORT_WKOC_E|PORT_WKDISC_E|PORT_WKCONN_E); | 157 | t2 &= ~PORT_WAKE_BITS; |
156 | 158 | ||
157 | if (t1 != t2) { | 159 | if (t1 != t2) { |
158 | ehci_vdbg (ehci, "port %d, %08x -> %08x\n", | 160 | ehci_vdbg (ehci, "port %d, %08x -> %08x\n", |
@@ -174,7 +176,7 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) | |||
174 | 176 | ||
175 | /* allow remote wakeup */ | 177 | /* allow remote wakeup */ |
176 | mask = INTR_MASK; | 178 | mask = INTR_MASK; |
177 | if (!device_may_wakeup(&hcd->self.root_hub->dev)) | 179 | if (!hcd->self.root_hub->do_remote_wakeup) |
178 | mask &= ~STS_PCD; | 180 | mask &= ~STS_PCD; |
179 | ehci_writel(ehci, mask, &ehci->regs->intr_enable); | 181 | ehci_writel(ehci, mask, &ehci->regs->intr_enable); |
180 | ehci_readl(ehci, &ehci->regs->intr_enable); | 182 | ehci_readl(ehci, &ehci->regs->intr_enable); |
@@ -232,8 +234,7 @@ static int ehci_bus_resume (struct usb_hcd *hcd) | |||
232 | i = HCS_N_PORTS (ehci->hcs_params); | 234 | i = HCS_N_PORTS (ehci->hcs_params); |
233 | while (i--) { | 235 | while (i--) { |
234 | temp = ehci_readl(ehci, &ehci->regs->port_status [i]); | 236 | temp = ehci_readl(ehci, &ehci->regs->port_status [i]); |
235 | temp &= ~(PORT_RWC_BITS | 237 | temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS); |
236 | | PORT_WKOC_E | PORT_WKDISC_E | PORT_WKCONN_E); | ||
237 | if (test_bit(i, &ehci->bus_suspended) && | 238 | if (test_bit(i, &ehci->bus_suspended) && |
238 | (temp & PORT_SUSPEND)) { | 239 | (temp & PORT_SUSPEND)) { |
239 | ehci->reset_done [i] = jiffies + msecs_to_jiffies (20); | 240 | ehci->reset_done [i] = jiffies + msecs_to_jiffies (20); |
@@ -534,8 +535,6 @@ ehci_hub_descriptor ( | |||
534 | 535 | ||
535 | /*-------------------------------------------------------------------------*/ | 536 | /*-------------------------------------------------------------------------*/ |
536 | 537 | ||
537 | #define PORT_WAKE_BITS (PORT_WKOC_E|PORT_WKDISC_E|PORT_WKCONN_E) | ||
538 | |||
539 | static int ehci_hub_control ( | 538 | static int ehci_hub_control ( |
540 | struct usb_hcd *hcd, | 539 | struct usb_hcd *hcd, |
541 | u16 typeReq, | 540 | u16 typeReq, |
@@ -801,8 +800,6 @@ static int ehci_hub_control ( | |||
801 | if ((temp & PORT_PE) == 0 | 800 | if ((temp & PORT_PE) == 0 |
802 | || (temp & PORT_RESET) != 0) | 801 | || (temp & PORT_RESET) != 0) |
803 | goto error; | 802 | goto error; |
804 | if (device_may_wakeup(&hcd->self.root_hub->dev)) | ||
805 | temp |= PORT_WAKE_BITS; | ||
806 | ehci_writel(ehci, temp | PORT_SUSPEND, status_reg); | 803 | ehci_writel(ehci, temp | PORT_SUSPEND, status_reg); |
807 | break; | 804 | break; |
808 | case USB_PORT_FEAT_POWER: | 805 | case USB_PORT_FEAT_POWER: |