From: Prashanth K <quic_prashk@quicinc.com>
To: Jack Pham <quic_jackp@quicinc.com>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Thinh Nguyen" <Thinh.Nguyen@synopsys.com>,
"Jakob Koschel" <jakobkoschel@gmail.com>,
"Jó Ágila Bitsch" <jgilab@gmail.com>,
"Alan Stern" <stern@rowland.harvard.edu>,
"Pratham Pratap" <quic_ppratap@quicinc.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 2/2] usb: gadget: composite: Draw 100mA current if not configured
Date: Thu, 23 Feb 2023 13:52:22 +0530 [thread overview]
Message-ID: <699d0d70-4d83-7bc6-e152-0a352a016e71@quicinc.com> (raw)
In-Reply-To: <20230223073329.GA3727894@hu-jackp-lv.qualcomm.com>
On 23-02-23 01:03 pm, Jack Pham wrote:
> Hi Prashanth,
>
> On Thu, Feb 23, 2023 at 10:48:30AM +0530, Prashanth K wrote:
>> Currently we don't change the current value if device isn't in
>> configured state. But the battery charging specification says,
>> the device can draw upto 100mA of current if its in unconfigured
>
> Here you say spec says "up to" (BTW you have a typo) 100mA...
>
Will fix it in v2
>> state. Hence add a Vbus_draw work in composite_resume to draw
>> 100mA if the device isn't configured.
>
> But here and in the patch you are calling the function to draw exactly
> 100mA. Consider the possibility that a gadget could be configured to
> draw less current than that or not anything at all, we should make sure
> to honor that as an absolute maximum.
That's right
>
>> Signed-off-by: Prashanth K <quic_prashk@quicinc.com>
>> ---
>> drivers/usb/gadget/composite.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
>> index fa7dd6c..147d278 100644
>> --- a/drivers/usb/gadget/composite.c
>> +++ b/drivers/usb/gadget/composite.c
>> @@ -2531,6 +2531,8 @@ void composite_resume(struct usb_gadget *gadget)
>> usb_gadget_clear_selfpowered(gadget);
>>
>> usb_gadget_vbus_draw(gadget, maxpower);
>> + } else {
>> + usb_gadget_vbus_draw(gadget, 100);
>
> Similar to the configured case, maybe you can perform a min()
> calculation against either or both the config->MaxPower or
> CONFIG_USB_GADGET_VBUS_DRAW.
>
Thanks for the suggestion, will update it in v2 patch
> Thanks,
> Jack
prev parent reply other threads:[~2023-02-23 8:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-23 5:18 [PATCH v1 0/2] Fix vbus draw of dwc3 gadget Prashanth K
2023-02-23 5:18 ` [PATCH v1 1/2] usb: dwc3: gadget: Change condition for processing suspend event Prashanth K
2023-02-23 5:18 ` [PATCH v1 2/2] usb: gadget: composite: Draw 100mA current if not configured Prashanth K
2023-02-23 7:33 ` Jack Pham
2023-02-23 8:22 ` Prashanth K [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=699d0d70-4d83-7bc6-e152-0a352a016e71@quicinc.com \
--to=quic_prashk@quicinc.com \
--cc=Thinh.Nguyen@synopsys.com \
--cc=gregkh@linuxfoundation.org \
--cc=jakobkoschel@gmail.com \
--cc=jgilab@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=quic_jackp@quicinc.com \
--cc=quic_ppratap@quicinc.com \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox