Historical ath9k-devel archives
 help / color / mirror / Atom feed
* [ath9k-devel] [PATCH] ath10k: program FW with appropriate regdomain
@ 2013-05-17  6:26 Michal Kazior
  2013-05-21 18:59 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Kazior @ 2013-05-17  6:26 UTC (permalink / raw)
  To: ath9k-devel

We already setup scan channel list upon regdomain
update but we should also setup the regpair to the
FW.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |   13 +++++++++++++
 drivers/net/wireless/ath/ath10k/wmi.c |   18 ++++++++++--------
 drivers/net/wireless/ath/ath10k/wmi.h |    3 ++-
 3 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 974f992..49e3940 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1249,6 +1249,7 @@ static void ath10k_reg_notifier(struct wiphy *wiphy,
 				struct regulatory_request *request)
 {
 	struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
+	struct reg_dmn_pair_mapping *regpair;
 	struct ath10k *ar = hw->priv;
 	int ret;
 
@@ -1257,6 +1258,18 @@ static void ath10k_reg_notifier(struct wiphy *wiphy,
 	ret = ath10k_update_channel_list(ar);
 	if (ret)
 		ath10k_warn("could not update channel list (%d)\n", ret);
+
+	regpair = ar->ath_common.regulatory.regpair;
+	/* Target allows setting up per-band regdomain but ath_common provides
+	 * a combined one only */
+	ret = ath10k_wmi_pdev_set_regdomain(ar,
+					    regpair->regDmnEnum,
+					    regpair->regDmnEnum, /* 2ghz */
+					    regpair->regDmnEnum, /* 5ghz */
+					    regpair->reg_2ghz_ctl,
+					    regpair->reg_5ghz_ctl);
+	if (ret)
+		ath10k_warn("could not set pdev regdomain (%d)\n", ret);
 }
 
 /***************/
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 0d5070d..bb33421a 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1132,7 +1132,8 @@ int ath10k_wmi_connect_htc_service(struct ath10k *ar)
 	return 0;
 }
 
-int ath10k_wmi_pdev_set_regdomain(struct ath10k *ar)
+int ath10k_wmi_pdev_set_regdomain(struct ath10k *ar, u16 rd, u16 rd2g,
+				  u16 rd5g, u16 ctl2g, u16 ctl5g)
 {
 	struct wmi_pdev_set_regdomain_cmd *cmd;
 	struct sk_buff *skb;
@@ -1142,14 +1143,15 @@ int ath10k_wmi_pdev_set_regdomain(struct ath10k *ar)
 		return -ENOMEM;
 
 	cmd = (struct wmi_pdev_set_regdomain_cmd *)skb->data;
+	cmd->reg_domain = __cpu_to_le32(rd);
+	cmd->reg_domain_2G = __cpu_to_le32(rd2g);
+	cmd->reg_domain_5G = __cpu_to_le32(rd5g);
+	cmd->conformance_test_limit_2G = __cpu_to_le32(ctl2g);
+	cmd->conformance_test_limit_5G = __cpu_to_le32(ctl5g);
 
-	/* FIXME: do not use hardcoded values */
-	/* TODO: provide correct values for reg domain */
-	cmd->reg_domain                = __cpu_to_le32(0x3a); /* FCC3_FCCA */
-	cmd->reg_domain_2G             = __cpu_to_le32(0x0a10); /* FCCA */
-	cmd->reg_domain_5G             = __cpu_to_le32(0x160); /* FCC3 */
-	cmd->conformance_test_limit_2G = __cpu_to_le32(0x12); /* FCC4-FCCA */
-	cmd->conformance_test_limit_5G = __cpu_to_le32(0x10); /* FCC1-FCCA */
+	ath10k_dbg(ATH10K_DBG_WMI,
+		   "wmi pdev regdomain rd %x rd2g %x rd5g %x ctl2g %x ctl5g %x\n",
+		   rd, rd2g, rd5g, ctl2g, ctl5g);
 
 	return ath10k_wmi_cmd_send(ar, skb, WMI_PDEV_SET_REGDOMAIN_CMDID);
 }
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index ccab87e..6c00e59 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -2958,7 +2958,8 @@ int ath10k_wmi_pdev_set_channel(struct ath10k *ar,
 				const struct wmi_channel_arg *);
 int ath10k_wmi_pdev_suspend_target(struct ath10k *ar);
 int ath10k_wmi_pdev_resume_target(struct ath10k *ar);
-int ath10k_wmi_pdev_set_regdomain(struct ath10k *ar);
+int ath10k_wmi_pdev_set_regdomain(struct ath10k *ar, u16 rd, u16 rd2g,
+				  u16 rd5g, u16 ctl2g, u16 ctl5g);
 int ath10k_wmi_pdev_set_param(struct ath10k *ar, enum wmi_pdev_param id,
 			      u32 value);
 int ath10k_wmi_cmd_init(struct ath10k *ar);
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [ath9k-devel] [PATCH] ath10k: program FW with appropriate regdomain
  2013-05-17  6:26 [ath9k-devel] [PATCH] ath10k: program FW with appropriate regdomain Michal Kazior
@ 2013-05-21 18:59 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2013-05-21 18:59 UTC (permalink / raw)
  To: ath9k-devel

Michal Kazior <michal.kazior@tieto.com> writes:

> We already setup scan channel list upon regdomain
> update but we should also setup the regpair to the
> FW.
>
> Signed-off-by: Michal Kazior <michal.kazior@tieto.com>

Thanks, applied.

There's actually one checkpatch warning:

drivers/net/wireless/ath/ath10k/mac.c:1266: WARNING: Avoid CamelCase: <regpair->regDmnEnum>

But there's not much we can do about that :)

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-05-21 18:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-17  6:26 [ath9k-devel] [PATCH] ath10k: program FW with appropriate regdomain Michal Kazior
2013-05-21 18:59 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox