aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/hub.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/core/hub.c')
-rw-r--r--drivers/usb/core/hub.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index a8d879a85d04..32ff32181852 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -643,15 +643,21 @@ static int hub_configure(struct usb_hub *hub,
643 message = "can't get hub status"; 643 message = "can't get hub status";
644 goto fail; 644 goto fail;
645 } 645 }
646 cpu_to_le16s(&hubstatus); 646 le16_to_cpus(&hubstatus);
647 if ((hubstatus & (1 << USB_DEVICE_SELF_POWERED)) == 0) { 647 if (hdev == hdev->bus->root_hub) {
648 struct usb_hcd *hcd =
649 container_of(hdev->bus, struct usb_hcd, self);
650
651 hub->power_budget = min(500u, hcd->power_budget) / 2;
652 } else if ((hubstatus & (1 << USB_DEVICE_SELF_POWERED)) == 0) {
648 dev_dbg(hub_dev, "hub controller current requirement: %dmA\n", 653 dev_dbg(hub_dev, "hub controller current requirement: %dmA\n",
649 hub->descriptor->bHubContrCurrent); 654 hub->descriptor->bHubContrCurrent);
650 hub->power_budget = (501 - hub->descriptor->bHubContrCurrent) 655 hub->power_budget = (501 - hub->descriptor->bHubContrCurrent)
651 / 2; 656 / 2;
657 }
658 if (hub->power_budget)
652 dev_dbg(hub_dev, "%dmA bus power budget for children\n", 659 dev_dbg(hub_dev, "%dmA bus power budget for children\n",
653 hub->power_budget * 2); 660 hub->power_budget * 2);
654 }
655 661
656 662
657 ret = hub_hub_status(hub, &hubstatus, &hubchange); 663 ret = hub_hub_status(hub, &hubstatus, &hubchange);
@@ -1727,7 +1733,7 @@ static int finish_port_resume(struct usb_device *udev)
1727 struct usb_driver *driver; 1733 struct usb_driver *driver;
1728 1734
1729 intf = udev->actconfig->interface[i]; 1735 intf = udev->actconfig->interface[i];
1730 if (intf->dev.power.power_state == PMSG_SUSPEND) 1736 if (intf->dev.power.power_state == PMSG_ON)
1731 continue; 1737 continue;
1732 if (!intf->dev.driver) { 1738 if (!intf->dev.driver) {
1733 /* FIXME maybe force to alt 0 */ 1739 /* FIXME maybe force to alt 0 */
@@ -2787,6 +2793,11 @@ static void hub_events(void)
2787 2793
2788 hub->activating = 0; 2794 hub->activating = 0;
2789 2795
2796 /* If this is a root hub, tell the HCD it's okay to
2797 * re-enable port-change interrupts now. */
2798 if (!hdev->parent)
2799 usb_enable_root_hub_irq(hdev->bus);
2800
2790loop: 2801loop:
2791 usb_unlock_device(hdev); 2802 usb_unlock_device(hdev);
2792 usb_put_intf(intf); 2803 usb_put_intf(intf);