Lines Matching refs:qmi

26 static int ath10k_qmi_map_msa_permission(struct ath10k_qmi *qmi,
30 struct ath10k *ar = qmi->ar;
58 static int ath10k_qmi_unmap_msa_permission(struct ath10k_qmi *qmi,
62 struct ath10k *ar = qmi->ar;
82 static int ath10k_qmi_setup_msa_permissions(struct ath10k_qmi *qmi)
87 if (qmi->msa_fixed_perm)
90 for (i = 0; i < qmi->nr_mem_region; i++) {
91 ret = ath10k_qmi_map_msa_permission(qmi, &qmi->mem_region[i]);
100 ath10k_qmi_unmap_msa_permission(qmi, &qmi->mem_region[i]);
104 static void ath10k_qmi_remove_msa_permission(struct ath10k_qmi *qmi)
108 if (qmi->msa_fixed_perm)
111 for (i = 0; i < qmi->nr_mem_region; i++)
112 ath10k_qmi_unmap_msa_permission(qmi, &qmi->mem_region[i]);
115 static int ath10k_qmi_msa_mem_info_send_sync_msg(struct ath10k_qmi *qmi)
119 struct ath10k *ar = qmi->ar;
128 ret = qmi_txn_init(&qmi->qmi_hdl, &txn,
133 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
161 qmi->nr_mem_region = resp.mem_region_info_len;
174 qmi->mem_region[i].addr = resp.mem_region_info[i].region_addr;
175 qmi->mem_region[i].size = resp.mem_region_info[i].size;
176 qmi->mem_region[i].secure = resp.mem_region_info[i].secure_flag;
178 "qmi msa mem region %d addr 0x%pa size 0x%x flag 0x%08x\n",
179 i, &qmi->mem_region[i].addr,
180 qmi->mem_region[i].size,
181 qmi->mem_region[i].secure);
184 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi msa mem info request completed\n");
188 memset(&qmi->mem_region[0], 0, sizeof(qmi->mem_region[0]) * i);
193 static int ath10k_qmi_msa_ready_send_sync_msg(struct ath10k_qmi *qmi)
197 struct ath10k *ar = qmi->ar;
201 ret = qmi_txn_init(&qmi->qmi_hdl, &txn,
206 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
225 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi msa mem ready request completed\n");
232 static int ath10k_qmi_bdf_dnld_send_sync(struct ath10k_qmi *qmi)
236 struct ath10k *ar = qmi->ar;
268 ret = qmi_txn_init(&qmi->qmi_hdl, &txn,
274 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
308 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi bdf download request completed\n");
318 static int ath10k_qmi_send_cal_report_req(struct ath10k_qmi *qmi)
322 struct ath10k *ar = qmi->ar;
333 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, wlfw_cal_report_resp_msg_v01_ei,
339 if (qmi->cal_data[i].total_size &&
340 qmi->cal_data[i].data) {
341 req.meta_data[j] = qmi->cal_data[i].cal_id;
347 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
367 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi cal report request completed\n");
378 struct ath10k_qmi *qmi = ar_snoc->qmi;
384 ret = qmi_txn_init(&qmi->qmi_hdl, &txn,
394 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
414 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi wlan mode req completed: %d\n", mode);
427 struct ath10k_qmi *qmi = ar_snoc->qmi;
438 ret = qmi_txn_init(&qmi->qmi_hdl, &txn,
480 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
500 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi config request completed\n");
516 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi mode %d config %p\n",
521 ath10k_err(ar, "failed to send qmi config: %d\n", ret);
527 ath10k_err(ar, "failed to send qmi mode: %d\n", ret);
539 static int ath10k_qmi_cap_send_sync_msg(struct ath10k_qmi *qmi)
543 struct ath10k *ar = qmi->ar;
552 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, wlfw_cap_resp_msg_v01_ei, resp);
556 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
577 qmi->chip_info.chip_id = resp->chip_info.chip_id;
578 qmi->chip_info.chip_family = resp->chip_info.chip_family;
580 qmi->chip_info.chip_id = 0xFF;
584 qmi->board_info.board_id = resp->board_info.board_id;
586 qmi->board_info.board_id = 0xFF;
589 qmi->soc_info.soc_id = resp->soc_info.soc_id;
592 qmi->fw_version = resp->fw_version_info.fw_version;
593 strlcpy(qmi->fw_build_timestamp, resp->fw_version_info.fw_build_timestamp,
594 sizeof(qmi->fw_build_timestamp));
598 strlcpy(qmi->fw_build_id, resp->fw_build_id,
602 ath10k_info(ar, "qmi chip_id 0x%x chip_family 0x%x board_id 0x%x soc_id 0x%x",
603 qmi->chip_info.chip_id, qmi->chip_info.chip_family,
604 qmi->board_info.board_id, qmi->soc_info.soc_id);
605 ath10k_info(ar, "qmi fw_version 0x%x fw_build_timestamp %s fw_build_id %s",
606 qmi->fw_version, qmi->fw_build_timestamp, qmi->fw_build_id);
617 static int ath10k_qmi_host_cap_send_sync(struct ath10k_qmi *qmi)
622 struct ath10k *ar = qmi->ar;
630 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, wlfw_host_cap_resp_msg_v01_ei,
640 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
662 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi host capability request completed\n");
673 struct ath10k_qmi *qmi = ar_snoc->qmi;
681 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, wlfw_ini_resp_msg_v01_ei,
686 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
706 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi fw log request completed, mode: %d\n",
715 ath10k_qmi_ind_register_send_sync_msg(struct ath10k_qmi *qmi)
719 struct ath10k *ar = qmi->ar;
736 ret = qmi_txn_init(&qmi->qmi_hdl, &txn,
741 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
763 qmi->fw_ready = true;
765 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi indication register request completed\n");
772 static void ath10k_qmi_event_server_arrive(struct ath10k_qmi *qmi)
774 struct ath10k *ar = qmi->ar;
777 ret = ath10k_qmi_ind_register_send_sync_msg(qmi);
781 if (qmi->fw_ready) {
786 ret = ath10k_qmi_host_cap_send_sync(qmi);
790 ret = ath10k_qmi_msa_mem_info_send_sync_msg(qmi);
801 ret = ath10k_qmi_setup_msa_permissions(qmi);
805 ret = ath10k_qmi_msa_ready_send_sync_msg(qmi);
809 ret = ath10k_qmi_cap_send_sync_msg(qmi);
816 ath10k_qmi_remove_msa_permission(qmi);
819 static int ath10k_qmi_fetch_board_file(struct ath10k_qmi *qmi)
821 struct ath10k *ar = qmi->ar;
826 ar->id.qmi_board_id = qmi->board_info.board_id;
827 ar->id.qmi_chip_id = qmi->chip_info.chip_id;
834 return ath10k_core_fetch_board_file(qmi->ar, ATH10K_BD_IE_BOARD);
838 ath10k_qmi_driver_event_post(struct ath10k_qmi *qmi,
851 spin_lock(&qmi->event_lock);
852 list_add_tail(&event->list, &qmi->event_list);
853 spin_unlock(&qmi->event_lock);
855 queue_work(qmi->event_wq, &qmi->event_work);
860 static void ath10k_qmi_event_server_exit(struct ath10k_qmi *qmi)
862 struct ath10k *ar = qmi->ar;
865 ath10k_qmi_remove_msa_permission(qmi);
871 ath10k_dbg(ar, ATH10K_DBG_QMI, "wifi fw qmi service disconnected\n");
874 static void ath10k_qmi_event_msa_ready(struct ath10k_qmi *qmi)
878 ret = ath10k_qmi_fetch_board_file(qmi);
882 ret = ath10k_qmi_bdf_dnld_send_sync(qmi);
886 ret = ath10k_qmi_send_cal_report_req(qmi);
892 static int ath10k_qmi_event_fw_ready_ind(struct ath10k_qmi *qmi)
894 struct ath10k *ar = qmi->ar;
906 struct ath10k_qmi *qmi = container_of(qmi_hdl, struct ath10k_qmi, qmi_hdl);
908 ath10k_qmi_driver_event_post(qmi, ATH10K_QMI_EVENT_FW_READY_IND, NULL);
915 struct ath10k_qmi *qmi = container_of(qmi_hdl, struct ath10k_qmi, qmi_hdl);
917 ath10k_qmi_driver_event_post(qmi, ATH10K_QMI_EVENT_MSA_READY_IND, NULL);
941 struct ath10k_qmi *qmi = container_of(qmi_hdl, struct ath10k_qmi, qmi_hdl);
942 struct sockaddr_qrtr *sq = &qmi->sq;
943 struct ath10k *ar = qmi->ar;
950 ath10k_dbg(ar, ATH10K_DBG_QMI, "wifi fw qmi service found\n");
952 ret = kernel_connect(qmi_hdl->sock, (struct sockaddr *)&qmi->sq,
953 sizeof(qmi->sq), 0);
959 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi wifi fw qmi service connected\n");
960 ath10k_qmi_driver_event_post(qmi, ATH10K_QMI_EVENT_SERVER_ARRIVE, NULL);
968 struct ath10k_qmi *qmi =
971 qmi->fw_ready = false;
975 * the qmi server. The qmi infrastructure sends del_server, when
976 * any client releases the qmi handle. In this case do not process
979 if (qmi->state == ATH10K_QMI_STATE_INIT_DONE)
980 ath10k_qmi_driver_event_post(qmi, ATH10K_QMI_EVENT_SERVER_EXIT,
991 struct ath10k_qmi *qmi = container_of(work, struct ath10k_qmi,
994 struct ath10k *ar = qmi->ar;
996 spin_lock(&qmi->event_lock);
997 while (!list_empty(&qmi->event_list)) {
998 event = list_first_entry(&qmi->event_list,
1001 spin_unlock(&qmi->event_lock);
1005 ath10k_qmi_event_server_arrive(qmi);
1008 ath10k_qmi_event_server_exit(qmi);
1011 ath10k_qmi_event_fw_ready_ind(qmi);
1014 ath10k_qmi_event_msa_ready(qmi);
1021 spin_lock(&qmi->event_lock);
1023 spin_unlock(&qmi->event_lock);
1030 struct ath10k_qmi *qmi;
1033 qmi = kzalloc(sizeof(*qmi), GFP_KERNEL);
1034 if (!qmi)
1037 qmi->ar = ar;
1038 ar_snoc->qmi = qmi;
1041 qmi->msa_fixed_perm = true;
1043 ret = qmi_handle_init(&qmi->qmi_hdl,
1049 qmi->event_wq = alloc_workqueue("ath10k_qmi_driver_event",
1051 if (!qmi->event_wq) {
1057 INIT_LIST_HEAD(&qmi->event_list);
1058 spin_lock_init(&qmi->event_lock);
1059 INIT_WORK(&qmi->event_work, ath10k_qmi_driver_event_work);
1061 ret = qmi_add_lookup(&qmi->qmi_hdl, WLFW_SERVICE_ID_V01,
1066 qmi->state = ATH10K_QMI_STATE_INIT_DONE;
1070 destroy_workqueue(qmi->event_wq);
1073 qmi_handle_release(&qmi->qmi_hdl);
1076 kfree(qmi);
1083 struct ath10k_qmi *qmi = ar_snoc->qmi;
1085 qmi->state = ATH10K_QMI_STATE_DEINIT;
1086 qmi_handle_release(&qmi->qmi_hdl);
1087 cancel_work_sync(&qmi->event_work);
1088 destroy_workqueue(qmi->event_wq);
1089 kfree(qmi);
1090 ar_snoc->qmi = NULL;