All of lore.kernel.org
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: htl10@users.sourceforge.net, Piter PUNK <piterpk@terra.com.br>
Cc: Herton Ronaldo Krzesinski <herton@mandriva.com.br>,
	Pavel Roskin <proski@gnu.org>,
	wireless <linux-wireless@vger.kernel.org>
Subject: [RFC/RFT] rtl8187: Change TX power settings
Date: Thu, 30 Oct 2008 09:51:02 -0700	[thread overview]
Message-ID: <4909E5F6.9040401@lwfinger.net> (raw)
In-Reply-To: <490905E9.8040005@lwfinger.net>


The latest vendor driver (rtl8187B_linux_26.1036.0708.2008) has changed the
CCK and OFDM power setting code as compared with previous versions. This
patch implements those changes for the Linux driver.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---

Piter,

Does this help your devices?

Larry


Index: wireless-testing/drivers/net/wireless/rtl8187_rtl8225.c
===================================================================
--- wireless-testing.orig/drivers/net/wireless/rtl8187_rtl8225.c
+++ wireless-testing/drivers/net/wireless/rtl8187_rtl8225.c
@@ -578,23 +578,27 @@ static void rtl8225z2_b_rf_set_tx_power(
 {
 	struct rtl8187_priv *priv = dev->priv;
 	u8 cck_power, ofdm_power;
+	u8 min_cck_power = (priv->hw_rev == RTL8187BvB) ? 0 : 7;
+	u8 max_cck_power = (priv->hw_rev == RTL8187BvB) ? 15 : 22;
+	u8 min_ofdm_power = (priv->hw_rev == RTL8187BvB) ? 2 : 10;
+	u8 max_ofdm_power = (priv->hw_rev == RTL8187BvB) ? 17 : 25;
 	const u8 *tmp;
 	int i;

 	cck_power = priv->channels[channel - 1].hw_value & 0xF;
 	ofdm_power = priv->channels[channel - 1].hw_value >> 4;

-	if (cck_power > 15)
-		cck_power = (priv->hw_rev == RTL8187BvB) ? 15 : 22;
+	if (cck_power > max_cck_power - min_cck_power)
+		cck_power = max_cck_power;
 	else
-		cck_power += (priv->hw_rev == RTL8187BvB) ? 0 : 7;
+		cck_power += min_cck_power;
 	cck_power += priv->txpwr_base & 0xF;
 	cck_power = min(cck_power, (u8)35);

-	if (ofdm_power > 15)
-		ofdm_power = (priv->hw_rev == RTL8187BvB) ? 17 : 25;
+	if (ofdm_power > max_ofdm_power - min_ofdm_power)
+		ofdm_power = max_ofdm_power;
 	else
-		ofdm_power += (priv->hw_rev == RTL8187BvB) ? 2 : 10;
+		ofdm_power += min_ofdm_power;
 	ofdm_power += (priv->txpwr_base >> 4) & 0xF;
 	ofdm_power = min(ofdm_power, (u8)35);

@@ -625,7 +629,7 @@ static void rtl8225z2_b_rf_set_tx_power(
 		rtl8225_write_phy_cck(dev, 0x44 + i, *tmp++);

 	rtl818x_iowrite8(priv, &priv->map->TX_GAIN_CCK,
-			 rtl8225z2_tx_gain_cck_ofdm[cck_power]);
+			 rtl8225z2_tx_gain_cck_ofdm[cck_power] << 1);
 	msleep(1);

 	rtl818x_iowrite8(priv, &priv->map->TX_GAIN_OFDM,



  reply	other threads:[~2008-10-30 16:51 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <838057.50079.qm@web23102.mail.ird.yahoo.com>
2008-10-29 16:29 ` [RFC/RFT] rtl8187: Reduce delays to reduce startup time Larry Finger
2008-10-29 18:42   ` Herton Ronaldo Krzesinski
2008-10-29 19:38     ` Hin-Tak Leung
2008-10-30  0:48       ` Larry Finger
2008-10-30  0:49   ` [RFC/RFT PATCH 0/6] " Larry Finger
2008-10-30  0:52   ` [RFC/RFT PATCH 2/6] rtl8187: Remove OFDM delays Larry Finger
2008-10-30  0:53   ` [RFC/RFT PATCH 3/6] rtl8187: Remove CCK delays Larry Finger
2008-10-30  0:54   ` [RFC/RFT PATCH 6/6] rtl8187: Reduce channel switch delay Larry Finger
2008-10-30  0:54   ` [RFC/RFT PATCH 1/6] rtl8187: Remove large delays Larry Finger
2008-10-30  0:54   ` [RFC/RFT PATCH 4/6] rtl8187: Remove msleep calls after calls to rtl8225_write Larry Finger
2008-10-30  0:55   ` [RFC/RFT PATCH 5/6] rtl8187: Remove primitive write delays Larry Finger
2008-10-30 16:51     ` Larry Finger [this message]
2008-10-30 18:52       ` [RFC/RFT] rtl8187: Change TX power settings Hin-Tak Leung
2008-10-30 23:42         ` Larry Finger
2008-10-31  3:29       ` Piter PUNK
2008-10-31 16:51   ` [PATCH 0/6] rtl8187: Reduce delays to reduce startup time Larry Finger
2008-10-31 18:03     ` Herton Ronaldo Krzesinski
2008-10-31 16:52   ` [PATCH 1/6] rtl8187: Remove large delays Larry Finger
2008-10-31 16:52   ` [PATCH 2/6] rtl8187: Remove OFDM delays Larry Finger
2008-10-31 16:52   ` [PATCH 3/6] rtl8187: Remove CCK delays Larry Finger
2008-10-31 16:54   ` [PATCH 4/6] rtl8187: Remove msleep calls after calls to rtl8225_write Larry Finger
2008-10-31 16:54   ` [PATCH 5/6] rtl8187: Remove primitive write delays Larry Finger
2008-10-31 16:54   ` [PATCH 6/6] rtl8187: Reduce channel switch delay Larry Finger

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=4909E5F6.9040401@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=herton@mandriva.com.br \
    --cc=htl10@users.sourceforge.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=piterpk@terra.com.br \
    --cc=proski@gnu.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.