USB: msm_otg: Fix device detection issue in Host mode during system suspend

When auto suspend happens in host mode, a_bus_req is dropped to allow
low power mode. This input should be asserted again when the attached
device initiates remote wakeup or resume happens from host side. The
current code is not asserting a_bus_req in case of remote wakeup from
device during system suspend. Fix the issue by asserting it in case of
remote wakup from device.

CRs-Fixed: 380384
Change-Id: I62e6549b777f6525d3f031a3f38a24c6d80e8a97
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
diff --git a/drivers/usb/otg/msm_otg.c b/drivers/usb/otg/msm_otg.c
index 0e1267b..2b894b3 100644
--- a/drivers/usb/otg/msm_otg.c
+++ b/drivers/usb/otg/msm_otg.c
@@ -2726,10 +2726,14 @@
 		pr_debug("OTG IRQ: in LPM\n");
 		disable_irq_nosync(irq);
 		motg->async_int = 1;
-		if (atomic_read(&motg->pm_suspended))
+		if (atomic_read(&motg->pm_suspended)) {
 			motg->sm_work_pending = true;
-		else
+			if ((otg->phy->state == OTG_STATE_A_SUSPEND) ||
+				(otg->phy->state == OTG_STATE_A_WAIT_BCON))
+				set_bit(A_BUS_REQ, &motg->inputs);
+		} else {
 			pm_request_resume(otg->phy->dev);
+		}
 		return IRQ_HANDLED;
 	}