mirror of
https://github.com/torvalds/linux.git
synced 2024-12-14 23:25:54 +00:00
iwlagn: add support for v2 of temperature offset calibration
For 2000 series of NICs, version 2 of temperature offset calibration should be used. Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
18d0077f0c
commit
c6f30347a7
@ -264,6 +264,7 @@ static struct iwl_bt_params iwl2030_bt_params = {
|
||||
.base_params = &iwl2000_base_params, \
|
||||
.need_dc_calib = true, \
|
||||
.need_temp_offset_calib = true, \
|
||||
.temp_offset_v2 = true, \
|
||||
.led_mode = IWL_LED_RF_STATE, \
|
||||
.iq_invert = true \
|
||||
|
||||
@ -296,6 +297,7 @@ struct iwl_cfg iwl2000_2bgn_d_cfg = {
|
||||
.bt_params = &iwl2030_bt_params, \
|
||||
.need_dc_calib = true, \
|
||||
.need_temp_offset_calib = true, \
|
||||
.temp_offset_v2 = true, \
|
||||
.led_mode = IWL_LED_RF_STATE, \
|
||||
.adv_pm = true, \
|
||||
.iq_invert = true \
|
||||
@ -322,6 +324,7 @@ struct iwl_cfg iwl2030_2bg_cfg = {
|
||||
.base_params = &iwl2000_base_params, \
|
||||
.need_dc_calib = true, \
|
||||
.need_temp_offset_calib = true, \
|
||||
.temp_offset_v2 = true, \
|
||||
.led_mode = IWL_LED_RF_STATE, \
|
||||
.adv_pm = true, \
|
||||
.rx_with_siso_diversity = true, \
|
||||
@ -350,6 +353,7 @@ struct iwl_cfg iwl105_bgn_cfg = {
|
||||
.bt_params = &iwl2030_bt_params, \
|
||||
.need_dc_calib = true, \
|
||||
.need_temp_offset_calib = true, \
|
||||
.temp_offset_v2 = true, \
|
||||
.led_mode = IWL_LED_RF_STATE, \
|
||||
.adv_pm = true, \
|
||||
.rx_with_siso_diversity = true, \
|
||||
|
@ -74,8 +74,8 @@
|
||||
static inline s32 iwl_temp_calib_to_offset(struct iwl_priv *priv)
|
||||
{
|
||||
u16 temperature, voltage;
|
||||
__le16 *temp_calib =
|
||||
(__le16 *)iwl_eeprom_query_addr(priv, EEPROM_TEMPERATURE);
|
||||
__le16 *temp_calib = (__le16 *)iwl_eeprom_query_addr(priv,
|
||||
EEPROM_KELVIN_TEMPERATURE);
|
||||
|
||||
temperature = le16_to_cpu(temp_calib[0]);
|
||||
voltage = le16_to_cpu(temp_calib[1]);
|
||||
|
@ -164,7 +164,7 @@ static int iwlagn_set_temperature_offset_calib(struct iwl_priv *priv)
|
||||
{
|
||||
struct iwl_calib_temperature_offset_cmd cmd;
|
||||
__le16 *offset_calib =
|
||||
(__le16 *)iwl_eeprom_query_addr(priv, EEPROM_TEMPERATURE);
|
||||
(__le16 *)iwl_eeprom_query_addr(priv, EEPROM_RAW_TEMPERATURE);
|
||||
|
||||
memset(&cmd, 0, sizeof(cmd));
|
||||
iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD);
|
||||
@ -178,6 +178,41 @@ static int iwlagn_set_temperature_offset_calib(struct iwl_priv *priv)
|
||||
(u8 *)&cmd, sizeof(cmd));
|
||||
}
|
||||
|
||||
static int iwlagn_set_temperature_offset_calib_v2(struct iwl_priv *priv)
|
||||
{
|
||||
struct iwl_calib_temperature_offset_v2_cmd cmd;
|
||||
__le16 *offset_calib_high = (__le16 *)iwl_eeprom_query_addr(priv,
|
||||
EEPROM_KELVIN_TEMPERATURE);
|
||||
__le16 *offset_calib_low =
|
||||
(__le16 *)iwl_eeprom_query_addr(priv, EEPROM_RAW_TEMPERATURE);
|
||||
__le16 *voltage_reading =
|
||||
(__le16 *)iwl_eeprom_query_addr(priv, EEPROM_VOLTAGE_READING);
|
||||
|
||||
memset(&cmd, 0, sizeof(cmd));
|
||||
iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD);
|
||||
memcpy(&cmd.radio_sensor_offset_high, offset_calib_high,
|
||||
sizeof(offset_calib_high));
|
||||
memcpy(&cmd.radio_sensor_offset_low, offset_calib_low,
|
||||
sizeof(offset_calib_low));
|
||||
if (!(cmd.radio_sensor_offset_low)) {
|
||||
IWL_DEBUG_CALIB(priv, "no info in EEPROM, use default\n");
|
||||
cmd.radio_sensor_offset_low = DEFAULT_RADIO_SENSOR_OFFSET;
|
||||
cmd.radio_sensor_offset_high = DEFAULT_RADIO_SENSOR_OFFSET;
|
||||
}
|
||||
memcpy(&cmd.burntVoltageRef, voltage_reading,
|
||||
sizeof(voltage_reading));
|
||||
|
||||
IWL_DEBUG_CALIB(priv, "Radio sensor offset high: %d\n",
|
||||
le16_to_cpu(cmd.radio_sensor_offset_high));
|
||||
IWL_DEBUG_CALIB(priv, "Radio sensor offset low: %d\n",
|
||||
le16_to_cpu(cmd.radio_sensor_offset_low));
|
||||
IWL_DEBUG_CALIB(priv, "Voltage Ref: %d\n",
|
||||
le16_to_cpu(cmd.burntVoltageRef));
|
||||
|
||||
return iwl_calib_set(&priv->calib_results[IWL_CALIB_TEMP_OFFSET],
|
||||
(u8 *)&cmd, sizeof(cmd));
|
||||
}
|
||||
|
||||
static int iwlagn_send_calib_cfg(struct iwl_priv *priv)
|
||||
{
|
||||
struct iwl_calib_cfg_cmd calib_cfg_cmd;
|
||||
@ -263,8 +298,12 @@ int iwlagn_init_alive_start(struct iwl_priv *priv)
|
||||
* temperature offset calibration is only needed for runtime ucode,
|
||||
* so prepare the value now.
|
||||
*/
|
||||
if (priv->cfg->need_temp_offset_calib)
|
||||
return iwlagn_set_temperature_offset_calib(priv);
|
||||
if (priv->cfg->need_temp_offset_calib) {
|
||||
if (priv->cfg->temp_offset_v2)
|
||||
return iwlagn_set_temperature_offset_calib_v2(priv);
|
||||
else
|
||||
return iwlagn_set_temperature_offset_calib(priv);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -3263,6 +3263,14 @@ struct iwl_calib_temperature_offset_cmd {
|
||||
__le16 reserved;
|
||||
} __packed;
|
||||
|
||||
struct iwl_calib_temperature_offset_v2_cmd {
|
||||
struct iwl_calib_hdr hdr;
|
||||
__le16 radio_sensor_offset_high;
|
||||
__le16 radio_sensor_offset_low;
|
||||
__le16 burntVoltageRef;
|
||||
__le16 reserved;
|
||||
} __packed;
|
||||
|
||||
/* IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD */
|
||||
struct iwl_calib_chain_noise_reset_cmd {
|
||||
struct iwl_calib_hdr hdr;
|
||||
|
@ -193,6 +193,7 @@ struct iwl_ht_params {
|
||||
* @rx_with_siso_diversity: 1x1 device with rx antenna diversity
|
||||
* @internal_wimax_coex: internal wifi/wimax combo device
|
||||
* @iq_invert: I/Q inversion
|
||||
* @temp_offset_v2: support v2 of temperature offset calibration
|
||||
*
|
||||
* We enable the driver to be backward compatible wrt API version. The
|
||||
* driver specifies which APIs it supports (with @ucode_api_max being the
|
||||
@ -230,6 +231,7 @@ struct iwl_cfg {
|
||||
const bool rx_with_siso_diversity;
|
||||
const bool internal_wimax_coex;
|
||||
const bool iq_invert;
|
||||
const bool temp_offset_v2;
|
||||
};
|
||||
|
||||
/***************************
|
||||
|
@ -167,7 +167,10 @@ struct iwl_eeprom_enhanced_txpwr {
|
||||
#define EEPROM_XTAL ((2*0x128) | EEPROM_CALIB_ALL)
|
||||
|
||||
/* temperature */
|
||||
#define EEPROM_TEMPERATURE ((2*0x12A) | EEPROM_CALIB_ALL)
|
||||
#define EEPROM_VOLTAGE_READING ((2*0x1) | EEPROM_CALIB_ALL)
|
||||
#define EEPROM_KELVIN_TEMPERATURE ((2*0x12A) | EEPROM_CALIB_ALL)
|
||||
#define EEPROM_RAW_TEMPERATURE ((2*0x12B) | EEPROM_CALIB_ALL)
|
||||
|
||||
|
||||
/* agn links */
|
||||
#define EEPROM_LINK_HOST (2*0x64)
|
||||
|
Loading…
Reference in New Issue
Block a user