diff mbox

[RFC,7/8] b43: Allow HWPS state to be changed

Message ID 1387231260-2849-8-git-send-email-seth.forshee@canonical.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Seth Forshee Dec. 16, 2013, 10 p.m. UTC
During background scans mac80211 wants to set powersave at the AP
so that frames will be buffered while off-channel. In order to do
this on Broadcom chips B43_MACCTL_HWPS needs to be set when
transmitting the nullfunc frames to enable powersave, however
b43_power_saving_ctl_bits() doesn't allow it to be set.

Rework this function a bit to allow setting HWPS. First,
initialize the hwps and awake variables based off the macctl
register to avoid changing the unintentionally changing the
values. It's not really necessary to set awake since it is later
forced to true, but it does no harm and might help avoid future
problems.

Second, remove the force set of hwps to false. No code currently tries
to change the hwps state anyway, so this results in no functional
change.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
---
 drivers/net/wireless/b43/main.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index ccd24f0a..bc6ba1c 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -1117,6 +1117,10 @@  void b43_power_saving_ctl_bits(struct b43_wldev *dev, unsigned int ps_flags)
 		    (ps_flags & B43_PS_DISABLED));
 	B43_WARN_ON((ps_flags & B43_PS_AWAKE) && (ps_flags & B43_PS_ASLEEP));
 
+	macctl = b43_read32(dev, B43_MMIO_MACCTL);
+	hwps = !!(macctl & B43_MACCTL_HWPS);
+	awake = !!(macctl & B43_MACCTL_AWAKE);
+
 	if (ps_flags & B43_PS_ENABLED) {
 		hwps = true;
 	} else if (ps_flags & B43_PS_DISABLED) {
@@ -1135,11 +1139,9 @@  void b43_power_saving_ctl_bits(struct b43_wldev *dev, unsigned int ps_flags)
 		//      successful, set bit26
 	}
 
-/* FIXME: For now we force awake-on and hwps-off */
-	hwps = false;
+/* FIXME: For now we force awake-on */
 	awake = true;
 
-	macctl = b43_read32(dev, B43_MMIO_MACCTL);
 	if (hwps)
 		macctl |= B43_MACCTL_HWPS;
 	else