ChangeSet 1.1722.97.52, 2004/06/08 16:08:19-07:00, [EMAIL PROTECTED] [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: David Brownell <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> drivers/usb/core/hub.h | 11 +++++++++++ drivers/usb/gadget/dummy_hcd.c | 3 +++ 2 files changed, 14 insertions(+) diff -Nru a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h --- a/drivers/usb/core/hub.h Fri Jun 18 10:59:02 2004 +++ b/drivers/usb/core/hub.h Fri Jun 18 10:59:02 2004 @@ -215,4 +215,15 @@ 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 */ diff -Nru a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c --- a/drivers/usb/gadget/dummy_hcd.c Fri Jun 18 10:59:02 2004 +++ b/drivers/usb/gadget/dummy_hcd.c Fri Jun 18 10:59:02 2004 @@ -1686,6 +1686,9 @@ goto clean1; } + /* only show a low-power port: just 8mA */ + hub_set_power_budget (root, 8); + dum->started = 1; if ((retval = dummy_register_udc (dum)) != 0) { ------------------------------------------------------- This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel