Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a68c356b authored by Rafał Miłecki's avatar Rafał Miłecki Committed by John W. Linville
Browse files

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: default avatarRafał Miłecki <zajec5@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 33df85f6
Loading
Loading
Loading
Loading
+18 −3
Original line number Original line Diff line number Diff line
@@ -4235,8 +4235,9 @@ static void b43_nphy_tx_gain_table_upload(struct b43_wldev *dev)


	const u32 *table = NULL;
	const u32 *table = NULL;
	u32 rfpwr_offset;
	u32 rfpwr_offset;
	u8 pga_gain;
	u8 pga_gain, pad_gain;
	int i;
	int i;
	const s16 *uninitialized_var(rf_pwr_offset_table);


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


	for (i = 0; i < 128; i++) {
	if (phy->rev >= 19) {
	if (phy->rev >= 19) {
			/* TODO */
		return;
		return;
	} else if (phy->rev >= 7) {
	} else if (phy->rev >= 7) {
		rf_pwr_offset_table = b43_ntab_get_rf_pwr_offset_table(dev);
		if (!rf_pwr_offset_table)
			return;
		/* TODO: Enable this once we have gains configured */
		return;
	}

	for (i = 0; i < 128; i++) {
		if (phy->rev >= 19) {
			/* TODO */
			/* TODO */
			return;
			return;
		} else if (phy->rev >= 7) {
			pga_gain = (table[i] >> 24) & 0xf;
			pad_gain = (table[i] >> 19) & 0x1f;
			if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
				rfpwr_offset = rf_pwr_offset_table[pad_gain];
			else
				rfpwr_offset = rf_pwr_offset_table[pga_gain];
		} else {
		} else {
			pga_gain = (table[i] >> 24) & 0xF;
			pga_gain = (table[i] >> 24) & 0xF;
			if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
			if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
+67 −0
Original line number Original line Diff line number Diff line
@@ -2878,6 +2878,40 @@ const s8 b43_ntab_papd_pga_gain_delta_ipa_2g[] = {
	-54, -46, -39, -31, -23, -15, -8, 0
	-54, -46, -39, -31, -23, -15, -8, 0
};
};


/* Extracted from MMIO dump of 6.30.223.248
 * Entries: 0, 15, 17, 21, 24, 26, 27, 29, 30 were guessed
 */
static const s16 b43_ntab_rf_pwr_offset_2057_rev9_2g[] = {
	-133, -133, -107, -92, -81,
	-73, -66, -61, -56, -52,
	-48, -44, -41, -37, -34,
	-31, -28, -25, -22, -19,
	-17, -14, -12, -10, -9,
	-7, -5, -4, -3, -2,
	-1, 0,
};

/* Extracted from MMIO dump of 6.30.223.248 */
static const s16 b43_ntab_rf_pwr_offset_2057_rev9_5g[] = {
	-101, -94, -86, -79, -72,
	-65, -57, -50, -42, -35,
	-28, -21, -16, -9, -4,
	0,
};

/* Extracted from MMIO dump of 6.30.223.248
 * Entries: 0, 26, 28, 29, 30, 31 were guessed
 */
static const s16 b43_ntab_rf_pwr_offset_2057_rev14_2g[] = {
	-111, -111, -111, -84, -70,
	-59, -52, -45, -40, -36,
	-32, -29, -26, -23, -21,
	-18, -16, -15, -13, -11,
	-10, -8, -7, -6, -5,
	-4, -4, -3, -3, -2,
	-2, -1,
};

const u16 tbl_iqcal_gainparams[2][9][8] = {
const u16 tbl_iqcal_gainparams[2][9][8] = {
	{
	{
		{ 0x000, 0, 0, 2, 0x69, 0x69, 0x69, 0x69 },
		{ 0x000, 0, 0, 2, 0x69, 0x69, 0x69, 0x69 },
@@ -3708,6 +3742,39 @@ const u32 *b43_nphy_get_tx_gain_table(struct b43_wldev *dev)
	}
	}
}
}


const s16 *b43_ntab_get_rf_pwr_offset_table(struct b43_wldev *dev)
{
	struct b43_phy *phy = &dev->phy;

	if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
		switch (phy->rev) {
		case 17:
			if (phy->radio_rev == 14)
				return b43_ntab_rf_pwr_offset_2057_rev14_2g;
			break;
		case 16:
			if (phy->radio_rev == 9)
				return b43_ntab_rf_pwr_offset_2057_rev9_2g;
			break;
		}

		b43err(dev->wl,
		       "No 2GHz RF power table available for this device\n");
		return NULL;
	} else {
		switch (phy->rev) {
		case 16:
			if (phy->radio_rev == 9)
				return b43_ntab_rf_pwr_offset_2057_rev9_5g;
			break;
		}

		b43err(dev->wl,
		       "No 5GHz RF power table available for this device\n");
		return NULL;
	}
}

struct nphy_gain_ctl_workaround_entry *b43_nphy_get_gain_ctl_workaround_ent(
struct nphy_gain_ctl_workaround_entry *b43_nphy_get_gain_ctl_workaround_ent(
	struct b43_wldev *dev, bool ghz5, bool ext_lna)
	struct b43_wldev *dev, bool ghz5, bool ext_lna)
{
{
+2 −0
Original line number Original line Diff line number Diff line
@@ -191,6 +191,8 @@ void b43_nphy_tables_init(struct b43_wldev *dev);


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


const s16 *b43_ntab_get_rf_pwr_offset_table(struct b43_wldev *dev);

extern const s8 b43_ntab_papd_pga_gain_delta_ipa_2g[];
extern const s8 b43_ntab_papd_pga_gain_delta_ipa_2g[];


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