Initial commit
[wrt350n-kernel.git] / drivers / net / wireless / b43 / lo.h
blob455615d1f8c657698b77dfbfbd14af8862e07438
1 #ifndef B43_LO_H_
2 #define B43_LO_H_
4 #include "phy.h"
6 struct b43_wldev;
8 /* Local Oscillator control value-pair. */
9 struct b43_loctl {
10 /* Control values. */
11 s8 i;
12 s8 q;
13 /* "Used by hardware" flag. */
14 bool used;
15 #ifdef CONFIG_B43_DEBUG
16 /* Is this lo-control-array entry calibrated? */
17 bool calibrated;
18 #endif
21 /* Debugging: Poison value for i and q values. */
22 #define B43_LOCTL_POISON 111
24 /* loctl->calibrated debugging mechanism */
25 #ifdef CONFIG_B43_DEBUG
26 static inline void b43_loctl_set_calibrated(struct b43_loctl *loctl,
27 bool calibrated)
29 loctl->calibrated = calibrated;
31 static inline bool b43_loctl_is_calibrated(struct b43_loctl *loctl)
33 return loctl->calibrated;
35 #else
36 static inline void b43_loctl_set_calibrated(struct b43_loctl *loctl,
37 bool calibrated)
40 static inline bool b43_loctl_is_calibrated(struct b43_loctl *loctl)
42 return 1;
44 #endif
46 /* TX Power LO Control Array.
47 * Value-pairs to adjust the LocalOscillator are stored
48 * in this structure.
49 * There are two different set of values. One for "Flag is Set"
50 * and one for "Flag is Unset".
51 * By "Flag" the flag in struct b43_rfatt is meant.
52 * The Value arrays are two-dimensional. The first index
53 * is the baseband attenuation and the second index
54 * is the radio attenuation.
55 * Use b43_get_lo_g_ctl() to retrieve a value from the lists.
57 struct b43_txpower_lo_control {
58 #define B43_NR_BB 12
59 #define B43_NR_RF 16
60 /* LO Control values, with PAD Mixer */
61 struct b43_loctl with_padmix[B43_NR_BB][B43_NR_RF];
62 /* LO Control values, without PAD Mixer */
63 struct b43_loctl no_padmix[B43_NR_BB][B43_NR_RF];
65 /* Flag to indicate a complete rebuild of the two tables above
66 * to the LO measuring code. */
67 bool rebuild;
69 /* Lists of valid RF and BB attenuation values for this device. */
70 struct b43_rfatt_list rfatt_list;
71 struct b43_bbatt_list bbatt_list;
73 /* Current TX Bias value */
74 u8 tx_bias;
75 /* Current TX Magnification Value (if used by the device) */
76 u8 tx_magn;
78 /* GPHY LO is measured. */
79 bool lo_measured;
81 /* Saved device PowerVector */
82 u64 power_vector;
85 /* Measure the BPHY Local Oscillator. */
86 void b43_lo_b_measure(struct b43_wldev *dev);
87 /* Measure the BPHY/GPHY Local Oscillator. */
88 void b43_lo_g_measure(struct b43_wldev *dev);
90 /* Adjust the Local Oscillator to the saved attenuation
91 * and txctl values.
93 void b43_lo_g_adjust(struct b43_wldev *dev);
94 /* Adjust to specific values. */
95 void b43_lo_g_adjust_to(struct b43_wldev *dev,
96 u16 rfatt, u16 bbatt, u16 tx_control);
98 /* Mark all possible b43_lo_g_ctl as "unused" */
99 void b43_lo_g_ctl_mark_all_unused(struct b43_wldev *dev);
100 /* Mark the b43_lo_g_ctl corresponding to the current
101 * attenuation values as used.
103 void b43_lo_g_ctl_mark_cur_used(struct b43_wldev *dev);
105 /* Get a reference to a LO Control value pair in the
106 * TX Power LO Control Array.
108 struct b43_loctl *b43_get_lo_g_ctl(struct b43_wldev *dev,
109 const struct b43_rfatt *rfatt,
110 const struct b43_bbatt *bbatt);
112 #endif /* B43_LO_H_ */