This patch adds the possibility to disable the tx_power calibration.
In 5000 HW, this calibration is implemented in uCode, hence, it is
disabled in driver by default.
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>
        priv->temperature = temp;
        set_bit(STATUS_TEMPERATURE, &priv->status);
 
-       if (unlikely(!test_bit(STATUS_SCANNING, &priv->status)) &&
-                    iwl4965_is_temp_calib_needed(priv))
+       if (!priv->disable_tx_power_cal &&
+            unlikely(!test_bit(STATUS_SCANNING, &priv->status)) &&
+            iwl4965_is_temp_calib_needed(priv))
                queue_work(priv->workqueue, &priv->txpower_work);
 }
 
 
        return len;
 }
 
+static void iwl5000_setup_deferred_work(struct iwl_priv *priv)
+{
+       /* in 5000 the tx power calibration is done in uCode */
+       priv->disable_tx_power_cal = 1;
+}
+
 static void iwl5000_rx_handler_setup(struct iwl_priv *priv)
 {
        /* init calibration handlers */
        .txq_inval_byte_cnt_tbl = iwl5000_txq_inval_byte_cnt_tbl,
        .txq_set_sched = iwl5000_txq_set_sched,
        .rx_handler_setup = iwl5000_rx_handler_setup,
+       .setup_deferred_work = iwl5000_setup_deferred_work,
        .is_valid_rtc_data_addr = iwl5000_hw_valid_rtc_data_addr,
        .load_ucode = iwl5000_load_ucode,
        .init_alive_start = iwl5000_init_alive_start,
 
        struct dir_rf_files {
                struct dentry *file_disable_sensitivity;
                struct dentry *file_disable_chain_noise;
+               struct dentry *file_disable_tx_power;
        } dbgfs_rf_files;
        u32 sram_offset;
        u32 sram_len;
 
        DEBUGFS_ADD_BOOL(disable_sensitivity, rf, &priv->disable_sens_cal);
        DEBUGFS_ADD_BOOL(disable_chain_noise, rf,
                         &priv->disable_chain_noise_cal);
+       DEBUGFS_ADD_BOOL(disable_tx_power, rf, &priv->disable_tx_power_cal);
        return 0;
 
 err:
        DEBUGFS_REMOVE(priv->dbgfs->dir_data);
        DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_sensitivity);
        DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_chain_noise);
+       DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_tx_power);
        DEBUGFS_REMOVE(priv->dbgfs->dir_rf);
        DEBUGFS_REMOVE(priv->dbgfs->dir_drv);
        kfree(priv->dbgfs);
 
        struct work_struct txpower_work;
        u32 disable_sens_cal;
        u32 disable_chain_noise_cal;
+       u32 disable_tx_power_cal;
        struct work_struct run_time_calib_work;
        struct timer_list statistics_periodic;
 }; /*iwl_priv */