55 #ifdef CONFIG_B43_PHY_N
60 #ifdef CONFIG_B43_PHY_LP
65 #ifdef CONFIG_B43_PHY_HT
70 #ifdef CONFIG_B43_PHY_LCN
78 err = phy->
ops->allocate(dev);
87 dev->
phy.ops->free(dev);
100 err = ops->
init(dev);
102 b43err(dev->
wl,
"PHY init failed\n");
109 b43err(dev->
wl,
"PHY init: Channel switch to default failed\n");
135 if (!dev->
phy.hardware_power_control)
137 if (!dev->
phy.ops->supports_hwpctl)
139 return dev->
phy.ops->supports_hwpctl(dev);
148 dev->
phy.radio_locked =
true;
166 dev->
phy.radio_locked =
false;
181 dev->
phy.phy_locked =
true;
193 dev->
phy.phy_locked =
false;
201 static inline void assert_mac_suspended(
struct b43_wldev *
dev)
207 b43dbg(dev->
wl,
"PHY/RADIO register access with "
215 assert_mac_suspended(dev);
216 return dev->
phy.ops->radio_read(dev, reg);
221 assert_mac_suspended(dev);
222 dev->
phy.ops->radio_write(dev, reg, value);
249 for (i = 0; i < timeout; i +=
delay) {
251 if ((val & mask) == value)
260 assert_mac_suspended(dev);
261 dev->
phy.writes_counter = 0;
262 return dev->
phy.ops->phy_read(dev, reg);
267 assert_mac_suspended(dev);
268 dev->
phy.ops->phy_write(dev, reg, value);
271 dev->
phy.writes_counter = 0;
277 assert_mac_suspended(dev);
278 dev->
phy.ops->phy_write(dev, destreg,
279 dev->
phy.ops->phy_read(dev, srcreg));
284 if (dev->
phy.ops->phy_maskset) {
285 assert_mac_suspended(dev);
286 dev->
phy.ops->phy_maskset(dev, offset, mask, 0);
295 if (dev->
phy.ops->phy_maskset) {
296 assert_mac_suspended(dev);
297 dev->
phy.ops->phy_maskset(dev, offset, 0xFFFF,
set);
306 if (dev->
phy.ops->phy_maskset) {
307 assert_mac_suspended(dev);
308 dev->
phy.ops->phy_maskset(dev, offset, mask,
set);
318 u16 channelcookie, savedcookie;
322 new_channel = phy->
ops->get_default_chan(dev);
327 channelcookie = new_channel;
337 err = phy->
ops->switch_channel(dev, new_channel);
339 goto err_restore_cookie;
341 dev->
phy.channel = new_channel;
359 phy->
ops->software_rfkill(dev, blocked);
379 dev->
phy.ops->adjust_txpower(dev);
416 unsigned int a,
b,
c,
d;
422 b = (tmp >> 8) & 0xFF;
423 c = (tmp >> 16) & 0xFF;
424 d = (tmp >> 24) & 0xFF;
443 average = (a + b + c + d + 2) / 4;
448 average = (average >= 13) ? (average - 13) : 0;
474 switch (dev->
dev->bus_type) {
475 #ifdef CONFIG_B43_BCMA
485 #ifdef CONFIG_B43_SSB
501 static const u32 arctg[] = {
502 2949120, 1740967, 919879, 466945, 234379, 117304,
503 58666, 29335, 14668, 7334, 3667, 1833,
504 917, 458, 229, 115, 57, 29,
510 struct b43_c32 ret = { .
i = 39797, .q = 0, };
512 while (theta > (180 << 16))
513 theta -= (360 << 16);
514 while (theta < -(180 << 16))
515 theta += (360 << 16);
517 if (theta > (90 << 16)) {
518 theta -= (180 << 16);
520 }
else if (theta < -(90 << 16)) {
521 theta += (180 << 16);
525 for (
i = 0;
i <= 17;
i++) {
527 tmp = ret.
i - (ret.
q >>
i);
532 tmp = ret.
i + (ret.
q >>
i);