wlan: FTM: Process WE_GET_CHANNEL IOCTL appropriately

While processing WE_GET_CHANNEL IOCTL, Host converts frequency,
received from firmware, to channel number and provides same to USER.
Presently Host converts only 2.4G channels and it retunes failure for
all 5G channels, though 5G channels can be set using WE_SET_CHANNEL
IOCTL.
Hence include 5G channels as well while converting frequency to channel.

Change-Id: I1573780b693dac7c349f89acfa2da1fdc3316391
CRs-Fixed: 923142
diff --git a/CORE/HDD/src/wlan_hdd_ftm.c b/CORE/HDD/src/wlan_hdd_ftm.c
index 88125f4..e814701 100644
--- a/CORE/HDD/src/wlan_hdd_ftm.c
+++ b/CORE/HDD/src/wlan_hdd_ftm.c
@@ -128,15 +128,6 @@
 static int wlan_ftm_stop(hdd_context_t *pHddCtx);
 VOS_STATUS wlan_write_to_efs (v_U8_t *pData, v_U16_t data_len);
 
-/* for PRIMA: all the available frequency, channal pair i the table are defined for channel frequency @ RF center frequency
-   Since it is associated to agc.channel_freq register for mapping.
-   For channel bonding, the channel number is +2 or -2 for CB with primary high, or with primary low respectively.
-*/
-static const freq_chan_t  freq_chan_tbl[] = {
-     {2412, 1}, {2417, 2},{2422, 3}, {2427, 4}, {2432, 5}, {2437, 6}, {2442, 7},
-     {2447, 8}, {2452, 9},{2457, 10},{2462, 11},{2467 ,12},{2472, 13},{2484, 14}
-};
-
 static rateStr2rateIndex_t rateName_rateIndex_tbl[] =
 {
    { HAL_PHY_RATE_11B_LONG_1_MBPS,       "11B_LONG_1_MBPS"},
@@ -4411,7 +4402,6 @@
     uPttMsgs *pMsgBody;
     VOS_STATUS status;
     v_U16_t  freq;
-    v_U8_t indx=0;
     long ret;
 
     hdd_context_t *pHddCtx = (hdd_context_t *)pAdapter->pHddCtx;
@@ -4478,16 +4468,8 @@
 
     freq = ((v_U16_t)pMsgBody->DbgReadRegister.regValue & QWLAN_AGC_CHANNEL_FREQ_FREQ_MASK);
 
-    while ((indx <  SIZE_OF_TABLE(freq_chan_tbl)) && (freq != freq_chan_tbl[indx].freq))
-            indx++;
-    if (indx >= SIZE_OF_TABLE(freq_chan_tbl))
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:Invalid Frequency!!!",__func__);
-        status = VOS_STATUS_E_FAILURE;
-        goto done;
-    }
-
-    *pChannel = freq_chan_tbl[indx].chan;
+    *pChannel = vos_freq_to_chan(freq);
+    (*pChannel) ? (status = VOS_STATUS_SUCCESS) : (status = VOS_STATUS_E_FAILURE);
 
      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Channel = %d  freq = %d",*pChannel, freq);
  done: