Skip to content

Commit a68c356

Browse files
rmileckilinvjw
authored andcommitted
b43: N-PHY: add RF power tables for radio 0x2057 revs 9 & 14
Don't write them as we don't have gains configured correctly yet. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 33df85f commit a68c356

3 files changed

Lines changed: 87 additions & 3 deletions

File tree

‎drivers/net/wireless/b43/phy_n.c‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4235,8 +4235,9 @@ static void b43_nphy_tx_gain_table_upload(struct b43_wldev *dev)
42354235

42364236
const u32 *table = NULL;
42374237
u32 rfpwr_offset;
4238-
u8 pga_gain;
4238+
u8 pga_gain, pad_gain;
42394239
int i;
4240+
const s16 *uninitialized_var(rf_pwr_offset_table);
42404241

42414242
table = b43_nphy_get_tx_gain_table(dev);
42424243
if (!table)
@@ -4252,13 +4253,27 @@ static void b43_nphy_tx_gain_table_upload(struct b43_wldev *dev)
42524253
nphy->gmval = (table[0] >> 16) & 0x7000;
42534254
#endif
42544255

4256+
if (phy->rev >= 19) {
4257+
return;
4258+
} else if (phy->rev >= 7) {
4259+
rf_pwr_offset_table = b43_ntab_get_rf_pwr_offset_table(dev);
4260+
if (!rf_pwr_offset_table)
4261+
return;
4262+
/* TODO: Enable this once we have gains configured */
4263+
return;
4264+
}
4265+
42554266
for (i = 0; i < 128; i++) {
42564267
if (phy->rev >= 19) {
42574268
/* TODO */
42584269
return;
42594270
} else if (phy->rev >= 7) {
4260-
/* TODO */
4261-
return;
4271+
pga_gain = (table[i] >> 24) & 0xf;
4272+
pad_gain = (table[i] >> 19) & 0x1f;
4273+
if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
4274+
rfpwr_offset = rf_pwr_offset_table[pad_gain];
4275+
else
4276+
rfpwr_offset = rf_pwr_offset_table[pga_gain];
42624277
} else {
42634278
pga_gain = (table[i] >> 24) & 0xF;
42644279
if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)

‎drivers/net/wireless/b43/tables_nphy.c‎

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2878,6 +2878,40 @@ const s8 b43_ntab_papd_pga_gain_delta_ipa_2g[] = {
28782878
-54, -46, -39, -31, -23, -15, -8, 0
28792879
};
28802880

2881+
/* Extracted from MMIO dump of 6.30.223.248
2882+
* Entries: 0, 15, 17, 21, 24, 26, 27, 29, 30 were guessed
2883+
*/
2884+
static const s16 b43_ntab_rf_pwr_offset_2057_rev9_2g[] = {
2885+
-133, -133, -107, -92, -81,
2886+
-73, -66, -61, -56, -52,
2887+
-48, -44, -41, -37, -34,
2888+
-31, -28, -25, -22, -19,
2889+
-17, -14, -12, -10, -9,
2890+
-7, -5, -4, -3, -2,
2891+
-1, 0,
2892+
};
2893+
2894+
/* Extracted from MMIO dump of 6.30.223.248 */
2895+
static const s16 b43_ntab_rf_pwr_offset_2057_rev9_5g[] = {
2896+
-101, -94, -86, -79, -72,
2897+
-65, -57, -50, -42, -35,
2898+
-28, -21, -16, -9, -4,
2899+
0,
2900+
};
2901+
2902+
/* Extracted from MMIO dump of 6.30.223.248
2903+
* Entries: 0, 26, 28, 29, 30, 31 were guessed
2904+
*/
2905+
static const s16 b43_ntab_rf_pwr_offset_2057_rev14_2g[] = {
2906+
-111, -111, -111, -84, -70,
2907+
-59, -52, -45, -40, -36,
2908+
-32, -29, -26, -23, -21,
2909+
-18, -16, -15, -13, -11,
2910+
-10, -8, -7, -6, -5,
2911+
-4, -4, -3, -3, -2,
2912+
-2, -1,
2913+
};
2914+
28812915
const u16 tbl_iqcal_gainparams[2][9][8] = {
28822916
{
28832917
{ 0x000, 0, 0, 2, 0x69, 0x69, 0x69, 0x69 },
@@ -3708,6 +3742,39 @@ const u32 *b43_nphy_get_tx_gain_table(struct b43_wldev *dev)
37083742
}
37093743
}
37103744

3745+
const s16 *b43_ntab_get_rf_pwr_offset_table(struct b43_wldev *dev)
3746+
{
3747+
struct b43_phy *phy = &dev->phy;
3748+
3749+
if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
3750+
switch (phy->rev) {
3751+
case 17:
3752+
if (phy->radio_rev == 14)
3753+
return b43_ntab_rf_pwr_offset_2057_rev14_2g;
3754+
break;
3755+
case 16:
3756+
if (phy->radio_rev == 9)
3757+
return b43_ntab_rf_pwr_offset_2057_rev9_2g;
3758+
break;
3759+
}
3760+
3761+
b43err(dev->wl,
3762+
"No 2GHz RF power table available for this device\n");
3763+
return NULL;
3764+
} else {
3765+
switch (phy->rev) {
3766+
case 16:
3767+
if (phy->radio_rev == 9)
3768+
return b43_ntab_rf_pwr_offset_2057_rev9_5g;
3769+
break;
3770+
}
3771+
3772+
b43err(dev->wl,
3773+
"No 5GHz RF power table available for this device\n");
3774+
return NULL;
3775+
}
3776+
}
3777+
37113778
struct nphy_gain_ctl_workaround_entry *b43_nphy_get_gain_ctl_workaround_ent(
37123779
struct b43_wldev *dev, bool ghz5, bool ext_lna)
37133780
{

‎drivers/net/wireless/b43/tables_nphy.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ void b43_nphy_tables_init(struct b43_wldev *dev);
191191

192192
const u32 *b43_nphy_get_tx_gain_table(struct b43_wldev *dev);
193193

194+
const s16 *b43_ntab_get_rf_pwr_offset_table(struct b43_wldev *dev);
195+
194196
extern const s8 b43_ntab_papd_pga_gain_delta_ipa_2g[];
195197

196198
extern const u16 tbl_iqcal_gainparams[2][9][8];

0 commit comments

Comments
 (0)