|
@@ -642,29 +642,70 @@ static void reg_modify_chan_list_for_band(struct regulatory_channel *chan_list,
|
|
|
|
|
|
}
|
|
|
|
|
|
+#ifdef CONFIG_REG_CLIENT
|
|
|
+/**
|
|
|
+ * reg_get_tx_power_for_fcc_channel() - Set FCC txpower received from firmware
|
|
|
+ * @chan_list: Regulatory channel to be updated
|
|
|
+ * @fcc_rule: Pointer to current fcc rule array
|
|
|
+ *
|
|
|
+ * Return: true if regulatory channel is present in current fcc rules array
|
|
|
+ */
|
|
|
+static bool reg_get_tx_power_for_fcc_channel(
|
|
|
+ struct regulatory_channel *chan_list,
|
|
|
+ struct cur_fcc_rule *fcc_rule)
|
|
|
+{
|
|
|
+ int index = 0;
|
|
|
+
|
|
|
+ if (!chan_list || !fcc_rule)
|
|
|
+ return false;
|
|
|
+
|
|
|
+ for (index = 0; index < MAX_NUM_FCC_RULES; index++) {
|
|
|
+ if (chan_list->center_freq == fcc_rule[index].center_freq) {
|
|
|
+ chan_list->tx_power = fcc_rule[index].tx_power;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* reg_modify_chan_list_for_fcc_channel() - Set maximum FCC txpower for channel
|
|
|
* 12 and 13 if set_fcc_channel flag is set to true.
|
|
|
- * @chan_list: Pointer to regulatory channel list.
|
|
|
- * @set_fcc_channel: If this flag is set to true, then set the max FCC txpower
|
|
|
- * for channel 12 and 13.
|
|
|
+ * @pdev_priv_obj: Pointer to pdev private object.
|
|
|
*/
|
|
|
static void reg_modify_chan_list_for_fcc_channel(
|
|
|
- struct regulatory_channel *chan_list, bool set_fcc_channel)
|
|
|
+ struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj)
|
|
|
{
|
|
|
- enum channel_enum chan_enum;
|
|
|
+ struct regulatory_channel *chan_list = pdev_priv_obj->cur_chan_list;
|
|
|
+ struct cur_fcc_rule *fcc_rules = pdev_priv_obj->fcc_rules_ptr;
|
|
|
|
|
|
- if (!set_fcc_channel)
|
|
|
+ if (!pdev_priv_obj->set_fcc_channel)
|
|
|
return;
|
|
|
|
|
|
- for (chan_enum = 0; chan_enum < NUM_CHANNELS; chan_enum++) {
|
|
|
- if (chan_list[chan_enum].center_freq == CHAN_12_CENT_FREQ)
|
|
|
- chan_list[chan_enum].tx_power = MAX_PWR_FCC_CHAN_12;
|
|
|
+ if (!chan_list || !fcc_rules)
|
|
|
+ return;
|
|
|
|
|
|
- if (chan_list[chan_enum].center_freq == CHAN_13_CENT_FREQ)
|
|
|
- chan_list[chan_enum].tx_power = MAX_PWR_FCC_CHAN_13;
|
|
|
+ if (!reg_get_tx_power_for_fcc_channel(
|
|
|
+ &chan_list[CHAN_ENUM_2467], fcc_rules)) {
|
|
|
+ chan_list[CHAN_ENUM_2467].tx_power = MAX_PWR_FCC_CHAN_12;
|
|
|
+ reg_debug("Channel 12 not found from BDF");
|
|
|
+ }
|
|
|
+ if (!reg_get_tx_power_for_fcc_channel(
|
|
|
+ &chan_list[CHAN_ENUM_2472], fcc_rules)) {
|
|
|
+ chan_list[CHAN_ENUM_2472].tx_power = MAX_PWR_FCC_CHAN_13;
|
|
|
+ reg_debug("Channel 13 not found from BDF");
|
|
|
}
|
|
|
+ reg_debug("Channel 12 tx_power = %d, 13 tx_power = %d",
|
|
|
+ chan_list[CHAN_ENUM_2467].tx_power,
|
|
|
+ chan_list[CHAN_ENUM_2472].tx_power);
|
|
|
+}
|
|
|
+#else
|
|
|
+static inline void reg_modify_chan_list_for_fcc_channel(
|
|
|
+ struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj)
|
|
|
+{
|
|
|
}
|
|
|
+#endif
|
|
|
|
|
|
/**
|
|
|
* reg_modify_chan_list_for_chan_144() - Disable channel 144 if en_chan_144 flag
|
|
@@ -2596,8 +2637,7 @@ void reg_compute_pdev_current_chan_list(struct wlan_regulatory_pdev_priv_obj
|
|
|
|
|
|
reg_modify_chan_list_for_indoor_channels(pdev_priv_obj);
|
|
|
|
|
|
- reg_modify_chan_list_for_fcc_channel(pdev_priv_obj->cur_chan_list,
|
|
|
- pdev_priv_obj->set_fcc_channel);
|
|
|
+ reg_modify_chan_list_for_fcc_channel(pdev_priv_obj);
|
|
|
|
|
|
reg_modify_chan_list_for_chan_144(pdev_priv_obj->cur_chan_list,
|
|
|
pdev_priv_obj->en_chan_144);
|
|
@@ -2809,6 +2849,40 @@ void reg_save_reg_rules_to_pdev(struct reg_rule_info *psoc_reg_rules,
|
|
|
qdf_spin_unlock_bh(&pdev_priv_obj->reg_rules_lock);
|
|
|
}
|
|
|
|
|
|
+#ifdef CONFIG_REG_CLIENT
|
|
|
+/**
|
|
|
+ * reg_set_pdev_fcc_rules - Set pdev fcc rules array
|
|
|
+ * @psoc_priv_obj - PSOC private object pointer
|
|
|
+ * @pdev_priv_obj - PDEV private object pointer
|
|
|
+ *
|
|
|
+ */
|
|
|
+
|
|
|
+static void reg_set_pdev_fcc_rules(
|
|
|
+ struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj,
|
|
|
+ struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj)
|
|
|
+{
|
|
|
+ if (!psoc_priv_obj) {
|
|
|
+ reg_err("psoc priv obj is NULL");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
|
|
|
+ reg_err("reg pdev priv obj is NULL");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ qdf_mem_copy(pdev_priv_obj->fcc_rules_ptr,
|
|
|
+ psoc_priv_obj->fcc_rules_ptr,
|
|
|
+ sizeof(struct cur_fcc_rule) * MAX_NUM_FCC_RULES);
|
|
|
+}
|
|
|
+#else
|
|
|
+static void reg_set_pdev_fcc_rules(
|
|
|
+ struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj,
|
|
|
+ struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj)
|
|
|
+{
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
void reg_propagate_mas_chan_list_to_pdev(struct wlan_objmgr_psoc *psoc,
|
|
|
void *object, void *arg)
|
|
|
{
|
|
@@ -2845,6 +2919,7 @@ void reg_propagate_mas_chan_list_to_pdev(struct wlan_objmgr_psoc *psoc,
|
|
|
else
|
|
|
phy_id = pdev_id;
|
|
|
|
|
|
+ reg_set_pdev_fcc_rules(psoc_priv_obj, pdev_priv_obj);
|
|
|
reg_init_pdev_mas_chan_list(
|
|
|
pdev_priv_obj,
|
|
|
&psoc_priv_obj->mas_chan_params[phy_id]);
|
|
@@ -3187,6 +3262,40 @@ static void reg_init_legacy_master_chan(struct regulatory_channel *dst_list,
|
|
|
reg_init_chan(dst_list, 0, NUM_CHANNELS - 1, 0, soc_reg);
|
|
|
}
|
|
|
|
|
|
+#ifdef CONFIG_REG_CLIENT
|
|
|
+/**
|
|
|
+ * reg_set_psoc_fcc_rules - Set PSOC fcc rules array
|
|
|
+ * @soc_reg - PSOC private object pointer
|
|
|
+ * @regulat_info - Regulatory info pointer
|
|
|
+ *
|
|
|
+ * Return - QDF_STATUS
|
|
|
+ */
|
|
|
+static QDF_STATUS reg_set_psoc_fcc_rules(
|
|
|
+ struct wlan_regulatory_psoc_priv_obj *soc_reg,
|
|
|
+ struct cur_regulatory_info *regulat_info)
|
|
|
+{
|
|
|
+ if (!IS_VALID_PSOC_REG_OBJ(soc_reg)) {
|
|
|
+ reg_err("psoc reg component is NULL");
|
|
|
+ return QDF_STATUS_E_FAILURE;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (regulat_info->num_fcc_rules)
|
|
|
+ qdf_mem_copy(soc_reg->fcc_rules_ptr,
|
|
|
+ regulat_info->fcc_rules_ptr,
|
|
|
+ sizeof(struct cur_fcc_rule) *
|
|
|
+ regulat_info->num_fcc_rules);
|
|
|
+
|
|
|
+ return QDF_STATUS_SUCCESS;
|
|
|
+}
|
|
|
+#else
|
|
|
+static inline QDF_STATUS reg_set_psoc_fcc_rules(
|
|
|
+ struct wlan_regulatory_psoc_priv_obj *soc_reg,
|
|
|
+ struct cur_regulatory_info *regulat_info)
|
|
|
+{
|
|
|
+ return QDF_STATUS_SUCCESS;
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
#ifdef CONFIG_BAND_6GHZ
|
|
|
static void reg_init_2g_5g_master_chan(struct regulatory_channel *dst_list,
|
|
|
struct wlan_regulatory_psoc_priv_obj *soc_reg)
|
|
@@ -3747,6 +3856,10 @@ QDF_STATUS reg_process_master_chan_list_ext(
|
|
|
|
|
|
reg_set_socpriv_vars(soc_reg, regulat_info, psoc, phy_id);
|
|
|
|
|
|
+ status = reg_set_psoc_fcc_rules(soc_reg, regulat_info);
|
|
|
+ if (!QDF_IS_STATUS_SUCCESS(status))
|
|
|
+ return status;
|
|
|
+
|
|
|
pdev = wlan_objmgr_get_pdev_by_id(psoc, pdev_id, dbg_id);
|
|
|
if (pdev) {
|
|
|
reg_propagate_mas_chan_list_to_pdev(psoc, pdev, &dir);
|
|
@@ -4696,6 +4809,10 @@ QDF_STATUS reg_process_master_chan_list(
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ status = reg_set_psoc_fcc_rules(soc_reg, regulat_info);
|
|
|
+ if (!QDF_IS_STATUS_SUCCESS(status))
|
|
|
+ return status;
|
|
|
+
|
|
|
pdev = wlan_objmgr_get_pdev_by_id(psoc, pdev_id, dbg_id);
|
|
|
if (pdev) {
|
|
|
reg_propagate_mas_chan_list_to_pdev(psoc, pdev, &dir);
|