qcacmn: Add host support for db2dbm RSSI changes

Add host support for db2dbm RSSI changes. Firmware
indicates this capability when underlying hardware
has RSSI reporting feature. Based on this capability
host will know if firmware sends SNR or RSSI. If no
capablity is present then host will convert SNR to
rssi using a fixed offset of -96. If capability is
present host will directly use the rssi as it is.

Change-Id: I9058f16c6280d466feb96cf88a8a0d8cd7b02032
CRs-Fixed: 2364025
diff --git a/umac/scan/dispatcher/src/wlan_scan_utils_api.c b/umac/scan/dispatcher/src/wlan_scan_utils_api.c
index d99dd1f..b3b0152 100644
--- a/umac/scan/dispatcher/src/wlan_scan_utils_api.c
+++ b/umac/scan/dispatcher/src/wlan_scan_utils_api.c
@@ -985,6 +985,7 @@
 	struct scan_cache_entry *scan_entry;
 	struct qbss_load_ie *qbss_load;
 	struct scan_cache_node *scan_node;
+	uint8_t i;
 
 	scan_entry = qdf_mem_malloc_atomic(sizeof(*scan_entry));
 	if (!scan_entry) {
@@ -1020,9 +1021,22 @@
 	scan_entry->tsf_delta = rx_param->tsf_delta;
 
 	/* Copy per chain rssi to scan entry */
-	qdf_mem_copy(scan_entry->per_chain_snr, rx_param->rssi_ctl,
+	qdf_mem_copy(scan_entry->per_chain_rssi, rx_param->rssi_ctl,
 		     WLAN_MGMT_TXRX_HOST_MAX_ANTENNA);
 
+	if (!wlan_psoc_nif_fw_ext_cap_get(wlan_pdev_get_psoc(pdev),
+					  WLAN_SOC_CEXT_HW_DB2DBM)) {
+		for (i = 0; i < WLAN_MGMT_TXRX_HOST_MAX_ANTENNA; i++) {
+			if (scan_entry->per_chain_rssi[i] !=
+			    WLAN_INVALID_PER_CHAIN_SNR)
+				scan_entry->per_chain_rssi[i] +=
+						WLAN_NOISE_FLOOR_DBM_DEFAULT;
+			else
+				scan_entry->per_chain_rssi[i] =
+						WLAN_INVALID_PER_CHAIN_RSSI;
+		}
+	}
+
 	/* store jiffies */
 	scan_entry->rrm_parent_tsf = (uint32_t)qdf_system_ticks();