From: Himani Gupta Date: Tue, 12 Mar 2019 11:07:33 +0000 (+0530) Subject: [NEUS7920-133][9610][7885][7872][7570] wlbt: Disable ch12/13,when cellular is off. X-Git-Tag: MMI-QSAS30.62-33-3~969 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cfe11a24abab824c48a53c74486eaf03841fcf7c;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git [NEUS7920-133][9610][7885][7872][7570] wlbt: Disable ch12/13,when cellular is off. Driver shall disable ch 12/13 when cellular is off on receiving GETREGULATORY 0. Change-Id: Iee0e32e2d9b629344e6ac24e89da78c2efc5c9d2 SCSC-Bug-Id: SSB-50468 Signed-off-by: Himani Gupta --- diff --git a/drivers/net/wireless/scsc/dev.h b/drivers/net/wireless/scsc/dev.h index f23fd9f65a86..c63b43dbf369 100755 --- a/drivers/net/wireless/scsc/dev.h +++ b/drivers/net/wireless/scsc/dev.h @@ -847,6 +847,7 @@ struct slsi_dev_config { int rssi_boost_5g; int rssi_boost_2g; + bool disable_ch12_ch13; }; #define SLSI_DEVICE_STATE_ATTACHING 0 diff --git a/drivers/net/wireless/scsc/ioctl.c b/drivers/net/wireless/scsc/ioctl.c index d842fe4c673c..2466a4d050d1 100755 --- a/drivers/net/wireless/scsc/ioctl.c +++ b/drivers/net/wireless/scsc/ioctl.c @@ -1922,6 +1922,9 @@ static int slsi_get_supported_channels(struct slsi_dev *sdev, struct net_device chan_count = supported_chan_mib.data[i*2 + 1]; if (chan_start == 1) { /* for 2.4GHz */ supported_channels[supp_chan_length].start_chan_num = 1; + if (!(sdev->device_config.host_state & FAPI_HOSTSTATE_CELLULAR_ACTIVE) && + chan_count > 11 && sdev->device_config.disable_ch12_ch13) + chan_count = 11; supported_channels[supp_chan_length].channel_count = chan_count; supported_channels[supp_chan_length].increment = 1; supported_channels[supp_chan_length].band = NL80211_BAND_2GHZ; @@ -2010,6 +2013,19 @@ static int slsi_get_regulatory(struct net_device *dev, char *buf, int buf_len) return -ENOMEM; } +void slsi_disable_ch12_13(struct slsi_dev *sdev) +{ + struct wiphy *wiphy = sdev->wiphy; + struct ieee80211_channel *chan; + + if (wiphy->bands[0]) { + chan = &wiphy->bands[0]->channels[11]; + chan->flags |= IEEE80211_CHAN_DISABLED; + chan = &wiphy->bands[0]->channels[12]; + chan->flags |= IEEE80211_CHAN_DISABLED; + } +} + int slsi_set_fcc_channel(struct net_device *dev, char *cmd, int cmd_len) { struct netdev_vif *ndev_vif = netdev_priv(dev); @@ -2045,6 +2061,8 @@ int slsi_set_fcc_channel(struct net_device *dev, char *cmd, int cmd_len) slsi_reset_channel_flags(sdev); wiphy_apply_custom_regulatory(sdev->wiphy, sdev->device_config.domain_info.regdomain); slsi_update_supported_channels_regd_flags(sdev); + if (flight_mode_ena && sdev->device_config.disable_ch12_ch13) + slsi_disable_ch12_13(sdev); } } } diff --git a/drivers/net/wireless/scsc/mgt.c b/drivers/net/wireless/scsc/mgt.c index 1973eed4e6b2..b55c129480d3 100755 --- a/drivers/net/wireless/scsc/mgt.c +++ b/drivers/net/wireless/scsc/mgt.c @@ -1264,8 +1264,9 @@ static int slsi_mib_initial_get(struct slsi_dev *sdev) { SLSI_PSID_UNIFI_MAX_CLIENT, {0, 0} }, #endif #ifdef CONFIG_SCSC_WLAN_ENABLE_MAC_RANDOMISATION - { SLSI_PSID_UNIFI_MAC_ADDRESS_RANDOMISATION_ACTIVATED, {0, 0} } + { SLSI_PSID_UNIFI_MAC_ADDRESS_RANDOMISATION_ACTIVATED, {0, 0} }, #endif + { SLSI_PSID_UNIFI_DEFAULT_COUNTRY_WITHOUT_CH12_CH13, {0, 0} } };/*Check the mibrsp.dataLength when a new mib is added*/ /* 40 MHz bandwidth is not supported in 2.4 GHz in AP/GO Mode Currently. @@ -1276,7 +1277,7 @@ static int slsi_mib_initial_get(struct slsi_dev *sdev) if (r != SLSI_MIB_STATUS_SUCCESS) return -ENOMEM; - mibrsp.dataLength = 164; + mibrsp.dataLength = 174; mibrsp.data = kmalloc(mibrsp.dataLength, GFP_KERNEL); if (!mibrsp.data) { kfree(mibreq.data); @@ -1423,6 +1424,11 @@ static int slsi_mib_initial_get(struct slsi_dev *sdev) else SLSI_WARN(sdev, "Error reading Mac Randomization Support\n"); #endif + if (values[++mib_index].type != SLSI_MIB_TYPE_NONE) /* Disable ch12/ch13 */ + sdev->device_config.disable_ch12_ch13 = values[mib_index].u.boolValue; + else + SLSI_WARN(sdev, "Error reading default country without ch12/13 mib\n"); + kfree(values); } kfree(mibrsp.data);