qcacld-3.0: Move chanmode_to_chanwidth API to qcacmn

Move chanmode_to_chanwidth API to qcacmn since it will be used by ndp
schedule update event.

Change-Id: I13d00c0b818eb0da434c8a5372b2ab7b6693f22a
CRs-Fixed: 2216803
diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h
index fde60c7..3035607 100644
--- a/core/wma/inc/wma.h
+++ b/core/wma/inc/wma.h
@@ -2461,14 +2461,6 @@
 }
 
 /**
- * chanmode_to_chanwidth() - get channel width through channel mode
- * @chanmode:   channel phy mode
- *
- * Return: channel width
- */
-wmi_channel_width chanmode_to_chanwidth(WLAN_PHY_MODE chanmode);
-
-/**
  * wma_process_roaming_config() - process roam request
  * @wma_handle: wma handle
  * @roam_req: roam request parameters
diff --git a/core/wma/src/wma_dev_if.c b/core/wma/src/wma_dev_if.c
index 56d558a..19e4b21 100644
--- a/core/wma/src/wma_dev_if.c
+++ b/core/wma/src/wma_dev_if.c
@@ -1037,56 +1037,6 @@
 }
 #endif /* FEATURE_AP_MCC_CH_AVOIDANCE */
 
-static const wmi_channel_width mode_to_width[MODE_MAX] = {
-	[MODE_11A]           = WMI_CHAN_WIDTH_20,
-	[MODE_11G]           = WMI_CHAN_WIDTH_20,
-	[MODE_11B]           = WMI_CHAN_WIDTH_20,
-	[MODE_11GONLY]       = WMI_CHAN_WIDTH_20,
-	[MODE_11NA_HT20]     = WMI_CHAN_WIDTH_20,
-	[MODE_11NG_HT20]     = WMI_CHAN_WIDTH_20,
-	[MODE_11AC_VHT20]    = WMI_CHAN_WIDTH_20,
-	[MODE_11AC_VHT20_2G] = WMI_CHAN_WIDTH_20,
-	[MODE_11NA_HT40]     = WMI_CHAN_WIDTH_40,
-	[MODE_11NG_HT40]     = WMI_CHAN_WIDTH_40,
-	[MODE_11AC_VHT40]    = WMI_CHAN_WIDTH_40,
-	[MODE_11AC_VHT40_2G] = WMI_CHAN_WIDTH_40,
-	[MODE_11AC_VHT80]    = WMI_CHAN_WIDTH_80,
-	[MODE_11AC_VHT80_2G] = WMI_CHAN_WIDTH_80,
-#if CONFIG_160MHZ_SUPPORT
-	[MODE_11AC_VHT80_80] = WMI_CHAN_WIDTH_80P80,
-	[MODE_11AC_VHT160]   = WMI_CHAN_WIDTH_160,
-#endif
-
-#if SUPPORT_11AX
-	[MODE_11AX_HE20]     = WMI_CHAN_WIDTH_20,
-	[MODE_11AX_HE40]     = WMI_CHAN_WIDTH_40,
-	[MODE_11AX_HE80]     = WMI_CHAN_WIDTH_80,
-	[MODE_11AX_HE80_80]  = WMI_CHAN_WIDTH_80P80,
-	[MODE_11AX_HE160]    = WMI_CHAN_WIDTH_160,
-	[MODE_11AX_HE20_2G]  = WMI_CHAN_WIDTH_20,
-	[MODE_11AX_HE40_2G]  = WMI_CHAN_WIDTH_40,
-	[MODE_11AX_HE80_2G]  = WMI_CHAN_WIDTH_80,
-#endif
-};
-
-/**
- * chanmode_to_chanwidth() - get channel width through channel mode
- * @chanmode:   channel phy mode
- *
- * Return: channel width
- */
-wmi_channel_width chanmode_to_chanwidth(WLAN_PHY_MODE chanmode)
-{
-	wmi_channel_width chan_width;
-
-	if (chanmode >= MODE_11A && chanmode < MODE_MAX)
-		chan_width = mode_to_width[chanmode];
-	else
-		chan_width = WMI_CHAN_WIDTH_20;
-
-	return chan_width;
-}
-
 /**
  * wma_vdev_start_resp_handler() - vdev start response handler
  * @handle: wma handle
@@ -1106,7 +1056,7 @@
 	struct vdev_up_params param = {0};
 	QDF_STATUS status;
 	int err;
-	wmi_channel_width chanwidth;
+	wmi_host_channel_width chanwidth;
 	target_resource_config *wlan_res_cfg;
 	struct wlan_objmgr_psoc *psoc = wma->psoc;
 #ifdef FEATURE_AP_MCC_CH_AVOIDANCE
@@ -1277,7 +1227,9 @@
 				__func__, resp_event->vdev_id,
 				iface->chanmode, err);
 
-			chanwidth = chanmode_to_chanwidth(iface->chanmode);
+			chanwidth =
+				wmi_get_ch_width_from_phy_mode(wma->wmi_handle,
+							       iface->chanmode);
 			err = wma_set_peer_param(wma, iface->bssid,
 					WMI_PEER_CHWIDTH, chanwidth,
 					resp_event->vdev_id);
diff --git a/core/wma/src/wma_mgmt.c b/core/wma/src/wma_mgmt.c
index 3e3ea19..599c9f6 100644
--- a/core/wma/src/wma_mgmt.c
+++ b/core/wma/src/wma_mgmt.c
@@ -2980,11 +2980,11 @@
 			       tUpdateVHTOpMode *update_vht_opmode)
 {
 	struct wma_txrx_node *iface;
-	wmi_channel_width ch_width;
+	wmi_host_channel_width ch_width;
 
 	iface = &wma_handle->interfaces[update_vht_opmode->smesessionId];
-	ch_width = chanmode_to_chanwidth(iface->chanmode);
-
+	ch_width = wmi_get_ch_width_from_phy_mode(wma_handle->wmi_handle,
+						  iface->chanmode);
 	if (ch_width < update_vht_opmode->opMode) {
 		WMA_LOGE("%s: Invalid peer bw update %d, self bw %d",
 				__func__, update_vht_opmode->opMode,