All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anna Neal <anna@cozybit.com>
To: linux-wireless@vger.kernel.org
Cc: libertas-dev@lists.infradead.org
Subject: [PATCH] libertas: Improvements on automatic tx power control via SIOCSIWTXPOW.
Date: Wed, 10 Sep 2008 16:45:18 -0700	[thread overview]
Message-ID: <48c86ed3.16be600a.2bc8.4c4e@mx.google.com> (raw)

Improved the tx power control configuration per Dan Williams suggestions. Added
a firmware version check because the current implementation will only work for
below version 9.

Signed-off-by: Anna Neal <anna@cozybit.com>
---
 drivers/net/wireless/libertas/cmd.c  |    4 +-
 drivers/net/wireless/libertas/cmd.h  |    4 +-
 drivers/net/wireless/libertas/wext.c |   44 +++++++++++++++++++++------------
 3 files changed, 32 insertions(+), 20 deletions(-)

diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index 6cc4858..5fef05f 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -1983,7 +1983,7 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv)
  *
  * @return 0 on success
  */
-int lbs_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1,
+int lbs_set_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1,
 		int8_t p2, int usesnr)
 {
 	struct cmd_ds_802_11_tpc_cfg cmd;
@@ -2015,7 +2015,7 @@ int lbs_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1,
  * @return 0 on Success
  */
 
-int lbs_power_adapt_cfg(struct lbs_private *priv, int enable, int8_t p0,
+int lbs_set_power_adapt_cfg(struct lbs_private *priv, int enable, int8_t p0,
 		int8_t p1, int8_t p2)
 {
 	struct cmd_ds_802_11_pa_cfg cmd;
diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h
index 77bd070..336a181 100644
--- a/drivers/net/wireless/libertas/cmd.h
+++ b/drivers/net/wireless/libertas/cmd.h
@@ -26,10 +26,10 @@ int __lbs_cmd(struct lbs_private *priv, uint16_t command,
 	      int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),
 	      unsigned long callback_arg);
 
-int lbs_power_adapt_cfg(struct lbs_private *priv, int enable, int8_t p0,
+int lbs_set_power_adapt_cfg(struct lbs_private *priv, int enable, int8_t p0,
 		int8_t p1, int8_t p2);
 
-int lbs_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1,
+int lbs_set_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1,
 		int8_t p2, int usesnr);
 
 int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra,
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index b08bad8..8a81aca 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -1823,14 +1823,20 @@ static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info,
 		/* User requests automatic tx power control, however there are
 		 * many auto tx settings.  For now use firmware defaults until
 		 * we come up with a good way to expose these to the user. */
-		ret = lbs_power_adapt_cfg(priv, 1, POW_ADAPT_DEFAULT_P0,
-				POW_ADAPT_DEFAULT_P1, POW_ADAPT_DEFAULT_P2);
-		if (ret)
-			goto out;
-		ret = lbs_tpc_cfg(priv, 0, TPC_DEFAULT_P0, TPC_DEFAULT_P1,
-				TPC_DEFAULT_P2, 1);
-		if (ret)
-			goto out;
+		if (priv->fwrelease < 0x09000000) {
+			ret = lbs_set_power_adapt_cfg(priv, 1,
+					POW_ADAPT_DEFAULT_P0,
+					POW_ADAPT_DEFAULT_P1,
+					POW_ADAPT_DEFAULT_P2);
+			if (ret)
+				goto out;
+			ret = lbs_set_tpc_cfg(priv, 0,
+					TPC_DEFAULT_P0,
+					TPC_DEFAULT_P1,
+					TPC_DEFAULT_P2, 1);
+			if (ret)
+				goto out;
+		}
 		dbm = priv->txpower_max;
 	} else {
 		/* Userspace check in iwrange if it should use dBm or mW,
@@ -1851,14 +1857,20 @@ static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info,
 			ret = -EINVAL;
 			goto out;
 		}
-		ret = lbs_power_adapt_cfg(priv, 0, POW_ADAPT_DEFAULT_P0,
-				POW_ADAPT_DEFAULT_P1, POW_ADAPT_DEFAULT_P2);
-		if (ret)
-			goto out;
-		ret = lbs_tpc_cfg(priv, 0, TPC_DEFAULT_P0, TPC_DEFAULT_P1,
-				TPC_DEFAULT_P2, 1);
-		if (ret)
-			goto out;
+		if (priv->fwrelease < 0x09000000) {
+			ret = lbs_set_power_adapt_cfg(priv, 0,
+					POW_ADAPT_DEFAULT_P0,
+					POW_ADAPT_DEFAULT_P1,
+					POW_ADAPT_DEFAULT_P2);
+			if (ret)
+				goto out;
+			ret = lbs_set_tpc_cfg(priv, 0,
+					TPC_DEFAULT_P0,
+					TPC_DEFAULT_P1,
+					TPC_DEFAULT_P2, 1);
+			if (ret)
+				goto out;
+		}
 	}
 
 	/* If the radio was off, turn it on */
-- 
1.5.4.3




             reply	other threads:[~2008-09-11  1:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-10 23:45 Anna Neal [this message]
2008-09-11 15:34 ` [PATCH] libertas: Improvements on automatic tx power control via SIOCSIWTXPOW Dan Williams
2008-09-11 17:03   ` Anna Neal
2008-09-11 17:13     ` Anna Neal
2008-09-11 17:24       ` John W. Linville
  -- strict thread matches above, loose matches on Subject: below --
2008-09-11 18:17 Anna Neal
2008-09-11 18:37 ` Johannes Berg
2008-09-11 18:56   ` Anna Neal
2008-09-11 19:12     ` Johannes Berg
2008-09-15  5:44 ` Dan Williams
2008-09-17 18:23   ` Anna Neal
2008-09-25 23:19 Anna Neal
2008-09-26 14:49 ` Dan Williams
2008-09-26 16:26 ` John W. Linville
2008-09-29 20:59   ` Dan Williams
2008-09-29 21:20     ` John W. Linville

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48c86ed3.16be600a.2bc8.4c4e@mx.google.com \
    --to=anna@cozybit.com \
    --cc=libertas-dev@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.