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