From: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
To: "Du, Changbin" <changbin.du@intel.com>, Felipe Balbi <balbi@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] usb/gadget: make composite gadget meet usb compliance for vbus draw
Date: Thu, 23 Jul 2015 16:28:57 +0200 [thread overview]
Message-ID: <55B0FA29.5080402@samsung.com> (raw)
In-Reply-To: <0C18FE92A7765D4EB9EE5D38D86A563A01D14FD5@SHSMSX103.ccr.corp.intel.com>
Hi Changbin,
(I assume I address your name properly, if not please excuse)
W dniu 23.07.2015 o 14:34, Du, Changbin pisze:
>>From 0a8e0d63a9887735c6782d7b0c15c2c1fdf1952a Mon Sep 17 00:00:00 2001
<snip>
> void composite_disconnect(struct usb_gadget *gadget)
> {
> struct usb_composite_dev *cdev = get_gadget_data(gadget);
> @@ -2095,7 +2119,7 @@ void composite_suspend(struct usb_gadget *gadget)
>
> cdev->suspended = 1;
>
> - usb_gadget_vbus_draw(gadget, 2);
> + usb_gadget_vbus_draw(gadget, USB_VBUS_DRAW_SUSPEND);
> }
This looks like an unrelated change. I think it should go first
in a separate patch which eliminates usage of "magic" numbers.
>
> void composite_resume(struct usb_gadget *gadget)
> @@ -2117,10 +2141,11 @@ void composite_resume(struct usb_gadget *gadget)
> }
>
> maxpower = cdev->config->MaxPower;
> -
> - usb_gadget_vbus_draw(gadget, maxpower ?
> - maxpower : CONFIG_USB_GADGET_VBUS_DRAW);
> - }
> + if (!maxpower)
> + maxpower = CONFIG_USB_GADGET_VBUS_DRAW;
> + } else
> + maxpower = unconfigured_vbus_draw(cdev);
> + usb_gadget_vbus_draw(gadget, maxpower);
>
> cdev->suspended = 0;
> }
> @@ -2132,7 +2157,7 @@ static const struct usb_gadget_driver composite_driver_template = {
> .unbind = composite_unbind,
>
> .setup = composite_setup,
> - .reset = composite_disconnect,
> + .reset = composite_reset,
> .disconnect = composite_disconnect,
>
A similar "template" is in drivers/usb/gadget/configfs.c. Shouldn't the "reset"
method be changed there as well?
> .suspend = composite_suspend,
> diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
> index 2511469..90b434d 100644
> --- a/include/linux/usb/composite.h
> +++ b/include/linux/usb/composite.h
> @@ -333,6 +333,14 @@ enum {
> USB_GADGET_FIRST_AVAIL_IDX,
> };
>
> +/* USB2 compliance requires that un-configured current draw <= 100mA,
> + * USB3 requires it <= 150mA, OTG requires it <= 2.5mA.
> + */
> +#define USB2_VBUS_DRAW_UNCONF 100
> +#define USB3_VBUS_DRAW_UNCONF 150
> +#define USB_OTG_VBUS_DRAW_UNCONF 2
> +#define USB_VBUS_DRAW_SUSPEND 2
separate patch
Thanks,
AP
next prev parent reply other threads:[~2015-07-23 14:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-23 12:34 [PATCH] usb/gadget: make composite gadget meet usb compliance for vbus draw Du, Changbin
2015-07-23 14:28 ` Andrzej Pietrasiewicz [this message]
2015-07-24 4:11 ` Du, Changbin
2015-07-24 7:38 ` Andrzej Pietrasiewicz
2015-07-24 8:33 ` Du, Changbin
[not found] ` <0C18FE92A7765D4EB9EE5D38D86A563A01D4BDCD@SHSMSX103.ccr.corp.intel.com>
2015-07-28 4:25 ` Du, Changbin
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=55B0FA29.5080402@samsung.com \
--to=andrzej.p@samsung.com \
--cc=balbi@ti.com \
--cc=changbin.du@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/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