ath10k.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] ath10k: tx power fixes
@ 2013-10-23 11:02 Michal Kazior
  2013-10-23 11:02 ` [PATCH 1/3] ath10k: setup min channel power to a reasonable value Michal Kazior
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Michal Kazior @ 2013-10-23 11:02 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Michal Kazior

Hi,

This patchset fixes power units used in ath10k and
also make it respect (user) configurable tx power.


Michal Kazior (3):
  ath10k: setup min channel power to a reasonable value
  ath10k: use proper tx power unit
  ath10k: respect power_level values

 drivers/net/wireless/ath/ath10k/mac.c | 44 +++++++++++++++++++++++++----------
 drivers/net/wireless/ath/ath10k/wmi.h |  3 ++-
 2 files changed, 34 insertions(+), 13 deletions(-)

-- 
1.8.4.rc3


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

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

* [PATCH 1/3] ath10k: setup min channel power to a reasonable value
  2013-10-23 11:02 [PATCH 0/3] ath10k: tx power fixes Michal Kazior
@ 2013-10-23 11:02 ` Michal Kazior
  2013-10-23 11:02 ` [PATCH 2/3] ath10k: use proper tx power unit Michal Kazior
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Michal Kazior @ 2013-10-23 11:02 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Michal Kazior

This will be needed for proper support of (user)
configurable tx power level.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index da23c3f..35d5d3a 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -450,7 +450,7 @@ static int ath10k_vdev_start(struct ath10k_vif *arvif)
 
 	arg.channel.mode = chan_to_phymode(&conf->chandef);
 
-	arg.channel.min_power = channel->max_power * 3;
+	arg.channel.min_power = 0;
 	arg.channel.max_power = channel->max_power * 4;
 	arg.channel.max_reg_power = channel->max_reg_power * 4;
 	arg.channel.max_antenna_gain = channel->max_antenna_gain;
@@ -529,7 +529,7 @@ static int ath10k_monitor_start(struct ath10k *ar, int vdev_id)
 	   don't have any vifs? */
 	arg.channel.mode = chan_to_phymode(&ar->hw->conf.chandef);
 
-	arg.channel.min_power = channel->max_power * 3;
+	arg.channel.min_power = 0;
 	arg.channel.max_power = channel->max_power * 4;
 	arg.channel.max_reg_power = channel->max_reg_power * 4;
 	arg.channel.max_antenna_gain = channel->max_antenna_gain;
@@ -1375,7 +1375,7 @@ static int ath10k_update_channel_list(struct ath10k *ar)
 			ch->passive = passive;
 
 			ch->freq = channel->center_freq;
-			ch->min_power = channel->max_power * 3;
+			ch->min_power = 0;
 			ch->max_power = channel->max_power * 4;
 			ch->max_reg_power = channel->max_reg_power * 4;
 			ch->max_antenna_gain = channel->max_antenna_gain;
-- 
1.8.4.rc3


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

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

* [PATCH 2/3] ath10k: use proper tx power unit
  2013-10-23 11:02 [PATCH 0/3] ath10k: tx power fixes Michal Kazior
  2013-10-23 11:02 ` [PATCH 1/3] ath10k: setup min channel power to a reasonable value Michal Kazior
@ 2013-10-23 11:02 ` Michal Kazior
  2013-10-23 11:02 ` [PATCH 3/3] ath10k: respect power_level values Michal Kazior
  2013-10-24  5:43 ` [PATCH 0/3] ath10k: tx power fixes Kalle Valo
  3 siblings, 0 replies; 5+ messages in thread
From: Michal Kazior @ 2013-10-23 11:02 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Michal Kazior

It was previously thought that FW expects tx power
in quarters of dBm.

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

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 35d5d3a..1d91201 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -451,9 +451,9 @@ static int ath10k_vdev_start(struct ath10k_vif *arvif)
 	arg.channel.mode = chan_to_phymode(&conf->chandef);
 
 	arg.channel.min_power = 0;
-	arg.channel.max_power = channel->max_power * 4;
-	arg.channel.max_reg_power = channel->max_reg_power * 4;
-	arg.channel.max_antenna_gain = channel->max_antenna_gain;
+	arg.channel.max_power = channel->max_power * 2;
+	arg.channel.max_reg_power = channel->max_reg_power * 2;
+	arg.channel.max_antenna_gain = channel->max_antenna_gain * 2;
 
 	if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
 		arg.ssid = arvif->u.ap.ssid;
@@ -530,9 +530,9 @@ static int ath10k_monitor_start(struct ath10k *ar, int vdev_id)
 	arg.channel.mode = chan_to_phymode(&ar->hw->conf.chandef);
 
 	arg.channel.min_power = 0;
-	arg.channel.max_power = channel->max_power * 4;
-	arg.channel.max_reg_power = channel->max_reg_power * 4;
-	arg.channel.max_antenna_gain = channel->max_antenna_gain;
+	arg.channel.max_power = channel->max_power * 2;
+	arg.channel.max_reg_power = channel->max_reg_power * 2;
+	arg.channel.max_antenna_gain = channel->max_antenna_gain * 2;
 
 	ret = ath10k_wmi_vdev_start(ar, &arg);
 	if (ret) {
@@ -1376,9 +1376,9 @@ static int ath10k_update_channel_list(struct ath10k *ar)
 
 			ch->freq = channel->center_freq;
 			ch->min_power = 0;
-			ch->max_power = channel->max_power * 4;
-			ch->max_reg_power = channel->max_reg_power * 4;
-			ch->max_antenna_gain = channel->max_antenna_gain;
+			ch->max_power = channel->max_power * 2;
+			ch->max_reg_power = channel->max_reg_power * 2;
+			ch->max_antenna_gain = channel->max_antenna_gain * 2;
 			ch->reg_class_id = 0; /* FIXME */
 
 			/* FIXME: why use only legacy modes, why not any
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 78c991a..81e33a7 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -893,6 +893,7 @@ struct wmi_channel {
 	union {
 		__le32 reginfo0;
 		struct {
+			/* note: power unit is 0.5 dBm */
 			u8 min_power;
 			u8 max_power;
 			u8 reg_power;
@@ -915,7 +916,7 @@ struct wmi_channel_arg {
 	bool allow_ht;
 	bool allow_vht;
 	bool ht40plus;
-	/* note: power unit is 1/4th of dBm */
+	/* note: power unit is 0.5 dBm */
 	u32 min_power;
 	u32 max_power;
 	u32 max_reg_power;
-- 
1.8.4.rc3


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

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

* [PATCH 3/3] ath10k: respect power_level values
  2013-10-23 11:02 [PATCH 0/3] ath10k: tx power fixes Michal Kazior
  2013-10-23 11:02 ` [PATCH 1/3] ath10k: setup min channel power to a reasonable value Michal Kazior
  2013-10-23 11:02 ` [PATCH 2/3] ath10k: use proper tx power unit Michal Kazior
@ 2013-10-23 11:02 ` Michal Kazior
  2013-10-24  5:43 ` [PATCH 0/3] ath10k: tx power fixes Kalle Valo
  3 siblings, 0 replies; 5+ messages in thread
From: Michal Kazior @ 2013-10-23 11:02 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Michal Kazior

This allows txpower limits other than regulatory
to be applied (e.g. user txpower limit provided
via iw/nl80211).

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 1d91201..643518d 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2013,6 +2013,7 @@ static int ath10k_config(struct ieee80211_hw *hw, u32 changed)
 	struct ath10k *ar = hw->priv;
 	struct ieee80211_conf *conf = &hw->conf;
 	int ret = 0;
+	u32 param;
 
 	mutex_lock(&ar->conf_mutex);
 
@@ -2024,6 +2025,25 @@ static int ath10k_config(struct ieee80211_hw *hw, u32 changed)
 		spin_unlock_bh(&ar->data_lock);
 	}
 
+	if (changed & IEEE80211_CONF_CHANGE_POWER) {
+		ath10k_dbg(ATH10K_DBG_MAC, "mac config power %d\n",
+			   hw->conf.power_level);
+
+		param = ar->wmi.pdev_param->txpower_limit2g;
+		ret = ath10k_wmi_pdev_set_param(ar, param,
+						hw->conf.power_level * 2);
+		if (ret)
+			ath10k_warn("mac failed to set 2g txpower %d (%d)\n",
+				    hw->conf.power_level, ret);
+
+		param = ar->wmi.pdev_param->txpower_limit5g;
+		ret = ath10k_wmi_pdev_set_param(ar, param,
+						hw->conf.power_level * 2);
+		if (ret)
+			ath10k_warn("mac failed to set 5g txpower %d (%d)\n",
+				    hw->conf.power_level, ret);
+	}
+
 	if (changed & IEEE80211_CONF_CHANGE_PS)
 		ath10k_config_ps(ar);
 
-- 
1.8.4.rc3


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

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

* Re: [PATCH 0/3] ath10k: tx power fixes
  2013-10-23 11:02 [PATCH 0/3] ath10k: tx power fixes Michal Kazior
                   ` (2 preceding siblings ...)
  2013-10-23 11:02 ` [PATCH 3/3] ath10k: respect power_level values Michal Kazior
@ 2013-10-24  5:43 ` Kalle Valo
  3 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2013-10-24  5:43 UTC (permalink / raw)
  To: Michal Kazior; +Cc: linux-wireless, ath10k

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

> Hi,
>
> This patchset fixes power units used in ath10k and
> also make it respect (user) configurable tx power.
>
>
> Michal Kazior (3):
>   ath10k: setup min channel power to a reasonable value
>   ath10k: use proper tx power unit
>   ath10k: respect power_level values

Thanks, all patches applied.

-- 
Kalle Valo

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

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

end of thread, other threads:[~2013-10-24  5:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-23 11:02 [PATCH 0/3] ath10k: tx power fixes Michal Kazior
2013-10-23 11:02 ` [PATCH 1/3] ath10k: setup min channel power to a reasonable value Michal Kazior
2013-10-23 11:02 ` [PATCH 2/3] ath10k: use proper tx power unit Michal Kazior
2013-10-23 11:02 ` [PATCH 3/3] ath10k: respect power_level values Michal Kazior
2013-10-24  5:43 ` [PATCH 0/3] ath10k: tx power fixes Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).