diff options
-rw-r--r-- | drivers/usb/otg/ab5500-usb.c | 12 | ||||
-rw-r--r-- | drivers/usb/otg/ab8500-usb.c | 8 |
2 files changed, 20 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; diff --git a/drivers/usb/otg/ab8500-usb.c b/drivers/usb/otg/ab8500-usb.c index 49c5d31c150..d6e83a4d671 100644 --- a/drivers/usb/otg/ab8500-usb.c +++ b/drivers/usb/otg/ab8500-usb.c @@ -37,6 +37,9 @@ #include <linux/mfd/dbx500-prcmu.h> #include <linux/kernel_stat.h> #include <linux/pm_qos.h> +#include <linux/wakelock.h> + +static struct wake_lock ab8500_musb_wakelock; #define AB8500_MAIN_WD_CTRL_REG 0x01 #define AB8500_USB_LINE_STAT_REG 0x80 @@ -272,6 +275,8 @@ static void ab8500_usb_phy_enable(struct ab8500_usb *ab, bool sel_host) bit = sel_host ? AB8500_BIT_PHY_CTRL_HOST_EN : AB8500_BIT_PHY_CTRL_DEVICE_EN; + wake_lock(&ab8500_musb_wakelock); + clk_enable(ab->sysclk); ab8500_usb_regulator_ctrl(ab, sel_host, true); @@ -334,6 +339,8 @@ static void ab8500_usb_phy_disable(struct ab8500_usb *ab, bool sel_host) prcmu_qos_update_requirement(PRCMU_QOS_ARM_OPP, "usb", 25); } + + wake_unlock(&ab8500_musb_wakelock); } #define ab8500_usb_host_phy_en(ab) ab8500_usb_phy_enable(ab, true) @@ -1082,6 +1089,7 @@ static int __devinit ab8500_usb_probe(struct platform_device *pdev) dev_info(&pdev->dev, "revision 0x%2x driver initialized\n", rev); prcmu_qos_add_requirement(PRCMU_QOS_ARM_OPP, "usb", 25); + wake_lock_init(&ab8500_musb_wakelock, WAKE_LOCK_SUSPEND, "ab8500-usb"); err = ab8500_usb_boot_detect(ab); if (err < 0) |