.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | |
---|
3 | 4 | Broadcom B43 wireless driver |
---|
.. | .. |
---|
6 | 7 | Copyright (c) 2008-2009 Michael Buesch <m@bues.ch> |
---|
7 | 8 | Copyright (c) 2009 Gábor Stefanik <netrolller.3d@gmail.com> |
---|
8 | 9 | |
---|
9 | | - This program is free software; you can redistribute it and/or modify |
---|
10 | | - it under the terms of the GNU General Public License as published by |
---|
11 | | - the Free Software Foundation; either version 2 of the License, or |
---|
12 | | - (at your option) any later version. |
---|
13 | | - |
---|
14 | | - This program is distributed in the hope that it will be useful, |
---|
15 | | - but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | | - GNU General Public License for more details. |
---|
18 | | - |
---|
19 | | - You should have received a copy of the GNU General Public License |
---|
20 | | - along with this program; see the file COPYING. If not, write to |
---|
21 | | - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, |
---|
22 | | - Boston, MA 02110-1301, USA. |
---|
23 | 10 | |
---|
24 | 11 | */ |
---|
25 | 12 | |
---|
| 13 | +#include <linux/cordic.h> |
---|
26 | 14 | #include <linux/slab.h> |
---|
27 | 15 | |
---|
28 | 16 | #include "b43.h" |
---|
.. | .. |
---|
82 | 70 | dev->phy.lp = NULL; |
---|
83 | 71 | } |
---|
84 | 72 | |
---|
85 | | -/* http://bcm-v4.sipsolutions.net/802.11/PHY/LP/ReadBandSrom */ |
---|
| 73 | +/* https://bcm-v4.sipsolutions.net/802.11/PHY/LP/ReadBandSrom */ |
---|
86 | 74 | static void lpphy_read_band_sprom(struct b43_wldev *dev) |
---|
87 | 75 | { |
---|
88 | 76 | struct ssb_sprom *sprom = dev->dev->bus_sprom; |
---|
.. | .. |
---|
1780 | 1768 | { |
---|
1781 | 1769 | struct b43_phy_lp *lpphy = dev->phy.lp; |
---|
1782 | 1770 | u16 buf[64]; |
---|
1783 | | - int i, samples = 0, angle = 0; |
---|
| 1771 | + int i, samples = 0, theta = 0; |
---|
1784 | 1772 | int rotation = (((36 * freq) / 20) << 16) / 100; |
---|
1785 | | - struct b43_c32 sample; |
---|
| 1773 | + struct cordic_iq sample; |
---|
1786 | 1774 | |
---|
1787 | 1775 | lpphy->tx_tone_freq = freq; |
---|
1788 | 1776 | |
---|
.. | .. |
---|
1798 | 1786 | } |
---|
1799 | 1787 | |
---|
1800 | 1788 | for (i = 0; i < samples; i++) { |
---|
1801 | | - sample = b43_cordic(angle); |
---|
1802 | | - angle += rotation; |
---|
1803 | | - buf[i] = CORDIC_CONVERT((sample.i * max) & 0xFF) << 8; |
---|
1804 | | - buf[i] |= CORDIC_CONVERT((sample.q * max) & 0xFF); |
---|
| 1789 | + sample = cordic_calc_iq(CORDIC_FIXED(theta)); |
---|
| 1790 | + theta += rotation; |
---|
| 1791 | + buf[i] = CORDIC_FLOAT((sample.i * max) & 0xFF) << 8; |
---|
| 1792 | + buf[i] |= CORDIC_FLOAT((sample.q * max) & 0xFF); |
---|
1805 | 1793 | } |
---|
1806 | 1794 | |
---|
1807 | 1795 | b43_lptab_write_bulk(dev, B43_LPTAB16(5, 0), samples, buf); |
---|
.. | .. |
---|
1825 | 1813 | } |
---|
1826 | 1814 | |
---|
1827 | 1815 | |
---|
1828 | | -static void lpphy_papd_cal(struct b43_wldev *dev, struct lpphy_tx_gains gains, |
---|
1829 | | - int mode, bool useindex, u8 index) |
---|
1830 | | -{ |
---|
1831 | | - //TODO |
---|
1832 | | -} |
---|
1833 | | - |
---|
1834 | 1816 | static void lpphy_papd_cal_txpwr(struct b43_wldev *dev) |
---|
1835 | 1817 | { |
---|
1836 | 1818 | struct b43_phy_lp *lpphy = dev->phy.lp; |
---|
.. | .. |
---|
1846 | 1828 | old_bbmult = lpphy_get_bb_mult(dev); |
---|
1847 | 1829 | |
---|
1848 | 1830 | lpphy_set_tx_power_control(dev, B43_LPPHY_TXPCTL_OFF); |
---|
1849 | | - |
---|
1850 | | - if (dev->dev->chip_id == 0x4325 && dev->dev->chip_rev == 0) |
---|
1851 | | - lpphy_papd_cal(dev, oldgains, 0, 1, 30); |
---|
1852 | | - else |
---|
1853 | | - lpphy_papd_cal(dev, oldgains, 0, 1, 65); |
---|
1854 | 1831 | |
---|
1855 | 1832 | if (old_afe_ovr) |
---|
1856 | 1833 | lpphy_set_tx_gains(dev, oldgains); |
---|