summaryrefslogtreecommitdiff
path: root/drivers/usb/otg/ab5500-usb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/otg/ab5500-usb.c')
-rw-r--r--drivers/usb/otg/ab5500-usb.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/usb/otg/ab5500-usb.c b/drivers/usb/otg/ab5500-usb.c
index e8c06e694a6..9bb43508cae 100644
--- a/drivers/usb/otg/ab5500-usb.c
+++ b/drivers/usb/otg/ab5500-usb.c
@@ -25,6 +25,9 @@
#include <mach/reboot_reasons.h>
#include <linux/pm_qos.h>
+#include <linux/wakelock.h>
+static struct wake_lock ab5500_musb_wakelock;
+
/* AB5500 USB macros
*/
#define AB5500_MAIN_WATCHDOG_ENABLE 0x1
@@ -197,6 +200,7 @@ static void ab5500_usb_phy_enable(struct ab5500_usb *ab, bool sel_host)
return;
ab->phy_enabled = true;
+ wake_lock(&ab5500_musb_wakelock);
ab->usb_gpio->enable();
clk_enable(ab->sysclk);
regulator_enable(ab->v_ape);
@@ -239,6 +243,8 @@ static void ab5500_usb_phy_disable(struct ab5500_usb *ab, bool sel_host)
}
cancel_delayed_work_sync(&ab->work_usb_workaround);
}
+
+ wake_unlock(&ab5500_musb_wakelock);
}
#define ab5500_usb_peri_phy_en(ab) ab5500_usb_phy_enable(ab, false)
@@ -636,6 +642,12 @@ static int __devinit ab5500_usb_probe(struct platform_device *pdev)
if (err < 0)
goto fail1;
+ /*
+ * wake lock is acquired when usb cable is connected and released when
+ * cable is removed
+ */
+ wake_lock_init(&ab5500_musb_wakelock, WAKE_LOCK_SUSPEND, "ab5500-usb");
+
err = ab5500_usb_boot_detect(ab);
if (err < 0)
goto fail1;