diff options
author | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2008-06-30 05:23:07 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-06-30 17:37:39 -0400 |
commit | 8f91aecb4cdc2d786df8941e827b9dff3c10a4e4 (patch) | |
tree | 868178c41e3559b7f91bda02a78f4a9caea79fe6 /drivers/net/wireless/iwlwifi/iwl-4965.c | |
parent | 43d59b323743b8a01e9ad1a1b31b0d7c0ef6e35a (diff) |
iwlwifi: move RX stats to core, and move temperature to handler
This patch moves RX stats flow to core modules, and moves temperature
calibration to handler since it is not needed in 5000.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@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 | 78 |
1 files changed, 6 insertions, 72 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index ab5027345a01..1688803af582 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -555,8 +555,6 @@ out: | |||
555 | return ret; | 555 | return ret; |
556 | } | 556 | } |
557 | 557 | ||
558 | #define REG_RECALIB_PERIOD (60) | ||
559 | |||
560 | /* Reset differential Rx gains in NIC to prepare for chain noise calibration. | 558 | /* Reset differential Rx gains in NIC to prepare for chain noise calibration. |
561 | * Called after every association, but this runs only once! | 559 | * Called after every association, but this runs only once! |
562 | * ... once chain noise is calibrated the first time, it's good forever. */ | 560 | * ... once chain noise is calibrated the first time, it's good forever. */ |
@@ -1890,80 +1888,15 @@ static int iwl4965_is_temp_calib_needed(struct iwl_priv *priv) | |||
1890 | return 1; | 1888 | return 1; |
1891 | } | 1889 | } |
1892 | 1890 | ||
1893 | /* Calculate noise level, based on measurements during network silence just | 1891 | static void iwl4965_temperature_calib(struct iwl_priv *priv, |
1894 | * before arriving beacon. This measurement can be done only if we know | 1892 | struct iwl_notif_statistics *stats) |
1895 | * exactly when to expect beacons, therefore only when we're associated. */ | ||
1896 | static void iwl4965_rx_calc_noise(struct iwl_priv *priv) | ||
1897 | { | 1893 | { |
1898 | struct statistics_rx_non_phy *rx_info | ||
1899 | = &(priv->statistics.rx.general); | ||
1900 | int num_active_rx = 0; | ||
1901 | int total_silence = 0; | ||
1902 | int bcn_silence_a = | ||
1903 | le32_to_cpu(rx_info->beacon_silence_rssi_a) & IN_BAND_FILTER; | ||
1904 | int bcn_silence_b = | ||
1905 | le32_to_cpu(rx_info->beacon_silence_rssi_b) & IN_BAND_FILTER; | ||
1906 | int bcn_silence_c = | ||
1907 | le32_to_cpu(rx_info->beacon_silence_rssi_c) & IN_BAND_FILTER; | ||
1908 | |||
1909 | if (bcn_silence_a) { | ||
1910 | total_silence += bcn_silence_a; | ||
1911 | num_active_rx++; | ||
1912 | } | ||
1913 | if (bcn_silence_b) { | ||
1914 | total_silence += bcn_silence_b; | ||
1915 | num_active_rx++; | ||
1916 | } | ||
1917 | if (bcn_silence_c) { | ||
1918 | total_silence += bcn_silence_c; | ||
1919 | num_active_rx++; | ||
1920 | } | ||
1921 | |||
1922 | /* Average among active antennas */ | ||
1923 | if (num_active_rx) | ||
1924 | priv->last_rx_noise = (total_silence / num_active_rx) - 107; | ||
1925 | else | ||
1926 | priv->last_rx_noise = IWL_NOISE_MEAS_NOT_AVAILABLE; | ||
1927 | |||
1928 | IWL_DEBUG_CALIB("inband silence a %u, b %u, c %u, dBm %d\n", | ||
1929 | bcn_silence_a, bcn_silence_b, bcn_silence_c, | ||
1930 | priv->last_rx_noise); | ||
1931 | } | ||
1932 | |||
1933 | void iwl4965_hw_rx_statistics(struct iwl_priv *priv, | ||
1934 | struct iwl_rx_mem_buffer *rxb) | ||
1935 | { | ||
1936 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; | ||
1937 | int change; | ||
1938 | s32 temp; | 1894 | s32 temp; |
1939 | 1895 | int change = ((priv->statistics.general.temperature != | |
1940 | IWL_DEBUG_RX("Statistics notification received (%d vs %d).\n", | 1896 | stats->general.temperature) || |
1941 | (int)sizeof(priv->statistics), pkt->len); | ||
1942 | |||
1943 | change = ((priv->statistics.general.temperature != | ||
1944 | pkt->u.stats.general.temperature) || | ||
1945 | ((priv->statistics.flag & | 1897 | ((priv->statistics.flag & |
1946 | STATISTICS_REPLY_FLG_FAT_MODE_MSK) != | 1898 | STATISTICS_REPLY_FLG_FAT_MODE_MSK) != |
1947 | (pkt->u.stats.flag & STATISTICS_REPLY_FLG_FAT_MODE_MSK))); | 1899 | (stats->flag & STATISTICS_REPLY_FLG_FAT_MODE_MSK))); |
1948 | |||
1949 | memcpy(&priv->statistics, &pkt->u.stats, sizeof(priv->statistics)); | ||
1950 | |||
1951 | set_bit(STATUS_STATISTICS, &priv->status); | ||
1952 | |||
1953 | /* Reschedule the statistics timer to occur in | ||
1954 | * REG_RECALIB_PERIOD seconds to ensure we get a | ||
1955 | * thermal update even if the uCode doesn't give | ||
1956 | * us one */ | ||
1957 | mod_timer(&priv->statistics_periodic, jiffies + | ||
1958 | msecs_to_jiffies(REG_RECALIB_PERIOD * 1000)); | ||
1959 | |||
1960 | if (unlikely(!test_bit(STATUS_SCANNING, &priv->status)) && | ||
1961 | (pkt->hdr.cmd == STATISTICS_NOTIFICATION)) { | ||
1962 | iwl4965_rx_calc_noise(priv); | ||
1963 | queue_work(priv->workqueue, &priv->run_time_calib_work); | ||
1964 | } | ||
1965 | |||
1966 | iwl_leds_background(priv); | ||
1967 | 1900 | ||
1968 | /* If the hardware hasn't reported a change in | 1901 | /* If the hardware hasn't reported a change in |
1969 | * temperature then don't bother computing a | 1902 | * temperature then don't bother computing a |
@@ -3391,6 +3324,7 @@ static struct iwl_lib_ops iwl4965_lib = { | |||
3391 | .set_power = iwl4965_set_power, | 3324 | .set_power = iwl4965_set_power, |
3392 | .send_tx_power = iwl4965_send_tx_power, | 3325 | .send_tx_power = iwl4965_send_tx_power, |
3393 | .update_chain_flags = iwl4965_update_chain_flags, | 3326 | .update_chain_flags = iwl4965_update_chain_flags, |
3327 | .temperature = iwl4965_temperature_calib, | ||
3394 | }; | 3328 | }; |
3395 | 3329 | ||
3396 | static struct iwl_ops iwl4965_ops = { | 3330 | static struct iwl_ops iwl4965_ops = { |