Skip to contentSkip to conversation

PATCH/RFC: ohci wakeup updates (4/4)

PATCH David Brownell 1 participant 1 message Oct 4, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

The HCDs that understand about wakeup (OHCI, EHCI) would need small tweaks to use the driver model hooks.

EHCI needs comparable changes, but I didn't want to spend the time splitting them out from other patches unless there was some agreement that this was the way the driver model should expose wakeup.

Makes OHCI use the new pmcore wakeup bits, not the old usbcore ones. Also includes a slightly better interpretation of the RWC bit.

[ against Greg's 2.6.9-rc3 USB tree, hence 2.6.9-rc3-mm2 ]

drivers/usb/host/ohci-hcd.c +6 -5
@@ -505,10 +505,6 @@
 			hcfs2string (ohci->hc_control & OHCI_CTRL_HCFS),
 			ohci->hc_control);
 
-	if (ohci->hc_control & OHCI_CTRL_RWC
-			&& !(ohci->flags & OHCI_QUIRK_AMD756))
-		ohci->hcd.can_wakeup = 1;
-
 	switch (ohci->hc_control & OHCI_CTRL_HCFS) {
 	case OHCI_USB_OPER:
 		temp = 0;
@@ -655,7 +651,7 @@
 		usb_set_device_state (udev, USB_STATE_CONFIGURED);
 		return 0;
 	}
- 
+
 	/* connect the virtual root hub */
 	udev = usb_alloc_dev (NULL, bus, 0);
 	if (!udev) {
@@ -664,6 +660,11 @@
 		writel (ohci->hc_control, &ohci->regs->control);
 		return -ENOMEM;
 	}
+	/* RWC doesn't always mean the same thing... */
+	if (device_can_wakeup(bus->controller))
+		device_init_wakeup(bus->controller,
+				ohci->hc_control & OHCI_CTRL_RWC);
+	device_init_wakeup(&udev->dev, !(ohci->flags & OHCI_QUIRK_AMD756));
 
 	udev->speed = USB_SPEED_FULL;
 	if (hcd_register_root (udev, &ohci->hcd) != 0) {
drivers/usb/host/ohci-hub.c +4 -3
@@ -105,7 +105,7 @@
 	writel (ohci_readl (&ohci->regs->intrstatus), &ohci->regs->intrstatus);
 
 	/* maybe resume can wake root hub */
-	if (ohci->hcd.remote_wakeup)
+	if (device_may_wakeup(&root->dev))
 		ohci->hc_control |= OHCI_CTRL_RWE;
 	else
 		ohci->hc_control &= ~OHCI_CTRL_RWE;
@@ -231,7 +231,7 @@
 	msleep (3);
 
 	temp = OHCI_CONTROL_INIT | OHCI_USB_OPER;
-	if (ohci->hcd.can_wakeup)
+	if (device_can_wakeup(hcd->self.controller));
 		temp |= OHCI_CTRL_RWC;
 	ohci->hc_control = temp;
 	writel (temp, &ohci->regs->control);
@@ -347,7 +347,8 @@
 		 */
 		if (!(status & RH_PS_CCS))
 			continue;
-		if ((status & RH_PS_PSS) && ohci->hcd.remote_wakeup)
+		if ((status & RH_PS_PSS)
+				&& device_may_wakeup(&hcd->self.root_hub->dev))
 			continue;
 		can_suspend = 0;
 	}