add b43 fixes from #2677
[openwrt.git] / package / b43 / src / lo.h
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;
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
19 };
20
21 /* Debugging: Poison value for i and q values. */
22 #define B43_LOCTL_POISON 111
23
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)
28 {
29 loctl->calibrated = calibrated;
30 }
31 static inline bool b43_loctl_is_calibrated(struct b43_loctl *loctl)
32 {
33 return loctl->calibrated;
34 }
35 #else
36 static inline void b43_loctl_set_calibrated(struct b43_loctl *loctl,
37 bool calibrated)
38 {
39 }
40 static inline bool b43_loctl_is_calibrated(struct b43_loctl *loctl)
41 {
42 return 1;
43 }
44 #endif
45
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.
56 */
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];
64
65 /* Flag to indicate a complete rebuild of the two tables above
66 * to the LO measuring code. */
67 bool rebuild;
68
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;
72
73 /* Current TX Bias value */
74 u8 tx_bias;
75 /* Current TX Magnification Value (if used by the device) */
76 u8 tx_magn;
77
78 /* GPHY LO is measured. */
79 bool lo_measured;
80
81 /* Saved device PowerVector */
82 u64 power_vector;
83 };
84
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);
89
90 /* Adjust the Local Oscillator to the saved attenuation
91 * and txctl values.
92 */
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);
97
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.
102 */
103 void b43_lo_g_ctl_mark_cur_used(struct b43_wldev *dev);
104
105 /* Get a reference to a LO Control value pair in the
106 * TX Power LO Control Array.
107 */
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);
111
112 #endif /* B43_LO_H_ */
This page took 0.058078 seconds and 5 git commands to generate.