aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGregory Herrero <gregory.herrero@intel.com>2015-09-29 06:08:28 -0400
committerFelipe Balbi <balbi@ti.com>2015-10-01 13:40:27 -0400
commit61f7223bf14689382fdf36b7580f206745c2409a (patch)
treed81fc7466e37c9f0a164adc325240a92b81c419d
parent1ee6903b8f9bbcbeb7cf72e5127d7a0b8aeb267c (diff)
usb: dwc2: gadget: exit hibernation before power down
When disconnecting cable, controller will detect a suspend condition and enter partial power down. If vbus_session is called by the phy driver during hibernation, make sure controller exit hibernation before it is accessed. Signed-off-by: Jianqiang Tang <jianqiang.tang@intel.com> Signed-off-by: Gregory Herrero <gregory.herrero@intel.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Tested-by: Robert Baldyga <r.baldyga@samsung.com> Tested-by: Dinh Nguyen <dinguyen@opensource.altera.com> Tested-by: John Youn <johnyoun@synopsys.com> Acked-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r--drivers/usb/dwc2/gadget.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index e87a7359e632..ef964814b928 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3285,14 +3285,15 @@ static int dwc2_hsotg_vbus_session(struct usb_gadget *gadget, int is_active)
3285 dev_dbg(hsotg->dev, "%s: is_active: %d\n", __func__, is_active); 3285 dev_dbg(hsotg->dev, "%s: is_active: %d\n", __func__, is_active);
3286 spin_lock_irqsave(&hsotg->lock, flags); 3286 spin_lock_irqsave(&hsotg->lock, flags);
3287 3287
3288 /*
3289 * If controller is hibernated, it must exit from hibernation
3290 * before being initialized / de-initialized
3291 */
3292 if (hsotg->lx_state == DWC2_L2)
3293 dwc2_exit_hibernation(hsotg, false);
3294
3288 if (is_active) { 3295 if (is_active) {
3289 hsotg->op_state = OTG_STATE_B_PERIPHERAL; 3296 hsotg->op_state = OTG_STATE_B_PERIPHERAL;
3290 /*
3291 * If controller is hibernated, it must exit from hibernation
3292 * before being initialized
3293 */
3294 if (hsotg->lx_state == DWC2_L2)
3295 dwc2_exit_hibernation(hsotg, false);
3296 3297
3297 dwc2_hsotg_core_init_disconnected(hsotg, false); 3298 dwc2_hsotg_core_init_disconnected(hsotg, false);
3298 if (hsotg->enabled) 3299 if (hsotg->enabled)