Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 183687
b: refs/heads/master
c: b0022e1
h: refs/heads/master
i:
  183685: dfe170b
  183683: a440e97
  183679: 1670cc7
v: v3
  • Loading branch information
Rafał Miłecki authored and John W. Linville committed Jan 15, 2010
1 parent f91c871 commit 5a2d0d9
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 34a56f2cae865224829d3fa7b8d7ddeee139191f
refs/heads/master: b0022e15cc39abebd997fefa18cf3b6e141f76bd
87 changes: 85 additions & 2 deletions trunk/drivers/net/wireless/b43/phy_n.c
Original file line number Diff line number Diff line change
Expand Up @@ -1151,6 +1151,89 @@ static const u32 *b43_nphy_get_ipa_gain_table(struct b43_wldev *dev)
}
}

/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/GetTxGain */
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;
const u32 *table = NULL;

if (nphy->txpwrctrl == 0) {
int i;

if (nphy->hang_avoid)
b43_nphy_stay_in_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_in_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];
index[0] = (b43_phy_read(dev, B43_NPHY_C1_TXPCTL_STAT) &
B43_NPHY_TXPCTL_STAT_BIDX) >>
B43_NPHY_TXPCTL_STAT_BIDX_SHIFT;
index[1] = (b43_phy_read(dev, B43_NPHY_C2_TXPCTL_STAT) &
B43_NPHY_TXPCTL_STAT_BIDX) >>
B43_NPHY_TXPCTL_STAT_BIDX_SHIFT;

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 = b43_nphy_get_ipa_gain_table(dev);
} else {
if (band == IEEE80211_BAND_5GHZ) {
if (dev->phy.rev == 3)
table = b43_ntab_tx_gain_rev3_5ghz;
else if (dev->phy.rev == 4)
table = b43_ntab_tx_gain_rev4_5ghz;
else
table = b43_ntab_tx_gain_rev5plus_5ghz;
} else {
table = b43_ntab_tx_gain_rev3plus_2ghz;
}
}

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 = b43_ntab_tx_gain_rev0_1_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;
}

/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RestoreCal */
static void b43_nphy_restore_cal(struct b43_wldev *dev)
{
Expand Down Expand Up @@ -1376,7 +1459,7 @@ int b43_phy_initn(struct b43_wldev *dev)
do_cal = false;

if (do_cal) {
/* target = b43_nphy_get_tx_gains(dev); */
target = b43_nphy_get_tx_gains(dev);

if (nphy->antsel_type == 2)
;/*TODO NPHY Superswitch Init with argument 1*/
Expand All @@ -1388,7 +1471,7 @@ int b43_phy_initn(struct b43_wldev *dev)
nphy->cal_orig_pwr_idx[1] =
nphy->txpwrindex[1].index_internal;
/* TODO N PHY Pre Calibrate TX Gain */
/*target = b43_nphy_get_tx_gains(dev)*/
target = b43_nphy_get_tx_gains(dev);
}
}
}
Expand Down

0 comments on commit 5a2d0d9

Please sign in to comment.