drvers: wireless: bcmdhd: set MMC_PM_KEEP_POWER on suspend
Rakesh Kumar [Fri, 2 Mar 2012 10:46:24 +0000 (15:46 +0530)]
MMC_PM_KEEP_POWER should be set before each suspend/resume cyble as
mmc drivers clears MMC_PM_KEEP_POWER from pm_flags on resume.

Bug 942826

Change-Id: Ifc647b500d744a37206a4879f1e3df495bc4123a
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: http://git-master/r/87208
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Tested-by: Bharat Nihalani <bnihalani@nvidia.com>

drivers/net/wireless/bcmdhd/bcmsdh_sdmmc_linux.c

index 726b639..6ec4a75 100644 (file)
@@ -163,6 +163,8 @@ MODULE_DEVICE_TABLE(sdio, bcmsdh_sdmmc_ids);
 static int bcmsdh_sdmmc_suspend(struct device *pdev)
 {
        struct sdio_func *func = dev_to_sdio_func(pdev);
+       mmc_pm_flag_t sdio_flags;
+       int ret = 0;
 
        if (func->num != 2)
                return 0;
@@ -171,10 +173,28 @@ static int bcmsdh_sdmmc_suspend(struct device *pdev)
 #if defined(OOB_INTR_ONLY)
        bcmsdh_oob_intr_set(0);
 #endif
-       dhd_mmc_suspend = TRUE;
        smp_mb();
 
-       return 0;
+       sdio_flags = sdio_get_host_pm_caps(func);
+
+       if (!(sdio_flags & MMC_PM_KEEP_POWER)) {
+               sd_err(("can't keep power while host "
+                               "is suspended\n", __FUNCTION__));
+               ret = -EINVAL;
+               goto out;
+       }
+
+       /* keep power while host suspended */
+       ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
+       if (ret) {
+               sd_err(("error while trying to keep power\n", __FUNCTION__));
+               goto out;
+       }
+
+       dhd_mmc_suspend = TRUE;
+
+out:
+       return ret;
 }
 
 static int bcmsdh_sdmmc_resume(struct device *pdev)