Lines Matching defs:priv

81 iwl_get_ucode_image(struct iwl_priv *priv, enum iwl_ucode_type ucode_type)
86 return &priv->fw->img[ucode_type];
92 static int iwl_set_Xtal_calib(struct iwl_priv *priv)
96 (__le16 *)iwl_eeprom_query_addr(priv->shrd, EEPROM_XTAL);
101 return iwl_calib_set(priv, (void *)&cmd, sizeof(cmd));
104 static int iwl_set_temperature_offset_calib(struct iwl_priv *priv)
108 (__le16 *)iwl_eeprom_query_addr(priv->shrd,
117 IWL_DEBUG_CALIB(priv, "Radio sensor offset: %d\n",
119 return iwl_calib_set(priv, (void *)&cmd, sizeof(cmd));
122 static int iwl_set_temperature_offset_calib_v2(struct iwl_priv *priv)
125 __le16 *offset_calib_high = (__le16 *)iwl_eeprom_query_addr(priv->shrd,
128 (__le16 *)iwl_eeprom_query_addr(priv->shrd,
134 hdr = (struct iwl_eeprom_calib_hdr *)iwl_eeprom_query_addr(priv->shrd,
141 IWL_DEBUG_CALIB(priv, "no info in EEPROM, use default\n");
148 IWL_DEBUG_CALIB(priv, "Radio sensor offset high: %d\n",
150 IWL_DEBUG_CALIB(priv, "Radio sensor offset low: %d\n",
152 IWL_DEBUG_CALIB(priv, "Voltage Ref: %d\n",
155 return iwl_calib_set(priv, (void *)&cmd, sizeof(cmd));
158 static int iwl_send_calib_cfg(struct iwl_priv *priv)
174 return iwl_dvm_send_cmd(priv, &cmd);
177 int iwlagn_rx_calib_result(struct iwl_priv *priv,
188 if (iwl_calib_set(priv, hdr, len))
189 IWL_ERR(priv, "Failed to record calibration data %d\n",
195 int iwl_init_alive_start(struct iwl_priv *priv)
199 if (cfg(priv)->bt_params &&
200 cfg(priv)->bt_params->advanced_bt_coexist) {
207 ret = iwl_send_bt_env(priv, IWL_BT_COEX_ENV_OPEN,
214 ret = iwl_send_calib_cfg(priv);
222 if (cfg(priv)->need_temp_offset_calib) {
223 if (cfg(priv)->temp_offset_v2)
224 return iwl_set_temperature_offset_calib_v2(priv);
226 return iwl_set_temperature_offset_calib(priv);
232 static int iwl_send_wimax_coex(struct iwl_priv *priv)
236 if (cfg(priv)->base_params->support_wimax_coexist) {
255 return iwl_dvm_send_cmd_pdu(priv,
282 void iwl_send_prio_tbl(struct iwl_priv *priv)
288 if (iwl_dvm_send_cmd_pdu(priv,
291 IWL_ERR(priv, "failed to send BT prio tbl command\n");
294 int iwl_send_bt_env(struct iwl_priv *priv, u8 action, u8 type)
301 ret = iwl_dvm_send_cmd_pdu(priv,
305 IWL_ERR(priv, "failed to send BT env command\n");
310 static int iwl_alive_notify(struct iwl_priv *priv)
314 iwl_trans_fw_alive(trans(priv));
316 priv->passive_no_rx = false;
317 priv->transport_queue_stop = 0;
319 ret = iwl_send_wimax_coex(priv);
323 if (!cfg(priv)->no_xtal_calib) {
324 ret = iwl_set_Xtal_calib(priv);
329 return iwl_send_calib_results(priv);
338 static int iwl_verify_sec_sparse(struct iwl_priv *priv,
346 IWL_DEBUG_FW(priv, "ucode inst image size is %u\n", len);
352 iwl_write_direct32(trans(priv), HBUS_TARG_MEM_RADDR,
354 val = iwl_read32(trans(priv), HBUS_TARG_MEM_RDAT);
362 static void iwl_print_mismatch_sec(struct iwl_priv *priv,
371 IWL_DEBUG_FW(priv, "ucode inst image size is %u\n", len);
373 iwl_write_direct32(trans(priv), HBUS_TARG_MEM_RADDR,
380 val = iwl_read32(trans(priv), HBUS_TARG_MEM_RDAT);
382 IWL_ERR(priv, "uCode INST section at "
394 static int iwl_verify_ucode(struct iwl_priv *priv,
397 const struct fw_img *img = iwl_get_ucode_image(priv, ucode_type);
400 IWL_ERR(priv, "Invalid ucode requested (%d)\n", ucode_type);
404 if (!iwl_verify_sec_sparse(priv, &img->sec[IWL_UCODE_SECTION_INST])) {
405 IWL_DEBUG_FW(priv, "uCode is good in inst SRAM\n");
409 IWL_ERR(priv, "UCODE IMAGE IN INSTRUCTION SRAM NOT VALID!!\n");
411 iwl_print_mismatch_sec(priv, &img->sec[IWL_UCODE_SECTION_INST]);
424 struct iwl_priv *priv =
431 IWL_DEBUG_FW(priv, "Alive ucode status 0x%08X revision "
436 priv->shrd->device_pointers.error_event_table =
438 priv->shrd->device_pointers.log_event_table =
448 int iwl_load_ucode_wait_alive(struct iwl_priv *priv,
457 old_type = priv->shrd->ucode_type;
458 priv->shrd->ucode_type = ucode_type;
459 fw = iwl_get_ucode_image(priv, ucode_type);
461 priv->ucode_loaded = false;
466 iwl_init_notification_wait(&priv->notif_wait, &alive_wait, REPLY_ALIVE,
469 ret = iwl_trans_start_fw(trans(priv), fw);
471 priv->shrd->ucode_type = old_type;
472 iwl_remove_notification(&priv->notif_wait, &alive_wait);
480 ret = iwl_wait_notification(&priv->notif_wait, &alive_wait,
483 priv->shrd->ucode_type = old_type;
488 IWL_ERR(priv, "Loaded ucode is not valid!\n");
489 priv->shrd->ucode_type = old_type;
499 ret = iwl_verify_ucode(priv, ucode_type);
501 priv->shrd->ucode_type = old_type;
509 ret = iwl_alive_notify(priv);
511 IWL_WARN(priv,
513 priv->shrd->ucode_type = old_type;
517 priv->ucode_loaded = true;
522 int iwl_run_init_ucode(struct iwl_priv *priv)
527 lockdep_assert_held(&priv->mutex);
530 if (!priv->fw->img[IWL_UCODE_INIT].sec[0].len)
533 if (priv->init_ucode_run)
536 iwl_init_notification_wait(&priv->notif_wait, &calib_wait,
541 ret = iwl_load_ucode_wait_alive(priv, IWL_UCODE_INIT);
545 ret = iwl_init_alive_start(priv);
553 ret = iwl_wait_notification(&priv->notif_wait, &calib_wait,
556 priv->init_ucode_run = true;
561 iwl_remove_notification(&priv->notif_wait, &calib_wait);
564 iwl_trans_stop_device(trans(priv));
565 priv->ucode_loaded = false;