wlan: Changes to check if hardware supports 5 GHz band.

In QRD devices, 5GHz band is not supported. This change checks if
5GHz band is supported by hardware and updates accordingly the
configuration.

CRs-fixed: 490347
Change-Id: I2c51bcd20f6f2495b962b3352e71aa9c4472cce4
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index e173ed6..dae9ced 100644
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -5362,6 +5362,34 @@
 
 /**---------------------------------------------------------------------------
 
+  \brief hdd_is_5g_supported() - HDD function to know if hardware supports  5GHz
+
+  \param  - pHddCtx - Pointer to the hdd context
+
+  \return -  true if hardware supports 5GHz
+
+  --------------------------------------------------------------------------*/
+static boolean hdd_is_5g_supported(hdd_context_t * pHddCtx)
+{
+   /* If wcnss_wlan_iris_xo_mode() returns WCNSS_XO_48MHZ(1);
+    * then hardware support 5Ghz.
+   */
+   if (WCNSS_XO_48MHZ == wcnss_wlan_iris_xo_mode())
+   {
+      hddLog(VOS_TRACE_LEVEL_INFO, "%s: Hardware supports 5Ghz", __func__);
+      return true;
+   }
+   else
+   {
+      hddLog(VOS_TRACE_LEVEL_INFO, "%s: Hardware doesn't supports 5Ghz",
+                    __func__);
+      return false;
+   }
+}
+
+
+/**---------------------------------------------------------------------------
+
   \brief hdd_wlan_startup() - HDD init function
 
   This is the driver startup code executed once a WLAN device has been detected
@@ -5460,6 +5488,17 @@
    pHddCtx->configuredMcastBcastFilter = pHddCtx->cfg_ini->mcastBcastFilterSetting;
    hddLog(VOS_TRACE_LEVEL_INFO, "Setting configuredMcastBcastFilter: %d",
                    pHddCtx->cfg_ini->mcastBcastFilterSetting);
+
+   if (false == hdd_is_5g_supported(pHddCtx))
+   {
+      //5Ghz is not supported.
+      if (1 != pHddCtx->cfg_ini->nBandCapability)
+      {
+         hddLog(VOS_TRACE_LEVEL_INFO,
+                "%s: Setting pHddCtx->cfg_ini->nBandCapability = 1", __func__);
+         pHddCtx->cfg_ini->nBandCapability = 1;
+      }
+   }
    /*
     * cfg80211: Initialization and registration ...
     */