diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2008-11-25 16:36:01 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-12-05 09:32:11 -0500 |
commit | 0d950d84d9d16f7d4edf380a238c5b534ff00d11 (patch) | |
tree | 3127b67a67b82c131cd0ab63b6ab8dc245e4ceba /drivers/net/wireless/iwlwifi/iwl-5000.c | |
parent | 8e268e47b8ca5bddd189320884c3cc7d9ae489f4 (diff) |
iwlwifi: properly initialize calibration command header
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-5000.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-5000.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index a738886b434f..c3dce81aecc8 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -338,9 +338,13 @@ static void iwl5000_gain_computation(struct iwl_priv *priv, | |||
338 | 338 | ||
339 | if (!data->radio_write) { | 339 | if (!data->radio_write) { |
340 | struct iwl_calib_chain_noise_gain_cmd cmd; | 340 | struct iwl_calib_chain_noise_gain_cmd cmd; |
341 | |||
341 | memset(&cmd, 0, sizeof(cmd)); | 342 | memset(&cmd, 0, sizeof(cmd)); |
342 | 343 | ||
343 | cmd.op_code = IWL_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD; | 344 | cmd.hdr.op_code = IWL_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD; |
345 | cmd.hdr.first_group = 0; | ||
346 | cmd.hdr.groups_num = 1; | ||
347 | cmd.hdr.data_valid = 1; | ||
344 | cmd.delta_gain_1 = data->delta_gain_code[1]; | 348 | cmd.delta_gain_1 = data->delta_gain_code[1]; |
345 | cmd.delta_gain_2 = data->delta_gain_code[2]; | 349 | cmd.delta_gain_2 = data->delta_gain_code[2]; |
346 | iwl_send_cmd_pdu_async(priv, REPLY_PHY_CALIBRATION_CMD, | 350 | iwl_send_cmd_pdu_async(priv, REPLY_PHY_CALIBRATION_CMD, |
@@ -362,14 +366,19 @@ static void iwl5000_gain_computation(struct iwl_priv *priv, | |||
362 | static void iwl5000_chain_noise_reset(struct iwl_priv *priv) | 366 | static void iwl5000_chain_noise_reset(struct iwl_priv *priv) |
363 | { | 367 | { |
364 | struct iwl_chain_noise_data *data = &priv->chain_noise_data; | 368 | struct iwl_chain_noise_data *data = &priv->chain_noise_data; |
369 | int ret; | ||
365 | 370 | ||
366 | if ((data->state == IWL_CHAIN_NOISE_ALIVE) && iwl_is_associated(priv)) { | 371 | if ((data->state == IWL_CHAIN_NOISE_ALIVE) && iwl_is_associated(priv)) { |
367 | struct iwl_calib_chain_noise_reset_cmd cmd; | 372 | struct iwl_calib_chain_noise_reset_cmd cmd; |
368 | |||
369 | memset(&cmd, 0, sizeof(cmd)); | 373 | memset(&cmd, 0, sizeof(cmd)); |
370 | cmd.op_code = IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD; | 374 | |
371 | if (iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, | 375 | cmd.hdr.op_code = IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD; |
372 | sizeof(cmd), &cmd)) | 376 | cmd.hdr.first_group = 0; |
377 | cmd.hdr.groups_num = 1; | ||
378 | cmd.hdr.data_valid = 1; | ||
379 | ret = iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, | ||
380 | sizeof(cmd), &cmd); | ||
381 | if (ret) | ||
373 | IWL_ERROR("Could not send REPLY_PHY_CALIBRATION_CMD\n"); | 382 | IWL_ERROR("Could not send REPLY_PHY_CALIBRATION_CMD\n"); |
374 | data->state = IWL_CHAIN_NOISE_ACCUMULATE; | 383 | data->state = IWL_CHAIN_NOISE_ACCUMULATE; |
375 | IWL_DEBUG_CALIB("Run chain_noise_calibrate\n"); | 384 | IWL_DEBUG_CALIB("Run chain_noise_calibrate\n"); |
@@ -420,17 +429,17 @@ static const u8 *iwl5000_eeprom_query_addr(const struct iwl_priv *priv, | |||
420 | */ | 429 | */ |
421 | static int iwl5000_set_Xtal_calib(struct iwl_priv *priv) | 430 | static int iwl5000_set_Xtal_calib(struct iwl_priv *priv) |
422 | { | 431 | { |
423 | u8 data[sizeof(struct iwl_calib_hdr) + | 432 | struct iwl_calib_xtal_freq_cmd cmd; |
424 | sizeof(struct iwl_cal_xtal_freq)]; | ||
425 | struct iwl_calib_cmd *cmd = (struct iwl_calib_cmd *)data; | ||
426 | struct iwl_cal_xtal_freq *xtal = (struct iwl_cal_xtal_freq *)cmd->data; | ||
427 | u16 *xtal_calib = (u16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_XTAL); | 433 | u16 *xtal_calib = (u16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_XTAL); |
428 | 434 | ||
429 | cmd->hdr.op_code = IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD; | 435 | cmd.hdr.op_code = IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD; |
430 | xtal->cap_pin1 = (u8)xtal_calib[0]; | 436 | cmd.hdr.first_group = 0; |
431 | xtal->cap_pin2 = (u8)xtal_calib[1]; | 437 | cmd.hdr.groups_num = 1; |
438 | cmd.hdr.data_valid = 1; | ||
439 | cmd.cap_pin1 = (u8)xtal_calib[0]; | ||
440 | cmd.cap_pin2 = (u8)xtal_calib[1]; | ||
432 | return iwl_calib_set(&priv->calib_results[IWL_CALIB_XTAL], | 441 | return iwl_calib_set(&priv->calib_results[IWL_CALIB_XTAL], |
433 | data, sizeof(data)); | 442 | (u8 *)&cmd, sizeof(cmd)); |
434 | } | 443 | } |
435 | 444 | ||
436 | static int iwl5000_send_calib_cfg(struct iwl_priv *priv) | 445 | static int iwl5000_send_calib_cfg(struct iwl_priv *priv) |