summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorHao Wu <hao.wu@intel.com>2010-11-29 08:17:03 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2010-12-01 01:46:34 +0100
commitb23f2f94136884ebeb1b5e2196f4a53086444afa (patch)
tree3c5195b1e5750c45377ba07b979ddd42234a3f4e /drivers/usb/gadget
parentusb: otg: twl4030-usb: Fix unbalanced regulator disables at module removal (diff)
downloadlinux-b23f2f94136884ebeb1b5e2196f4a53086444afa.tar.xz
linux-b23f2f94136884ebeb1b5e2196f4a53086444afa.zip
usb: composite gadget: set vbus_draw current limitation during suspend
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>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/composite.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index d3493fede64a..21dc0da36ab7 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -1188,6 +1188,8 @@ composite_suspend(struct usb_gadget *gadget)
composite->suspend(cdev);
cdev->suspended = 1;
+
+ usb_gadget_vbus_draw(gadget, 2);
}
static void
@@ -1195,6 +1197,7 @@ 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?
@@ -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;