From 128f9e9e1cd275f13bcb71751c97e0a429bce9a5 Mon Sep 17 00:00:00 2001 From: Zhao Xuewen <zhaoxuewen@huawei.com> Date: Fri, 12 Jun 2015 20:56:22 -0700 Subject: [PATCH] driver:wlan: wifi rssi adjust Because of path loss of hardware,the returned rssi value of wifi is not exactly. To ensure the signal strength returned to framwork and application is exactly. the rssi value need to be adjusted. rssi value below -50dbm, adjust +4db. rssi value above -50dbm, adjust +2db. Change-Id: I7f390b1fe99bb06f481a82659dc9bdd205810bfd Signed-off-by: Zheng Guolin <zhengguolin@huawei.com> --- drivers/net/wireless/bcmdhd/dhd_linux.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/net/wireless/bcmdhd/dhd_linux.c b/drivers/net/wireless/bcmdhd/dhd_linux.c index a731a535cac1..dcc8704f3f6b 100644 --- a/drivers/net/wireless/bcmdhd/dhd_linux.c +++ b/drivers/net/wireless/bcmdhd/dhd_linux.c @@ -152,6 +152,7 @@ extern bool ap_fw_loaded; /* enable HOSTIP cache update from the host side when an eth0:N is up */ #define AOE_IP_ALIAS_SUPPORT 1 +#define RSSI_ADJUST_THRESHOLD -50 /* rssi threshold to be adjust */ #ifdef BCM_FD_AGGR #include <bcm_rpc.h> @@ -3624,6 +3625,7 @@ dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd) int ret; void *local_buf = NULL; u16 buflen = 0; + scb_val_t *scb_val = NULL; DHD_OS_WAKE_LOCK(&dhd->pub); DHD_PERIM_LOCK(&dhd->pub); @@ -3752,6 +3754,18 @@ dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd) if (!bcmerror && buflen && local_buf && ioc.buf) { DHD_PERIM_UNLOCK(&dhd->pub); + if(WLC_GET_RSSI == ioc.cmd) + { + scb_val = (scb_val_t *)local_buf; + if (scb_val->val <= RSSI_ADJUST_THRESHOLD) + { + scb_val->val += 4; /* rssi adjust: below -50dbm adjust 4dbm */ + } + else + { + scb_val->val += 2; /* rssi adjust: above -50dbm adjust 2dbm */ + } + } if (copy_to_user(ioc.buf, local_buf, buflen)) bcmerror = -EFAULT; DHD_PERIM_LOCK(&dhd->pub); -- GitLab