Commit 39e971ef authored by Rafał Miłecki's avatar Rafał Miłecki Committed by John W. Linville

b43: PHY: drop own channel_freq (get it from chandef when needed)

Signed-off-by: default avatarRafał Miłecki <zajec5@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent ea42e71c
...@@ -269,7 +269,6 @@ struct b43_phy { ...@@ -269,7 +269,6 @@ struct b43_phy {
/* Current channel */ /* Current channel */
struct cfg80211_chan_def *chandef; struct cfg80211_chan_def *chandef;
unsigned int channel; unsigned int channel;
u16 channel_freq;
enum nl80211_channel_type channel_type; enum nl80211_channel_type channel_type;
/* PHY TX errors counter. */ /* PHY TX errors counter. */
......
...@@ -596,7 +596,7 @@ static void b43_phy_ht_tx_power_ctl_setup(struct b43_wldev *dev) ...@@ -596,7 +596,7 @@ static void b43_phy_ht_tx_power_ctl_setup(struct b43_wldev *dev)
u8 target[3]; u8 target[3];
s16 a1[3], b0[3], b1[3]; s16 a1[3], b0[3], b1[3];
u16 freq = dev->phy.channel_freq; u16 freq = dev->phy.chandef->chan->center_freq;
int i, c; int i, c;
if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
......
...@@ -798,6 +798,7 @@ static void b43_chantab_radio_2056_upload(struct b43_wldev *dev, ...@@ -798,6 +798,7 @@ static void b43_chantab_radio_2056_upload(struct b43_wldev *dev,
static void b43_radio_2056_setup(struct b43_wldev *dev, static void b43_radio_2056_setup(struct b43_wldev *dev,
const struct b43_nphy_channeltab_entry_rev3 *e) const struct b43_nphy_channeltab_entry_rev3 *e)
{ {
struct b43_phy *phy = &dev->phy;
struct ssb_sprom *sprom = dev->dev->bus_sprom; struct ssb_sprom *sprom = dev->dev->bus_sprom;
enum ieee80211_band band = b43_current_band(dev->wl); enum ieee80211_band band = b43_current_band(dev->wl);
u16 offset; u16 offset;
...@@ -909,7 +910,7 @@ static void b43_radio_2056_setup(struct b43_wldev *dev, ...@@ -909,7 +910,7 @@ static void b43_radio_2056_setup(struct b43_wldev *dev,
b43_radio_write(dev, offset | B2056_TX_PA_SPARE1, 0xee); b43_radio_write(dev, offset | B2056_TX_PA_SPARE1, 0xee);
} }
} else if (dev->phy.n->ipa5g_on && band == IEEE80211_BAND_5GHZ) { } else if (dev->phy.n->ipa5g_on && band == IEEE80211_BAND_5GHZ) {
u16 freq = dev->phy.channel_freq; u16 freq = phy->chandef->chan->center_freq;
if (freq < 5100) { if (freq < 5100) {
paa_boost = 0xA; paa_boost = 0xA;
pada_boost = 0x77; pada_boost = 0x77;
...@@ -1675,6 +1676,7 @@ static int b43_nphy_poll_rssi(struct b43_wldev *dev, enum n_rssi_type rssi_type, ...@@ -1675,6 +1676,7 @@ static int b43_nphy_poll_rssi(struct b43_wldev *dev, enum n_rssi_type rssi_type,
/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSICalRev3 */ /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSICalRev3 */
static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev) static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev)
{ {
struct b43_phy *phy = &dev->phy;
struct b43_phy_n *nphy = dev->phy.n; struct b43_phy_n *nphy = dev->phy.n;
u16 saved_regs_phy_rfctl[2]; u16 saved_regs_phy_rfctl[2];
...@@ -1897,9 +1899,9 @@ static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev) ...@@ -1897,9 +1899,9 @@ static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev)
/* Remember for which channel we store configuration */ /* Remember for which channel we store configuration */
if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
nphy->rssical_chanspec_2G.center_freq = dev->phy.channel_freq; nphy->rssical_chanspec_2G.center_freq = phy->chandef->chan->center_freq;
else else
nphy->rssical_chanspec_5G.center_freq = dev->phy.channel_freq; nphy->rssical_chanspec_5G.center_freq = phy->chandef->chan->center_freq;
/* End of calibration, restore configuration */ /* End of calibration, restore configuration */
b43_nphy_classifier(dev, 7, class); b43_nphy_classifier(dev, 7, class);
...@@ -2528,7 +2530,7 @@ static void b43_nphy_workarounds_rev7plus(struct b43_wldev *dev) ...@@ -2528,7 +2530,7 @@ static void b43_nphy_workarounds_rev7plus(struct b43_wldev *dev)
} }
} }
} else { } else {
u16 freq = phy->channel_freq; u16 freq = phy->chandef->chan->center_freq;
if ((freq >= 5180 && freq <= 5230) || if ((freq >= 5180 && freq <= 5230) ||
(freq >= 5745 && freq <= 5805)) { (freq >= 5745 && freq <= 5805)) {
b43_radio_write(dev, 0x7D, 0xFF); b43_radio_write(dev, 0x7D, 0xFF);
...@@ -3184,12 +3186,13 @@ static void b43_nphy_tx_power_ctrl(struct b43_wldev *dev, bool enable) ...@@ -3184,12 +3186,13 @@ static void b43_nphy_tx_power_ctrl(struct b43_wldev *dev, bool enable)
/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrFix */ /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrFix */
static void b43_nphy_tx_power_fix(struct b43_wldev *dev) static void b43_nphy_tx_power_fix(struct b43_wldev *dev)
{ {
struct b43_phy *phy = &dev->phy;
struct b43_phy_n *nphy = dev->phy.n; struct b43_phy_n *nphy = dev->phy.n;
struct ssb_sprom *sprom = dev->dev->bus_sprom; struct ssb_sprom *sprom = dev->dev->bus_sprom;
u8 txpi[2], bbmult, i; u8 txpi[2], bbmult, i;
u16 tmp, radio_gain, dac_gain; u16 tmp, radio_gain, dac_gain;
u16 freq = dev->phy.channel_freq; u16 freq = phy->chandef->chan->center_freq;
u32 txgain; u32 txgain;
/* u32 gaintbl; rev3+ */ /* u32 gaintbl; rev3+ */
...@@ -3474,6 +3477,7 @@ static void b43_nphy_tx_prepare_adjusted_power_table(struct b43_wldev *dev) ...@@ -3474,6 +3477,7 @@ static void b43_nphy_tx_prepare_adjusted_power_table(struct b43_wldev *dev)
/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlSetup */ /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlSetup */
static void b43_nphy_tx_power_ctl_setup(struct b43_wldev *dev) static void b43_nphy_tx_power_ctl_setup(struct b43_wldev *dev)
{ {
struct b43_phy *phy = &dev->phy;
struct b43_phy_n *nphy = dev->phy.n; struct b43_phy_n *nphy = dev->phy.n;
struct ssb_sprom *sprom = dev->dev->bus_sprom; struct ssb_sprom *sprom = dev->dev->bus_sprom;
...@@ -3483,7 +3487,7 @@ static void b43_nphy_tx_power_ctl_setup(struct b43_wldev *dev) ...@@ -3483,7 +3487,7 @@ static void b43_nphy_tx_power_ctl_setup(struct b43_wldev *dev)
s32 num, den, pwr; s32 num, den, pwr;
u32 regval[64]; u32 regval[64];
u16 freq = dev->phy.channel_freq; u16 freq = phy->chandef->chan->center_freq;
u16 tmp; u16 tmp;
u16 r; /* routing */ u16 r; /* routing */
u8 i, c; u8 i, c;
...@@ -4500,7 +4504,7 @@ static void b43_nphy_save_cal(struct b43_wldev *dev) ...@@ -4500,7 +4504,7 @@ static void b43_nphy_save_cal(struct b43_wldev *dev)
txcal_radio_regs[2] = b43_radio_read(dev, 0x8D); txcal_radio_regs[2] = b43_radio_read(dev, 0x8D);
txcal_radio_regs[3] = b43_radio_read(dev, 0xBC); txcal_radio_regs[3] = b43_radio_read(dev, 0xBC);
} }
iqcal_chanspec->center_freq = dev->phy.channel_freq; iqcal_chanspec->center_freq = dev->phy.chandef->chan->center_freq;
iqcal_chanspec->channel_type = dev->phy.channel_type; iqcal_chanspec->channel_type = dev->phy.channel_type;
b43_ntab_read_bulk(dev, B43_NTAB16(15, 80), 8, table); b43_ntab_read_bulk(dev, B43_NTAB16(15, 80), 8, table);
...@@ -4581,6 +4585,7 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev, ...@@ -4581,6 +4585,7 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev,
struct nphy_txgains target, struct nphy_txgains target,
bool full, bool mphase) bool full, bool mphase)
{ {
struct b43_phy *phy = &dev->phy;
struct b43_phy_n *nphy = dev->phy.n; struct b43_phy_n *nphy = dev->phy.n;
int i; int i;
int error = 0; int error = 0;
...@@ -4773,7 +4778,7 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev, ...@@ -4773,7 +4778,7 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev,
nphy->txiqlocal_bestc); nphy->txiqlocal_bestc);
nphy->txiqlocal_coeffsvalid = true; nphy->txiqlocal_coeffsvalid = true;
nphy->txiqlocal_chanspec.center_freq = nphy->txiqlocal_chanspec.center_freq =
dev->phy.channel_freq; phy->chandef->chan->center_freq;
nphy->txiqlocal_chanspec.channel_type = nphy->txiqlocal_chanspec.channel_type =
dev->phy.channel_type; dev->phy.channel_type;
} else { } else {
...@@ -4811,7 +4816,7 @@ static void b43_nphy_reapply_tx_cal_coeffs(struct b43_wldev *dev) ...@@ -4811,7 +4816,7 @@ static void b43_nphy_reapply_tx_cal_coeffs(struct b43_wldev *dev)
bool equal = true; bool equal = true;
if (!nphy->txiqlocal_coeffsvalid || if (!nphy->txiqlocal_coeffsvalid ||
nphy->txiqlocal_chanspec.center_freq != dev->phy.channel_freq || nphy->txiqlocal_chanspec.center_freq != dev->phy.chandef->chan->center_freq ||
nphy->txiqlocal_chanspec.channel_type != dev->phy.channel_type) nphy->txiqlocal_chanspec.channel_type != dev->phy.channel_type)
return; return;
...@@ -5502,7 +5507,6 @@ static int b43_nphy_set_channel(struct b43_wldev *dev, ...@@ -5502,7 +5507,6 @@ static int b43_nphy_set_channel(struct b43_wldev *dev,
/* Channel is set later in common code, but we need to set it on our /* Channel is set later in common code, but we need to set it on our
own to let this function's subcalls work properly. */ own to let this function's subcalls work properly. */
phy->channel = channel->hw_value; phy->channel = channel->hw_value;
phy->channel_freq = channel->center_freq;
if (b43_channel_type_is_40mhz(phy->channel_type) != if (b43_channel_type_is_40mhz(phy->channel_type) !=
b43_channel_type_is_40mhz(channel_type)) b43_channel_type_is_40mhz(channel_type))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment