From: "Rafał Miłecki" <zajec5@gmail.com>
To: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"John W. Linville" <linville@tuxdriver.com>
Cc: "bcm43xx-dev@lists.berlios.de" <bcm43xx-dev@lists.berlios.de>
Subject: [PATCH 2/5] b43: N-PHY: b43_nphy_get_tx_gains
Date: Wed, 06 Jan 2010 16:40:47 +0100 [thread overview]
Message-ID: <op.u54a59c89lhzdc@linux-g0th.site> (raw)
[-- Attachment #1: Type: text/plain, Size: 3990 bytes --]
b43: N-PHY: b43_nphy_get_tx_gains
From 5c96b3de80f7d044c42808e8123ae3f50916d6fc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
Date: Wed, 6 Jan 2010 15:25:14 +0100
Subject: [PATCH 2/5] b43: N-PHY: b43_nphy_get_tx_gains
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
drivers/net/wireless/b43/phy_n.c | 75 ++++++++++++++++++++++++++++++++++++++
drivers/net/wireless/b43/phy_n.h | 1 +
2 files changed, 76 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 40d7b73..249caf0 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -30,6 +30,8 @@
#include "tables_nphy.h"
+struct nphy_txgains { u16 txgm[2]; u16 pga[2]; u16 pad[2]; u16 ipa[2]; };
+
void b43_nphy_set_rxantenna(struct b43_wldev *dev, int antenna)
{//TODO
}
@@ -405,6 +407,79 @@ static void b43_nphy_stay_carrier_search(struct b43_wldev *dev, bool enable)
}
}
+static struct nphy_txgains b43_nphy_get_tx_gains(struct b43_wldev *dev)
+{
+ struct b43_phy_n *nphy = dev->phy.n;
+
+ u16 curr_gain[2];
+ struct nphy_txgains target;
+ u32 *table = NULL;
+
+ if (nphy->txpwrctrl == 0) {
+ int i;
+
+ if (nphy->hang_avoid)
+ b43_nphy_stay_carrier_search(dev, true);
+ //TODO: Read an N PHY Table with ID 7, length 2, offset 0x110, width 16, and curr_gain
+ if (nphy->hang_avoid)
+ b43_nphy_stay_carrier_search(dev, false);
+
+ for (i = 0; i < 2; ++i) {
+ if (dev->phy.rev >= 3) {
+ target.ipa[i] = curr_gain[i] & 0x000F;
+ target.pad[i] = (curr_gain[i] & 0x00F0) >> 4;
+ target.pga[i] = (curr_gain[i] & 0x0F00) >> 8;
+ target.txgm[i] = (curr_gain[i] & 0x7000) >> 12;
+ } else {
+ target.ipa[i] = curr_gain[i] & 0x0003;
+ target.pad[i] = (curr_gain[i] & 0x000C) >> 2;
+ target.pga[i] = (curr_gain[i] & 0x0070) >> 4;
+ target.txgm[i] = (curr_gain[i] & 0x0380) >> 7;
+ }
+ }
+ } else {
+ int i;
+ u16 index[2];
+
+ for (i = 0; i < 2; ++i) {
+ if (dev->phy.rev >= 3) {
+ enum ieee80211_band band =
+ b43_current_band(dev->wl);
+
+ if ((nphy->ipa2g_on && band == IEEE80211_BAND_2GHZ) ||
+ (nphy->ipa5g_on && band == IEEE80211_BAND_5GHZ)) {
+ table = NULL; //FIXME: = output of N PHY Get IPA GainTbl
+ } else {
+ if (band == IEEE80211_BAND_5GHZ) {
+ if (dev->phy.rev == 3)
+ table = NULL; //FIXME: N PHY TX Power Control - TX Gain Table Rev >= 3 (5 GHz)
+ else if (dev->phy.rev == 4)
+ table = NULL; //FIXME: N PHY TX Power Control - TX Gain Table Rev 4 (5 GHz)
+ else
+ table = NULL; //FIXME: N PHY TX Power Control - TX Gain Table Rev 5 (5 GHz)
+ } else {
+ table = NULL; //FIXME: N PHY TX Power Control - TX Gain Table Rev >= 3 (2.4 GHz)
+ }
+ }
+
+ target.ipa[i] = (table[index[i]] >> 16) & 0xF;
+ target.pad[i] = (table[index[i]] >> 20) & 0xF;
+ target.pga[i] = (table[index[i]] >> 24) & 0xF;
+ target.txgm[i] = (table[index[i]] >> 28) & 0xF;
+ } else {
+ table = NULL; //FIXME: N PHY TX Power Control - TX Gain Table Rev <= 2
+
+ target.ipa[i] = (table[index[i]] >> 16) & 0x3;
+ target.pad[i] = (table[index[i]] >> 18) & 0x3;
+ target.pga[i] = (table[index[i]] >> 20) & 0x7;
+ target.txgm[i] = (table[index[i]] >> 23) & 0x7;
+ }
+ }
+ }
+
+ return target;
+}
+
enum b43_nphy_rf_sequence {
B43_RFSEQ_RX2TX,
B43_RFSEQ_TX2RX,
diff --git a/drivers/net/wireless/b43/phy_n.h b/drivers/net/wireless/b43/phy_n.h
index 6ab07fc..e63c371 100644
--- a/drivers/net/wireless/b43/phy_n.h
+++ b/drivers/net/wireless/b43/phy_n.h
@@ -930,6 +930,7 @@ struct b43_phy_n {
u8 phyrxchain;
u8 mphase_cal_phase_id;
u32 deaf_count;
+ bool hang_avoid;
bool mute;
u16 classifier_state;
--
1.6.4.2
[-- Attachment #2: 0002-b43-N-PHY-b43_nphy_get_tx_gains.patch --]
[-- Type: application/octet-stream, Size: 3825 bytes --]
From 5c96b3de80f7d044c42808e8123ae3f50916d6fc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
Date: Wed, 6 Jan 2010 15:25:14 +0100
Subject: [PATCH 2/5] b43: N-PHY: b43_nphy_get_tx_gains
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
drivers/net/wireless/b43/phy_n.c | 75 ++++++++++++++++++++++++++++++++++++++
drivers/net/wireless/b43/phy_n.h | 1 +
2 files changed, 76 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 40d7b73..249caf0 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -30,6 +30,8 @@
#include "tables_nphy.h"
+struct nphy_txgains { u16 txgm[2]; u16 pga[2]; u16 pad[2]; u16 ipa[2]; };
+
void b43_nphy_set_rxantenna(struct b43_wldev *dev, int antenna)
{//TODO
}
@@ -405,6 +407,79 @@ static void b43_nphy_stay_carrier_search(struct b43_wldev *dev, bool enable)
}
}
+static struct nphy_txgains b43_nphy_get_tx_gains(struct b43_wldev *dev)
+{
+ struct b43_phy_n *nphy = dev->phy.n;
+
+ u16 curr_gain[2];
+ struct nphy_txgains target;
+ u32 *table = NULL;
+
+ if (nphy->txpwrctrl == 0) {
+ int i;
+
+ if (nphy->hang_avoid)
+ b43_nphy_stay_carrier_search(dev, true);
+ //TODO: Read an N PHY Table with ID 7, length 2, offset 0x110, width 16, and curr_gain
+ if (nphy->hang_avoid)
+ b43_nphy_stay_carrier_search(dev, false);
+
+ for (i = 0; i < 2; ++i) {
+ if (dev->phy.rev >= 3) {
+ target.ipa[i] = curr_gain[i] & 0x000F;
+ target.pad[i] = (curr_gain[i] & 0x00F0) >> 4;
+ target.pga[i] = (curr_gain[i] & 0x0F00) >> 8;
+ target.txgm[i] = (curr_gain[i] & 0x7000) >> 12;
+ } else {
+ target.ipa[i] = curr_gain[i] & 0x0003;
+ target.pad[i] = (curr_gain[i] & 0x000C) >> 2;
+ target.pga[i] = (curr_gain[i] & 0x0070) >> 4;
+ target.txgm[i] = (curr_gain[i] & 0x0380) >> 7;
+ }
+ }
+ } else {
+ int i;
+ u16 index[2];
+
+ for (i = 0; i < 2; ++i) {
+ if (dev->phy.rev >= 3) {
+ enum ieee80211_band band =
+ b43_current_band(dev->wl);
+
+ if ((nphy->ipa2g_on && band == IEEE80211_BAND_2GHZ) ||
+ (nphy->ipa5g_on && band == IEEE80211_BAND_5GHZ)) {
+ table = NULL; //FIXME: = output of N PHY Get IPA GainTbl
+ } else {
+ if (band == IEEE80211_BAND_5GHZ) {
+ if (dev->phy.rev == 3)
+ table = NULL; //FIXME: N PHY TX Power Control - TX Gain Table Rev >= 3 (5 GHz)
+ else if (dev->phy.rev == 4)
+ table = NULL; //FIXME: N PHY TX Power Control - TX Gain Table Rev 4 (5 GHz)
+ else
+ table = NULL; //FIXME: N PHY TX Power Control - TX Gain Table Rev 5 (5 GHz)
+ } else {
+ table = NULL; //FIXME: N PHY TX Power Control - TX Gain Table Rev >= 3 (2.4 GHz)
+ }
+ }
+
+ target.ipa[i] = (table[index[i]] >> 16) & 0xF;
+ target.pad[i] = (table[index[i]] >> 20) & 0xF;
+ target.pga[i] = (table[index[i]] >> 24) & 0xF;
+ target.txgm[i] = (table[index[i]] >> 28) & 0xF;
+ } else {
+ table = NULL; //FIXME: N PHY TX Power Control - TX Gain Table Rev <= 2
+
+ target.ipa[i] = (table[index[i]] >> 16) & 0x3;
+ target.pad[i] = (table[index[i]] >> 18) & 0x3;
+ target.pga[i] = (table[index[i]] >> 20) & 0x7;
+ target.txgm[i] = (table[index[i]] >> 23) & 0x7;
+ }
+ }
+ }
+
+ return target;
+}
+
enum b43_nphy_rf_sequence {
B43_RFSEQ_RX2TX,
B43_RFSEQ_TX2RX,
diff --git a/drivers/net/wireless/b43/phy_n.h b/drivers/net/wireless/b43/phy_n.h
index 6ab07fc..e63c371 100644
--- a/drivers/net/wireless/b43/phy_n.h
+++ b/drivers/net/wireless/b43/phy_n.h
@@ -930,6 +930,7 @@ struct b43_phy_n {
u8 phyrxchain;
u8 mphase_cal_phase_id;
u32 deaf_count;
+ bool hang_avoid;
bool mute;
u16 classifier_state;
--
1.6.4.2
next reply other threads:[~2010-01-06 15:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-06 15:40 Rafał Miłecki [this message]
2010-01-06 17:26 ` [PATCH 2/5] b43: N-PHY: b43_nphy_get_tx_gains Luis R. Rodriguez
2010-01-06 18:18 ` Rafał Miłecki
2010-01-06 18:22 ` Michael Buesch
2010-01-06 19:29 ` Rafał Miłecki
2010-01-06 19:36 ` Michael Buesch
2010-01-06 19:41 ` Rafał Miłecki
2010-01-06 19:51 ` Michael Buesch
2010-01-06 20:15 ` Rafał Miłecki
2010-01-06 20:57 ` [PATCH 2/5] b43: N-PHY: add b43_nphy_get_tx_gains (V2) Rafał Miłecki
2010-01-06 21:23 ` Larry Finger
2010-01-06 21:29 ` Rafał Miłecki
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=op.u54a59c89lhzdc@linux-g0th.site \
--to=zajec5@gmail.com \
--cc=bcm43xx-dev@lists.berlios.de \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/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.