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

Commit b85f3255 authored by Rajeev Kumar Sirasanagandla's avatar Rajeev Kumar Sirasanagandla
Browse files

ath: Disable non-20 mhz 2G world regulatory channels



The minimum bandwidth supported is 5 MHZ. Kernel API
wiphy_apply_custom_regulatory can enable channels 12/13
with BW 5/10 even for reg rule 2402-2472. Circumvent the issue
by doing a check in the driver.

CRs-Fixed: 2136273
Change-Id: I296e45d142c38a83c90deb743e992eb1a7743feb
Signed-off-by: default avatarRajeev Kumar Sirasanagandla <rsirasan@codeaurora.org>
parent 9c23726a
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -631,6 +631,8 @@ ath_regd_init_wiphy(struct ath_regulatory *reg,
					 struct regulatory_request *request))
{
	const struct ieee80211_regdomain *regd;
	u32 chan_num;
	struct ieee80211_channel *chan;

	wiphy->reg_notifier = reg_notifier;
	wiphy->regulatory_flags |= REGULATORY_STRICT_REG |
@@ -653,6 +655,20 @@ ath_regd_init_wiphy(struct ath_regulatory *reg,
	}

	wiphy_apply_custom_regulatory(wiphy, regd);

	/* For regulatory rules similar to the following:
	 * REG_RULE(2412-10, 2462+10, 40, 0, 20, 0), channels 12/13 are enabled
	 * due to support of 5/10 MHz.
	 * Therefore, disable 2.4 Ghz channels that dont have 20 mhz bw
	 */
	for (chan_num = 0;
	     chan_num < wiphy->bands[IEEE80211_BAND_2GHZ]->n_channels;
	     chan_num++) {
		chan = &wiphy->bands[IEEE80211_BAND_2GHZ]->channels[chan_num];
		if (chan->flags & IEEE80211_CHAN_NO_20MHZ)
			chan->flags |= IEEE80211_CHAN_DISABLED;
	}

	ath_reg_apply_radar_flags(wiphy);
	ath_reg_apply_world_flags(wiphy, NL80211_REGDOM_SET_BY_DRIVER, reg);
	return 0;