usb:penwell_otg: disable otg interrupt in penwell_otg_resume_noirq
authorjzhuan5 <jin.can.zhuang@intel.com>
Tue, 8 May 2012 09:13:00 +0000 (17:13 +0800)
committerbuildbot <buildbot@intel.com>
Fri, 11 May 2012 10:37:47 +0000 (03:37 -0700)
BZ: 35035

1. As irq isn't disabled when suspended (if does so, wakeup interrupt maybe
missed), irq should be disabled in penwell_otg_resume_noirq. Otherwise,
irq may happen before penwell_otg_resume is called, this causes
unconsistent state regarding to that before suspending.

2. move the hsm update from penwell_otg_resume_noirq to
penwell_otg_resume

Change-Id: I38c510b77b4cdd9f29fdbd52d71057b4a8ef0187
Signed-off-by: jzhuan5 <jin.can.zhuang@intel.com>
Reviewed-on: http://android.intel.com:8080/47818
Reviewed-by: Meng, Zhe <zhe.meng@intel.com>
Tested-by: Meng, Zhe <zhe.meng@intel.com>
Reviewed-by: Tang, Richard <richard.tang@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
drivers/usb/otg/penwell_otg.c

index fc16d4c..43c35d8 100644 (file)
@@ -4555,9 +4555,12 @@ static int penwell_otg_resume_noirq(struct device *dev)
                break;
        }
 
-       update_hsm();
 
-       penwell_update_transceiver();
+       /* We didn't disable otgsc interrupt, to prevent intr from happening
+       * before penwell_otg_resume, intr is disabled here, and can be enabled
+       * by penwell_otg_resume
+       */
+       penwell_otg_intr(0);
 
        dev_dbg(pnw->dev, "%s <---\n", __func__);
        return ret;
@@ -4596,6 +4599,15 @@ static int penwell_otg_resume(struct device *dev)
        pnw->queue_stop = 0;
        spin_unlock(&pnw->notify_lock);
 
+       penwell_otg_intr(1);
+
+       /* If a plugging in or pluggout event happens during D3,
+       * we will miss the interrupt, so check OTGSC here to check
+       * if any ID change and update hsm correspondingly
+       */
+       update_hsm();
+       penwell_update_transceiver();
+
        dev_dbg(pnw->dev, "%s <---\n", __func__);
        return ret;
 }