Browse Source

qcacmn: Get AFC mas_chan_list and check if AFC power event is received

Add an API wlan_reg_is_afc_power_event_received, to check if AFC power
event is received.

Add an API wlan_reg_get_6g_afc_mas_chan_list. to get the AFC master
channel list.

Export wlan_reg_get_6g_afc_chan_list so that it can be used by
APIs outside the UMAC module.

Change-Id: I09338a41f38e4db03f00ef2c15e9a0b7805f649e
CRs-Fixed: 2991293
Hariharan Basuthkar 4 năm trước cách đây
mục cha
commit
d2ef66d69a

+ 19 - 0
umac/regulatory/core/src/reg_build_chan_list.c

@@ -2643,6 +2643,25 @@ QDF_STATUS reg_get_6g_afc_chan_list(struct wlan_objmgr_pdev *pdev,
 	return QDF_STATUS_SUCCESS;
 }
 
+QDF_STATUS
+reg_get_6g_afc_mas_chan_list(struct wlan_objmgr_pdev *pdev,
+			     struct regulatory_channel *chan_list)
+{
+	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
+
+	pdev_priv_obj = reg_get_pdev_obj(pdev);
+
+	if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
+		reg_err("reg pdev private obj is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	qdf_mem_copy(chan_list, pdev_priv_obj->mas_chan_list_6g_afc,
+		     NUM_6GHZ_CHANNELS * sizeof(struct regulatory_channel));
+
+	return QDF_STATUS_SUCCESS;
+}
+
 /**
  * struct bw_10log10_pair - The bandwidth and 10*log10(bandwidth) pair.
  * ten_l_len = trunc(10*log10(bw)).  'trunc' is truncation function.

+ 12 - 0
umac/regulatory/core/src/reg_build_chan_list.h

@@ -130,6 +130,18 @@ QDF_STATUS reg_get_6g_ap_master_chan_list(struct wlan_objmgr_pdev *pdev,
  */
 QDF_STATUS reg_get_6g_afc_chan_list(struct wlan_objmgr_pdev *pdev,
 				    struct regulatory_channel *chan_list);
+
+/**
+ * reg_get_6g_afc_mas_chan_list() - provide the pdev afc master channel list
+ * @pdev: pdev pointer
+ * @chan_list: channel list pointer
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+reg_get_6g_afc_mas_chan_list(struct wlan_objmgr_pdev *pdev,
+			     struct regulatory_channel *chan_list);
+
 /**
  * reg_psd_2_eirp() - Calculate EIRP from PSD and bandwidth
  * channel list

+ 14 - 1
umac/regulatory/core/src/reg_services_common.c

@@ -5836,7 +5836,7 @@ reg_process_ch_avoid_ext_event(struct wlan_objmgr_psoc *psoc,
 }
 #endif
 
-#ifdef CONFIG_AFC_SUPPORT
+#if defined(CONFIG_AFC_SUPPORT) && defined(CONFIG_BAND_6GHZ)
 QDF_STATUS reg_send_afc_cmd(struct wlan_objmgr_pdev *pdev,
 			    struct reg_afc_resp_rx_ind_info *afc_ind_obj)
 {
@@ -5856,4 +5856,17 @@ QDF_STATUS reg_send_afc_cmd(struct wlan_objmgr_pdev *pdev,
 
 	return QDF_STATUS_E_FAILURE;
 }
+
+bool reg_is_afc_power_event_received(struct wlan_objmgr_pdev *pdev)
+{
+	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
+
+	pdev_priv_obj = reg_get_pdev_obj(pdev);
+	if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
+		reg_err("pdev reg component is NULL");
+		return false;
+	}
+
+	return pdev_priv_obj->is_6g_afc_power_event_received;
+}
 #endif

+ 11 - 1
umac/regulatory/core/src/reg_services_common.h

@@ -1685,7 +1685,7 @@ reg_process_ch_avoid_ext_event(struct wlan_objmgr_psoc *psoc,
 }
 #endif
 
-#ifdef CONFIG_AFC_SUPPORT
+#if defined(CONFIG_AFC_SUPPORT) && defined(CONFIG_BAND_6GHZ)
 /**
  * reg_send_afc_cmd() - Send AFC cmd to the FW
  * @pdev: pdev ptr
@@ -1696,5 +1696,15 @@ reg_process_ch_avoid_ext_event(struct wlan_objmgr_psoc *psoc,
  */
 QDF_STATUS reg_send_afc_cmd(struct wlan_objmgr_pdev *pdev,
 			    struct reg_afc_resp_rx_ind_info *afc_ind_obj);
+
+/**
+ * reg_is_afc_power_event_received() - Checks if AFC power event is
+ * received from the FW.
+ *
+ * @pdev: pdev ptr
+ *
+ * Return: true if AFC power event is received from the FW or false otherwise
+ */
+bool reg_is_afc_power_event_received(struct wlan_objmgr_pdev *pdev);
 #endif
 #endif

+ 35 - 0
umac/regulatory/dispatcher/inc/wlan_reg_services_api.h

@@ -555,6 +555,18 @@ QDF_STATUS wlan_reg_get_6g_ap_master_chan_list(struct wlan_objmgr_pdev *pdev,
 QDF_STATUS wlan_reg_get_6g_afc_chan_list(struct wlan_objmgr_pdev *pdev,
 					 struct regulatory_channel *chan_list);
 
+/**
+ * wlan_reg_get_6g_afc_mas_chan_list() - provide the pdev afc master channel
+ * list
+ * @pdev: pdev pointer
+ * @chan_list: channel list pointer
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+wlan_reg_get_6g_afc_mas_chan_list(struct wlan_objmgr_pdev *pdev,
+				  struct regulatory_channel *chan_list);
+
 /**
  * wlan_reg_psd_2_eirp() - Calculate EIRP from PSD and bandwidth
  * channel list
@@ -569,6 +581,29 @@ QDF_STATUS wlan_reg_psd_2_eirp(struct wlan_objmgr_pdev *pdev,
 			       int16_t psd,
 			       uint16_t ch_bw,
 			       int16_t *eirp);
+
+/**
+ * wlan_reg_is_afc_power_event_received() - Checks if AFC power event is
+ * received from the FW.
+ *
+ * @pdev: pdev ptr
+ *
+ * Return: true if AFC power event is received from the FW or false otherwise
+ */
+bool wlan_reg_is_afc_power_event_received(struct wlan_objmgr_pdev *pdev);
+#else
+static inline bool
+wlan_reg_is_afc_power_event_received(struct wlan_objmgr_pdev *pdev)
+{
+	return false;
+}
+
+static inline QDF_STATUS
+wlan_reg_get_6g_afc_chan_list(struct wlan_objmgr_pdev *pdev,
+			      struct regulatory_channel *chan_list)
+{
+	return QDF_STATUS_E_NOSUPPORT;
+}
 #endif
 
 /**

+ 1 - 1
umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h

@@ -504,7 +504,7 @@ ucfg_reg_set_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev,
 }
 #endif
 
-#ifdef CONFIG_AFC_SUPPORT
+#if defined(CONFIG_AFC_SUPPORT) && defined(CONFIG_BAND_6GHZ)
 /**
  * ucfg_reg_send_afc_resp_rx_ind() - Send AFC response received indication to
  * the FW.

+ 22 - 0
umac/regulatory/dispatcher/src/wlan_reg_services_api.c

@@ -145,6 +145,17 @@ QDF_STATUS wlan_reg_get_6g_afc_chan_list(struct wlan_objmgr_pdev *pdev,
 	return reg_get_6g_afc_chan_list(pdev, chan_list);
 }
 
+qdf_export_symbol(wlan_reg_get_6g_afc_chan_list);
+
+QDF_STATUS
+wlan_reg_get_6g_afc_mas_chan_list(struct wlan_objmgr_pdev *pdev,
+				  struct regulatory_channel *chan_list)
+{
+	return reg_get_6g_afc_mas_chan_list(pdev, chan_list);
+}
+
+qdf_export_symbol(wlan_reg_get_6g_afc_mas_chan_list);
+
 QDF_STATUS wlan_reg_psd_2_eirp(struct wlan_objmgr_pdev *pdev,
 			       int16_t psd,
 			       uint16_t ch_bw,
@@ -1274,6 +1285,8 @@ QDF_STATUS wlan_reg_get_6g_chan_ap_power(struct wlan_objmgr_pdev *pdev,
 					tx_power, eirp_psd_power);
 }
 
+qdf_export_symbol(wlan_reg_get_6g_chan_ap_power);
+
 QDF_STATUS
 wlan_reg_get_client_power_for_connecting_ap(struct wlan_objmgr_pdev *pdev,
 					    enum reg_6g_ap_type ap_type,
@@ -1319,3 +1332,12 @@ bool wlan_reg_is_ext_tpc_supported(struct wlan_objmgr_psoc *psoc)
 {
 	return reg_is_ext_tpc_supported(psoc);
 }
+
+#ifdef CONFIG_AFC_SUPPORT
+bool wlan_reg_is_afc_power_event_received(struct wlan_objmgr_pdev *pdev)
+{
+	return reg_is_afc_power_event_received(pdev);
+}
+
+qdf_export_symbol(wlan_reg_is_afc_power_event_received);
+#endif

+ 1 - 1
umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c

@@ -386,7 +386,7 @@ ucfg_reg_get_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev,
 qdf_export_symbol(ucfg_reg_get_cur_6g_ap_pwr_type);
 #endif
 
-#ifdef CONFIG_AFC_SUPPORT
+#if defined(CONFIG_AFC_SUPPORT) && defined(CONFIG_BAND_6GHZ)
 QDF_STATUS
 ucfg_reg_send_afc_resp_rx_ind(struct wlan_objmgr_pdev *pdev,
 			      struct reg_afc_resp_rx_ind_info *afc_ind_obj)