Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 1 | #ifndef B43_LO_H_ |
| 2 | #define B43_LO_H_ |
| 3 | |
| 4 | #include "phy.h" |
| 5 | |
| 6 | struct b43_wldev; |
| 7 | |
| 8 | /* Local Oscillator control value-pair. */ |
| 9 | struct b43_loctl { |
| 10 | /* Control values. */ |
| 11 | s8 i; |
| 12 | s8 q; |
Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 13 | }; |
Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 14 | /* Debugging: Poison value for i and q values. */ |
| 15 | #define B43_LOCTL_POISON 111 |
| 16 | |
Michael Buesch | f5eda47 | 2008-04-20 16:03:32 +0200 | [diff] [blame] | 17 | /* This struct holds calibrated LO settings for a set of |
| 18 | * Baseband and RF attenuation settings. */ |
| 19 | struct b43_lo_calib { |
| 20 | /* The set of attenuation values this set of LO |
| 21 | * control values is calibrated for. */ |
| 22 | struct b43_bbatt bbatt; |
| 23 | struct b43_rfatt rfatt; |
| 24 | /* The set of control values for the LO. */ |
| 25 | struct b43_loctl ctl; |
| 26 | /* The time when these settings were calibrated (in jiffies) */ |
| 27 | unsigned long calib_time; |
| 28 | /* List. */ |
| 29 | struct list_head list; |
| 30 | }; |
Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 31 | |
Michael Buesch | f5eda47 | 2008-04-20 16:03:32 +0200 | [diff] [blame] | 32 | /* Size of the DC Lookup Table in 16bit words. */ |
| 33 | #define B43_DC_LT_SIZE 32 |
| 34 | |
| 35 | /* Local Oscillator calibration information */ |
Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 36 | struct b43_txpower_lo_control { |
Michael Buesch | f5eda47 | 2008-04-20 16:03:32 +0200 | [diff] [blame] | 37 | /* Lists of RF and BB attenuation values for this device. |
| 38 | * Used for building hardware power control tables. */ |
Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 39 | struct b43_rfatt_list rfatt_list; |
| 40 | struct b43_bbatt_list bbatt_list; |
| 41 | |
Michael Buesch | f5eda47 | 2008-04-20 16:03:32 +0200 | [diff] [blame] | 42 | /* The DC Lookup Table is cached in memory here. |
| 43 | * Note that this is only used for Hardware Power Control. */ |
| 44 | u16 dc_lt[B43_DC_LT_SIZE]; |
| 45 | |
| 46 | /* List of calibrated control values (struct b43_lo_calib). */ |
| 47 | struct list_head calib_list; |
| 48 | /* Last time the power vector was read (jiffies). */ |
| 49 | unsigned long pwr_vec_read_time; |
| 50 | /* Last time the txctl values were measured (jiffies). */ |
| 51 | unsigned long txctl_measured_time; |
| 52 | |
Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 53 | /* Current TX Bias value */ |
| 54 | u8 tx_bias; |
| 55 | /* Current TX Magnification Value (if used by the device) */ |
| 56 | u8 tx_magn; |
| 57 | |
Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 58 | /* Saved device PowerVector */ |
| 59 | u64 power_vector; |
| 60 | }; |
| 61 | |
Michael Buesch | f5eda47 | 2008-04-20 16:03:32 +0200 | [diff] [blame] | 62 | /* Calibration expire timeouts. |
| 63 | * Timeouts must be multiple of 15 seconds. To make sure |
| 64 | * the item really expired when the 15 second timer hits, we |
| 65 | * subtract two additional seconds from the timeout. */ |
| 66 | #define B43_LO_CALIB_EXPIRE (HZ * (30 - 2)) |
| 67 | #define B43_LO_PWRVEC_EXPIRE (HZ * (30 - 2)) |
| 68 | #define B43_LO_TXCTL_EXPIRE (HZ * (180 - 4)) |
| 69 | |
Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 70 | |
| 71 | /* Adjust the Local Oscillator to the saved attenuation |
| 72 | * and txctl values. |
| 73 | */ |
| 74 | void b43_lo_g_adjust(struct b43_wldev *dev); |
| 75 | /* Adjust to specific values. */ |
| 76 | void b43_lo_g_adjust_to(struct b43_wldev *dev, |
| 77 | u16 rfatt, u16 bbatt, u16 tx_control); |
| 78 | |
Michael Buesch | f5eda47 | 2008-04-20 16:03:32 +0200 | [diff] [blame] | 79 | void b43_gphy_dc_lt_init(struct b43_wldev *dev, bool update_all); |
Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 80 | |
Michael Buesch | f5eda47 | 2008-04-20 16:03:32 +0200 | [diff] [blame] | 81 | void b43_lo_g_maintanance_work(struct b43_wldev *dev); |
| 82 | void b43_lo_g_cleanup(struct b43_wldev *dev); |
| 83 | void b43_lo_g_init(struct b43_wldev *dev); |
Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 84 | |
| 85 | #endif /* B43_LO_H_ */ |