瀏覽代碼

qcacmn: Add API reg_is_supr_entry_mode_disabled to check AFC_NOT_DONE flag

Add an API reg_is_supr_entry_mode_disabled to check if
REGULATORY_CHAN_AFC_NOT_DONE is cleared for a given frequency and
input power mode.

Change-Id: I6ca851bbe89e6003d8084856eb30b4796d01616e
CRs-Fixed: 3230917
Amith A 3 年之前
父節點
當前提交
5bb1139116

+ 28 - 0
umac/regulatory/core/src/reg_services_common.c

@@ -9240,3 +9240,31 @@ bool reg_is_offload_enabled(struct wlan_objmgr_pdev *pdev)
 	}
 	return soc_reg->offload_enabled;
 }
+
+#if defined(CONFIG_AFC_SUPPORT) && defined(CONFIG_BAND_6GHZ)
+bool
+reg_is_sup_chan_entry_afc_done(struct wlan_objmgr_pdev *pdev,
+			       enum channel_enum chan_idx,
+			       enum supported_6g_pwr_types in_6g_pwr_mode)
+{
+	const struct super_chan_info *super_chan_ent;
+	QDF_STATUS status;
+
+	status = reg_get_superchan_entry(pdev, chan_idx,
+					 &super_chan_ent);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		reg_debug("Failed to get super channel entry for chan_idx %d",
+			  chan_idx);
+		return false;
+	}
+
+	if (in_6g_pwr_mode == REG_BEST_PWR_MODE)
+		in_6g_pwr_mode = super_chan_ent->best_power_mode;
+
+	if (in_6g_pwr_mode != REG_AP_SP)
+		return false;
+
+	return !(super_chan_ent->chan_flags_arr[in_6g_pwr_mode] &
+		 REGULATORY_CHAN_AFC_NOT_DONE);
+}
+#endif

+ 25 - 0
umac/regulatory/core/src/reg_services_common.h

@@ -2565,6 +2565,31 @@ reg_get_chan_state_for_320(struct wlan_objmgr_pdev *pdev,
  */
 QDF_STATUS reg_get_regd_rules(struct wlan_objmgr_pdev *pdev,
 			      struct reg_rule_info *reg_rules);
+
+#if defined(CONFIG_AFC_SUPPORT) && defined(CONFIG_BAND_6GHZ)
+/**
+ * reg_is_sup_chan_entry_afc_done() - Checks if the super chan entry of given
+ * channel idx and power mode has REGULATORY_CHAN_AFC_NOT_DONE flag cleared.
+ *
+ * @pdev: pdev pointer.
+ * @freq: input channel idx.
+ * @in_6g_pwr_mode: input power mode
+ *
+ * Return: True if REGULATORY_CHAN_AFC_NOT_DONE flag is clear for the super
+ * chan entry.
+ */
+bool reg_is_sup_chan_entry_afc_done(struct wlan_objmgr_pdev *pdev,
+				    enum channel_enum chan_idx,
+				    enum supported_6g_pwr_types in_6g_pwr_mode);
+#else
+static inline bool
+reg_is_sup_chan_entry_afc_done(struct wlan_objmgr_pdev *pdev,
+			       enum channel_enum chan_idx,
+			       enum supported_6g_pwr_types in_6g_pwr_mode)
+{
+	return false;
+}
+#endif
 #endif
 
 /**

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

@@ -2520,4 +2520,30 @@ wlan_reg_get_chan_state_for_320(struct wlan_objmgr_pdev *pdev,
 	return CHANNEL_STATE_INVALID;
 }
 #endif
+
+/**
+ * wlan_is_sup_chan_entry_afc_done() - Checks if the super chan entry of given
+ * channel idx and power mode has REGULATORY_CHAN_AFC_NOT_DONE flag cleared.
+ *
+ * @pdev: pdev pointer
+ * @freq: input channel idx
+ * @in_6g_pwr_mode: input power mode
+ *
+ * Return: True if REGULATORY_CHAN_AFC_NOT_DONE flag is clear for the super
+ * chan entry.
+ */
+#ifdef CONFIG_BAND_6GHZ
+bool
+wlan_is_sup_chan_entry_afc_done(struct wlan_objmgr_pdev *pdev,
+				enum channel_enum chan_idx,
+				enum supported_6g_pwr_types in_6g_pwr_mode);
+#else
+static inline bool
+wlan_is_sup_chan_entry_afc_done(struct wlan_objmgr_pdev *pdev,
+				enum channel_enum chan_idx,
+				enum supported_6g_pwr_types in_6g_pwr_mode)
+{
+	return false;
+}
+#endif
 #endif

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

@@ -1877,3 +1877,14 @@ wlan_reg_get_chan_state_for_320(struct wlan_objmgr_pdev *pdev,
 					  treat_nol_chan_as_disabled);
 }
 #endif
+
+#ifdef CONFIG_BAND_6GHZ
+bool wlan_is_sup_chan_entry_afc_done(struct wlan_objmgr_pdev *pdev,
+				     enum channel_enum chan_idx,
+				     enum supported_6g_pwr_types in_6g_pwr_mode)
+{
+	return reg_is_sup_chan_entry_afc_done(pdev, chan_idx, in_6g_pwr_mode);
+}
+
+qdf_export_symbol(wlan_is_sup_chan_entry_afc_done);
+#endif