aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
authorShanyu Zhao <shanyu.zhao@intel.com>2010-09-21 19:54:01 -0400
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2010-10-07 18:53:58 -0400
commitbf53f939e02c0e818df93ab130fedc0e4ba95796 (patch)
treee7606844f9f0404ad200a88362125ccbcc5f7727 /drivers/net/wireless/iwlwifi
parent642454cc0774e0774bc1ccb4292d6dc0abd06d20 (diff)
iwlagn: add temperature offset calib for 6000g2
6000g2 devices need to have temperature offset calibration. The runtime uCode needs to receive the calibration results just like BB and LO calibration. To do this, driver reads the offset value from NVM and send it to uCode after runtime uCode is alive. Signed-off-by: Shanyu Zhao <shanyu.zhao@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-6000.c11
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-ucode.c27
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-commands.h10
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h1
5 files changed, 50 insertions, 1 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index a45929ef22ec..4810258aefd9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -204,6 +204,8 @@ static int iwl6000_hw_set_hw_params(struct iwl_priv *priv)
204 BIT(IWL_CALIB_BASE_BAND); 204 BIT(IWL_CALIB_BASE_BAND);
205 if (priv->cfg->need_dc_calib) 205 if (priv->cfg->need_dc_calib)
206 priv->hw_params.calib_rt_cfg |= BIT(IWL_CALIB_CFG_DC_IDX); 206 priv->hw_params.calib_rt_cfg |= BIT(IWL_CALIB_CFG_DC_IDX);
207 if (priv->cfg->need_temp_offset_calib)
208 priv->hw_params.calib_init_cfg |= BIT(IWL_CALIB_TEMP_OFFSET);
207 209
208 priv->hw_params.beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS; 210 priv->hw_params.beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
209 211
@@ -536,6 +538,7 @@ struct iwl_cfg iwl6000g2a_2agn_cfg = {
536 .base_params = &iwl6000_base_params, 538 .base_params = &iwl6000_base_params,
537 .ht_params = &iwl6000_ht_params, 539 .ht_params = &iwl6000_ht_params,
538 .need_dc_calib = true, 540 .need_dc_calib = true,
541 .need_temp_offset_calib = true,
539}; 542};
540 543
541struct iwl_cfg iwl6000g2a_2abg_cfg = { 544struct iwl_cfg iwl6000g2a_2abg_cfg = {
@@ -552,6 +555,7 @@ struct iwl_cfg iwl6000g2a_2abg_cfg = {
552 .mod_params = &iwlagn_mod_params, 555 .mod_params = &iwlagn_mod_params,
553 .base_params = &iwl6000_base_params, 556 .base_params = &iwl6000_base_params,
554 .need_dc_calib = true, 557 .need_dc_calib = true,
558 .need_temp_offset_calib = true,
555}; 559};
556 560
557struct iwl_cfg iwl6000g2a_2bg_cfg = { 561struct iwl_cfg iwl6000g2a_2bg_cfg = {
@@ -568,6 +572,7 @@ struct iwl_cfg iwl6000g2a_2bg_cfg = {
568 .mod_params = &iwlagn_mod_params, 572 .mod_params = &iwlagn_mod_params,
569 .base_params = &iwl6000_base_params, 573 .base_params = &iwl6000_base_params,
570 .need_dc_calib = true, 574 .need_dc_calib = true,
575 .need_temp_offset_calib = true,
571}; 576};
572 577
573struct iwl_cfg iwl6000g2b_2agn_cfg = { 578struct iwl_cfg iwl6000g2b_2agn_cfg = {
@@ -586,6 +591,7 @@ struct iwl_cfg iwl6000g2b_2agn_cfg = {
586 .bt_params = &iwl6000_bt_params, 591 .bt_params = &iwl6000_bt_params,
587 .ht_params = &iwl6000_ht_params, 592 .ht_params = &iwl6000_ht_params,
588 .need_dc_calib = true, 593 .need_dc_calib = true,
594 .need_temp_offset_calib = true,
589 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ 595 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
590 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, 596 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
591}; 597};
@@ -605,6 +611,7 @@ struct iwl_cfg iwl6000g2b_2abg_cfg = {
605 .base_params = &iwl6000_base_params, 611 .base_params = &iwl6000_base_params,
606 .bt_params = &iwl6000_bt_params, 612 .bt_params = &iwl6000_bt_params,
607 .need_dc_calib = true, 613 .need_dc_calib = true,
614 .need_temp_offset_calib = true,
608 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ 615 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
609 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, 616 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
610}; 617};
@@ -625,6 +632,7 @@ struct iwl_cfg iwl6000g2b_2bgn_cfg = {
625 .bt_params = &iwl6000_bt_params, 632 .bt_params = &iwl6000_bt_params,
626 .ht_params = &iwl6000_ht_params, 633 .ht_params = &iwl6000_ht_params,
627 .need_dc_calib = true, 634 .need_dc_calib = true,
635 .need_temp_offset_calib = true,
628 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ 636 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
629 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, 637 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
630}; 638};
@@ -644,6 +652,7 @@ struct iwl_cfg iwl6000g2b_2bg_cfg = {
644 .base_params = &iwl6000_base_params, 652 .base_params = &iwl6000_base_params,
645 .bt_params = &iwl6000_bt_params, 653 .bt_params = &iwl6000_bt_params,
646 .need_dc_calib = true, 654 .need_dc_calib = true,
655 .need_temp_offset_calib = true,
647 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ 656 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
648 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, 657 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
649}; 658};
@@ -664,6 +673,7 @@ struct iwl_cfg iwl6000g2b_bgn_cfg = {
664 .bt_params = &iwl6000_bt_params, 673 .bt_params = &iwl6000_bt_params,
665 .ht_params = &iwl6000_ht_params, 674 .ht_params = &iwl6000_ht_params,
666 .need_dc_calib = true, 675 .need_dc_calib = true,
676 .need_temp_offset_calib = true,
667 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ 677 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
668 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, 678 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
669}; 679};
@@ -683,6 +693,7 @@ struct iwl_cfg iwl6000g2b_bg_cfg = {
683 .base_params = &iwl6000_base_params, 693 .base_params = &iwl6000_base_params,
684 .bt_params = &iwl6000_bt_params, 694 .bt_params = &iwl6000_bt_params,
685 .need_dc_calib = true, 695 .need_dc_calib = true,
696 .need_temp_offset_calib = true,
686 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ 697 /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
687 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, 698 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A,
688}; 699};
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
index 3a9537953875..703621107dac 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
@@ -215,6 +215,25 @@ static int iwlagn_set_Xtal_calib(struct iwl_priv *priv)
215 (u8 *)&cmd, sizeof(cmd)); 215 (u8 *)&cmd, sizeof(cmd));
216} 216}
217 217
218static int iwlagn_set_temperature_offset_calib(struct iwl_priv *priv)
219{
220 struct iwl_calib_temperature_offset_cmd cmd;
221 __le16 *offset_calib =
222 (__le16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_TEMPERATURE);
223 cmd.hdr.op_code = IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD;
224 cmd.hdr.first_group = 0;
225 cmd.hdr.groups_num = 1;
226 cmd.hdr.data_valid = 1;
227 cmd.radio_sensor_offset = le16_to_cpu(offset_calib[1]);
228 if (!(cmd.radio_sensor_offset))
229 cmd.radio_sensor_offset = DEFAULT_RADIO_SENSOR_OFFSET;
230 cmd.reserved = 0;
231 IWL_DEBUG_CALIB(priv, "Radio sensor offset: %d\n",
232 cmd.radio_sensor_offset);
233 return iwl_calib_set(&priv->calib_results[IWL_CALIB_TEMP_OFFSET],
234 (u8 *)&cmd, sizeof(cmd));
235}
236
218static int iwlagn_send_calib_cfg(struct iwl_priv *priv) 237static int iwlagn_send_calib_cfg(struct iwl_priv *priv)
219{ 238{
220 struct iwl_calib_cfg_cmd calib_cfg_cmd; 239 struct iwl_calib_cfg_cmd calib_cfg_cmd;
@@ -321,6 +340,14 @@ void iwlagn_init_alive_start(struct iwl_priv *priv)
321 340
322 } 341 }
323 iwlagn_send_calib_cfg(priv); 342 iwlagn_send_calib_cfg(priv);
343
344 /**
345 * temperature offset calibration is only needed for runtime ucode,
346 * so prepare the value now.
347 */
348 if (priv->cfg->need_temp_offset_calib)
349 iwlagn_set_temperature_offset_calib(priv);
350
324 return; 351 return;
325 352
326restart: 353restart:
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h
index 74b78d858936..424801abc80e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-commands.h
@@ -3794,7 +3794,8 @@ enum {
3794 IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD = 15, 3794 IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD = 15,
3795 IWL_PHY_CALIBRATE_BASE_BAND_CMD = 16, 3795 IWL_PHY_CALIBRATE_BASE_BAND_CMD = 16,
3796 IWL_PHY_CALIBRATE_TX_IQ_PERD_CMD = 17, 3796 IWL_PHY_CALIBRATE_TX_IQ_PERD_CMD = 17,
3797 IWL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE = 18, 3797 IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD = 18,
3798 IWL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE = 19,
3798}; 3799};
3799 3800
3800#define IWL_MAX_PHY_CALIBRATE_TBL_SIZE (253) 3801#define IWL_MAX_PHY_CALIBRATE_TBL_SIZE (253)
@@ -3864,6 +3865,13 @@ struct iwl_calib_xtal_freq_cmd {
3864 u8 pad[2]; 3865 u8 pad[2];
3865} __packed; 3866} __packed;
3866 3867
3868#define DEFAULT_RADIO_SENSOR_OFFSET 2700
3869struct iwl_calib_temperature_offset_cmd {
3870 struct iwl_calib_hdr hdr;
3871 s16 radio_sensor_offset;
3872 s16 reserved;
3873} __packed;
3874
3867/* IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD */ 3875/* IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD */
3868struct iwl_calib_chain_noise_reset_cmd { 3876struct iwl_calib_chain_noise_reset_cmd {
3869 struct iwl_calib_hdr hdr; 3877 struct iwl_calib_hdr hdr;
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index a5e12b70c594..64527def059f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -342,6 +342,7 @@ struct iwl_ht_params {
342 * @ucode_api_min: Lowest version of uCode API supported by driver. 342 * @ucode_api_min: Lowest version of uCode API supported by driver.
343 * @pa_type: used by 6000 series only to identify the type of Power Amplifier 343 * @pa_type: used by 6000 series only to identify the type of Power Amplifier
344 * @need_dc_calib: need to perform init dc calibration 344 * @need_dc_calib: need to perform init dc calibration
345 * @need_temp_offset_calib: need to perform temperature offset calibration
345 * @scan_antennas: available antenna for scan operation 346 * @scan_antennas: available antenna for scan operation
346 * 347 *
347 * We enable the driver to be backward compatible wrt API version. The 348 * We enable the driver to be backward compatible wrt API version. The
@@ -386,6 +387,7 @@ struct iwl_cfg {
386 struct iwl_bt_params *bt_params; 387 struct iwl_bt_params *bt_params;
387 enum iwl_pa_type pa_type; /* if used set to IWL_PA_SYSTEM */ 388 enum iwl_pa_type pa_type; /* if used set to IWL_PA_SYSTEM */
388 const bool need_dc_calib; /* if used set to true */ 389 const bool need_dc_calib; /* if used set to true */
390 const bool need_temp_offset_calib; /* if used set to true */
389 u8 scan_rx_antennas[IEEE80211_NUM_BANDS]; 391 u8 scan_rx_antennas[IEEE80211_NUM_BANDS];
390 u8 scan_tx_antennas[IEEE80211_NUM_BANDS]; 392 u8 scan_tx_antennas[IEEE80211_NUM_BANDS];
391}; 393};
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 2c57dbd2de19..de43e1350ed1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -835,6 +835,7 @@ enum iwl_calib {
835 IWL_CALIB_TX_IQ, 835 IWL_CALIB_TX_IQ,
836 IWL_CALIB_TX_IQ_PERD, 836 IWL_CALIB_TX_IQ_PERD,
837 IWL_CALIB_BASE_BAND, 837 IWL_CALIB_BASE_BAND,
838 IWL_CALIB_TEMP_OFFSET,
838 IWL_CALIB_MAX 839 IWL_CALIB_MAX
839}; 840};
840 841