lo.h 2.9 KB

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