Skip to content

Commit c7d6431

Browse files
rmileckilinvjw
authored andcommitted
b43: N-PHY: determine various PHY params
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 66d80a5 commit c7d6431

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

drivers/net/wireless/b43/phy_n.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4062,10 +4062,13 @@ static void b43_nphy_op_prepare_structs(struct b43_wldev *dev)
40624062
{
40634063
struct b43_phy *phy = &dev->phy;
40644064
struct b43_phy_n *nphy = phy->n;
4065+
struct ssb_sprom *sprom = dev->dev->bus_sprom;
40654066

40664067
memset(nphy, 0, sizeof(*nphy));
40674068

40684069
nphy->hang_avoid = (phy->rev == 3 || phy->rev == 4);
4070+
nphy->spur_avoid = (phy->rev >= 3) ?
4071+
B43_SPUR_AVOID_AUTO : B43_SPUR_AVOID_DISABLE;
40694072
nphy->gain_boost = true; /* this way we follow wl, assume it is true */
40704073
nphy->txrx_chain = 2; /* sth different than 0 and 1 for now */
40714074
nphy->phyrxchain = 3; /* to avoid b43_nphy_set_rx_core_state like wl */
@@ -4074,6 +4077,38 @@ static void b43_nphy_op_prepare_structs(struct b43_wldev *dev)
40744077
* 0x7f == 127 and we check for 128 when restoring TX pwr ctl. */
40754078
nphy->tx_pwr_idx[0] = 128;
40764079
nphy->tx_pwr_idx[1] = 128;
4080+
4081+
/* Hardware TX power control and 5GHz power gain */
4082+
nphy->txpwrctrl = false;
4083+
nphy->pwg_gain_5ghz = false;
4084+
if (dev->phy.rev >= 3 ||
4085+
(dev->dev->board_vendor == PCI_VENDOR_ID_APPLE &&
4086+
(dev->dev->core_rev == 11 || dev->dev->core_rev == 12))) {
4087+
nphy->txpwrctrl = true;
4088+
nphy->pwg_gain_5ghz = true;
4089+
} else if (sprom->revision >= 4) {
4090+
if (dev->phy.rev >= 2 &&
4091+
(sprom->boardflags2_lo & B43_BFL2_TXPWRCTRL_EN)) {
4092+
nphy->txpwrctrl = true;
4093+
#ifdef CONFIG_B43_SSB
4094+
if (dev->dev->bus_type == B43_BUS_SSB &&
4095+
dev->dev->sdev->bus->bustype == SSB_BUSTYPE_PCI) {
4096+
struct pci_dev *pdev =
4097+
dev->dev->sdev->bus->host_pci;
4098+
if (pdev->device == 0x4328 ||
4099+
pdev->device == 0x432a)
4100+
nphy->pwg_gain_5ghz = true;
4101+
}
4102+
#endif
4103+
} else if (sprom->boardflags2_lo & B43_BFL2_5G_PWRGAIN) {
4104+
nphy->pwg_gain_5ghz = true;
4105+
}
4106+
}
4107+
4108+
if (dev->phy.rev >= 3) {
4109+
nphy->ipa2g_on = sprom->fem.ghz2.extpa_gain == 2;
4110+
nphy->ipa5g_on = sprom->fem.ghz5.extpa_gain == 2;
4111+
}
40774112
}
40784113

40794114
static void b43_nphy_op_free(struct b43_wldev *dev)

drivers/net/wireless/b43/phy_n.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,12 @@
716716

717717
struct b43_wldev;
718718

719+
enum b43_nphy_spur_avoid {
720+
B43_SPUR_AVOID_DISABLE,
721+
B43_SPUR_AVOID_AUTO,
722+
B43_SPUR_AVOID_FORCE,
723+
};
724+
719725
struct b43_chanspec {
720726
u16 center_freq;
721727
enum nl80211_channel_type channel_type;
@@ -785,6 +791,7 @@ struct b43_phy_n {
785791
u16 mphase_txcal_bestcoeffs[11];
786792

787793
bool txpwrctrl;
794+
bool pwg_gain_5ghz;
788795
u8 tx_pwr_idx[2];
789796
u16 adj_pwr_tbl[84];
790797
u16 txcal_bbmult;
@@ -803,6 +810,7 @@ struct b43_phy_n {
803810
u16 classifier_state;
804811
u16 clip_state[2];
805812

813+
enum b43_nphy_spur_avoid spur_avoid;
806814
bool aband_spurwar_en;
807815
bool gband_spurwar_en;
808816

0 commit comments

Comments
 (0)