linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] USB: dummy-hcd: fix power budget for SuperSpeed mode
@ 2019-09-05  4:11 Jacky.Cao
  2019-09-05 14:14 ` Alan Stern
  2019-09-05 20:55 ` Greg KH
  0 siblings, 2 replies; 4+ messages in thread
From: Jacky.Cao @ 2019-09-05  4:11 UTC (permalink / raw)
  To: balbi, gregkh, stern
  Cc: linux-usb, linux-kernel, Kento.A.Kobayashi, Jacky.Cao

The power budget for SuperSpeed mode should be 900 mA
according to USB specification, so set the power budget
to 900mA 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 <Jacky.Cao@sony.com>
---
Changes in v3:
  - Rename POWER_BUDGET_3_0 to POWER_BUDGET_3
  - Update commit message from USB3.0 specification to USB specification

Changes in v2:
  - Fix whitespace damage

 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..3d499d9 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	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;
 	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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] USB: dummy-hcd: fix power budget for SuperSpeed mode
  2019-09-05  4:11 [PATCH v3] USB: dummy-hcd: fix power budget for SuperSpeed mode Jacky.Cao
@ 2019-09-05 14:14 ` Alan Stern
  2019-09-05 20:55 ` Greg KH
  1 sibling, 0 replies; 4+ messages in thread
From: Alan Stern @ 2019-09-05 14:14 UTC (permalink / raw)
  To: Jacky.Cao; +Cc: balbi, gregkh, linux-usb, linux-kernel, Kento.A.Kobayashi

On Thu, 5 Sep 2019 Jacky.Cao@sony.com wrote:

> The power budget for SuperSpeed mode should be 900 mA
> according to USB specification, so set the power budget
> to 900mA 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 <Jacky.Cao@sony.com>
> ---
> Changes in v3:
>   - Rename POWER_BUDGET_3_0 to POWER_BUDGET_3
>   - Update commit message from USB3.0 specification to USB specification
> 
> Changes in v2:
>   - Fix whitespace damage
> 
>  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..3d499d9 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	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;
>  	dummy_hcd_to_hcd(dum_hcd)->state = HC_STATE_RUNNING;
>  	dummy_hcd_to_hcd(dum_hcd)->uses_new_polling = 1;
>  #ifdef CONFIG_USB_OTG

Acked-by: Alan Stern <stern@rowland.harvard.edu>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] USB: dummy-hcd: fix power budget for SuperSpeed mode
  2019-09-05  4:11 [PATCH v3] USB: dummy-hcd: fix power budget for SuperSpeed mode Jacky.Cao
  2019-09-05 14:14 ` Alan Stern
@ 2019-09-05 20:55 ` Greg KH
  2019-09-06  9:04   ` Jacky.Cao
  1 sibling, 1 reply; 4+ messages in thread
From: Greg KH @ 2019-09-05 20:55 UTC (permalink / raw)
  To: Jacky.Cao; +Cc: balbi, stern, linux-usb, linux-kernel, Kento.A.Kobayashi

On Thu, Sep 05, 2019 at 04:11:57AM +0000, Jacky.Cao@sony.com wrote:
> The power budget for SuperSpeed mode should be 900 mA
> according to USB specification, so set the power budget
> to 900mA 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 <Jacky.Cao@sony.com>

Does this "fix" a specific commit in the tree, and if so, what is the
commit id of that?  Also, should this go to the stable kernel(s)?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH v3] USB: dummy-hcd: fix power budget for SuperSpeed mode
  2019-09-05 20:55 ` Greg KH
@ 2019-09-06  9:04   ` Jacky.Cao
  0 siblings, 0 replies; 4+ messages in thread
From: Jacky.Cao @ 2019-09-06  9:04 UTC (permalink / raw)
  To: gregkh
  Cc: balbi, stern, linux-usb, linux-kernel, Kento.A.Kobayashi, Jacky.Cao

Hi, 

> 
> Does this "fix" a specific commit in the tree, and if so, what is the commit id of
> that?  Also, should this go to the stable kernel(s)?
> 
> thanks,
> 
> greg k-h

No, this fix is not for specific commit since the POWER_BUDGET(500mA) is used for 
SuperSpeed mode when dummy hcd added SuperSpeed support in commit(1cd8fd2887).

And I think it should be imported to stable kernel(s) considering the "insufficient
available bus power error" mentioned in commit message really happens. We reproduced
this issue with linux-3.10, linux-4.9 which we use and confirmed it can be solved by
this modification.

Regards
Jacky

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-09-06  9:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-05  4:11 [PATCH v3] USB: dummy-hcd: fix power budget for SuperSpeed mode Jacky.Cao
2019-09-05 14:14 ` Alan Stern
2019-09-05 20:55 ` Greg KH
2019-09-06  9:04   ` Jacky.Cao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).