diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2008-08-04 04:00:42 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-08-04 15:09:12 -0400 |
commit | caab8f1a5d0da583b6ffe41afea2774c676444ca (patch) | |
tree | a732088119050a566e00d44d05976d9a4363379d /drivers/net/wireless/iwlwifi/iwl-4965.c | |
parent | da99c4b6c25964b90c79f19beccda208df1a865a (diff) |
iwlwifi: implement iwl5000_calc_rssi
This patch implements rssi calculation for 5000 HW.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-4965.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 718f9d9e4947..22bb26985c2e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -2258,6 +2258,40 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv, | |||
2258 | IWL_ERROR("TODO: Implement Tx ABORT REQUIRED!!!\n"); | 2258 | IWL_ERROR("TODO: Implement Tx ABORT REQUIRED!!!\n"); |
2259 | } | 2259 | } |
2260 | 2260 | ||
2261 | static int iwl4965_calc_rssi(struct iwl_priv *priv, | ||
2262 | struct iwl_rx_phy_res *rx_resp) | ||
2263 | { | ||
2264 | /* data from PHY/DSP regarding signal strength, etc., | ||
2265 | * contents are always there, not configurable by host. */ | ||
2266 | struct iwl4965_rx_non_cfg_phy *ncphy = | ||
2267 | (struct iwl4965_rx_non_cfg_phy *)rx_resp->non_cfg_phy_buf; | ||
2268 | u32 agc = (le16_to_cpu(ncphy->agc_info) & IWL49_AGC_DB_MASK) | ||
2269 | >> IWL49_AGC_DB_POS; | ||
2270 | |||
2271 | u32 valid_antennae = | ||
2272 | (le16_to_cpu(rx_resp->phy_flags) & IWL49_RX_PHY_FLAGS_ANTENNAE_MASK) | ||
2273 | >> IWL49_RX_PHY_FLAGS_ANTENNAE_OFFSET; | ||
2274 | u8 max_rssi = 0; | ||
2275 | u32 i; | ||
2276 | |||
2277 | /* Find max rssi among 3 possible receivers. | ||
2278 | * These values are measured by the digital signal processor (DSP). | ||
2279 | * They should stay fairly constant even as the signal strength varies, | ||
2280 | * if the radio's automatic gain control (AGC) is working right. | ||
2281 | * AGC value (see below) will provide the "interesting" info. */ | ||
2282 | for (i = 0; i < 3; i++) | ||
2283 | if (valid_antennae & (1 << i)) | ||
2284 | max_rssi = max(ncphy->rssi_info[i << 1], max_rssi); | ||
2285 | |||
2286 | IWL_DEBUG_STATS("Rssi In A %d B %d C %d Max %d AGC dB %d\n", | ||
2287 | ncphy->rssi_info[0], ncphy->rssi_info[2], ncphy->rssi_info[4], | ||
2288 | max_rssi, agc); | ||
2289 | |||
2290 | /* dBm = max_rssi dB - agc dB - constant. | ||
2291 | * Higher AGC (higher radio gain) means lower signal. */ | ||
2292 | return max_rssi - agc - IWL_RSSI_OFFSET; | ||
2293 | } | ||
2294 | |||
2261 | 2295 | ||
2262 | /* Set up 4965-specific Rx frame reply handlers */ | 2296 | /* Set up 4965-specific Rx frame reply handlers */ |
2263 | static void iwl4965_rx_handler_setup(struct iwl_priv *priv) | 2297 | static void iwl4965_rx_handler_setup(struct iwl_priv *priv) |
@@ -2289,6 +2323,7 @@ static struct iwl_hcmd_utils_ops iwl4965_hcmd_utils = { | |||
2289 | .chain_noise_reset = iwl4965_chain_noise_reset, | 2323 | .chain_noise_reset = iwl4965_chain_noise_reset, |
2290 | .gain_computation = iwl4965_gain_computation, | 2324 | .gain_computation = iwl4965_gain_computation, |
2291 | .rts_tx_cmd_flag = iwl4965_rts_tx_cmd_flag, | 2325 | .rts_tx_cmd_flag = iwl4965_rts_tx_cmd_flag, |
2326 | .calc_rssi = iwl4965_calc_rssi, | ||
2292 | }; | 2327 | }; |
2293 | 2328 | ||
2294 | static struct iwl_lib_ops iwl4965_lib = { | 2329 | static struct iwl_lib_ops iwl4965_lib = { |