Răsfoiți Sursa

qcacmn: Add logic to decide AP pwr mode when starting

Add logic to decide which power mode the AP should start in

Change-Id: I59b64e6ca26d47e395575ab129f35b97ddcc6737
CRs-fixed: 2863552
Lincoln Tran 4 ani în urmă
părinte
comite
b3b38d585a

+ 0 - 14
umac/regulatory/core/src/reg_db.c

@@ -1618,20 +1618,6 @@ const struct regdomain regdomains_5g[] = {
 };
 
 #if defined(CONFIG_BAND_6GHZ) && defined(COMPILE_REGDB_6G)
-/**
- * enum reg_super_domain_6g - 6G Super Domain enumeration
- * @FCC1_6G: Super domain FCC1_6G
- * @ETSI1_6G: Super domain ETSI1_6G
- * @ETSI2_6G: Super domain ETSI2_6G
- * @APL1_6G: Super domain APL1_6G
- */
-enum reg_super_domain_6g {
-	FCC1_6G = 0x01,
-	ETSI1_6G = 0x02,
-	ETSI2_6G = 0x03,
-	APL1_6G = 0x04,
-};
-
 /**
  * List of 6G Sub Domains.
  *

+ 20 - 2
umac/regulatory/core/src/reg_db.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
  *
  *
  * Permission to use, copy, modify, and/or distribute this software for
@@ -160,7 +160,24 @@ struct reg_domain_pair {
 	uint8_t dmn_id_2g;
 };
 
-#if defined(CONFIG_BAND_6GHZ) && defined(COMPILE_REGDB_6G)
+#if defined(CONFIG_BAND_6GHZ)
+/**
+ * enum reg_super_domain_6g - 6G Super Domain enumeration
+ * @FCC1_6G: Super domain FCC1_6G for US
+ * @ETSI1_6G: Super domain ETSI1_6G
+ * @ETSI2_6G: Super domain ETSI2_6G
+ * @APL1_6G: Super domain APL1_6G
+ * @FCC1_6G_CL: Super domain FCC1_6G for Chile
+ */
+enum reg_super_domain_6g {
+	FCC1_6G = 0x01,
+	ETSI1_6G = 0x02,
+	ETSI2_6G = 0x03,
+	APL1_6G = 0x04,
+	FCC1_6G_CL = 0x05,
+};
+
+#if defined(COMPILE_REGDB_6G)
 /**
  * struct sixghz_super_to_subdomains
  * @reg_6ghz_super_dmn_id: 6G super domain id.
@@ -181,6 +198,7 @@ struct sixghz_super_to_subdomains {
 	uint8_t reg_domain_6g_id_client_vlp[REG_MAX_CLIENT_TYPE - 1];
 };
 #endif
+#endif
 
 QDF_STATUS reg_get_num_countries(int *num_countries);
 

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

@@ -4441,6 +4441,9 @@ QDF_STATUS reg_get_client_power_for_6ghz_ap(struct wlan_objmgr_pdev *pdev,
 		return QDF_STATUS_E_FAILURE;
 	}
 
+	if (ap_pwr_type >= REG_CURRENT_MAX_AP_TYPE)
+		return QDF_STATUS_E_FAILURE;
+
 	master_chan_list = pdev_priv_obj->
 			mas_chan_list_6g_client[ap_pwr_type][client_type];
 
@@ -4456,6 +4459,41 @@ QDF_STATUS reg_get_client_power_for_6ghz_ap(struct wlan_objmgr_pdev *pdev,
 	return status;
 }
 
+/**
+ * reg_is_afc_available() - check if the automated frequency control system is
+ * available, function will need to be updated once AFC is implemented
+ * @pdev: Pointer to pdev structure
+ *
+ * Return: false since the AFC system is not yet available
+ */
+static bool reg_is_afc_available(struct wlan_objmgr_pdev *pdev)
+{
+	return false;
+}
+
+enum reg_6g_ap_type reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev)
+{
+	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
+	enum reg_6g_ap_type ap_pwr_type = REG_INDOOR_AP;
+
+	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 REG_VERY_LOW_POWER_AP;
+	}
+
+	if (reg_is_afc_available(pdev))
+		ap_pwr_type = REG_STANDARD_POWER_AP;
+	else if (pdev_priv_obj->indoor_chan_enabled)
+		ap_pwr_type = REG_INDOOR_AP;
+	else if (pdev_priv_obj->reg_6g_superid != FCC1_6G &&
+		 pdev_priv_obj->reg_6g_superid != FCC1_6G_CL)
+		ap_pwr_type = REG_VERY_LOW_POWER_AP;
+
+	reg_set_cur_6g_ap_pwr_type(pdev, ap_pwr_type);
+
+	return ap_pwr_type;
+}
 #endif
 
 bool reg_is_regdb_offloaded(struct wlan_objmgr_psoc *psoc)

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

@@ -1428,6 +1428,15 @@ QDF_STATUS reg_get_client_power_for_6ghz_ap(struct wlan_objmgr_pdev *pdev,
 					    qdf_freq_t chan_freq,
 					    bool *is_psd, uint16_t *tx_power,
 					    uint16_t *eirp_psd_power);
+
+/**
+ * reg_decide_6g_ap_pwr_type() - Decide which power mode AP should operate in
+ *
+ * @pdev: pdev ptr
+ *
+ * Return: AP power type
+ */
+enum reg_6g_ap_type reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev);
 #else
 static inline QDF_STATUS
 reg_set_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev,
@@ -1513,6 +1522,12 @@ QDF_STATUS reg_get_client_power_for_6ghz_ap(struct wlan_objmgr_pdev *pdev,
 	*eirp_psd_power = 0;
 	return QDF_STATUS_E_NOSUPPORT;
 }
+
+static inline enum reg_6g_ap_type
+reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev)
+{
+	return REG_INDOOR_AP;
+}
 #endif
 
 #ifdef CONFIG_HOST_FIND_CHAN

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

@@ -1705,6 +1705,17 @@ wlan_reg_get_client_power_for_6ghz_ap(struct wlan_objmgr_pdev *pdev,
 				      qdf_freq_t chan_freq,
 				      bool *is_psd, uint16_t *tx_power,
 				      uint16_t *eirp_psd_power);
+
+/**
+ * wlan_reg_decide_6g_ap_pwr_type() - Decide which power mode AP should operate
+ * in
+ *
+ * @pdev: pdev ptr
+ *
+ * Return: AP power type
+ */
+enum reg_6g_ap_type
+wlan_reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev);
 #else
 static inline QDF_STATUS
 wlan_reg_get_cur_6g_client_type(struct wlan_objmgr_pdev *pdev,
@@ -1774,5 +1785,12 @@ wlan_reg_get_client_power_for_6ghz_ap(struct wlan_objmgr_pdev *pdev,
 	*eirp_psd_power = 0;
 	return QDF_STATUS_E_NOSUPPORT;
 }
+
+static inline
+enum reg_6g_ap_type
+wlan_reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev)
+{
+	return REG_INDOOR_AP;
+}
 #endif
 #endif

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

@@ -1344,4 +1344,10 @@ wlan_reg_get_client_power_for_6ghz_ap(struct wlan_objmgr_pdev *pdev,
 						is_psd, tx_power,
 						eirp_psd_power);
 }
+
+enum reg_6g_ap_type
+wlan_reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev)
+{
+	return reg_decide_6g_ap_pwr_type(pdev);
+}
 #endif