net: wireless: bcm4335: power off card when not in use
Om Prakash Singh [Thu, 14 Feb 2013 04:24:52 +0000 (20:24 -0800)]
Power off the card when wifi is off and power up only when wifi
is turned on

Bug 1011349

Change-Id: I018c3757280c81c9077dd07949422bf572fc3a0d
Signed-off-by: Om Prakash Singh <omp@nvidia.com>
Reviewed-on: http://git-master/r/200667
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>

drivers/net/wireless/bcm4335/bcmsdh_sdmmc.c
drivers/net/wireless/bcm4335/bcmsdh_sdmmc_linux.c

index 3810056..3451e55 100644 (file)
@@ -36,6 +36,7 @@
 
 #include <linux/mmc/core.h>
 #include <linux/mmc/card.h>
+#include <linux/mmc/host.h>
 #include <linux/mmc/sdio_func.h>
 #include <linux/mmc/sdio_ids.h>
 
@@ -1534,7 +1535,9 @@ sdioh_start(sdioh_info_t *si, int stage)
                   2.6.27. The implementation prior to that is buggy, and needs broadcom's
                   patch for it
                */
-               if ((ret = sdio_reset_comm(gInstance->func[0]->card))) {
+               ret = mmc_power_restore_host((gInstance->func[0])->card->host);
+
+               if (ret) {
                        sd_err(("%s Failed, error = %d\n", __FUNCTION__, ret));
                        return ret;
                }
@@ -1619,6 +1622,8 @@ sdioh_stop(sdioh_info_t *si)
 #endif
                bcmsdh_oob_intr_set(FALSE);
 #endif /* !defined(OOB_INTR_ONLY) */
+               if (mmc_power_save_host((gInstance->func[0])->card->host))
+                       sd_err(("%s card power save fail\n", __func__));
        }
        else
                sd_err(("%s Failed\n", __FUNCTION__));
index a341ec5..29afa39 100644 (file)
@@ -34,6 +34,7 @@
 
 #include <linux/mmc/core.h>
 #include <linux/mmc/card.h>
+#include <linux/mmc/host.h>
 #include <linux/mmc/sdio_func.h>
 #include <linux/mmc/sdio_ids.h>
 
@@ -136,6 +137,8 @@ static int bcmsdh_sdmmc_probe(struct sdio_func *func,
        #endif
                        sd_trace(("F2 found, calling bcmsdh_probe...\n"));
                        ret = bcmsdh_probe(&func->dev);
+                       if (mmc_power_save_host(func->card->host))
+                               sd_err(("%s: card power save fail", __func__));
                }
        } else {
                ret = -ENODEV;