Lines Matching full:qmi
32 static int ath10k_qmi_map_msa_permission(struct ath10k_qmi *qmi,
36 struct ath10k *ar = qmi->ar;
64 static int ath10k_qmi_unmap_msa_permission(struct ath10k_qmi *qmi,
68 struct ath10k *ar = qmi->ar;
88 static int ath10k_qmi_setup_msa_permissions(struct ath10k_qmi *qmi)
93 if (qmi->msa_fixed_perm)
96 for (i = 0; i < qmi->nr_mem_region; i++) {
97 ret = ath10k_qmi_map_msa_permission(qmi, &qmi->mem_region[i]);
106 ath10k_qmi_unmap_msa_permission(qmi, &qmi->mem_region[i]);
110 static void ath10k_qmi_remove_msa_permission(struct ath10k_qmi *qmi)
114 if (qmi->msa_fixed_perm)
117 for (i = 0; i < qmi->nr_mem_region; i++)
118 ath10k_qmi_unmap_msa_permission(qmi, &qmi->mem_region[i]);
121 static int ath10k_qmi_msa_mem_info_send_sync_msg(struct ath10k_qmi *qmi)
125 struct ath10k *ar = qmi->ar;
134 ret = qmi_txn_init(&qmi->qmi_hdl, &txn,
139 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
167 qmi->nr_mem_region = resp.mem_region_info_len;
180 qmi->mem_region[i].addr = resp.mem_region_info[i].region_addr;
181 qmi->mem_region[i].size = resp.mem_region_info[i].size;
182 qmi->mem_region[i].secure = resp.mem_region_info[i].secure_flag;
184 "qmi msa mem region %d addr 0x%pa size 0x%x flag 0x%08x\n",
185 i, &qmi->mem_region[i].addr,
186 qmi->mem_region[i].size,
187 qmi->mem_region[i].secure);
190 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi msa mem info request completed\n");
194 memset(&qmi->mem_region[0], 0, sizeof(qmi->mem_region[0]) * i);
199 static int ath10k_qmi_msa_ready_send_sync_msg(struct ath10k_qmi *qmi)
203 struct ath10k *ar = qmi->ar;
207 ret = qmi_txn_init(&qmi->qmi_hdl, &txn,
212 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
231 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi msa mem ready request completed\n");
238 static int ath10k_qmi_bdf_dnld_send_sync(struct ath10k_qmi *qmi)
242 struct ath10k *ar = qmi->ar;
274 ret = qmi_txn_init(&qmi->qmi_hdl, &txn,
280 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
314 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi bdf download request completed\n");
324 static int ath10k_qmi_send_cal_report_req(struct ath10k_qmi *qmi)
328 struct ath10k *ar = qmi->ar;
339 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, wlfw_cal_report_resp_msg_v01_ei,
345 if (qmi->cal_data[i].total_size &&
346 qmi->cal_data[i].data) {
347 req.meta_data[j] = qmi->cal_data[i].cal_id;
353 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
373 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi cal report request completed\n");
384 struct ath10k_qmi *qmi = ar_snoc->qmi;
390 ret = qmi_txn_init(&qmi->qmi_hdl, &txn,
400 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
420 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi wlan mode req completed: %d\n", mode);
433 struct ath10k_qmi *qmi = ar_snoc->qmi;
444 ret = qmi_txn_init(&qmi->qmi_hdl, &txn,
486 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
506 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi config request completed\n");
522 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi mode %d config %p\n",
527 ath10k_err(ar, "failed to send qmi config: %d\n", ret);
533 ath10k_err(ar, "failed to send qmi mode: %d\n", ret);
572 static int ath10k_qmi_cap_send_sync_msg(struct ath10k_qmi *qmi)
576 struct ath10k *ar = qmi->ar;
585 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, wlfw_cap_resp_msg_v01_ei, resp);
589 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
610 qmi->chip_info.chip_id = resp->chip_info.chip_id;
611 qmi->chip_info.chip_family = resp->chip_info.chip_family;
613 qmi->chip_info.chip_id = 0xFF;
617 qmi->board_info.board_id = resp->board_info.board_id;
619 qmi->board_info.board_id = 0xFF;
622 qmi->soc_info.soc_id = resp->soc_info.soc_id;
625 qmi->fw_version = resp->fw_version_info.fw_version;
626 strscpy(qmi->fw_build_timestamp, resp->fw_version_info.fw_build_timestamp,
627 sizeof(qmi->fw_build_timestamp));
631 strscpy(qmi->fw_build_id, resp->fw_build_id,
635 ath10k_info(ar, "qmi chip_id 0x%x chip_family 0x%x board_id 0x%x soc_id 0x%x",
636 qmi->chip_info.chip_id, qmi->chip_info.chip_family,
637 qmi->board_info.board_id, qmi->soc_info.soc_id);
638 ath10k_info(ar, "qmi fw_version 0x%x fw_build_timestamp %s fw_build_id %s",
639 qmi->fw_version, qmi->fw_build_timestamp, qmi->fw_build_id);
643 ath10k_qmi_add_wlan_ver_smem(ar, qmi->fw_build_id);
653 static int ath10k_qmi_host_cap_send_sync(struct ath10k_qmi *qmi)
658 struct ath10k *ar = qmi->ar;
666 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, wlfw_host_cap_resp_msg_v01_ei,
676 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
698 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi host capability request completed\n");
709 struct ath10k_qmi *qmi = ar_snoc->qmi;
717 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, wlfw_ini_resp_msg_v01_ei,
722 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
742 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi fw log request completed, mode: %d\n",
751 ath10k_qmi_ind_register_send_sync_msg(struct ath10k_qmi *qmi)
755 struct ath10k *ar = qmi->ar;
772 ret = qmi_txn_init(&qmi->qmi_hdl, &txn,
777 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
799 qmi->fw_ready = true;
801 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi indication register request completed\n");
808 static void ath10k_qmi_event_server_arrive(struct ath10k_qmi *qmi)
810 struct ath10k *ar = qmi->ar;
813 ret = ath10k_qmi_ind_register_send_sync_msg(qmi);
817 if (qmi->fw_ready) {
822 ret = ath10k_qmi_host_cap_send_sync(qmi);
826 ret = ath10k_qmi_msa_mem_info_send_sync_msg(qmi);
837 ret = ath10k_qmi_setup_msa_permissions(qmi);
841 ret = ath10k_qmi_msa_ready_send_sync_msg(qmi);
845 ret = ath10k_qmi_cap_send_sync_msg(qmi);
852 ath10k_qmi_remove_msa_permission(qmi);
855 static int ath10k_qmi_fetch_board_file(struct ath10k_qmi *qmi)
857 struct ath10k *ar = qmi->ar;
862 ar->id.qmi_board_id = qmi->board_info.board_id;
863 ar->id.qmi_chip_id = qmi->chip_info.chip_id;
870 return ath10k_core_fetch_board_file(qmi->ar, ATH10K_BD_IE_BOARD);
874 ath10k_qmi_driver_event_post(struct ath10k_qmi *qmi,
887 spin_lock(&qmi->event_lock);
888 list_add_tail(&event->list, &qmi->event_list);
889 spin_unlock(&qmi->event_lock);
891 queue_work(qmi->event_wq, &qmi->event_work);
896 static void ath10k_qmi_event_server_exit(struct ath10k_qmi *qmi)
898 struct ath10k *ar = qmi->ar;
901 ath10k_qmi_remove_msa_permission(qmi);
908 ath10k_dbg(ar, ATH10K_DBG_QMI, "wifi fw qmi service disconnected\n");
911 static void ath10k_qmi_event_msa_ready(struct ath10k_qmi *qmi)
915 ret = ath10k_qmi_fetch_board_file(qmi);
919 ret = ath10k_qmi_bdf_dnld_send_sync(qmi);
923 ret = ath10k_qmi_send_cal_report_req(qmi);
929 static int ath10k_qmi_event_fw_ready_ind(struct ath10k_qmi *qmi)
931 struct ath10k *ar = qmi->ar;
943 struct ath10k_qmi *qmi = container_of(qmi_hdl, struct ath10k_qmi, qmi_hdl);
945 ath10k_qmi_driver_event_post(qmi, ATH10K_QMI_EVENT_FW_READY_IND, NULL);
952 struct ath10k_qmi *qmi = container_of(qmi_hdl, struct ath10k_qmi, qmi_hdl);
954 ath10k_qmi_driver_event_post(qmi, ATH10K_QMI_EVENT_MSA_READY_IND, NULL);
978 struct ath10k_qmi *qmi = container_of(qmi_hdl, struct ath10k_qmi, qmi_hdl);
979 struct sockaddr_qrtr *sq = &qmi->sq;
980 struct ath10k *ar = qmi->ar;
987 ath10k_dbg(ar, ATH10K_DBG_QMI, "wifi fw qmi service found\n");
989 ret = kernel_connect(qmi_hdl->sock, (struct sockaddr_unsized *)&qmi->sq,
990 sizeof(qmi->sq), 0);
992 ath10k_err(ar, "failed to connect to a remote QMI service port\n");
996 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi wifi fw qmi service connected\n");
997 ath10k_qmi_driver_event_post(qmi, ATH10K_QMI_EVENT_SERVER_ARRIVE, NULL);
1005 struct ath10k_qmi *qmi =
1008 qmi->fw_ready = false;
1012 * the qmi server. The qmi infrastructure sends del_server, when
1013 * any client releases the qmi handle. In this case do not process
1016 if (qmi->state == ATH10K_QMI_STATE_INIT_DONE)
1017 ath10k_qmi_driver_event_post(qmi, ATH10K_QMI_EVENT_SERVER_EXIT,
1028 struct ath10k_qmi *qmi = container_of(work, struct ath10k_qmi,
1031 struct ath10k *ar = qmi->ar;
1033 spin_lock(&qmi->event_lock);
1034 while (!list_empty(&qmi->event_list)) {
1035 event = list_first_entry(&qmi->event_list,
1038 spin_unlock(&qmi->event_lock);
1042 ath10k_qmi_event_server_arrive(qmi);
1043 if (qmi->no_msa_ready_indicator) {
1044 ath10k_info(ar, "qmi not waiting for msa_ready indicator");
1045 ath10k_qmi_event_msa_ready(qmi);
1049 ath10k_qmi_event_server_exit(qmi);
1052 ath10k_qmi_event_fw_ready_ind(qmi);
1055 if (qmi->no_msa_ready_indicator) {
1056 ath10k_warn(ar, "qmi unexpected msa_ready indicator");
1059 ath10k_qmi_event_msa_ready(qmi);
1066 spin_lock(&qmi->event_lock);
1068 spin_unlock(&qmi->event_lock);
1075 struct ath10k_qmi *qmi;
1078 qmi = kzalloc(sizeof(*qmi), GFP_KERNEL);
1079 if (!qmi)
1082 qmi->ar = ar;
1083 ar_snoc->qmi = qmi;
1086 qmi->msa_fixed_perm = true;
1089 qmi->no_msa_ready_indicator = true;
1091 ret = qmi_handle_init(&qmi->qmi_hdl,
1097 qmi->event_wq = alloc_ordered_workqueue("ath10k_qmi_driver_event", 0);
1098 if (!qmi->event_wq) {
1104 INIT_LIST_HEAD(&qmi->event_list);
1105 spin_lock_init(&qmi->event_lock);
1106 INIT_WORK(&qmi->event_work, ath10k_qmi_driver_event_work);
1108 ret = qmi_add_lookup(&qmi->qmi_hdl, WLFW_SERVICE_ID_V01,
1113 qmi->state = ATH10K_QMI_STATE_INIT_DONE;
1117 destroy_workqueue(qmi->event_wq);
1120 qmi_handle_release(&qmi->qmi_hdl);
1123 kfree(qmi);
1130 struct ath10k_qmi *qmi = ar_snoc->qmi;
1132 qmi->state = ATH10K_QMI_STATE_DEINIT;
1133 qmi_handle_release(&qmi->qmi_hdl);
1134 cancel_work_sync(&qmi->event_work);
1135 destroy_workqueue(qmi->event_wq);
1136 kfree(qmi);
1137 ar_snoc->qmi = NULL;