Commit f7843d7f authored by Michal Kazior's avatar Michal Kazior Committed by Kalle Valo

ath10k: allow deferred regd update

Regulatory domain notification hook can be called
regardless of the hw state (i.e. before start
mac80211 callback).
Signed-off-by: default avatarMichal Kazior <michal.kazior@tieto.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent dd30a36e
...@@ -247,6 +247,11 @@ struct ath10k_debug { ...@@ -247,6 +247,11 @@ struct ath10k_debug {
struct completion event_stats_compl; struct completion event_stats_compl;
}; };
enum ath10k_state {
ATH10K_STATE_OFF = 0,
ATH10K_STATE_ON,
};
struct ath10k { struct ath10k {
struct ath_common ath_common; struct ath_common ath_common;
struct ieee80211_hw *hw; struct ieee80211_hw *hw;
...@@ -344,6 +349,8 @@ struct ath10k { ...@@ -344,6 +349,8 @@ struct ath10k {
struct completion offchan_tx_completed; struct completion offchan_tx_completed;
struct sk_buff *offchan_tx_skb; struct sk_buff *offchan_tx_skb;
enum ath10k_state state;
#ifdef CONFIG_ATH10K_DEBUGFS #ifdef CONFIG_ATH10K_DEBUGFS
struct ath10k_debug debug; struct ath10k_debug debug;
#endif #endif
......
...@@ -1310,23 +1310,19 @@ static int ath10k_update_channel_list(struct ath10k *ar) ...@@ -1310,23 +1310,19 @@ static int ath10k_update_channel_list(struct ath10k *ar)
return ret; return ret;
} }
static void ath10k_reg_notifier(struct wiphy *wiphy, static void ath10k_regd_update(struct ath10k *ar)
struct regulatory_request *request)
{ {
struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
struct reg_dmn_pair_mapping *regpair; struct reg_dmn_pair_mapping *regpair;
struct ath10k *ar = hw->priv;
int ret; int ret;
mutex_lock(&ar->conf_mutex); lockdep_assert_held(&ar->conf_mutex);
ath_reg_notifier_apply(wiphy, request, &ar->ath_common.regulatory);
ret = ath10k_update_channel_list(ar); ret = ath10k_update_channel_list(ar);
if (ret) if (ret)
ath10k_warn("could not update channel list (%d)\n", ret); ath10k_warn("could not update channel list (%d)\n", ret);
regpair = ar->ath_common.regulatory.regpair; regpair = ar->ath_common.regulatory.regpair;
/* Target allows setting up per-band regdomain but ath_common provides /* Target allows setting up per-band regdomain but ath_common provides
* a combined one only */ * a combined one only */
ret = ath10k_wmi_pdev_set_regdomain(ar, ret = ath10k_wmi_pdev_set_regdomain(ar,
...@@ -1337,7 +1333,19 @@ static void ath10k_reg_notifier(struct wiphy *wiphy, ...@@ -1337,7 +1333,19 @@ static void ath10k_reg_notifier(struct wiphy *wiphy,
regpair->reg_5ghz_ctl); regpair->reg_5ghz_ctl);
if (ret) if (ret)
ath10k_warn("could not set pdev regdomain (%d)\n", ret); ath10k_warn("could not set pdev regdomain (%d)\n", ret);
}
static void ath10k_reg_notifier(struct wiphy *wiphy,
struct regulatory_request *request)
{
struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
struct ath10k *ar = hw->priv;
ath_reg_notifier_apply(wiphy, request, &ar->ath_common.regulatory);
mutex_lock(&ar->conf_mutex);
if (ar->state == ATH10K_STATE_ON)
ath10k_regd_update(ar);
mutex_unlock(&ar->conf_mutex); mutex_unlock(&ar->conf_mutex);
} }
...@@ -1732,6 +1740,9 @@ static int ath10k_start(struct ieee80211_hw *hw) ...@@ -1732,6 +1740,9 @@ static int ath10k_start(struct ieee80211_hw *hw)
ath10k_warn("could not init WMI_PDEV_PARAM_DYNAMIC_BW (%d)\n", ath10k_warn("could not init WMI_PDEV_PARAM_DYNAMIC_BW (%d)\n",
ret); ret);
ar->state = ATH10K_STATE_ON;
ath10k_regd_update(ar);
mutex_unlock(&ar->conf_mutex); mutex_unlock(&ar->conf_mutex);
return 0; return 0;
} }
...@@ -1742,6 +1753,7 @@ static void ath10k_stop(struct ieee80211_hw *hw) ...@@ -1742,6 +1753,7 @@ static void ath10k_stop(struct ieee80211_hw *hw)
mutex_lock(&ar->conf_mutex); mutex_lock(&ar->conf_mutex);
ath10k_offchan_tx_purge(ar); ath10k_offchan_tx_purge(ar);
ar->state = ATH10K_STATE_OFF;
mutex_unlock(&ar->conf_mutex); mutex_unlock(&ar->conf_mutex);
cancel_work_sync(&ar->offchan_tx_work); cancel_work_sync(&ar->offchan_tx_work);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment