lo.h 2.5 KB

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