summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorPrashanth K <quic_prashk@quicinc.com>2023-02-24 11:16:59 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-09 15:31:15 +0100
commit2ae4e0dea3b0c7b380821bac05e03a71da1f452f (patch)
tree1cad5c829c6d4e74138e3d9bb3342300cab84729 /drivers/usb/gadget
parent4decf4060ecfee1f7a710999fcd421645ac0c419 (diff)
downloadlinux-stable-2ae4e0dea3b0c7b380821bac05e03a71da1f452f.tar.gz
linux-stable-2ae4e0dea3b0c7b380821bac05e03a71da1f452f.tar.bz2
linux-stable-2ae4e0dea3b0c7b380821bac05e03a71da1f452f.zip
usb: gadget: composite: Draw 100mA current if not configured
Currently we don't change the current value if device isn't in configured state. But in battery charging specification (section 1.2 and 1.4.13), it is mentioned that the device can draw up to 100mA of current if it's in unconfigured state. Hence add vbus draw work in composite_resume to draw 100mA if the device isn't configured. Signed-off-by: Prashanth K <quic_prashk@quicinc.com> Link: https://lore.kernel.org/r/1677217619-10261-3-git-send-email-quic_prashk@quicinc.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/composite.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index fa7dd6cf014d..36add1879ed2 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -2531,6 +2531,10 @@ void composite_resume(struct usb_gadget *gadget)
usb_gadget_clear_selfpowered(gadget);
usb_gadget_vbus_draw(gadget, maxpower);
+ } else {
+ maxpower = CONFIG_USB_GADGET_VBUS_DRAW;
+ maxpower = min(maxpower, 100U);
+ usb_gadget_vbus_draw(gadget, maxpower);
}
cdev->suspended = 0;