Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
phy.c File Reference
#include <linux/delay.h>
#include <linux/slab.h>
#include <asm/unaligned.h>
#include "ath5k.h"
#include "reg.h"
#include "rfbuffer.h"
#include "rfgain.h"
#include "../regd.h"

Go to the source code of this file.

Macros

#define pr_fmt(fmt)   KBUILD_MODNAME ": " fmt
 

Functions

u16 ath5k_hw_radio_revision (struct ath5k_hw *ah, enum ieee80211_band band)
 
bool ath5k_channel_ok (struct ath5k_hw *ah, struct ieee80211_channel *channel)
 
bool ath5k_hw_chan_has_spur_noise (struct ath5k_hw *ah, struct ieee80211_channel *channel)
 
int ath5k_hw_phy_disable (struct ath5k_hw *ah)
 
int ath5k_hw_rfgain_opt_init (struct ath5k_hw *ah)
 
enum ath5k_rfgain ath5k_hw_gainf_calibrate (struct ath5k_hw *ah)
 
void ath5k_hw_init_nfcal_hist (struct ath5k_hw *ah)
 
void ath5k_hw_update_noise_floor (struct ath5k_hw *ah)
 
int ath5k_hw_phy_calibrate (struct ath5k_hw *ah, struct ieee80211_channel *channel)
 
void ath5k_hw_set_antenna_switch (struct ath5k_hw *ah, u8 ee_mode)
 
void ath5k_hw_set_antenna_mode (struct ath5k_hw *ah, u8 ant_mode)
 
int ath5k_hw_set_txpower_limit (struct ath5k_hw *ah, u8 txpower)
 
int ath5k_hw_phy_init (struct ath5k_hw *ah, struct ieee80211_channel *channel, u8 mode, bool fast)
 

Macro Definition Documentation

#define pr_fmt (   fmt)    KBUILD_MODNAME ": " fmt

Definition at line 25 of file phy.c.

Function Documentation

bool ath5k_channel_ok ( struct ath5k_hw ah,
struct ieee80211_channel channel 
)

ath5k_channel_ok() - Check if a channel is supported by the hw : The &struct ath5k_hw : The &struct ieee80211_channel

Note: We don't do any regulatory domain checks here, it's just a sanity check.

Definition at line 136 of file phy.c.

bool ath5k_hw_chan_has_spur_noise ( struct ath5k_hw ah,
struct ieee80211_channel channel 
)

ath5k_hw_chan_has_spur_noise() - Check if channel is sensitive to spur noise : The &struct ath5k_hw : The &struct ieee80211_channel

Definition at line 159 of file phy.c.

enum ath5k_rfgain ath5k_hw_gainf_calibrate ( struct ath5k_hw ah)

ath5k_hw_gainf_calibrate() - Do a gain_F calibration : The &struct ath5k_hw

Main callback for thermal RF gain calibration engine Check for a new gain reading and schedule an adjustment if needed.

Returns one of enum ath5k_rfgain codes

Definition at line 683 of file phy.c.

void ath5k_hw_init_nfcal_hist ( struct ath5k_hw ah)

ath5k_hw_init_nfcal_hist() - Initialize NF calibration history buffer : The &struct ath5k_hw

Definition at line 1540 of file phy.c.

int ath5k_hw_phy_calibrate ( struct ath5k_hw ah,
struct ieee80211_channel channel 
)

ath5k_hw_phy_calibrate() - Perform a PHY calibration : The &struct ath5k_hw : The &struct ieee80211_channel

The main function we call from above to perform a short or full PHY calibration based on RF chip and current channel

Definition at line 1857 of file phy.c.

int ath5k_hw_phy_disable ( struct ath5k_hw ah)

ath5k_hw_phy_disable() - Disable PHY : The &struct ath5k_hw

Definition at line 349 of file phy.c.

int ath5k_hw_phy_init ( struct ath5k_hw ah,
struct ieee80211_channel channel,
u8  mode,
bool  fast 
)

Definition at line 3765 of file phy.c.

u16 ath5k_hw_radio_revision ( struct ath5k_hw ah,
enum ieee80211_band  band 
)

DOC: PHY related functions

Here we handle the low-level functions related to baseband and analog frontend (RF) parts. This is by far the most complex part of the hw code so make sure you know what you are doing.

Here is a list of what this is all about:

  • Channel setting/switching
  • Automatic Gain Control (AGC) calibration
  • Noise Floor calibration
  • I/Q imbalance calibration (QAM correction)
  • Calibration due to thermal changes (gain_F)
  • Spur noise mitigation
  • RF/PHY initialization for the various operating modes and bwmodes
  • Antenna control
  • TX power control per channel/rate/packet type

Also have in mind we never got documentation for most of these functions, what we have comes mostly from Atheros's code, reverse engineering and patent docs/presentations etc. ath5k_hw_radio_revision() - Get the PHY Chip revision : The &struct ath5k_hw : One of enum ieee80211_band

Returns the revision number of a 2GHz, 5GHz or single chip radio.

Definition at line 84 of file phy.c.

int ath5k_hw_rfgain_opt_init ( struct ath5k_hw ah)

DOC: RF Gain optimization

This code is used to optimize RF gain on different environments (temperature mostly) based on feedback from a power detector.

It's only used on RF5111 and RF5112, later RF chips seem to have auto adjustment on hw -notice they have a much smaller BANK 7 and no gain optimization ladder-.

For more infos check out this patent doc "http://www.freepatentsonline.com/7400691.html"

This paper describes power drops as seen on the receiver due to probe packets "http://www.cnri.dit.ie/publications/ICT08%20-%20Practical%20Issues %20of%20Power%20Control.pdf"

And this is the MadWiFi bug entry related to the above "http://madwifi-project.org/ticket/1659" with various measurements and diagrams ath5k_hw_rfgain_opt_init() - Initialize ah_gain during attach : The &struct ath5k_hw

Definition at line 420 of file phy.c.

void ath5k_hw_set_antenna_mode ( struct ath5k_hw ah,
u8  ant_mode 
)

ath5k_hw_set_antenna_mode() - Set antenna operating mode : The &struct ath5k_hw : One of enum ath5k_ant_mode

Definition at line 2298 of file phy.c.

void ath5k_hw_set_antenna_switch ( struct ath5k_hw ah,
u8  ee_mode 
)

ath5k_hw_set_antenna_switch() - Set up antenna switch table : The &struct ath5k_hw : One of enum ath5k_driver_mode

Switch table comes from EEPROM and includes information on controlling the 2 antenna RX attenuators

Definition at line 2262 of file phy.c.

int ath5k_hw_set_txpower_limit ( struct ath5k_hw ah,
u8  txpower 
)

ath5k_hw_set_txpower_limit() - Set txpower limit for the current channel : The &struct ath5k_hw : The requested tx power limit in 0.5dB steps

This function provides access to ath5k_hw_txpower to the driver in case user or an application changes it while PHY is running.

Definition at line 3738 of file phy.c.

void ath5k_hw_update_noise_floor ( struct ath5k_hw ah)

ath5k_hw_update_noise_floor() - Update NF on hardware : The &struct ath5k_hw

This is the main function we call to perform a NF calibration, it reads NF from hardware, calculates the median and updates NF on hw.

Definition at line 1598 of file phy.c.