USB: otg: delay device disconnect
Krishna Yarlagadda [Wed, 8 Aug 2012 11:31:10 +0000 (16:31 +0530)]
Device disconnect during resume might fail if notification
clients for this device removal are not ready.
Disconnecting device after the resume is complete.

Bug 1024496

Change-Id: Ia806e177d2dd2b1b43d3fea7a4af45f0d4a93cd4
Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com>
Reviewed-on: http://git-master/r/122079
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>

drivers/usb/otg/tegra-otg.c

index 1d7cc76..6b55d5d 100644 (file)
@@ -533,7 +533,6 @@ static void tegra_otg_resume(struct device *dev)
 {
        struct platform_device *pdev = to_platform_device(dev);
        struct tegra_otg_data *tegra = platform_get_drvdata(pdev);
-       struct otg_transceiver *otg = &tegra->otg;
        int val;
        unsigned long flags;
        DBG("%s(%d) BEGIN\n", __func__, __LINE__);
@@ -548,10 +547,6 @@ static void tegra_otg_resume(struct device *dev)
        DBG("%s(%d) PHY WAKEUP register : 0x%x\n", __func__, __LINE__, val);
        clk_disable(tegra->clk);
 
-       /* Handle if host cable is replaced with device during suspend state */
-       if (otg->state == OTG_STATE_A_HOST && (val & USB_ID_STATUS))
-               tegra_change_otg_state(tegra, OTG_STATE_A_SUSPEND);
-
        /* Enable interrupt and call work to set to appropriate state */
        spin_lock_irqsave(&tegra->lock, flags);
        if (tegra->builtin_host)
@@ -561,7 +556,7 @@ static void tegra_otg_resume(struct device *dev)
                        USB_ID_PIN_WAKEUP_EN;
 
        spin_unlock_irqrestore(&tegra->lock, flags);
-       irq_work(&tegra->work);
+       schedule_work(&tegra->work);
 
        enable_interrupt(tegra, true);