Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 1 | #ifndef LINUX_B43_PHY_COMMON_H_ |
| 2 | #define LINUX_B43_PHY_COMMON_H_ |
| 3 | |
Johannes Berg | f41f3f3 | 2009-06-07 12:30:34 -0500 | [diff] [blame] | 4 | #include <linux/types.h> |
Rafał Miłecki | e5c407f | 2010-10-11 03:11:02 +0200 | [diff] [blame] | 5 | #include <linux/nl80211.h> |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 6 | |
| 7 | struct b43_wldev; |
| 8 | |
Rafał Miłecki | 9865045 | 2010-01-25 18:59:59 +0100 | [diff] [blame] | 9 | /* Complex number using 2 32-bit signed integers */ |
| 10 | struct b43_c32 { s32 i, q; }; |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 11 | |
Rafał Miłecki | 6f98e62 | 2010-01-25 19:00:00 +0100 | [diff] [blame] | 12 | #define CORDIC_CONVERT(value) (((value) >= 0) ? \ |
| 13 | ((((value) >> 15) + 1) >> 1) : \ |
| 14 | -((((-(value)) >> 15) + 1) >> 1)) |
| 15 | |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 16 | /* PHY register routing bits */ |
| 17 | #define B43_PHYROUTE 0x0C00 /* PHY register routing bits mask */ |
| 18 | #define B43_PHYROUTE_BASE 0x0000 /* Base registers */ |
| 19 | #define B43_PHYROUTE_OFDM_GPHY 0x0400 /* OFDM register routing for G-PHYs */ |
| 20 | #define B43_PHYROUTE_EXT_GPHY 0x0800 /* Extended G-PHY registers */ |
| 21 | #define B43_PHYROUTE_N_BMODE 0x0C00 /* N-PHY BMODE registers */ |
| 22 | |
| 23 | /* CCK (B-PHY) registers. */ |
| 24 | #define B43_PHY_CCK(reg) ((reg) | B43_PHYROUTE_BASE) |
| 25 | /* N-PHY registers. */ |
| 26 | #define B43_PHY_N(reg) ((reg) | B43_PHYROUTE_BASE) |
| 27 | /* N-PHY BMODE registers. */ |
| 28 | #define B43_PHY_N_BMODE(reg) ((reg) | B43_PHYROUTE_N_BMODE) |
| 29 | /* OFDM (A-PHY) registers. */ |
| 30 | #define B43_PHY_OFDM(reg) ((reg) | B43_PHYROUTE_OFDM_GPHY) |
| 31 | /* Extended G-PHY registers. */ |
| 32 | #define B43_PHY_EXTG(reg) ((reg) | B43_PHYROUTE_EXT_GPHY) |
| 33 | |
| 34 | |
| 35 | /* Masks for the PHY versioning registers. */ |
| 36 | #define B43_PHYVER_ANALOG 0xF000 |
| 37 | #define B43_PHYVER_ANALOG_SHIFT 12 |
| 38 | #define B43_PHYVER_TYPE 0x0F00 |
| 39 | #define B43_PHYVER_TYPE_SHIFT 8 |
| 40 | #define B43_PHYVER_VERSION 0x00FF |
| 41 | |
Rafał Miłecki | 1551808 | 2010-12-07 09:42:07 +0100 | [diff] [blame] | 42 | /* PHY writes need to be flushed if we reach limit */ |
| 43 | #define B43_MAX_WRITES_IN_ROW 24 |
| 44 | |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 45 | /** |
| 46 | * enum b43_interference_mitigation - Interference Mitigation mode |
| 47 | * |
| 48 | * @B43_INTERFMODE_NONE: Disabled |
| 49 | * @B43_INTERFMODE_NONWLAN: Non-WLAN Interference Mitigation |
| 50 | * @B43_INTERFMODE_MANUALWLAN: WLAN Interference Mitigation |
| 51 | * @B43_INTERFMODE_AUTOWLAN: Automatic WLAN Interference Mitigation |
| 52 | */ |
| 53 | enum b43_interference_mitigation { |
| 54 | B43_INTERFMODE_NONE, |
| 55 | B43_INTERFMODE_NONWLAN, |
| 56 | B43_INTERFMODE_MANUALWLAN, |
| 57 | B43_INTERFMODE_AUTOWLAN, |
| 58 | }; |
| 59 | |
| 60 | /* Antenna identifiers */ |
| 61 | enum { |
Gábor Stefanik | 64e368b | 2009-08-27 22:49:49 +0200 | [diff] [blame] | 62 | B43_ANTENNA0 = 0, /* Antenna 0 */ |
| 63 | B43_ANTENNA1 = 1, /* Antenna 1 */ |
| 64 | B43_ANTENNA_AUTO0 = 2, /* Automatic, starting with antenna 0 */ |
| 65 | B43_ANTENNA_AUTO1 = 3, /* Automatic, starting with antenna 1 */ |
| 66 | B43_ANTENNA2 = 4, |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 67 | B43_ANTENNA3 = 8, |
| 68 | |
| 69 | B43_ANTENNA_AUTO = B43_ANTENNA_AUTO0, |
| 70 | B43_ANTENNA_DEFAULT = B43_ANTENNA_AUTO, |
| 71 | }; |
| 72 | |
| 73 | /** |
Michael Buesch | 18c8ade | 2008-08-28 19:33:40 +0200 | [diff] [blame] | 74 | * enum b43_txpwr_result - Return value for the recalc_txpower PHY op. |
| 75 | * |
| 76 | * @B43_TXPWR_RES_NEED_ADJUST: Values changed. Hardware adjustment is needed. |
| 77 | * @B43_TXPWR_RES_DONE: No more work to do. Everything is done. |
| 78 | */ |
| 79 | enum b43_txpwr_result { |
| 80 | B43_TXPWR_RES_NEED_ADJUST, |
| 81 | B43_TXPWR_RES_DONE, |
| 82 | }; |
| 83 | |
| 84 | /** |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 85 | * struct b43_phy_operations - Function pointers for PHY ops. |
| 86 | * |
Michael Buesch | fb11137 | 2008-09-02 13:00:34 +0200 | [diff] [blame] | 87 | * @allocate: Allocate and initialise the PHY data structures. |
| 88 | * Must not be NULL. |
| 89 | * @free: Destroy and free the PHY data structures. |
| 90 | * Must not be NULL. |
| 91 | * |
| 92 | * @prepare_structs: Prepare the PHY data structures. |
| 93 | * The data structures allocated in @allocate are |
| 94 | * initialized here. |
| 95 | * Must not be NULL. |
| 96 | * @prepare_hardware: Prepare the PHY. This is called before b43_chip_init to |
| 97 | * do some early early PHY hardware init. |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 98 | * Can be NULL, if not required. |
| 99 | * @init: Initialize the PHY. |
| 100 | * Must not be NULL. |
Michael Buesch | fb11137 | 2008-09-02 13:00:34 +0200 | [diff] [blame] | 101 | * @exit: Shutdown the PHY. |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 102 | * Can be NULL, if not required. |
| 103 | * |
| 104 | * @phy_read: Read from a PHY register. |
| 105 | * Must not be NULL. |
| 106 | * @phy_write: Write to a PHY register. |
| 107 | * Must not be NULL. |
Gábor Stefanik | 68ec532 | 2009-08-26 20:51:25 +0200 | [diff] [blame] | 108 | * @phy_maskset: Maskset a PHY register, taking shortcuts. |
| 109 | * If it is NULL, a generic algorithm is used. |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 110 | * @radio_read: Read from a Radio register. |
| 111 | * Must not be NULL. |
| 112 | * @radio_write: Write to a Radio register. |
| 113 | * Must not be NULL. |
| 114 | * |
| 115 | * @supports_hwpctl: Returns a boolean whether Hardware Power Control |
| 116 | * is supported or not. |
| 117 | * If NULL, hwpctl is assumed to be never supported. |
| 118 | * @software_rfkill: Turn the radio ON or OFF. |
| 119 | * Possible state values are |
| 120 | * RFKILL_STATE_SOFT_BLOCKED or |
| 121 | * RFKILL_STATE_UNBLOCKED |
| 122 | * Must not be NULL. |
Michael Buesch | cb24f57 | 2008-09-03 12:12:20 +0200 | [diff] [blame] | 123 | * @switch_analog: Turn the Analog on/off. |
| 124 | * Must not be NULL. |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 125 | * @switch_channel: Switch the radio to another channel. |
| 126 | * Must not be NULL. |
| 127 | * @get_default_chan: Just returns the default channel number. |
| 128 | * Must not be NULL. |
| 129 | * @set_rx_antenna: Set the antenna used for RX. |
| 130 | * Can be NULL, if not supported. |
| 131 | * @interf_mitigation: Switch the Interference Mitigation mode. |
| 132 | * Can be NULL, if not supported. |
| 133 | * |
Michael Buesch | 18c8ade | 2008-08-28 19:33:40 +0200 | [diff] [blame] | 134 | * @recalc_txpower: Recalculate the transmission power parameters. |
| 135 | * This callback has to recalculate the TX power settings, |
| 136 | * but does not need to write them to the hardware, yet. |
| 137 | * Returns enum b43_txpwr_result to indicate whether the hardware |
| 138 | * needs to be adjusted. |
| 139 | * If B43_TXPWR_NEED_ADJUST is returned, @adjust_txpower |
| 140 | * will be called later. |
| 141 | * If the parameter "ignore_tssi" is true, the TSSI values should |
| 142 | * be ignored and a recalculation of the power settings should be |
| 143 | * done even if the TSSI values did not change. |
Michael Buesch | 36dbd95 | 2009-09-04 22:51:29 +0200 | [diff] [blame] | 144 | * This function may sleep, but should not. |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 145 | * Must not be NULL. |
Michael Buesch | 18c8ade | 2008-08-28 19:33:40 +0200 | [diff] [blame] | 146 | * @adjust_txpower: Write the previously calculated TX power settings |
| 147 | * (from @recalc_txpower) to the hardware. |
| 148 | * This function may sleep. |
| 149 | * Can be NULL, if (and ONLY if) @recalc_txpower _always_ |
| 150 | * returns B43_TXPWR_RES_DONE. |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 151 | * |
| 152 | * @pwork_15sec: Periodic work. Called every 15 seconds. |
| 153 | * Can be NULL, if not required. |
| 154 | * @pwork_60sec: Periodic work. Called every 60 seconds. |
| 155 | * Can be NULL, if not required. |
| 156 | */ |
| 157 | struct b43_phy_operations { |
| 158 | /* Initialisation */ |
| 159 | int (*allocate)(struct b43_wldev *dev); |
Michael Buesch | fb11137 | 2008-09-02 13:00:34 +0200 | [diff] [blame] | 160 | void (*free)(struct b43_wldev *dev); |
| 161 | void (*prepare_structs)(struct b43_wldev *dev); |
| 162 | int (*prepare_hardware)(struct b43_wldev *dev); |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 163 | int (*init)(struct b43_wldev *dev); |
| 164 | void (*exit)(struct b43_wldev *dev); |
| 165 | |
| 166 | /* Register access */ |
| 167 | u16 (*phy_read)(struct b43_wldev *dev, u16 reg); |
| 168 | void (*phy_write)(struct b43_wldev *dev, u16 reg, u16 value); |
Gábor Stefanik | 68ec532 | 2009-08-26 20:51:25 +0200 | [diff] [blame] | 169 | void (*phy_maskset)(struct b43_wldev *dev, u16 reg, u16 mask, u16 set); |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 170 | u16 (*radio_read)(struct b43_wldev *dev, u16 reg); |
| 171 | void (*radio_write)(struct b43_wldev *dev, u16 reg, u16 value); |
| 172 | |
| 173 | /* Radio */ |
| 174 | bool (*supports_hwpctl)(struct b43_wldev *dev); |
Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 175 | void (*software_rfkill)(struct b43_wldev *dev, bool blocked); |
Michael Buesch | cb24f57 | 2008-09-03 12:12:20 +0200 | [diff] [blame] | 176 | void (*switch_analog)(struct b43_wldev *dev, bool on); |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 177 | int (*switch_channel)(struct b43_wldev *dev, unsigned int new_channel); |
| 178 | unsigned int (*get_default_chan)(struct b43_wldev *dev); |
| 179 | void (*set_rx_antenna)(struct b43_wldev *dev, int antenna); |
| 180 | int (*interf_mitigation)(struct b43_wldev *dev, |
| 181 | enum b43_interference_mitigation new_mode); |
| 182 | |
| 183 | /* Transmission power adjustment */ |
Michael Buesch | 18c8ade | 2008-08-28 19:33:40 +0200 | [diff] [blame] | 184 | enum b43_txpwr_result (*recalc_txpower)(struct b43_wldev *dev, |
| 185 | bool ignore_tssi); |
| 186 | void (*adjust_txpower)(struct b43_wldev *dev); |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 187 | |
| 188 | /* Misc */ |
| 189 | void (*pwork_15sec)(struct b43_wldev *dev); |
| 190 | void (*pwork_60sec)(struct b43_wldev *dev); |
| 191 | }; |
| 192 | |
| 193 | struct b43_phy_a; |
| 194 | struct b43_phy_g; |
| 195 | struct b43_phy_n; |
Michael Buesch | e63e436 | 2008-08-30 10:55:48 +0200 | [diff] [blame] | 196 | struct b43_phy_lp; |
Rafał Miłecki | d7520b1 | 2011-06-13 16:20:06 +0200 | [diff] [blame] | 197 | struct b43_phy_ht; |
Rafał Miłecki | 58eb7ff | 2011-07-07 18:58:25 +0200 | [diff] [blame] | 198 | struct b43_phy_lcn; |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 199 | |
| 200 | struct b43_phy { |
| 201 | /* Hardware operation callbacks. */ |
| 202 | const struct b43_phy_operations *ops; |
| 203 | |
| 204 | /* Most hardware context information is stored in the standard- |
| 205 | * specific data structures pointed to by the pointers below. |
| 206 | * Only one of them is valid (the currently enabled PHY). */ |
| 207 | #ifdef CONFIG_B43_DEBUG |
| 208 | /* No union for debug build to force NULL derefs in buggy code. */ |
| 209 | struct { |
| 210 | #else |
| 211 | union { |
| 212 | #endif |
| 213 | /* A-PHY specific information */ |
| 214 | struct b43_phy_a *a; |
| 215 | /* G-PHY specific information */ |
| 216 | struct b43_phy_g *g; |
| 217 | /* N-PHY specific information */ |
| 218 | struct b43_phy_n *n; |
Michael Buesch | e63e436 | 2008-08-30 10:55:48 +0200 | [diff] [blame] | 219 | /* LP-PHY specific information */ |
| 220 | struct b43_phy_lp *lp; |
Rafał Miłecki | d7520b1 | 2011-06-13 16:20:06 +0200 | [diff] [blame] | 221 | /* HT-PHY specific information */ |
| 222 | struct b43_phy_ht *ht; |
Rafał Miłecki | 58eb7ff | 2011-07-07 18:58:25 +0200 | [diff] [blame] | 223 | /* LCN-PHY specific information */ |
| 224 | struct b43_phy_lcn *lcn; |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 225 | }; |
| 226 | |
| 227 | /* Band support flags. */ |
| 228 | bool supports_2ghz; |
| 229 | bool supports_5ghz; |
| 230 | |
Rafał Miłecki | aa4c7b2 | 2010-01-22 01:53:12 +0100 | [diff] [blame] | 231 | /* HT info */ |
| 232 | bool is_40mhz; |
| 233 | |
Rafał Miłecki | 24acfc6 | 2014-05-20 09:27:18 +0200 | [diff] [blame] | 234 | /* Is GMODE (2 GHz mode) bit enabled? */ |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 235 | bool gmode; |
| 236 | |
Rafał Miłecki | 09951ad | 2014-05-27 22:07:31 +0200 | [diff] [blame] | 237 | /* After power reset full init has to be performed */ |
| 238 | bool do_full_init; |
| 239 | |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 240 | /* Analog Type */ |
| 241 | u8 analog; |
| 242 | /* B43_PHYTYPE_ */ |
| 243 | u8 type; |
| 244 | /* PHY revision number. */ |
| 245 | u8 rev; |
| 246 | |
Rafał Miłecki | 1551808 | 2010-12-07 09:42:07 +0100 | [diff] [blame] | 247 | /* Count writes since last read */ |
| 248 | u8 writes_counter; |
| 249 | |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 250 | /* Radio versioning */ |
| 251 | u16 radio_manuf; /* Radio manufacturer */ |
| 252 | u16 radio_ver; /* Radio version */ |
| 253 | u8 radio_rev; /* Radio revision */ |
| 254 | |
| 255 | /* Software state of the radio */ |
| 256 | bool radio_on; |
| 257 | |
| 258 | /* Desired TX power level (in dBm). |
| 259 | * This is set by the user and adjusted in b43_phy_xmitpower(). */ |
Michael Buesch | 18c8ade | 2008-08-28 19:33:40 +0200 | [diff] [blame] | 260 | int desired_txpower; |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 261 | |
| 262 | /* Hardware Power Control enabled? */ |
| 263 | bool hardware_power_control; |
| 264 | |
Michael Buesch | 18c8ade | 2008-08-28 19:33:40 +0200 | [diff] [blame] | 265 | /* The time (in absolute jiffies) when the next TX power output |
| 266 | * check is needed. */ |
| 267 | unsigned long next_txpwr_check_time; |
| 268 | |
Rafał Miłecki | e5c407f | 2010-10-11 03:11:02 +0200 | [diff] [blame] | 269 | /* Current channel */ |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 270 | unsigned int channel; |
Rafał Miłecki | 204a665 | 2010-10-14 19:33:34 +0200 | [diff] [blame] | 271 | u16 channel_freq; |
Rafał Miłecki | e5c407f | 2010-10-11 03:11:02 +0200 | [diff] [blame] | 272 | enum nl80211_channel_type channel_type; |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 273 | |
| 274 | /* PHY TX errors counter. */ |
| 275 | atomic_t txerr_cnt; |
| 276 | |
| 277 | #ifdef CONFIG_B43_DEBUG |
Michael Buesch | 591f3dc | 2009-03-31 12:27:32 +0200 | [diff] [blame] | 278 | /* PHY registers locked (w.r.t. firmware) */ |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 279 | bool phy_locked; |
Michael Buesch | 591f3dc | 2009-03-31 12:27:32 +0200 | [diff] [blame] | 280 | /* Radio registers locked (w.r.t. firmware) */ |
| 281 | bool radio_locked; |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 282 | #endif /* B43_DEBUG */ |
| 283 | }; |
| 284 | |
| 285 | |
| 286 | /** |
Michael Buesch | fb11137 | 2008-09-02 13:00:34 +0200 | [diff] [blame] | 287 | * b43_phy_allocate - Allocate PHY structs |
| 288 | * Allocate the PHY data structures, based on the current dev->phy.type |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 289 | */ |
Michael Buesch | fb11137 | 2008-09-02 13:00:34 +0200 | [diff] [blame] | 290 | int b43_phy_allocate(struct b43_wldev *dev); |
| 291 | |
| 292 | /** |
| 293 | * b43_phy_free - Free PHY structs |
| 294 | */ |
| 295 | void b43_phy_free(struct b43_wldev *dev); |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 296 | |
| 297 | /** |
| 298 | * b43_phy_init - Initialise the PHY |
| 299 | */ |
| 300 | int b43_phy_init(struct b43_wldev *dev); |
| 301 | |
| 302 | /** |
| 303 | * b43_phy_exit - Cleanup PHY |
| 304 | */ |
| 305 | void b43_phy_exit(struct b43_wldev *dev); |
| 306 | |
| 307 | /** |
| 308 | * b43_has_hardware_pctl - Hardware Power Control supported? |
| 309 | * Returns a boolean, whether hardware power control is supported. |
| 310 | */ |
| 311 | bool b43_has_hardware_pctl(struct b43_wldev *dev); |
| 312 | |
| 313 | /** |
| 314 | * b43_phy_read - 16bit PHY register read access |
| 315 | */ |
| 316 | u16 b43_phy_read(struct b43_wldev *dev, u16 reg); |
| 317 | |
| 318 | /** |
| 319 | * b43_phy_write - 16bit PHY register write access |
| 320 | */ |
| 321 | void b43_phy_write(struct b43_wldev *dev, u16 reg, u16 value); |
| 322 | |
| 323 | /** |
Gábor Stefanik | 738f0f4 | 2009-08-03 01:28:12 +0200 | [diff] [blame] | 324 | * b43_phy_copy - copy contents of 16bit PHY register to another |
| 325 | */ |
| 326 | void b43_phy_copy(struct b43_wldev *dev, u16 destreg, u16 srcreg); |
| 327 | |
| 328 | /** |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 329 | * b43_phy_mask - Mask a PHY register with a mask |
| 330 | */ |
| 331 | void b43_phy_mask(struct b43_wldev *dev, u16 offset, u16 mask); |
| 332 | |
| 333 | /** |
| 334 | * b43_phy_set - OR a PHY register with a bitmap |
| 335 | */ |
| 336 | void b43_phy_set(struct b43_wldev *dev, u16 offset, u16 set); |
| 337 | |
| 338 | /** |
| 339 | * b43_phy_maskset - Mask and OR a PHY register with a mask and bitmap |
| 340 | */ |
| 341 | void b43_phy_maskset(struct b43_wldev *dev, u16 offset, u16 mask, u16 set); |
| 342 | |
| 343 | /** |
| 344 | * b43_radio_read - 16bit Radio register read access |
| 345 | */ |
| 346 | u16 b43_radio_read(struct b43_wldev *dev, u16 reg); |
| 347 | #define b43_radio_read16 b43_radio_read /* DEPRECATED */ |
| 348 | |
| 349 | /** |
| 350 | * b43_radio_write - 16bit Radio register write access |
| 351 | */ |
| 352 | void b43_radio_write(struct b43_wldev *dev, u16 reg, u16 value); |
| 353 | #define b43_radio_write16 b43_radio_write /* DEPRECATED */ |
| 354 | |
| 355 | /** |
| 356 | * b43_radio_mask - Mask a 16bit radio register with a mask |
| 357 | */ |
| 358 | void b43_radio_mask(struct b43_wldev *dev, u16 offset, u16 mask); |
| 359 | |
| 360 | /** |
| 361 | * b43_radio_set - OR a 16bit radio register with a bitmap |
| 362 | */ |
| 363 | void b43_radio_set(struct b43_wldev *dev, u16 offset, u16 set); |
| 364 | |
| 365 | /** |
| 366 | * b43_radio_maskset - Mask and OR a radio register with a mask and bitmap |
| 367 | */ |
| 368 | void b43_radio_maskset(struct b43_wldev *dev, u16 offset, u16 mask, u16 set); |
| 369 | |
| 370 | /** |
Rafał Miłecki | 0f94177 | 2012-07-26 00:07:37 +0200 | [diff] [blame] | 371 | * b43_radio_wait_value - Waits for a given value in masked register read |
| 372 | */ |
| 373 | bool b43_radio_wait_value(struct b43_wldev *dev, u16 offset, u16 mask, |
| 374 | u16 value, int delay, int timeout); |
| 375 | |
| 376 | /** |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 377 | * b43_radio_lock - Lock firmware radio register access |
| 378 | */ |
| 379 | void b43_radio_lock(struct b43_wldev *dev); |
| 380 | |
| 381 | /** |
| 382 | * b43_radio_unlock - Unlock firmware radio register access |
| 383 | */ |
| 384 | void b43_radio_unlock(struct b43_wldev *dev); |
| 385 | |
| 386 | /** |
| 387 | * b43_phy_lock - Lock firmware PHY register access |
| 388 | */ |
| 389 | void b43_phy_lock(struct b43_wldev *dev); |
| 390 | |
| 391 | /** |
| 392 | * b43_phy_unlock - Unlock firmware PHY register access |
| 393 | */ |
| 394 | void b43_phy_unlock(struct b43_wldev *dev); |
| 395 | |
Rafał Miłecki | b60c3c2 | 2014-05-17 23:24:54 +0200 | [diff] [blame] | 396 | void b43_phy_put_into_reset(struct b43_wldev *dev); |
Rafał Miłecki | 50c1b59 | 2014-05-17 23:24:55 +0200 | [diff] [blame] | 397 | void b43_phy_take_out_of_reset(struct b43_wldev *dev); |
Rafał Miłecki | b60c3c2 | 2014-05-17 23:24:54 +0200 | [diff] [blame] | 398 | |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 399 | /** |
| 400 | * b43_switch_channel - Switch to another channel |
| 401 | */ |
| 402 | int b43_switch_channel(struct b43_wldev *dev, unsigned int new_channel); |
| 403 | /** |
| 404 | * B43_DEFAULT_CHANNEL - Switch to the default channel. |
| 405 | */ |
| 406 | #define B43_DEFAULT_CHANNEL UINT_MAX |
| 407 | |
| 408 | /** |
| 409 | * b43_software_rfkill - Turn the radio ON or OFF in software. |
| 410 | */ |
Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 411 | void b43_software_rfkill(struct b43_wldev *dev, bool blocked); |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 412 | |
Michael Buesch | 18c8ade | 2008-08-28 19:33:40 +0200 | [diff] [blame] | 413 | /** |
| 414 | * b43_phy_txpower_check - Check TX power output. |
| 415 | * |
| 416 | * Compare the current TX power output to the desired power emission |
| 417 | * and schedule an adjustment in case it mismatches. |
Michael Buesch | 18c8ade | 2008-08-28 19:33:40 +0200 | [diff] [blame] | 418 | * |
| 419 | * @flags: OR'ed enum b43_phy_txpower_check_flags flags. |
| 420 | * See the docs below. |
| 421 | */ |
| 422 | void b43_phy_txpower_check(struct b43_wldev *dev, unsigned int flags); |
| 423 | /** |
| 424 | * enum b43_phy_txpower_check_flags - Flags for b43_phy_txpower_check() |
| 425 | * |
| 426 | * @B43_TXPWR_IGNORE_TIME: Ignore the schedule time and force-redo |
| 427 | * the check now. |
| 428 | * @B43_TXPWR_IGNORE_TSSI: Redo the recalculation, even if the average |
| 429 | * TSSI did not change. |
| 430 | */ |
| 431 | enum b43_phy_txpower_check_flags { |
| 432 | B43_TXPWR_IGNORE_TIME = (1 << 0), |
| 433 | B43_TXPWR_IGNORE_TSSI = (1 << 1), |
| 434 | }; |
| 435 | |
| 436 | struct work_struct; |
| 437 | void b43_phy_txpower_adjust_work(struct work_struct *work); |
| 438 | |
| 439 | /** |
| 440 | * b43_phy_shm_tssi_read - Read the average of the last 4 TSSI from SHM. |
| 441 | * |
| 442 | * @shm_offset: The SHM address to read the values from. |
| 443 | * |
| 444 | * Returns the average of the 4 TSSI values, or a negative error code. |
| 445 | */ |
| 446 | int b43_phy_shm_tssi_read(struct b43_wldev *dev, u16 shm_offset); |
| 447 | |
Michael Buesch | cb24f57 | 2008-09-03 12:12:20 +0200 | [diff] [blame] | 448 | /** |
| 449 | * b43_phy_switch_analog_generic - Generic PHY operation for switching the Analog. |
| 450 | * |
| 451 | * It does the switching based on the PHY0 core register. |
| 452 | * Do _not_ call this directly. Only use it as a switch_analog callback |
| 453 | * for struct b43_phy_operations. |
| 454 | */ |
| 455 | void b43_phyop_switch_analog_generic(struct b43_wldev *dev, bool on); |
| 456 | |
Rafał Miłecki | abc1f7c | 2010-12-07 21:55:58 +0100 | [diff] [blame] | 457 | bool b43_channel_type_is_40mhz(enum nl80211_channel_type channel_type); |
| 458 | |
Rafał Miłecki | f6a3e99 | 2011-08-12 00:03:26 +0200 | [diff] [blame] | 459 | void b43_phy_force_clock(struct b43_wldev *dev, bool force); |
| 460 | |
Rafał Miłecki | 9865045 | 2010-01-25 18:59:59 +0100 | [diff] [blame] | 461 | struct b43_c32 b43_cordic(int theta); |
Michael Buesch | 18c8ade | 2008-08-28 19:33:40 +0200 | [diff] [blame] | 462 | |
Michael Buesch | ef1a628 | 2008-08-27 18:53:02 +0200 | [diff] [blame] | 463 | #endif /* LINUX_B43_PHY_COMMON_H_ */ |