usb: fsl_udc_core: Prevent udc timeout on suspend
authorColin Cross <ccross@android.com>
Fri, 23 Jul 2010 19:54:37 +0000 (12:54 -0700)
committerColin Cross <ccross@android.com>
Wed, 6 Oct 2010 23:33:23 +0000 (16:33 -0700)
Change-Id: Ic4780063d432860df835c54c17b2b9249132c8c5
Signed-off-by: Colin Cross <ccross@android.com>
drivers/usb/gadget/fsl_udc_core.c

index 68715f5183be7036198d284d0384897c23c71c88..fe66989232b9ffa18424004ef997227de62ba3ef 100644 (file)
@@ -2604,6 +2604,10 @@ static int __exit fsl_udc_remove(struct platform_device *pdev)
  -----------------------------------------------------------------*/
 static int fsl_udc_suspend(struct platform_device *pdev, pm_message_t state)
 {
+       if (udc_controller->transceiver &&
+                   udc_controller->transceiver->state != OTG_STATE_B_PERIPHERAL)
+               return 0;
+
        dr_controller_stop(udc_controller);
        return 0;
 }
@@ -2614,6 +2618,10 @@ static int fsl_udc_suspend(struct platform_device *pdev, pm_message_t state)
  *-----------------------------------------------------------------*/
 static int fsl_udc_resume(struct platform_device *pdev)
 {
+       if (udc_controller->transceiver &&
+                   udc_controller->transceiver->state != OTG_STATE_B_PERIPHERAL)
+               return 0;
+
        /* Enable DR irq reg and set controller Run */
        if (udc_controller->stopped) {
                dr_controller_setup(udc_controller);