aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorWey-Yi Guy <wey-yi.w.guy@intel.com>2010-08-04 11:42:17 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-08-24 16:32:02 -0400
commit7ccc896f4c9d5f11e449368cf520565bf2073a9b (patch)
treedf12106619cb6f62942639254387bede50643941 /drivers/net
parent30c1b0f7e96144e42e2be0bdec18d2475f5af31b (diff)
iwlwifi: more generic name for rssi calc in iwlagn
Change the define to more generic naming to match _agn devices since the rssi calculation are common function for 5000 series and up Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c21
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-commands.h33
2 files changed, 30 insertions, 24 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c
index 75b901b3eb1e..84939763d178 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c
@@ -235,13 +235,13 @@ static int iwlagn_calc_rssi(struct iwl_priv *priv,
235 /* data from PHY/DSP regarding signal strength, etc., 235 /* data from PHY/DSP regarding signal strength, etc.,
236 * contents are always there, not configurable by host 236 * contents are always there, not configurable by host
237 */ 237 */
238 struct iwl5000_non_cfg_phy *ncphy = 238 struct iwlagn_non_cfg_phy *ncphy =
239 (struct iwl5000_non_cfg_phy *)rx_resp->non_cfg_phy_buf; 239 (struct iwlagn_non_cfg_phy *)rx_resp->non_cfg_phy_buf;
240 u32 val, rssi_a, rssi_b, rssi_c, max_rssi; 240 u32 val, rssi_a, rssi_b, rssi_c, max_rssi;
241 u8 agc; 241 u8 agc;
242 242
243 val = le32_to_cpu(ncphy->non_cfg_phy[IWL50_RX_RES_AGC_IDX]); 243 val = le32_to_cpu(ncphy->non_cfg_phy[IWLAGN_RX_RES_AGC_IDX]);
244 agc = (val & IWL50_OFDM_AGC_MSK) >> IWL50_OFDM_AGC_BIT_POS; 244 agc = (val & IWLAGN_OFDM_AGC_MSK) >> IWLAGN_OFDM_AGC_BIT_POS;
245 245
246 /* Find max rssi among 3 possible receivers. 246 /* Find max rssi among 3 possible receivers.
247 * These values are measured by the digital signal processor (DSP). 247 * These values are measured by the digital signal processor (DSP).
@@ -249,11 +249,14 @@ static int iwlagn_calc_rssi(struct iwl_priv *priv,
249 * if the radio's automatic gain control (AGC) is working right. 249 * if the radio's automatic gain control (AGC) is working right.
250 * AGC value (see below) will provide the "interesting" info. 250 * AGC value (see below) will provide the "interesting" info.
251 */ 251 */
252 val = le32_to_cpu(ncphy->non_cfg_phy[IWL50_RX_RES_RSSI_AB_IDX]); 252 val = le32_to_cpu(ncphy->non_cfg_phy[IWLAGN_RX_RES_RSSI_AB_IDX]);
253 rssi_a = (val & IWL50_OFDM_RSSI_A_MSK) >> IWL50_OFDM_RSSI_A_BIT_POS; 253 rssi_a = (val & IWLAGN_OFDM_RSSI_INBAND_A_BITMSK) >>
254 rssi_b = (val & IWL50_OFDM_RSSI_B_MSK) >> IWL50_OFDM_RSSI_B_BIT_POS; 254 IWLAGN_OFDM_RSSI_A_BIT_POS;
255 val = le32_to_cpu(ncphy->non_cfg_phy[IWL50_RX_RES_RSSI_C_IDX]); 255 rssi_b = (val & IWLAGN_OFDM_RSSI_INBAND_B_BITMSK) >>
256 rssi_c = (val & IWL50_OFDM_RSSI_C_MSK) >> IWL50_OFDM_RSSI_C_BIT_POS; 256 IWLAGN_OFDM_RSSI_B_BIT_POS;
257 val = le32_to_cpu(ncphy->non_cfg_phy[IWLAGN_RX_RES_RSSI_C_IDX]);
258 rssi_c = (val & IWLAGN_OFDM_RSSI_INBAND_C_BITMSK) >>
259 IWLAGN_OFDM_RSSI_C_BIT_POS;
257 260
258 max_rssi = max_t(u32, rssi_a, rssi_b); 261 max_rssi = max_t(u32, rssi_a, rssi_b);
259 max_rssi = max_t(u32, max_rssi, rssi_c); 262 max_rssi = max_t(u32, max_rssi, rssi_c);
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h
index 13893a0a6197..4083e4430827 100644
--- a/drivers/net/wireless/iwlwifi/iwl-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-commands.h
@@ -1367,21 +1367,24 @@ struct iwl4965_rx_non_cfg_phy {
1367} __packed; 1367} __packed;
1368 1368
1369 1369
1370#define IWL50_RX_RES_PHY_CNT 8 1370#define IWLAGN_RX_RES_PHY_CNT 8
1371#define IWL50_RX_RES_AGC_IDX 1 1371#define IWLAGN_RX_RES_AGC_IDX 1
1372#define IWL50_RX_RES_RSSI_AB_IDX 2 1372#define IWLAGN_RX_RES_RSSI_AB_IDX 2
1373#define IWL50_RX_RES_RSSI_C_IDX 3 1373#define IWLAGN_RX_RES_RSSI_C_IDX 3
1374#define IWL50_OFDM_AGC_MSK 0xfe00 1374#define IWLAGN_OFDM_AGC_MSK 0xfe00
1375#define IWL50_OFDM_AGC_BIT_POS 9 1375#define IWLAGN_OFDM_AGC_BIT_POS 9
1376#define IWL50_OFDM_RSSI_A_MSK 0x00ff 1376#define IWLAGN_OFDM_RSSI_INBAND_A_BITMSK 0x00ff
1377#define IWL50_OFDM_RSSI_A_BIT_POS 0 1377#define IWLAGN_OFDM_RSSI_ALLBAND_A_BITMSK 0xff00
1378#define IWL50_OFDM_RSSI_B_MSK 0xff0000 1378#define IWLAGN_OFDM_RSSI_A_BIT_POS 0
1379#define IWL50_OFDM_RSSI_B_BIT_POS 16 1379#define IWLAGN_OFDM_RSSI_INBAND_B_BITMSK 0xff0000
1380#define IWL50_OFDM_RSSI_C_MSK 0x00ff 1380#define IWLAGN_OFDM_RSSI_ALLBAND_B_BITMSK 0xff000000
1381#define IWL50_OFDM_RSSI_C_BIT_POS 0 1381#define IWLAGN_OFDM_RSSI_B_BIT_POS 16
1382 1382#define IWLAGN_OFDM_RSSI_INBAND_C_BITMSK 0x00ff
1383struct iwl5000_non_cfg_phy { 1383#define IWLAGN_OFDM_RSSI_ALLBAND_C_BITMSK 0xff00
1384 __le32 non_cfg_phy[IWL50_RX_RES_PHY_CNT]; /* up to 8 phy entries */ 1384#define IWLAGN_OFDM_RSSI_C_BIT_POS 0
1385
1386struct iwlagn_non_cfg_phy {
1387 __le32 non_cfg_phy[IWLAGN_RX_RES_PHY_CNT]; /* up to 8 phy entries */
1385} __packed; 1388} __packed;
1386 1389
1387 1390