linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Arend van Spriel" <arend@broadcom.com>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org,
	"Roland Vossen" <rvossen@broadcom.com>,
	"Arend van Spriel" <arend@broadcom.com>
Subject: [PATCH v2 03/17] brcm80211: smac: removed MPC related code
Date: Fri, 21 Oct 2011 16:16:21 +0200	[thread overview]
Message-ID: <1319206595-17138-4-git-send-email-arend@broadcom.com> (raw)
In-Reply-To: <1319206595-17138-1-git-send-email-arend@broadcom.com>

From: Roland Vossen <rvossen@broadcom.com>

The chip init sequence enables MPC (Minimum Power Consumption), but the
driver disables it after that. As there are no interfaces to enable this
mode the related code is unused (member variable wlc->mpc is false).

Reviewed-by: Alwin Beukers <alwin@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 .../net/wireless/brcm80211/brcmsmac/mac80211_if.c  |    2 +-
 drivers/net/wireless/brcm80211/brcmsmac/main.c     |   70 ++------------------
 drivers/net/wireless/brcm80211/brcmsmac/main.h     |    2 -
 drivers/net/wireless/brcm80211/brcmsmac/pub.h      |    2 +-
 4 files changed, 8 insertions(+), 68 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
index 7a24a83..1781157 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
@@ -1079,7 +1079,7 @@ static struct brcms_info *brcms_attach(u16 vendor, u16 device,
 	wl->pub->ieee_hw = hw;
 
 	/* disable mpc */
-	brcms_c_set_radio_mpc(wl->wlc, false);
+	brcms_c_set_radio_mpc(wl->wlc);
 
 	/* register our interrupt handler */
 	if (request_irq(irq, brcms_isr, IRQF_SHARED, KBUILD_MODNAME, wl)) {
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
index 4f1d6e4..4687983 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
@@ -419,20 +419,6 @@ static int brcms_chspec_bw(u16 chanspec)
 	return BRCMS_10_MHZ;
 }
 
-/*
- * return true if Minimum Power Consumption should
- * be entered, false otherwise
- */
-static bool brcms_c_is_non_delay_mpc(struct brcms_c_info *wlc)
-{
-	return false;
-}
-
-static bool brcms_c_ismpc(struct brcms_c_info *wlc)
-{
-	return (wlc->mpc_delay_off == 0) && (brcms_c_is_non_delay_mpc(wlc));
-}
-
 static void brcms_c_bsscfg_mfree(struct brcms_bss_cfg *cfg)
 {
 	if (cfg == NULL)
@@ -4350,56 +4336,18 @@ static void brcms_b_watchdog(void *arg)
 
 static void brcms_c_radio_mpc_upd(struct brcms_c_info *wlc)
 {
-	bool mpc_radio, radio_state;
-
 	/*
 	 * Clear the WL_RADIO_MPC_DISABLE bit when mpc feature is disabled
 	 * in case the WL_RADIO_MPC_DISABLE bit was set. Stop the radio
 	 * monitor also when WL_RADIO_MPC_DISABLE is the only reason that
 	 * the radio is going down.
 	 */
-	if (!wlc->mpc) {
-		if (!wlc->pub->radio_disabled)
-			return;
-		mboolclr(wlc->pub->radio_disabled, WL_RADIO_MPC_DISABLE);
-		brcms_c_radio_upd(wlc);
-		if (!wlc->pub->radio_disabled)
-			brcms_c_radio_monitor_stop(wlc);
+	if (!wlc->pub->radio_disabled)
 		return;
-	}
-
-	/*
-	 * sync ismpc logic with WL_RADIO_MPC_DISABLE bit in
-	 * wlc->pub->radio_disabled to go ON, always call radio_upd
-	 * synchronously to go OFF, postpone radio_upd to later when
-	 * context is safe(e.g. watchdog)
-	 */
-	radio_state =
-	    (mboolisset(wlc->pub->radio_disabled, WL_RADIO_MPC_DISABLE) ? OFF :
-	     ON);
-	mpc_radio = (brcms_c_ismpc(wlc) == true) ? OFF : ON;
-
-	if (radio_state == ON && mpc_radio == OFF)
-		wlc->mpc_delay_off = wlc->mpc_dlycnt;
-	else if (radio_state == OFF && mpc_radio == ON) {
-		mboolclr(wlc->pub->radio_disabled, WL_RADIO_MPC_DISABLE);
-		brcms_c_radio_upd(wlc);
-		if (wlc->mpc_offcnt < BRCMS_MPC_THRESHOLD)
-			wlc->mpc_dlycnt = BRCMS_MPC_MAX_DELAYCNT;
-		else
-			wlc->mpc_dlycnt = BRCMS_MPC_MIN_DELAYCNT;
-	}
-	/*
-	 * Below logic is meant to capture the transition from mpc off
-	 * to mpc on for reasons other than wlc->mpc_delay_off keeping
-	 * the mpc off. In that case reset wlc->mpc_delay_off to
-	 * wlc->mpc_dlycnt, so that we restart the countdown of mpc_delay_off
-	 */
-	if ((wlc->prev_non_delay_mpc == false) &&
-	    (brcms_c_is_non_delay_mpc(wlc) == true) && wlc->mpc_delay_off)
-		wlc->mpc_delay_off = wlc->mpc_dlycnt;
-
-	wlc->prev_non_delay_mpc = brcms_c_is_non_delay_mpc(wlc);
+	mboolclr(wlc->pub->radio_disabled, WL_RADIO_MPC_DISABLE);
+	brcms_c_radio_upd(wlc);
+	if (!wlc->pub->radio_disabled)
+		brcms_c_radio_monitor_stop(wlc);
 }
 
 /* common watchdog code */
@@ -4427,8 +4375,6 @@ static void brcms_c_watchdog(void *arg)
 		if (--wlc->mpc_delay_off == 0) {
 			mboolset(wlc->pub->radio_disabled,
 				 WL_RADIO_MPC_DISABLE);
-			if (wlc->mpc && brcms_c_ismpc(wlc))
-				wlc->mpc_offcnt = 0;
 		}
 	}
 
@@ -5200,9 +5146,6 @@ static void brcms_c_ap_upd(struct brcms_c_info *wlc)
 {
 	/* STA-BSS; short capable */
 	wlc->PLCPHdr_override = BRCMS_PLCP_SHORT;
-
-	/* fixup mpc */
-	wlc->mpc = true;
 }
 
 /* Initialize just the hardware when coming out of POR or S3/S5 system states */
@@ -8192,9 +8135,8 @@ int brcms_c_get_tx_power(struct brcms_c_info *wlc)
 	return (int)(qdbm / BRCMS_TXPWR_DB_FACTOR);
 }
 
-void brcms_c_set_radio_mpc(struct brcms_c_info *wlc, bool mpc)
+void brcms_c_set_radio_mpc(struct brcms_c_info *wlc)
 {
-	wlc->mpc = mpc;
 	brcms_c_radio_mpc_upd(wlc);
 }
 
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.h b/drivers/net/wireless/brcm80211/brcmsmac/main.h
index c0e0fcf..37c55fd 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.h
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.h
@@ -427,7 +427,6 @@ struct brcms_txq_info {
  * bandinit_pending: track band init in auto band.
  * radio_monitor: radio timer is running.
  * going_down: down path intermediate variable.
- * mpc: enable minimum power consumption.
  * mpc_dlycnt: # of watchdog cnt before turn disable radio.
  * mpc_offcnt: # of watchdog cnt that radio is disabled.
  * mpc_delay_off: delay radio disable by # of watchdog cnt.
@@ -522,7 +521,6 @@ struct brcms_c_info {
 	bool radio_monitor;
 	bool going_down;
 
-	bool mpc;
 	u8 mpc_dlycnt;
 	u8 mpc_offcnt;
 	u8 mpc_delay_off;
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/pub.h b/drivers/net/wireless/brcm80211/brcmsmac/pub.h
index d20116a..2e09216 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/pub.h
+++ b/drivers/net/wireless/brcm80211/brcmsmac/pub.h
@@ -596,7 +596,7 @@ extern void brcms_c_set_beacon_listen_interval(struct brcms_c_info *wlc,
 					u8 interval);
 extern int brcms_c_set_tx_power(struct brcms_c_info *wlc, int txpwr);
 extern int brcms_c_get_tx_power(struct brcms_c_info *wlc);
-extern void brcms_c_set_radio_mpc(struct brcms_c_info *wlc, bool mpc);
+extern void brcms_c_set_radio_mpc(struct brcms_c_info *wlc);
 extern bool brcms_c_check_radio_disabled(struct brcms_c_info *wlc);
 
 #endif				/* _BRCM_PUB_H_ */
-- 
1.7.4.1



  parent reply	other threads:[~2011-10-21 14:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-21 14:16 [PATCH v2 00/17] fix mac80211 callback in brcmsmac and brcmfmac refactor Arend van Spriel
2011-10-21 14:16 ` [PATCH v2 01/17] brcm80211: fmac: allow wd timer to be disabled when bus down Arend van Spriel
2011-10-21 14:16 ` [PATCH v2 02/17] brcm80211: fmac: use brcmf_del_if for all net devices Arend van Spriel
2011-10-21 14:16 ` Arend van Spriel [this message]
2011-10-21 14:16 ` [PATCH v2 04/17] brcm80211: smac: removed MPC related variables Arend van Spriel
2011-10-21 14:16 ` [PATCH v2 05/17] brcm80211: smac: removed down-on-watchdog MPC functionality Arend van Spriel
2011-10-21 14:16 ` [PATCH v2 06/17] brcm80211: smac: removed down-on-rf-kill functionality Arend van Spriel
2011-10-21 14:16 ` [PATCH v2 07/17] brcm80211: smac: bugfix for tx mute in brcms_b_init() Arend van Spriel
2011-10-21 14:16 ` [PATCH v2 08/17] brcm80211: smac: fixed inconsistency in transmit mute Arend van Spriel
2011-10-21 14:16 ` [PATCH v2 09/17] brcm80211: smac: modified Mac80211 callback interface Arend van Spriel
2011-10-21 14:16 ` [PATCH v2 10/17] brcm80211: smac: mute transmit on ops_start Arend van Spriel
2011-10-21 14:16 ` [PATCH v2 11/17] brcm80211: smac: changed check to confirm STA only support Arend van Spriel
2011-10-21 14:16 ` [PATCH v2 12/17] brcm80211: smac: rename buffer endianess conversion functions Arend van Spriel
2011-10-21 14:16 ` [PATCH v2 13/17] brcm80211: smac: use sk_buff list for handling frames in receive path Arend van Spriel
2011-10-21 14:16 ` [PATCH v2 14/17] brcm80211: fmac: use brcmf_add_if for all net devices Arend van Spriel
2011-10-21 14:16 ` [PATCH v2 15/17] brcm80211: fmac: store brcmf_if in net device private data Arend van Spriel
2011-10-21 14:16 ` [PATCH v2 16/17] brcm80211: fmac: remove state from brcmf_if in fullmac Arend van Spriel
2011-10-21 14:16 ` [PATCH v2 17/17] brcm80211: smac: change buffer endianess convert function interface Arend van Spriel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1319206595-17138-4-git-send-email-arend@broadcom.com \
    --to=arend@broadcom.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=rvossen@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).