lo.h 2.4 KB

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