summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Langlais <philippe.langlais@linaro.org>2012-03-16 11:39:55 +0100
committerPhilippe Langlais <philippe.langlais@stericsson.com>2012-05-22 11:03:21 +0200
commit55ae02276e7db7a6632039a28574bdddcde4f9a1 (patch)
treed790ad247b64c14a9c8f79b23c2c6158188ee0f0
parentdebdb58003798a24e6565817a722a5272ec5706c (diff)
Android: usb: u5500: driver wakelock related changes.usb-android
Signed-off-by: Avinash Kumar <avinash.kumar@stericsson.com> Signed-off-by: Philippe Langlais <philippe.langlais@linaro.org>
-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;