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

Commit 8118b073 authored by Lincoln Tran's avatar Lincoln Tran Committed by Madan Koyyalamudi
Browse files

qcacmn: Add helper API to set AP power type

Add an API to set the AP power type and then recompute the current
channel list.

Change-Id: Iacd4d3244f601836f3ed0eae725eaa6375a3584c
CRs-fixed: 2934625
parent 5a2d88df
Loading
Loading
Loading
Loading
+24 −2
Original line number Diff line number Diff line
@@ -780,11 +780,33 @@ enum reg_6g_ap_type reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev)
		 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);
	reg_compute_pdev_current_chan_list(pdev_priv_obj);
	reg_set_ap_pwr_and_update_chan_list(pdev, ap_pwr_type);

	return ap_pwr_type;
}

QDF_STATUS reg_set_ap_pwr_and_update_chan_list(struct wlan_objmgr_pdev *pdev,
					       enum reg_6g_ap_type ap_pwr_type)
{
	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
	QDF_STATUS status;

	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 QDF_STATUS_E_INVAL;
	}

	status = reg_set_cur_6g_ap_pwr_type(pdev, ap_pwr_type);
	if (QDF_IS_STATUS_ERROR(status)) {
		reg_debug("failed to set AP power type to %d", ap_pwr_type);
		return status;
	}

	reg_compute_pdev_current_chan_list(pdev_priv_obj);

	return QDF_STATUS_SUCCESS;
}
#endif /* CONFIG_BAND_6GHZ */

#endif /* CONFIG_REG_CLIENT */
+26 −1
Original line number Diff line number Diff line
@@ -407,12 +407,31 @@ bool reg_ignore_default_country(struct wlan_regulatory_psoc_priv_obj *soc_reg,
 * Return: AP power type
 */
enum reg_6g_ap_type reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev);

/**
 * reg_set_ap_pwr_and_update_chan_list() - Set the AP power mode and recompute
 * the current channel list
 *
 * @pdev: pdev ptr
 * @ap_pwr_type: the AP power type to update to
 *
 * Return: QDF_STATUS
 */
QDF_STATUS reg_set_ap_pwr_and_update_chan_list(struct wlan_objmgr_pdev *pdev,
					       enum reg_6g_ap_type ap_pwr_type);
#else
static inline enum reg_6g_ap_type
reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev)
{
	return REG_CURRENT_MAX_AP_TYPE;
}

static inline
QDF_STATUS reg_set_ap_pwr_and_update_chan_list(struct wlan_objmgr_pdev *pdev,
					       enum reg_6g_ap_type ap_pwr_type)
{
	return QDF_STATUS_E_NOSUPPORT;
}
#endif /* CONFIG_BAND_6GHZ */
#else
static inline QDF_STATUS reg_read_current_country(struct wlan_objmgr_psoc *psoc,
@@ -523,7 +542,13 @@ reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev)
	return REG_CURRENT_MAX_AP_TYPE;
}

#endif
static inline
QDF_STATUS reg_set_ap_pwr_and_update_chan_list(struct wlan_objmgr_pdev *pdev,
					       enum reg_6g_ap_type ap_pwr_type)
{
	return QDF_STATUS_E_NOSUPPORT;
}
#endif /* CONFIG_REG_CLIENT */

#if defined(WLAN_FEATURE_DSRC) && defined(CONFIG_REG_CLIENT)
/**
+21 −2
Original line number Diff line number Diff line
@@ -1760,6 +1760,19 @@ wlan_reg_get_client_power_for_6ghz_ap(struct wlan_objmgr_pdev *pdev,
 */
enum reg_6g_ap_type
wlan_reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev);

/**
 * wlan_reg_set_ap_pwr_and_update_chan_list() - Set the AP power mode and
 * recompute the current channel list
 *
 * @pdev: pdev ptr
 * @ap_pwr_type: the AP power type to update to
 *
 * Return: QDF_STATUS
 */
QDF_STATUS
wlan_reg_set_ap_pwr_and_update_chan_list(struct wlan_objmgr_pdev *pdev,
					 enum reg_6g_ap_type ap_pwr_type);
#else
static inline QDF_STATUS
wlan_reg_get_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev,
@@ -1838,12 +1851,18 @@ wlan_reg_get_client_power_for_6ghz_ap(struct wlan_objmgr_pdev *pdev,
	return QDF_STATUS_E_NOSUPPORT;
}

static inline
enum reg_6g_ap_type
static inline enum reg_6g_ap_type
wlan_reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev)
{
	return REG_INDOOR_AP;
}

static inline QDF_STATUS
wlan_reg_set_ap_pwr_and_update_chan_list(struct wlan_objmgr_pdev *pdev,
					 enum reg_6g_ap_type ap_pwr_type)
{
	return QDF_STATUS_E_NOSUPPORT;
}
#endif

/**
+7 −0
Original line number Diff line number Diff line
@@ -1381,6 +1381,13 @@ wlan_reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev)
{
	return reg_decide_6g_ap_pwr_type(pdev);
}

QDF_STATUS
wlan_reg_set_ap_pwr_and_update_chan_list(struct wlan_objmgr_pdev *pdev,
					 enum reg_6g_ap_type ap_pwr_type)
{
	return reg_set_ap_pwr_and_update_chan_list(pdev, ap_pwr_type);
}
#endif /* CONFIG_BAND_6GHZ */

bool wlan_reg_is_ext_tpc_supported(struct wlan_objmgr_psoc *psoc)