Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 67b3bd4e authored by Arend van Spriel's avatar Arend van Spriel Committed by John W. Linville
Browse files

brcmfmac: fallback to mimo_bw_cap for older firmwares



In order to support the driver behaviour introduced by:

   commit d0575a5a703978c43e25128421158c78534ba100
   Author: Daniel Kim <dekim@broadcom.com>
   Date:   Wed Mar 12 18:12:14 2014 -0700

       brcmfmac: Enable 40MHz bandwidth in 2GHz band and OBSS scanning

in devices that do not support bwcap firmware command a fallback
is added.

Reviewed-by: default avatarDaniel (Deognyoun) Kim <dekim@broadcom.com>
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 4d1a4f16
Loading
Loading
Loading
Loading
+18 −8
Original line number Diff line number Diff line
@@ -4930,16 +4930,27 @@ static void init_vif_event(struct brcmf_cfg80211_vif_event *event)
	mutex_init(&event->vif_event_lock);
}

static int brcmf_set_bwcap(struct brcmf_if *ifp, u32 band, u32 bw_cap)
static int brcmf_enable_bw40_2g(struct brcmf_if *ifp)
{
	struct brcmf_fil_bwcap_le band_bwcap;
	u32 val;
	int err;

	band_bwcap.band = cpu_to_le32(band);
	band_bwcap.bw_cap = cpu_to_le32(bw_cap);
	/* verify support for bw_cap command */
	val = WLC_BAND_5G;
	err = brcmf_fil_iovar_int_get(ifp, "bw_cap", &val);

	if (!err) {
		/* only set 2G bandwidth using bw_cap command */
		band_bwcap.band = cpu_to_le32(WLC_BAND_2G);
		band_bwcap.bw_cap = cpu_to_le32(WLC_BW_40MHZ_BIT);
		err = brcmf_fil_iovar_data_set(ifp, "bw_cap", &band_bwcap,
					       sizeof(band_bwcap));

	} else {
		brcmf_dbg(INFO, "fallback to mimo_bw_cap\n");
		val = WLC_N_BW_40ALL;
		err = brcmf_fil_iovar_int_set(ifp, "mimo_bw_cap", val);
	}
	return err;
}

@@ -5005,12 +5016,11 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
	 */
	if (wiphy->bands[IEEE80211_BAND_2GHZ]->ht_cap.cap &
	    IEEE80211_HT_CAP_SUP_WIDTH_20_40) {
		err = brcmf_set_bwcap(ifp, WLC_BAND_2G, WLC_BW_CAP_40MHZ);
		if (!err) {
		err = brcmf_enable_bw40_2g(ifp);
		if (!err)
			err = brcmf_fil_iovar_int_set(ifp, "obss_coex",
						      BRCMF_OBSS_COEX_AUTO);
	}
	}

	err = brcmf_fil_iovar_int_set(ifp, "tdls_enable", 1);
	if (err) {