diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2013-03-09 07:52:12 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-03-13 14:27:50 -0400 |
commit | 60e8fb9233e13e98b13a380ecc1cc05515e6e34c (patch) | |
tree | be9d5288e29840d9822744ab10bd89dc619d3745 /drivers/net/wireless/b43 | |
parent | a51ab25811beef67bdd0ba2c5dd4b03e47948aa1 (diff) |
b43: HT-PHY: implement controlling TX power control
Don't enable it until we have (almost?) whole TX power management
figured out. It's similar to the N-PHY, the difference is that we call a
"fix" *before* disabling power control.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43')
-rw-r--r-- | drivers/net/wireless/b43/phy_ht.c | 55 | ||||
-rw-r--r-- | drivers/net/wireless/b43/phy_ht.h | 13 |
2 files changed, 68 insertions, 0 deletions
diff --git a/drivers/net/wireless/b43/phy_ht.c b/drivers/net/wireless/b43/phy_ht.c index 1998dca73faa..1663551f9428 100644 --- a/drivers/net/wireless/b43/phy_ht.c +++ b/drivers/net/wireless/b43/phy_ht.c | |||
@@ -319,6 +319,46 @@ static void b43_phy_ht_tx_power_fix(struct b43_wldev *dev) | |||
319 | } | 319 | } |
320 | } | 320 | } |
321 | 321 | ||
322 | #if 0 | ||
323 | static void b43_phy_ht_tx_power_ctl(struct b43_wldev *dev, bool enable) | ||
324 | { | ||
325 | struct b43_phy_ht *phy_ht = dev->phy.ht; | ||
326 | u16 en_bits = B43_PHY_HT_TXPCTL_CMD_C1_COEFF | | ||
327 | B43_PHY_HT_TXPCTL_CMD_C1_HWPCTLEN | | ||
328 | B43_PHY_HT_TXPCTL_CMD_C1_PCTLEN; | ||
329 | static const u16 cmd_regs[3] = { B43_PHY_HT_TXPCTL_CMD_C1, | ||
330 | B43_PHY_HT_TXPCTL_CMD_C2, | ||
331 | B43_PHY_HT_TXPCTL_CMD_C3 }; | ||
332 | int i; | ||
333 | |||
334 | if (!enable) { | ||
335 | if (b43_phy_read(dev, B43_PHY_HT_TXPCTL_CMD_C1) & en_bits) { | ||
336 | /* We disable enabled TX pwr ctl, save it's state */ | ||
337 | /* | ||
338 | * TODO: find the registers. On N-PHY they were 0x1ed | ||
339 | * and 0x1ee, we need 3 such a registers for HT-PHY | ||
340 | */ | ||
341 | } | ||
342 | b43_phy_mask(dev, B43_PHY_HT_TXPCTL_CMD_C1, ~en_bits); | ||
343 | } else { | ||
344 | b43_phy_set(dev, B43_PHY_HT_TXPCTL_CMD_C1, en_bits); | ||
345 | |||
346 | if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) { | ||
347 | for (i = 0; i < 3; i++) | ||
348 | b43_phy_write(dev, cmd_regs[i], 0x32); | ||
349 | } | ||
350 | |||
351 | for (i = 0; i < 3; i++) | ||
352 | if (phy_ht->tx_pwr_idx[i] <= | ||
353 | B43_PHY_HT_TXPCTL_CMD_C1_INIT) | ||
354 | b43_phy_write(dev, cmd_regs[i], | ||
355 | phy_ht->tx_pwr_idx[i]); | ||
356 | } | ||
357 | |||
358 | phy_ht->tx_pwr_ctl = enable; | ||
359 | } | ||
360 | #endif | ||
361 | |||
322 | /************************************************** | 362 | /************************************************** |
323 | * Channel switching ops. | 363 | * Channel switching ops. |
324 | **************************************************/ | 364 | **************************************************/ |
@@ -455,14 +495,21 @@ static void b43_phy_ht_op_prepare_structs(struct b43_wldev *dev) | |||
455 | { | 495 | { |
456 | struct b43_phy *phy = &dev->phy; | 496 | struct b43_phy *phy = &dev->phy; |
457 | struct b43_phy_ht *phy_ht = phy->ht; | 497 | struct b43_phy_ht *phy_ht = phy->ht; |
498 | int i; | ||
458 | 499 | ||
459 | memset(phy_ht, 0, sizeof(*phy_ht)); | 500 | memset(phy_ht, 0, sizeof(*phy_ht)); |
501 | |||
502 | phy_ht->tx_pwr_ctl = true; | ||
503 | for (i = 0; i < 3; i++) | ||
504 | phy_ht->tx_pwr_idx[i] = B43_PHY_HT_TXPCTL_CMD_C1_INIT + 1; | ||
460 | } | 505 | } |
461 | 506 | ||
462 | static int b43_phy_ht_op_init(struct b43_wldev *dev) | 507 | static int b43_phy_ht_op_init(struct b43_wldev *dev) |
463 | { | 508 | { |
509 | struct b43_phy_ht *phy_ht = dev->phy.ht; | ||
464 | u16 tmp; | 510 | u16 tmp; |
465 | u16 clip_state[3]; | 511 | u16 clip_state[3]; |
512 | bool saved_tx_pwr_ctl; | ||
466 | 513 | ||
467 | if (dev->dev->bus_type != B43_BUS_BCMA) { | 514 | if (dev->dev->bus_type != B43_BUS_BCMA) { |
468 | b43err(dev->wl, "HT-PHY is supported only on BCMA bus!\n"); | 515 | b43err(dev->wl, "HT-PHY is supported only on BCMA bus!\n"); |
@@ -589,6 +636,14 @@ static int b43_phy_ht_op_init(struct b43_wldev *dev) | |||
589 | b43_httab_write_bulk(dev, B43_HTTAB32(0x1a, 0xc0), | 636 | b43_httab_write_bulk(dev, B43_HTTAB32(0x1a, 0xc0), |
590 | B43_HTTAB_1A_C0_LATE_SIZE, b43_httab_0x1a_0xc0_late); | 637 | B43_HTTAB_1A_C0_LATE_SIZE, b43_httab_0x1a_0xc0_late); |
591 | 638 | ||
639 | saved_tx_pwr_ctl = phy_ht->tx_pwr_ctl; | ||
640 | b43_phy_ht_tx_power_fix(dev); | ||
641 | #if 0 | ||
642 | b43_phy_ht_tx_power_ctl(dev, false); | ||
643 | /* TODO */ | ||
644 | b43_phy_ht_tx_power_ctl(dev, saved_tx_pwr_ctl); | ||
645 | #endif | ||
646 | |||
592 | return 0; | 647 | return 0; |
593 | } | 648 | } |
594 | 649 | ||
diff --git a/drivers/net/wireless/b43/phy_ht.h b/drivers/net/wireless/b43/phy_ht.h index 684807c2f125..bc7a43f58c61 100644 --- a/drivers/net/wireless/b43/phy_ht.h +++ b/drivers/net/wireless/b43/phy_ht.h | |||
@@ -22,6 +22,13 @@ | |||
22 | #define B43_PHY_HT_BW4 0x1D1 | 22 | #define B43_PHY_HT_BW4 0x1D1 |
23 | #define B43_PHY_HT_BW5 0x1D2 | 23 | #define B43_PHY_HT_BW5 0x1D2 |
24 | #define B43_PHY_HT_BW6 0x1D3 | 24 | #define B43_PHY_HT_BW6 0x1D3 |
25 | #define B43_PHY_HT_TXPCTL_CMD_C1 0x1E7 /* TX power control command */ | ||
26 | #define B43_PHY_HT_TXPCTL_CMD_C1_INIT 0x007F /* Init */ | ||
27 | #define B43_PHY_HT_TXPCTL_CMD_C1_COEFF 0x2000 /* Power control coefficients */ | ||
28 | #define B43_PHY_HT_TXPCTL_CMD_C1_HWPCTLEN 0x4000 /* Hardware TX power control enable */ | ||
29 | #define B43_PHY_HT_TXPCTL_CMD_C1_PCTLEN 0x8000 /* TX power control enable */ | ||
30 | #define B43_PHY_HT_TXPCTL_CMD_C2 0x222 | ||
31 | #define B43_PHY_HT_TXPCTL_CMD_C2_INIT 0x007F | ||
25 | 32 | ||
26 | #define B43_PHY_HT_C1_CLIP1THRES B43_PHY_OFDM(0x00E) | 33 | #define B43_PHY_HT_C1_CLIP1THRES B43_PHY_OFDM(0x00E) |
27 | #define B43_PHY_HT_C2_CLIP1THRES B43_PHY_OFDM(0x04E) | 34 | #define B43_PHY_HT_C2_CLIP1THRES B43_PHY_OFDM(0x04E) |
@@ -51,6 +58,9 @@ | |||
51 | #define B43_PHY_HT_AFE_C3_OVER B43_PHY_EXTG(0x118) | 58 | #define B43_PHY_HT_AFE_C3_OVER B43_PHY_EXTG(0x118) |
52 | #define B43_PHY_HT_AFE_C3 B43_PHY_EXTG(0x119) | 59 | #define B43_PHY_HT_AFE_C3 B43_PHY_EXTG(0x119) |
53 | 60 | ||
61 | #define B43_PHY_HT_TXPCTL_CMD_C3 B43_PHY_EXTG(0x164) | ||
62 | #define B43_PHY_HT_TXPCTL_CMD_C3_INIT 0x007F | ||
63 | |||
54 | #define B43_PHY_HT_TEST B43_PHY_N_BMODE(0x00A) | 64 | #define B43_PHY_HT_TEST B43_PHY_N_BMODE(0x00A) |
55 | 65 | ||
56 | 66 | ||
@@ -67,6 +77,9 @@ struct b43_phy_ht_channeltab_e_phy { | |||
67 | 77 | ||
68 | struct b43_phy_ht { | 78 | struct b43_phy_ht { |
69 | u16 rf_ctl_int_save[3]; | 79 | u16 rf_ctl_int_save[3]; |
80 | |||
81 | bool tx_pwr_ctl; | ||
82 | u8 tx_pwr_idx[3]; | ||
70 | }; | 83 | }; |
71 | 84 | ||
72 | 85 | ||