[PATCH] staging:brcm80211:brcmfmac:add dongle power on/off functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add dongle power on/off functions.
Power save feature is essential in wi-fi
fullmac model. And this feature was missing.
This function can be controlled by rfkill layer.


Signed-off-by: Nohee Ko <noheek@xxxxxxxxxxxx>
---
 drivers/staging/brcm80211/brcmfmac/dhd.h         |    3 ++
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c |   35 ++++++++++++++++++++++
 2 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/dhd.h b/drivers/staging/brcm80211/brcmfmac/dhd.h
index 57d06b2..da1d7fc 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd.h
@@ -344,6 +344,9 @@ extern int dhd_customer_oob_irq_map(unsigned long *irq_flags_ptr);
 #endif				/* defined(OOB_INTR_ONLY) */
 extern void dhd_os_sdtxlock(dhd_pub_t *pub);
 extern void dhd_os_sdtxunlock(dhd_pub_t *pub);
+extern int dhd_dev_reset(struct net_device *dev, u8 flag);
+extern int net_os_set_dtim_skip(struct net_device *dev, int val);
+extern void dhd_dev_init_ioctl(struct net_device *dev);
 
 int setScheduler(struct task_struct *p, int policy, struct sched_param *param);
 
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index 621521b..792cffb 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -47,6 +47,7 @@
 #include <net/rtnetlink.h>
 #include <linux/mmc/sdio_func.h>
 #include <linux/firmware.h>
+#include <bcmsdbus.h>
 #include <wl_cfg80211.h>
 
 static struct sdio_func *cfg80211_sdio_func;
@@ -286,6 +287,8 @@ static s32 wl_pattern_atoh(s8 *src, s8 *dst);
 static s32 wl_dongle_filter(struct net_device *ndev, u32 filter_mode);
 static s32 wl_update_wiphybands(struct wl_priv *wl);
 #endif				/* !EMBEDDED_PLATFORM */
+static __used void wl_dongle_poweron(struct wl_priv *wl);
+static __used void wl_dongle_poweroff(struct wl_priv *wl);
 static s32 wl_config_dongle(struct wl_priv *wl, bool need_lock);
 
 /*
@@ -4229,3 +4232,35 @@ static void wl_debugfs_remove_netdev(struct wl_priv *wl)
 	debugfs_remove_recursive(wl->debugfsdir);
 	wl->debugfsdir = NULL;
 }
+
+static __used void wl_dongle_poweron(struct wl_priv *wl)
+{
+	struct net_device *ndev = wl_to_ndev(wl);
+
+	dhd_customer_gpio_wlan_ctrl(WLAN_RESET_ON);
+
+#if defined(BCMLXSDMMC)
+	sdioh_start(NULL, 0);
+#endif
+	dhd_dev_reset(ndev, 0);
+#if defined(BCMLXSDMMC)
+	sdioh_start(NULL, 1);
+#endif
+	dhd_dev_init_ioctl(ndev);
+	wl_cfg80211_resume(wl_to_wiphy(wl));
+}
+
+static __used void wl_dongle_poweroff(struct wl_priv *wl)
+{
+	struct net_device *ndev = wl_to_ndev(wl);
+
+	wl_cfg80211_suspend(wl_to_wiphy(wl));
+	dhd_dev_reset(ndev, 1);
+
+#if defined(BCMLXSDMMC)
+	sdioh_stop(NULL);
+#endif
+	/* clean up dtim_skip setting */
+	net_os_set_dtim_skip(ndev, 0);
+	dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF);
+}
-- 
1.7.0.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux