net: wireless: bcmdhd: Update wifi stack ps state if was changed
authorDmitry Shmidt <dimitrysh@google.com>
Sun, 16 Sep 2012 21:35:23 +0000 (14:35 -0700)
committerDmitry Shmidt <dimitrysh@google.com>
Mon, 17 Sep 2012 18:36:29 +0000 (11:36 -0700)
Change-Id: Ib1ee0b6ee05077d1ed6cfb578b6384dfc9787c81
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Conflicts:

drivers/net/wireless/bcmdhd/wl_cfg80211.h

drivers/net/wireless/bcmdhd/dhd_linux.c
drivers/net/wireless/bcmdhd/wl_cfg80211.c
drivers/net/wireless/bcmdhd/wl_cfg80211.h
drivers/net/wireless/bcmdhd/wl_cfgp2p.c

index a189d6383246c51ae5f9b90acd4e94d26db73f34..4570ace3e714231eebe2f698a88076e0b358bc2d 100644 (file)
@@ -4380,6 +4380,9 @@ int net_os_set_suspend(struct net_device *dev, int val, int force)
                ret = dhd_set_suspend(val, &dhd->pub);
 #else
                ret = dhd_suspend_resume_helper(dhd, val, force);
+#endif
+#ifdef WL_CFG80211
+               wl_cfg80211_update_power_mode(dev);
 #endif
        }
        return ret;
index ea6aedd0df6f820c3884099c740348536d528d2b..5abe2b3b3dd39f4acc9dc7cd782aa4af2d190521 100644 (file)
@@ -3067,6 +3067,23 @@ get_station_err:
        return err;
 }
 
+int wl_cfg80211_update_power_mode(struct net_device *dev)
+{
+       int pm = -1;
+       int err;
+
+       err = wldev_ioctl(dev, WLC_GET_PM, &pm, sizeof(pm), false);
+       if (err || (pm == -1)) {
+               WL_ERR(("error (%d)\n", err));
+       } else {
+               pm = (pm == PM_OFF) ? false : true;
+               WL_DBG(("%s: %d\n", __func__, pm));
+               if (dev->ieee80211_ptr)
+                       dev->ieee80211_ptr->ps = pm;
+       }
+       return err;
+}
+
 static s32
 wl_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
        bool enabled, s32 timeout)
index 888696895f2e01e198483e434bd549b52284c407..39832a568cc45b4b6f5432fc1f3722d38b1e05e3 100644 (file)
@@ -686,4 +686,5 @@ int wl_cfg80211_do_driver_init(struct net_device *net);
 void wl_cfg80211_enable_trace(int level);
 extern s32 wl_update_wiphybands(struct wl_priv *wl);
 extern s32 wl_cfg80211_if_is_group_owner(void);
+extern int wl_cfg80211_update_power_mode(struct net_device *dev);
 #endif                         /* _wl_cfg80211_h_ */
index f06ae50b12ab58690f6a3a981a3d36958663d0e2..7bcd14486dd938dd7b4eb20698bcb360a0d0bb24 100644 (file)
@@ -1755,6 +1755,8 @@ wl_cfgp2p_set_p2p_ps(struct wl_priv *wl, struct net_device *ndev, char* buf, int
                                WLC_SET_PM, &pm, sizeof(pm), true);
                        if (unlikely(ret)) {
                                CFGP2P_ERR(("error (%d)\n", ret));
+                       } else {
+                               wl_cfg80211_update_power_mode(ndev);
                        }
                }
        }