2019-09-04 07:53:29

by Jacky.Cao

[permalink] [raw]
Subject: [PATCH] USB: dummy-hcd: fix power budget for SuperSpeed mode

The power budget for SuperSpeed mode should be 900 mA
according to USB3.0 specification, so set the power
budget to 900 mA for dummy_start_ss which is only used
for SuperSpeed mode.

If the max power consumption of SuperSpeed device is
larger than 500 mA, insufficient available bus power
error happens in usb_choose_configuration function
when the device connects to dummy hcd.

Signed-off-by: Jacky Cao <[email protected]>
---
drivers/usb/gadget/udc/dummy_hcd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c
index 8414fac..52f2cf5 100644
--- a/drivers/usb/gadget/udc/dummy_hcd.c
+++ b/drivers/usb/gadget/udc/dummy_hcd.c
@@ -48,6 +48,7 @@
#define DRIVER_VERSION "02 May 2005"

#define POWER_BUDGET 500 /* in mA; use 8 for low-power port testing */
+#define POWER_BUDGET_3_0 900 /* in mA */

static const char driver_name[] = "dummy_hcd";
static const char driver_desc[] = "USB Host+Gadget Emulator";
@@ -2432,7 +2433,7 @@ static int dummy_start_ss(struct dummy_hcd *dum_hcd)
dum_hcd->rh_state = DUMMY_RH_RUNNING;
dum_hcd->stream_en_ep = 0;
INIT_LIST_HEAD(&dum_hcd->urbp_list);
- dummy_hcd_to_hcd(dum_hcd)->power_budget = POWER_BUDGET;
+ dummy_hcd_to_hcd(dum_hcd)->power_budget = POWER_BUDGET_3_0;
dummy_hcd_to_hcd(dum_hcd)->state = HC_STATE_RUNNING;
dummy_hcd_to_hcd(dum_hcd)->uses_new_polling = 1;
#ifdef CONFIG_USB_OTG
--
2.7.4


2019-09-04 07:56:00

by Felipe Balbi

[permalink] [raw]
Subject: Re: [PATCH] USB: dummy-hcd: fix power budget for SuperSpeed mode


Hi,

<[email protected]> writes:

> The power budget for SuperSpeed mode should be 900 mA
> according to USB3.0 specification, so set the power
> budget to 900 mA for dummy_start_ss which is only used
> for SuperSpeed mode.
>
> If the max power consumption of SuperSpeed device is
> larger than 500 mA, insufficient available bus power
> error happens in usb_choose_configuration function
> when the device connects to dummy hcd.
>
> Signed-off-by: Jacky Cao <[email protected]>
> ---
> drivers/usb/gadget/udc/dummy_hcd.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c
> index 8414fac..52f2cf5 100644
> --- a/drivers/usb/gadget/udc/dummy_hcd.c
> +++ b/drivers/usb/gadget/udc/dummy_hcd.c
> @@ -48,6 +48,7 @@
> #define DRIVER_VERSION "02 May 2005"
>
> #define POWER_BUDGET 500 /* in mA; use 8 for low-power port testing */
> +#define POWER_BUDGET_3_0 900 /* in mA */
>
> static const char driver_name[] = "dummy_hcd";
> static const char driver_desc[] = "USB Host+Gadget Emulator";
> @@ -2432,7 +2433,7 @@ static int dummy_start_ss(struct dummy_hcd *dum_hcd)
> dum_hcd->rh_state = DUMMY_RH_RUNNING;
> dum_hcd->stream_en_ep = 0;
> INIT_LIST_HEAD(&dum_hcd->urbp_list);
> - dummy_hcd_to_hcd(dum_hcd)->power_budget = POWER_BUDGET;
> + dummy_hcd_to_hcd(dum_hcd)->power_budget = POWER_BUDGET_3_0;
> dummy_hcd_to_hcd(dum_hcd)->state = HC_STATE_RUNNING;
> dummy_hcd_to_hcd(dum_hcd)->uses_new_polling = 1;
> #ifdef CONFIG_USB_OTG

Alan, I suppose you're okay with this change?

--
balbi


Attachments:
signature.asc (847.00 B)

2019-09-04 08:01:09

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] USB: dummy-hcd: fix power budget for SuperSpeed mode

On Wed, Sep 04, 2019 at 10:54:28AM +0300, Felipe Balbi wrote:
>
> Hi,
>
> <[email protected]> writes:
>
> > The power budget for SuperSpeed mode should be 900 mA
> > according to USB3.0 specification, so set the power
> > budget to 900 mA for dummy_start_ss which is only used
> > for SuperSpeed mode.
> >
> > If the max power consumption of SuperSpeed device is
> > larger than 500 mA, insufficient available bus power
> > error happens in usb_choose_configuration function
> > when the device connects to dummy hcd.
> >
> > Signed-off-by: Jacky Cao <[email protected]>
> > ---
> > drivers/usb/gadget/udc/dummy_hcd.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c
> > index 8414fac..52f2cf5 100644
> > --- a/drivers/usb/gadget/udc/dummy_hcd.c
> > +++ b/drivers/usb/gadget/udc/dummy_hcd.c
> > @@ -48,6 +48,7 @@
> > #define DRIVER_VERSION "02 May 2005"
> >
> > #define POWER_BUDGET 500 /* in mA; use 8 for low-power port testing */
> > +#define POWER_BUDGET_3_0 900 /* in mA */
> >
> > static const char driver_name[] = "dummy_hcd";
> > static const char driver_desc[] = "USB Host+Gadget Emulator";
> > @@ -2432,7 +2433,7 @@ static int dummy_start_ss(struct dummy_hcd *dum_hcd)
> > dum_hcd->rh_state = DUMMY_RH_RUNNING;
> > dum_hcd->stream_en_ep = 0;
> > INIT_LIST_HEAD(&dum_hcd->urbp_list);
> > - dummy_hcd_to_hcd(dum_hcd)->power_budget = POWER_BUDGET;
> > + dummy_hcd_to_hcd(dum_hcd)->power_budget = POWER_BUDGET_3_0;
> > dummy_hcd_to_hcd(dum_hcd)->state = HC_STATE_RUNNING;
> > dummy_hcd_to_hcd(dum_hcd)->uses_new_polling = 1;
> > #ifdef CONFIG_USB_OTG
>
> Alan, I suppose you're okay with this change?

I'm not ok with the whitespace damage making this patch impossible to
apply :)

2019-09-04 08:54:03

by Jacky.Cao

[permalink] [raw]
Subject: RE: [PATCH] USB: dummy-hcd: fix power budget for SuperSpeed mode

Hi,

> I'm not ok with the whitespace damage making this patch impossible to apply :)

Sorry for the whitespace damage issue I didn't notice when I copied the content.
Just now I submitted v2 for this patch with whitespace damage issue fix.
Please help to confirm, thank you.

Regards
Jacky

2019-09-04 10:02:44

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] USB: dummy-hcd: fix power budget for SuperSpeed mode

On Wed, Sep 04, 2019 at 08:52:12AM +0000, [email protected] wrote:
> Hi,
>
> > I'm not ok with the whitespace damage making this patch impossible to apply :)
>
> Sorry for the whitespace damage issue I didn't notice when I copied the content.
> Just now I submitted v2 for this patch with whitespace damage issue fix.
> Please help to confirm, thank you.

You can always confirm your own submissions by looking on the mailing
list itself, no need to ask anyone else to do that :)

greg k-h

2019-09-04 14:22:58

by Alan Stern

[permalink] [raw]
Subject: Re: [PATCH] USB: dummy-hcd: fix power budget for SuperSpeed mode

On Wed, 4 Sep 2019, Felipe Balbi wrote:

>
> Hi,
>
> <[email protected]> writes:
>
> > The power budget for SuperSpeed mode should be 900 mA
> > according to USB3.0 specification, so set the power
> > budget to 900 mA for dummy_start_ss which is only used
> > for SuperSpeed mode.
> >
> > If the max power consumption of SuperSpeed device is
> > larger than 500 mA, insufficient available bus power
> > error happens in usb_choose_configuration function
> > when the device connects to dummy hcd.
> >
> > Signed-off-by: Jacky Cao <[email protected]>
> > ---
> > drivers/usb/gadget/udc/dummy_hcd.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c
> > index 8414fac..52f2cf5 100644
> > --- a/drivers/usb/gadget/udc/dummy_hcd.c
> > +++ b/drivers/usb/gadget/udc/dummy_hcd.c
> > @@ -48,6 +48,7 @@
> > #define DRIVER_VERSION "02 May 2005"
> >
> > #define POWER_BUDGET 500 /* in mA; use 8 for low-power port testing */
> > +#define POWER_BUDGET_3_0 900 /* in mA */
> >
> > static const char driver_name[] = "dummy_hcd";
> > static const char driver_desc[] = "USB Host+Gadget Emulator";
> > @@ -2432,7 +2433,7 @@ static int dummy_start_ss(struct dummy_hcd *dum_hcd)
> > dum_hcd->rh_state = DUMMY_RH_RUNNING;
> > dum_hcd->stream_en_ep = 0;
> > INIT_LIST_HEAD(&dum_hcd->urbp_list);
> > - dummy_hcd_to_hcd(dum_hcd)->power_budget = POWER_BUDGET;
> > + dummy_hcd_to_hcd(dum_hcd)->power_budget = POWER_BUDGET_3_0;
> > dummy_hcd_to_hcd(dum_hcd)->state = HC_STATE_RUNNING;
> > dummy_hcd_to_hcd(dum_hcd)->uses_new_polling = 1;
> > #ifdef CONFIG_USB_OTG
>
> Alan, I suppose you're okay with this change?

Yes. Except that I think the name POWER_BUDGET_3_0 is a little odd.
It implies that this change is specific to USB 3.0 -- but it isn't.
USB 3.1 and 3.2 also have a 900 mA limit, right?

So please consider changing the name to POWER_BUDGET_3.

Alan Stern

2019-09-05 05:21:06

by Jacky.Cao

[permalink] [raw]
Subject: RE: [PATCH] USB: dummy-hcd: fix power budget for SuperSpeed mode

Hi

> Yes. Except that I think the name POWER_BUDGET_3_0 is a little odd.
> It implies that this change is specific to USB 3.0 -- but it isn't.
> USB 3.1 and 3.2 also have a 900 mA limit, right?
>
> So please consider changing the name to POWER_BUDGET_3.
>
> Alan Stern

Thank you for your comment.
I updated the name from POWER_BUDGET_3_0 to POWER_BUDGET_3 in PATCH v3
and submitted it just now.

Regards
Jacky