Skip to content

Commit

Permalink
usb: composite gadget: set vbus_draw current limitation during suspend
Browse files Browse the repository at this point in the history
This patch modifies the composite gadget to set vbus_draw current limitation
during suspend state. This current limitation in suspend state shouldn't be
more than 2.5mA

Signed-off-by: Hao Wu <hao.wu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Hao Wu authored and Greg Kroah-Hartman committed Dec 1, 2010
1 parent c3d6450 commit b23f2f9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/usb/gadget/composite.c
Original file line number Diff line number Diff line change
Expand Up @@ -1188,13 +1188,16 @@ composite_suspend(struct usb_gadget *gadget)
composite->suspend(cdev);

cdev->suspended = 1;

usb_gadget_vbus_draw(gadget, 2);
}

static void
composite_resume(struct usb_gadget *gadget)
{
struct usb_composite_dev *cdev = get_gadget_data(gadget);
struct usb_function *f;
u8 maxpower;

/* REVISIT: should we have config level
* suspend/resume callbacks?
Expand All @@ -1207,6 +1210,11 @@ composite_resume(struct usb_gadget *gadget)
if (f->resume)
f->resume(f);
}

maxpower = cdev->config->bMaxPower;

usb_gadget_vbus_draw(gadget, maxpower ?
(2 * maxpower) : CONFIG_USB_GADGET_VBUS_DRAW);
}

cdev->suspended = 0;
Expand Down

0 comments on commit b23f2f9

Please sign in to comment.