summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinrui Sun <xinrui.sun@broadcom.corp-partner.google.com>2020-05-27 13:44:23 +0800
committerAhmed ElArabawy <arabawy@google.com>2020-06-09 18:01:52 -0700
commit34dcec1b37bff1b08823d99495f69b2288e743b5 (patch)
treeaad1e3c8adbab7270429f78ba45fceb8a7008a13
parentc01ed19990a68a8cc79880537097b1b533861dab (diff)
downloadbcm43752-34dcec1b37bff1b08823d99495f69b2288e743b5.tar.gz
bcmdhd: Support SAR
Support SAR scenario for HEAD, GRIP and BT Support 5G sub-band Support regulatory BUG: 153199259 Change-Id: I1e6d25aa93cbe843dc5680d150b1adae36cc777c Signed-off-by: Ahmed ElArabawy <arabawy@google.com>
-rwxr-xr-xKbuild2
-rw-r--r--wl_cfg80211.h20
-rw-r--r--wl_cfgvendor.c47
3 files changed, 54 insertions, 15 deletions
diff --git a/Kbuild b/Kbuild
index 43138ed..7d81cfe 100755
--- a/Kbuild
+++ b/Kbuild
@@ -534,7 +534,7 @@ DHDCFLAGS += -DDUAL_ESCAN_RESULT_BUFFER
DHDCFLAGS += -DWL_NAN -DWL_NAN_DISC_CACHE -DWL_NANP2P -DWL_NAN_ENABLE_MERGE
# SAR tx power scenario
-#DHDCFLAGS += -DWL_SAR_TX_POWER
+DHDCFLAGS += -DWL_SAR_TX_POWER
# OWE
DHDCFLAGS += -DWL_OWE
diff --git a/wl_cfg80211.h b/wl_cfg80211.h
index 544a98c..3934b3a 100644
--- a/wl_cfg80211.h
+++ b/wl_cfg80211.h
@@ -1305,6 +1305,26 @@ typedef enum
NR_Sub6_SAR_BACKOFF_ENABLE,
SAR_BACKOFF_DISABLE_ALL
} sar_modes;
+typedef enum
+{
+ SAR_DISABLE = 0,
+ SAR_HEAD,
+ SAR_GRIP,
+ SAR_HEAD_GRIP,
+ SAR_NR_mW_ONLY,
+ SAR_NR_mW_HEAD,
+ SAR_NR_mW_GRIP,
+ SAR_NR_mW_HEAD_GRIP,
+ SAR_NR_SUB6_ONLY,
+ SAR_NR_SUB6_HEAD,
+ SAR_NR_SUB6_GRIP,
+ SAR_NR_SUB6_HEAD_GRIP,
+ SAR_NR_SUB6_mW_INVALID1,
+ SAR_NR_SUB6_mW_INVALID2,
+ SAR_NR_SUB6_mW_INVALID3,
+ SAR_NR_SUB6_mW_INVALID4,
+ SAR_BT = 16,
+} sar_advance_modes;
/* Pre selected Power scenarios to be applied from BDF file */
typedef enum
diff --git a/wl_cfgvendor.c b/wl_cfgvendor.c
index d027fed..7f691db 100644
--- a/wl_cfgvendor.c
+++ b/wl_cfgvendor.c
@@ -8584,12 +8584,13 @@ wl_cfgvendor_tx_power_scenario(struct wiphy *wiphy,
wifi_power_scenario wifi_tx_power_mode = WIFI_POWER_SCENARIO_INVALID;
struct bcm_cfg80211 *cfg = wl_get_cfg(wdev_to_ndev(wdev));
const struct nlattr *iter;
- s8 sar_tx_power_val = WIFI_POWER_SCENARIO_INVALID;
+ sar_advance_modes sar_tx_power_val = SAR_DISABLE;
+ int airplane_mode = 0;
nla_for_each_attr(iter, data, len, rem) {
type = nla_type(iter);
if (type == ANDR_WIFI_ATTRIBUTE_TX_POWER_SCENARIO) {
- sar_tx_power_val = nla_get_s8(iter);
+ wifi_tx_power_mode = nla_get_s8(iter);
} else {
WL_ERR(("Unknown attr type: %d\n", type));
err = -EINVAL;
@@ -8597,33 +8598,45 @@ wl_cfgvendor_tx_power_scenario(struct wiphy *wiphy,
}
}
/* If sar tx power is already configured, no need to set it again */
- if (cfg->wifi_tx_power_mode == sar_tx_power_val) {
+ if (cfg->wifi_tx_power_mode == wifi_tx_power_mode) {
WL_INFORM_MEM(("%s, tx_power_mode %d is already set\n",
- __FUNCTION__, sar_tx_power_val));
+ __FUNCTION__, wifi_tx_power_mode));
err = BCME_OK;
goto exit;
}
/* Map Android TX power modes to Brcm power mode */
- switch (sar_tx_power_val) {
+ switch (wifi_tx_power_mode) {
case WIFI_POWER_SCENARIO_VOICE_CALL:
case WIFI_POWER_SCENARIO_DEFAULT:
- wifi_tx_power_mode = HEAD_SAR_BACKOFF_ENABLE;
+ /* SAR disabled */
+ sar_tx_power_val = SAR_DISABLE;
+ airplane_mode = 0;
break;
case WIFI_POWER_SCENARIO_ON_HEAD_CELL_OFF:
- wifi_tx_power_mode = GRIP_SAR_BACKOFF_DISABLE;
+ /* HEAD mode, Airplane */
+ sar_tx_power_val = SAR_HEAD;
+ airplane_mode = 1;
break;
case WIFI_POWER_SCENARIO_ON_BODY_CELL_OFF:
- wifi_tx_power_mode = GRIP_SAR_BACKOFF_ENABLE;
+ /* GRIP mode, Airplane */
+ sar_tx_power_val = SAR_GRIP;
+ airplane_mode = 1;
break;
case WIFI_POWER_SCENARIO_ON_BODY_BT:
- wifi_tx_power_mode = NR_mmWave_SAR_BACKOFF_ENABLE;
+ /* BT mode, Airplane */
+ sar_tx_power_val = SAR_BT;
+ airplane_mode = 1;
break;
case WIFI_POWER_SCENARIO_ON_HEAD_CELL_ON:
- wifi_tx_power_mode = NR_Sub6_SAR_BACKOFF_DISABLE;
+ /* HEAD mode, Normal */
+ sar_tx_power_val = SAR_HEAD;
+ airplane_mode = 0;
break;
case WIFI_POWER_SCENARIO_ON_BODY_CELL_ON:
- wifi_tx_power_mode = NR_Sub6_SAR_BACKOFF_ENABLE;
+ /* GRIP mode, Normal */
+ sar_tx_power_val = SAR_GRIP;
+ airplane_mode = 0;
break;
default:
WL_ERR(("invalid wifi tx power scenario = %d\n",
@@ -8632,14 +8645,20 @@ wl_cfgvendor_tx_power_scenario(struct wiphy *wiphy,
goto exit;
}
- WL_DBG(("%s, tx_power_mode %d\n", __FUNCTION__, wifi_tx_power_mode));
- err = wldev_iovar_setint(wdev_to_ndev(wdev), "sar_enable", wifi_tx_power_mode);
+ WL_DBG(("%s, sar_mode %d airplane_mode %d\n", __FUNCTION__,
+ sar_tx_power_val, airplane_mode));
+ err = wldev_iovar_setint(wdev_to_ndev(wdev), "fccpwrlimit2g", airplane_mode);
+ if (unlikely(err)) {
+ WL_ERR(("%s: Failed to set airplane_mode - error (%d)\n", __FUNCTION__, err));
+ goto exit;
+ }
+ err = wldev_iovar_setint(wdev_to_ndev(wdev), "sar_enable", sar_tx_power_val);
if (unlikely(err)) {
WL_ERR(("%s: Failed to set sar_enable - error (%d)\n", __FUNCTION__, err));
goto exit;
}
/* Cache the tx power mode sent by the hal */
- cfg->wifi_tx_power_mode = sar_tx_power_val;
+ cfg->wifi_tx_power_mode = wifi_tx_power_mode;
exit:
return err;
}