Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 40f177fa authored by Lincoln Tran's avatar Lincoln Tran Committed by snandini
Browse files

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
parent 800ca290
Loading
Loading
Loading
Loading
+0 −14
Original line number Diff line number Diff line
@@ -1601,20 +1601,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
Original line number Diff line number Diff line
/*
 * 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
Original line number Diff line number Diff line
@@ -4476,6 +4476,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];

@@ -4491,4 +4494,39 @@ 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
+15 −0
Original line number Diff line number Diff line
@@ -1435,6 +1435,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,
@@ -1520,5 +1529,11 @@ 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
#endif
+18 −0
Original line number Diff line number Diff line
@@ -1718,6 +1718,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,
@@ -1787,5 +1798,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
Loading