Commit 6bd79f69 authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

[PATCH] USB: usb root hubs can set power budgets

This adds hub_set_power_budget(), mostly so that HCDs for low
powered ports (cell phone, PDA, etc) can more easily report their
true power budgets.  It's not always 500mA per root hub port; this
makes dummy_hcd report the minimum, 8mA.
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 910b4606
...@@ -215,4 +215,15 @@ struct usb_hub { ...@@ -215,4 +215,15 @@ struct usb_hub {
struct work_struct leds; struct work_struct leds;
}; };
/* use this for low-powered root hubs */
static inline void
hub_set_power_budget (struct usb_device *hubdev, unsigned mA)
{
struct usb_hub *hub;
hub = (struct usb_hub *)
usb_get_intfdata (hubdev->actconfig->interface[0]);
hub->power_budget = min(mA,(unsigned)500)/2;
}
#endif /* __LINUX_HUB_H */ #endif /* __LINUX_HUB_H */
...@@ -1686,6 +1686,9 @@ static int dummy_start (struct usb_hcd *hcd) ...@@ -1686,6 +1686,9 @@ static int dummy_start (struct usb_hcd *hcd)
goto clean1; goto clean1;
} }
/* only show a low-power port: just 8mA */
hub_set_power_budget (root, 8);
dum->started = 1; dum->started = 1;
if ((retval = dummy_register_udc (dum)) != 0) { if ((retval = dummy_register_udc (dum)) != 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment