Lines Matching +full:txpower +full:-

1 // SPDX-License-Identifier: GPL-2.0-or-later
6 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
14 driver Copyright(c) 2003 - 2004 Intel Corporation.
74 return frequencies_bg[channel - 1]; in channel2freq_bg()
101 struct b43legacy_phy *phy = &dev->phy; in b43legacy_radio_read16()
103 switch (phy->type) { in b43legacy_radio_read16()
105 if (phy->radio_ver == 0x2053) { in b43legacy_radio_read16()
110 } else if (phy->radio_ver == 0x2050) in b43legacy_radio_read16()
135 struct b43legacy_phy *phy = &dev->phy; in b43legacy_set_all_gains()
142 if (phy->rev <= 1) { in b43legacy_set_all_gains()
154 if (third != -1) { in b43legacy_set_all_gains()
171 struct b43legacy_phy *phy = &dev->phy; in b43legacy_set_original_gains()
178 if (phy->rev <= 1) { in b43legacy_set_original_gains()
193 b43legacy_ilt_write(dev, offset + i, i - start); in b43legacy_set_original_gains()
211 struct b43legacy_phy *phy = &dev->phy; in b43legacy_synth_pu_workaround()
215 if (phy->radio_ver != 0x2050 || phy->radio_rev >= 6) in b43legacy_synth_pu_workaround()
232 struct b43legacy_phy *phy = &dev->phy; in b43legacy_radio_aci_detect()
243 if (phy->aci_hw_rssi) in b43legacy_radio_aci_detect()
249 rssi -= 64; in b43legacy_radio_aci_detect()
253 temp -= 64; in b43legacy_radio_aci_detect()
266 struct b43legacy_phy *phy = &dev->phy; in b43legacy_radio_aci_scan()
268 unsigned int channel = phy->channel; in b43legacy_radio_aci_scan()
274 if (!((phy->type == B43legacy_PHYTYPE_G) && (phy->rev > 0))) in b43legacy_radio_aci_scan()
286 start = (channel > 5) ? channel - 5 : 1; in b43legacy_radio_aci_scan()
290 if (abs(channel - i) > 2) in b43legacy_radio_aci_scan()
291 ret[i-1] = b43legacy_radio_aci_detect(dev, i); in b43legacy_radio_aci_scan()
313 return ret[channel - 1]; in b43legacy_radio_aci_scan()
316 /* https://bcm-specs.sipsolutions.net/NRSSILookupTable */
323 /* https://bcm-specs.sipsolutions.net/NRSSILookupTable */
334 /* https://bcm-specs.sipsolutions.net/NRSSILookupTable */
342 tmp -= val; in b43legacy_nrssi_hw_update()
343 tmp = clamp_val(tmp, -32, 31); in b43legacy_nrssi_hw_update()
348 /* https://bcm-specs.sipsolutions.net/NRSSILookupTable */
351 struct b43legacy_phy *phy = &dev->phy; in b43legacy_nrssi_mem_update()
356 delta = 0x1F - phy->nrssi[0]; in b43legacy_nrssi_mem_update()
358 tmp = (i - delta) * phy->nrssislope; in b43legacy_nrssi_mem_update()
362 phy->nrssi_lt[i] = tmp; in b43legacy_nrssi_mem_update()
368 struct b43legacy_phy *phy = &dev->phy; in b43legacy_calc_nrssi_offset()
399 if (phy->rev >= 6) { in b43legacy_calc_nrssi_offset()
430 v47F -= 0x40; in b43legacy_calc_nrssi_offset()
432 for (i = 7; i >= 4; i--) { in b43legacy_calc_nrssi_offset()
438 v47F -= 0x40; in b43legacy_calc_nrssi_offset()
463 if (phy->analog == 0) in b43legacy_calc_nrssi_offset()
486 v47F -= 0x40; in b43legacy_calc_nrssi_offset()
487 if (v47F == -32) { in b43legacy_calc_nrssi_offset()
494 v47F -= 0x40; in b43legacy_calc_nrssi_offset()
495 if (v47F > -31 && saved == 0xFFFF) in b43legacy_calc_nrssi_offset()
505 if (phy->rev >= 6) { in b43legacy_calc_nrssi_offset()
525 if (phy->rev >= 6) { in b43legacy_calc_nrssi_offset()
538 struct b43legacy_phy *phy = &dev->phy; in b43legacy_calc_nrssi_slope()
544 switch (phy->type) { in b43legacy_calc_nrssi_slope()
562 tmp &= (phy->rev >= 5) ? 0x007F : 0x000F; in b43legacy_calc_nrssi_slope()
578 if (phy->analog >= 2) in b43legacy_calc_nrssi_slope()
580 else if (phy->analog == 0) in b43legacy_calc_nrssi_slope()
604 b43legacy_synth_pu_workaround(dev, phy->channel); in b43legacy_calc_nrssi_slope()
605 if (phy->analog != 0) in b43legacy_calc_nrssi_slope()
616 phy->nrssislope = 0x00010000; in b43legacy_calc_nrssi_slope()
618 phy->nrssislope = 0x00400000 / (nrssi0 - nrssi1); in b43legacy_calc_nrssi_slope()
620 if (nrssi0 <= -4) { in b43legacy_calc_nrssi_slope()
621 phy->nrssi[0] = nrssi0; in b43legacy_calc_nrssi_slope()
622 phy->nrssi[1] = nrssi1; in b43legacy_calc_nrssi_slope()
626 if (phy->radio_rev >= 9) in b43legacy_calc_nrssi_slope()
628 if (phy->radio_rev == 8) in b43legacy_calc_nrssi_slope()
648 if (phy->rev >= 3) { in b43legacy_calc_nrssi_slope()
660 switch (phy->rev) { in b43legacy_calc_nrssi_slope()
689 if (phy->rev >= 2) { in b43legacy_calc_nrssi_slope()
704 nrssi0 -= 0x0040; in b43legacy_calc_nrssi_slope()
709 if (phy->analog >= 2) in b43legacy_calc_nrssi_slope()
721 if (phy->rev >= 2) { in b43legacy_calc_nrssi_slope()
731 if (phy->radio_rev == 8) in b43legacy_calc_nrssi_slope()
745 nrssi1 -= 0x0040; in b43legacy_calc_nrssi_slope()
747 phy->nrssislope = 0x00010000; in b43legacy_calc_nrssi_slope()
749 phy->nrssislope = 0x00400000 / (nrssi0 - nrssi1); in b43legacy_calc_nrssi_slope()
750 if (nrssi0 >= -4) { in b43legacy_calc_nrssi_slope()
751 phy->nrssi[0] = nrssi1; in b43legacy_calc_nrssi_slope()
752 phy->nrssi[1] = nrssi0; in b43legacy_calc_nrssi_slope()
754 if (phy->rev >= 3) { in b43legacy_calc_nrssi_slope()
761 if (phy->rev >= 2) { in b43legacy_calc_nrssi_slope()
780 b43legacy_synth_pu_workaround(dev, phy->channel); in b43legacy_calc_nrssi_slope()
787 if (phy->rev >= 3) { in b43legacy_calc_nrssi_slope()
803 struct b43legacy_phy *phy = &dev->phy; in b43legacy_calc_nrssi_threshold()
810 switch (phy->type) { in b43legacy_calc_nrssi_threshold()
812 if (phy->radio_ver != 0x2050) in b43legacy_calc_nrssi_threshold()
814 if (!(dev->dev->bus->sprom.boardflags_lo & in b43legacy_calc_nrssi_threshold()
818 if (phy->radio_rev >= 6) { in b43legacy_calc_nrssi_threshold()
819 threshold = (phy->nrssi[1] - phy->nrssi[0]) * 32; in b43legacy_calc_nrssi_threshold()
820 threshold += 20 * (phy->nrssi[0] + 1); in b43legacy_calc_nrssi_threshold()
823 threshold = phy->nrssi[1] - 5; in b43legacy_calc_nrssi_threshold()
830 if (phy->radio_rev >= 6) { in b43legacy_calc_nrssi_threshold()
843 if (!phy->gmode || in b43legacy_calc_nrssi_threshold()
844 !(dev->dev->bus->sprom.boardflags_lo & in b43legacy_calc_nrssi_threshold()
848 tmp16 -= 0x40; in b43legacy_calc_nrssi_threshold()
858 if (phy->interfmode == in b43legacy_calc_nrssi_threshold()
862 } else if (!phy->aci_wlan_automatic && in b43legacy_calc_nrssi_threshold()
863 phy->aci_enable) { in b43legacy_calc_nrssi_threshold()
871 a = a * (phy->nrssi[1] - phy->nrssi[0]); in b43legacy_calc_nrssi_threshold()
872 a += (phy->nrssi[0] << 6); in b43legacy_calc_nrssi_threshold()
878 a = clamp_val(a, -31, 31); in b43legacy_calc_nrssi_threshold()
880 b = b * (phy->nrssi[1] - phy->nrssi[0]); in b43legacy_calc_nrssi_threshold()
881 b += (phy->nrssi[0] << 6); in b43legacy_calc_nrssi_threshold()
887 b = clamp_val(b, -31, 31); in b43legacy_calc_nrssi_threshold()
975 struct b43legacy_phy *phy = &dev->phy; in b43legacy_radio_interference_mitigation_enable()
980 u32 *stack = phy->interfstack; in b43legacy_radio_interference_mitigation_enable()
984 if (phy->rev != 1) { in b43legacy_radio_interference_mitigation_enable()
999 flipped -= 3; in b43legacy_radio_interference_mitigation_enable()
1053 phy->aci_enable = true; in b43legacy_radio_interference_mitigation_enable()
1057 if (phy->rev < 2) in b43legacy_radio_interference_mitigation_enable()
1076 if (phy->rev == 2) { in b43legacy_radio_interference_mitigation_enable()
1079 } else if (phy->rev >= 3) { in b43legacy_radio_interference_mitigation_enable()
1110 if (phy->rev < 2) in b43legacy_radio_interference_mitigation_enable()
1112 else if (phy->rev == 2) { in b43legacy_radio_interference_mitigation_enable()
1160 if (phy->rev >= 3) { in b43legacy_radio_interference_mitigation_enable()
1189 if (phy->rev >= 2) in b43legacy_radio_interference_mitigation_enable()
1196 if (phy->rev == 2) { in b43legacy_radio_interference_mitigation_enable()
1203 } else if (phy->rev >= 6) { in b43legacy_radio_interference_mitigation_enable()
1221 struct b43legacy_phy *phy = &dev->phy; in b43legacy_radio_interference_mitigation_disable()
1223 u32 *stack = phy->interfstack; in b43legacy_radio_interference_mitigation_disable()
1227 if (phy->rev != 1) { in b43legacy_radio_interference_mitigation_disable()
1241 if (!dev->bad_frames_preempt) in b43legacy_radio_interference_mitigation_disable()
1265 phy->aci_enable = false; in b43legacy_radio_interference_mitigation_disable()
1277 if (phy->rev >= 2) { in b43legacy_radio_interference_mitigation_disable()
1285 if (phy->rev == 2) { in b43legacy_radio_interference_mitigation_disable()
1288 } else if (phy->rev >= 3) { in b43legacy_radio_interference_mitigation_disable()
1325 struct b43legacy_phy *phy = &dev->phy; in b43legacy_radio_set_interference_mitigation()
1328 if ((phy->type != B43legacy_PHYTYPE_G) || in b43legacy_radio_set_interference_mitigation()
1329 (phy->rev == 0) || (!phy->gmode)) in b43legacy_radio_set_interference_mitigation()
1330 return -ENODEV; in b43legacy_radio_set_interference_mitigation()
1332 phy->aci_wlan_automatic = false; in b43legacy_radio_set_interference_mitigation()
1335 phy->aci_wlan_automatic = true; in b43legacy_radio_set_interference_mitigation()
1336 if (phy->aci_enable) in b43legacy_radio_set_interference_mitigation()
1346 return -EINVAL; in b43legacy_radio_set_interference_mitigation()
1349 currentmode = phy->interfmode; in b43legacy_radio_set_interference_mitigation()
1357 phy->aci_enable = false; in b43legacy_radio_set_interference_mitigation()
1358 phy->aci_hw_rssi = false; in b43legacy_radio_set_interference_mitigation()
1361 phy->interfmode = mode; in b43legacy_radio_set_interference_mitigation()
1384 struct b43legacy_phy *phy = &dev->phy; in b43legacy_get_812_value()
1386 u16 adj_loopback_gain = phy->loopback_gain[0]; in b43legacy_get_812_value()
1390 if (!phy->gmode) in b43legacy_get_812_value()
1393 if (phy->rev < 7 || !(dev->dev->bus->sprom.boardflags_lo in b43legacy_get_812_value()
1422 if (phy->radio_rev == 8) in b43legacy_get_812_value()
1427 adj_loopback_gain -= 0x46; in b43legacy_get_812_value()
1430 adj_loopback_gain -= 0x3A; in b43legacy_get_812_value()
1433 adj_loopback_gain -= 0x2E; in b43legacy_get_812_value()
1436 adj_loopback_gain -= 0x10; in b43legacy_get_812_value()
1440 u16 tmp = adj_loopback_gain - 6 * loop; in b43legacy_get_812_value()
1446 if (phy->rev >= 7 && dev->dev->bus->sprom.boardflags_lo in b43legacy_get_812_value()
1481 struct b43legacy_phy *phy = &dev->phy; in b43legacy_radio_init2050()
1496 if (phy->type == B43legacy_PHYTYPE_B) { in b43legacy_radio_init2050()
1502 if (phy->gmode) { in b43legacy_radio_init2050()
1522 if (phy->rev > 1) { /* loopback gain enabled */ in b43legacy_radio_init2050()
1525 if (phy->rev >= 3) in b43legacy_radio_init2050()
1536 if (phy->rev < 7 || in b43legacy_radio_init2050()
1537 !(dev->dev->bus->sprom.boardflags_lo in b43legacy_radio_init2050()
1554 if (phy->analog == 0) in b43legacy_radio_init2050()
1557 if (phy->analog >= 2) in b43legacy_radio_init2050()
1568 if (phy->type == B43legacy_PHYTYPE_B) in b43legacy_radio_init2050()
1571 if (phy->gmode) in b43legacy_radio_init2050()
1577 if (phy->gmode) in b43legacy_radio_init2050()
1585 if (phy->radio_rev == 8) in b43legacy_radio_init2050()
1599 if (phy->gmode) in b43legacy_radio_init2050()
1605 if (phy->gmode) in b43legacy_radio_init2050()
1611 if (phy->gmode) in b43legacy_radio_init2050()
1619 if (phy->gmode) in b43legacy_radio_init2050()
1640 if (phy->gmode) in b43legacy_radio_init2050()
1646 if (phy->gmode) in b43legacy_radio_init2050()
1652 if (phy->gmode) in b43legacy_radio_init2050()
1660 if (phy->gmode) in b43legacy_radio_init2050()
1681 if (phy->analog != 0) in b43legacy_radio_init2050()
1684 b43legacy_radio_selectchannel(dev, phy->channel, 1); in b43legacy_radio_init2050()
1685 if (phy->type == B43legacy_PHYTYPE_B) { in b43legacy_radio_init2050()
1689 if (phy->gmode) { in b43legacy_radio_init2050()
1700 if (phy->rev > 1) { in b43legacy_radio_init2050()
1733 struct b43legacy_phy *phy = &dev->phy; in b43legacy_radio_selectchannel()
1736 switch (phy->type) { in b43legacy_radio_selectchannel()
1746 /* TODO: Check if channel is valid - return -EINVAL if not */ in b43legacy_radio_selectchannel()
1754 if (dev->dev->bus->sprom.country_code == 5) /* JAPAN) */ in b43legacy_radio_selectchannel()
1776 phy->channel = channel; in b43legacy_radio_selectchannel()
1797 /* http://bcm-specs.sipsolutions.net/TX_Gain_Base_Band */
1798 static u16 b43legacy_get_txgain_base_band(u16 txpower) in b43legacy_get_txgain_base_band() argument
1802 B43legacy_WARN_ON(txpower > 63); in b43legacy_get_txgain_base_band()
1804 if (txpower >= 54) in b43legacy_get_txgain_base_band()
1806 else if (txpower >= 49) in b43legacy_get_txgain_base_band()
1808 else if (txpower >= 44) in b43legacy_get_txgain_base_band()
1816 /* http://bcm-specs.sipsolutions.net/TX_Gain_Radio_Frequency_Power_Amplifier */
1817 static u16 b43legacy_get_txgain_freq_power_amp(u16 txpower) in b43legacy_get_txgain_freq_power_amp() argument
1821 B43legacy_WARN_ON(txpower > 63); in b43legacy_get_txgain_freq_power_amp()
1823 if (txpower >= 32) in b43legacy_get_txgain_freq_power_amp()
1825 else if (txpower >= 25) in b43legacy_get_txgain_freq_power_amp()
1827 else if (txpower >= 20) in b43legacy_get_txgain_freq_power_amp()
1829 else if (txpower >= 12) in b43legacy_get_txgain_freq_power_amp()
1837 /* http://bcm-specs.sipsolutions.net/TX_Gain_Digital_Analog_Converter */
1838 static u16 b43legacy_get_txgain_dac(u16 txpower) in b43legacy_get_txgain_dac() argument
1842 B43legacy_WARN_ON(txpower > 63); in b43legacy_get_txgain_dac()
1844 if (txpower >= 54) in b43legacy_get_txgain_dac()
1845 ret = txpower - 53; in b43legacy_get_txgain_dac()
1846 else if (txpower >= 49) in b43legacy_get_txgain_dac()
1847 ret = txpower - 42; in b43legacy_get_txgain_dac()
1848 else if (txpower >= 44) in b43legacy_get_txgain_dac()
1849 ret = txpower - 37; in b43legacy_get_txgain_dac()
1850 else if (txpower >= 32) in b43legacy_get_txgain_dac()
1851 ret = txpower - 32; in b43legacy_get_txgain_dac()
1852 else if (txpower >= 25) in b43legacy_get_txgain_dac()
1853 ret = txpower - 20; in b43legacy_get_txgain_dac()
1854 else if (txpower >= 20) in b43legacy_get_txgain_dac()
1855 ret = txpower - 13; in b43legacy_get_txgain_dac()
1856 else if (txpower >= 12) in b43legacy_get_txgain_dac()
1857 ret = txpower - 8; in b43legacy_get_txgain_dac()
1859 ret = txpower; in b43legacy_get_txgain_dac()
1864 void b43legacy_radio_set_txpower_a(struct b43legacy_wldev *dev, u16 txpower) in b43legacy_radio_set_txpower_a() argument
1866 struct b43legacy_phy *phy = &dev->phy; in b43legacy_radio_set_txpower_a()
1872 txpower = clamp_val(txpower, 0, 63); in b43legacy_radio_set_txpower_a()
1874 pamp = b43legacy_get_txgain_freq_power_amp(txpower); in b43legacy_radio_set_txpower_a()
1879 base = b43legacy_get_txgain_base_band(txpower); in b43legacy_radio_set_txpower_a()
1886 dac = b43legacy_get_txgain_dac(txpower); in b43legacy_radio_set_txpower_a()
1892 phy->txpwr_offset = txpower; in b43legacy_radio_set_txpower_a()
1900 u16 txpower) in b43legacy_radio_set_txpower_bg() argument
1902 struct b43legacy_phy *phy = &dev->phy; in b43legacy_radio_set_txpower_bg()
1905 baseband_attenuation = phy->bbatt; in b43legacy_radio_set_txpower_bg()
1907 radio_attenuation = phy->rfatt; in b43legacy_radio_set_txpower_bg()
1908 if (txpower == 0xFFFF) in b43legacy_radio_set_txpower_bg()
1909 txpower = phy->txctl1; in b43legacy_radio_set_txpower_bg()
1910 phy->bbatt = baseband_attenuation; in b43legacy_radio_set_txpower_bg()
1911 phy->rfatt = radio_attenuation; in b43legacy_radio_set_txpower_bg()
1912 phy->txctl1 = txpower; in b43legacy_radio_set_txpower_bg()
1915 if (phy->radio_rev < 6) in b43legacy_radio_set_txpower_bg()
1919 B43legacy_WARN_ON(txpower > 7); in b43legacy_radio_set_txpower_bg()
1925 if (phy->radio_ver == 0x2050) in b43legacy_radio_set_txpower_bg()
1928 & ~0x0070) | ((txpower << 4) & 0x0070)); in b43legacy_radio_set_txpower_bg()
1930 if (phy->type == B43legacy_PHYTYPE_G) in b43legacy_radio_set_txpower_bg()
1936 struct b43legacy_phy *phy = &dev->phy; in b43legacy_default_baseband_attenuation()
1938 if (phy->radio_ver == 0x2050 && phy->radio_rev < 6) in b43legacy_default_baseband_attenuation()
1945 struct b43legacy_phy *phy = &dev->phy; in b43legacy_default_radio_attenuation()
1948 switch (phy->radio_ver) { in b43legacy_default_radio_attenuation()
1950 switch (phy->radio_rev) { in b43legacy_default_radio_attenuation()
1957 switch (phy->radio_rev) { in b43legacy_default_radio_attenuation()
1962 if (phy->type == B43legacy_PHYTYPE_G) { in b43legacy_default_radio_attenuation()
1964 dev->dev->bus->boardinfo.type == 0x421 && in b43legacy_default_radio_attenuation()
1965 dev->dev->bus->sprom.board_rev >= 30) in b43legacy_default_radio_attenuation()
1968 dev->dev->bus->boardinfo.type == 0x416) in b43legacy_default_radio_attenuation()
1974 dev->dev->bus->boardinfo.type == 0x421 && in b43legacy_default_radio_attenuation()
1975 dev->dev->bus->sprom.board_rev >= 30) in b43legacy_default_radio_attenuation()
1982 if (phy->type == B43legacy_PHYTYPE_G) { in b43legacy_default_radio_attenuation()
1984 dev->dev->bus->boardinfo.type == 0x421 && in b43legacy_default_radio_attenuation()
1985 dev->dev->bus->sprom.board_rev >= 30) in b43legacy_default_radio_attenuation()
1988 dev->dev->bus->boardinfo.type == in b43legacy_default_radio_attenuation()
1991 else if (dev->dev->bus->chip_id == 0x4320) in b43legacy_default_radio_attenuation()
2018 dev->dev->bus->boardinfo.type == 0x421) { in b43legacy_default_radio_attenuation()
2019 if (dev->dev->bus->sprom.board_rev < 0x43) in b43legacy_default_radio_attenuation()
2021 else if (dev->dev->bus->sprom.board_rev < 0x51) in b43legacy_default_radio_attenuation()
2032 struct b43legacy_phy *phy = &dev->phy; in b43legacy_default_txctl1()
2034 if (phy->radio_ver != 0x2050) in b43legacy_default_txctl1()
2036 if (phy->radio_rev == 1) in b43legacy_default_txctl1()
2038 if (phy->radio_rev < 6) in b43legacy_default_txctl1()
2040 if (phy->radio_rev == 8) in b43legacy_default_txctl1()
2047 struct b43legacy_phy *phy = &dev->phy; in b43legacy_radio_turn_on()
2053 if (phy->radio_on) in b43legacy_radio_turn_on()
2056 switch (phy->type) { in b43legacy_radio_turn_on()
2062 (phy->gmode ? 0x00C0 : 0x0000)); in b43legacy_radio_turn_on()
2063 if (phy->radio_off_context.valid) { in b43legacy_radio_turn_on()
2066 phy->radio_off_context.rfover); in b43legacy_radio_turn_on()
2068 phy->radio_off_context.rfoverval); in b43legacy_radio_turn_on()
2069 phy->radio_off_context.valid = false; in b43legacy_radio_turn_on()
2071 channel = phy->channel; in b43legacy_radio_turn_on()
2080 phy->radio_on = true; in b43legacy_radio_turn_on()
2085 struct b43legacy_phy *phy = &dev->phy; in b43legacy_radio_turn_off()
2087 if (!phy->radio_on && !force) in b43legacy_radio_turn_off()
2090 if (phy->type == B43legacy_PHYTYPE_G && dev->dev->id.revision >= 5) { in b43legacy_radio_turn_off()
2096 phy->radio_off_context.rfover = rfover; in b43legacy_radio_turn_off()
2097 phy->radio_off_context.rfoverval = rfoverval; in b43legacy_radio_turn_off()
2098 phy->radio_off_context.valid = true; in b43legacy_radio_turn_off()
2105 phy->radio_on = false; in b43legacy_radio_turn_off()
2106 b43legacydbg(dev->wl, "Radio initialized\n"); in b43legacy_radio_turn_off()
2111 struct b43legacy_phy *phy = &dev->phy; in b43legacy_radio_clear_tssi()
2113 switch (phy->type) { in b43legacy_radio_clear_tssi()