Lines Matching refs:qmi
31 static int ath10k_qmi_map_msa_permission(struct ath10k_qmi *qmi,
35 struct ath10k *ar = qmi->ar;
63 static int ath10k_qmi_unmap_msa_permission(struct ath10k_qmi *qmi,
67 struct ath10k *ar = qmi->ar;
87 static int ath10k_qmi_setup_msa_permissions(struct ath10k_qmi *qmi)
92 if (qmi->msa_fixed_perm)
95 for (i = 0; i < qmi->nr_mem_region; i++) {
96 ret = ath10k_qmi_map_msa_permission(qmi, &qmi->mem_region[i]);
105 ath10k_qmi_unmap_msa_permission(qmi, &qmi->mem_region[i]);
109 static void ath10k_qmi_remove_msa_permission(struct ath10k_qmi *qmi)
113 if (qmi->msa_fixed_perm)
116 for (i = 0; i < qmi->nr_mem_region; i++)
117 ath10k_qmi_unmap_msa_permission(qmi, &qmi->mem_region[i]);
120 static int ath10k_qmi_msa_mem_info_send_sync_msg(struct ath10k_qmi *qmi)
124 struct ath10k *ar = qmi->ar;
133 ret = qmi_txn_init(&qmi->qmi_hdl, &txn,
138 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
166 qmi->nr_mem_region = resp.mem_region_info_len;
179 qmi->mem_region[i].addr = resp.mem_region_info[i].region_addr;
180 qmi->mem_region[i].size = resp.mem_region_info[i].size;
181 qmi->mem_region[i].secure = resp.mem_region_info[i].secure_flag;
183 "qmi msa mem region %d addr 0x%pa size 0x%x flag 0x%08x\n",
184 i, &qmi->mem_region[i].addr,
185 qmi->mem_region[i].size,
186 qmi->mem_region[i].secure);
189 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi msa mem info request completed\n");
193 memset(&qmi->mem_region[0], 0, sizeof(qmi->mem_region[0]) * i);
198 static int ath10k_qmi_msa_ready_send_sync_msg(struct ath10k_qmi *qmi)
202 struct ath10k *ar = qmi->ar;
206 ret = qmi_txn_init(&qmi->qmi_hdl, &txn,
211 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
230 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi msa mem ready request completed\n");
237 static int ath10k_qmi_bdf_dnld_send_sync(struct ath10k_qmi *qmi)
241 struct ath10k *ar = qmi->ar;
273 ret = qmi_txn_init(&qmi->qmi_hdl, &txn,
279 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
313 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi bdf download request completed\n");
323 static int ath10k_qmi_send_cal_report_req(struct ath10k_qmi *qmi)
327 struct ath10k *ar = qmi->ar;
338 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, wlfw_cal_report_resp_msg_v01_ei,
344 if (qmi->cal_data[i].total_size &&
345 qmi->cal_data[i].data) {
346 req.meta_data[j] = qmi->cal_data[i].cal_id;
352 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
372 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi cal report request completed\n");
383 struct ath10k_qmi *qmi = ar_snoc->qmi;
389 ret = qmi_txn_init(&qmi->qmi_hdl, &txn,
399 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
419 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi wlan mode req completed: %d\n", mode);
432 struct ath10k_qmi *qmi = ar_snoc->qmi;
443 ret = qmi_txn_init(&qmi->qmi_hdl, &txn,
485 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
505 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi config request completed\n");
521 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi mode %d config %p\n",
526 ath10k_err(ar, "failed to send qmi config: %d\n", ret);
532 ath10k_err(ar, "failed to send qmi mode: %d\n", ret);
571 static int ath10k_qmi_cap_send_sync_msg(struct ath10k_qmi *qmi)
575 struct ath10k *ar = qmi->ar;
584 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, wlfw_cap_resp_msg_v01_ei, resp);
588 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
609 qmi->chip_info.chip_id = resp->chip_info.chip_id;
610 qmi->chip_info.chip_family = resp->chip_info.chip_family;
612 qmi->chip_info.chip_id = 0xFF;
616 qmi->board_info.board_id = resp->board_info.board_id;
618 qmi->board_info.board_id = 0xFF;
621 qmi->soc_info.soc_id = resp->soc_info.soc_id;
624 qmi->fw_version = resp->fw_version_info.fw_version;
625 strscpy(qmi->fw_build_timestamp, resp->fw_version_info.fw_build_timestamp,
626 sizeof(qmi->fw_build_timestamp));
630 strscpy(qmi->fw_build_id, resp->fw_build_id,
634 ath10k_info(ar, "qmi chip_id 0x%x chip_family 0x%x board_id 0x%x soc_id 0x%x",
635 qmi->chip_info.chip_id, qmi->chip_info.chip_family,
636 qmi->board_info.board_id, qmi->soc_info.soc_id);
637 ath10k_info(ar, "qmi fw_version 0x%x fw_build_timestamp %s fw_build_id %s",
638 qmi->fw_version, qmi->fw_build_timestamp, qmi->fw_build_id);
642 ath10k_qmi_add_wlan_ver_smem(ar, qmi->fw_build_id);
652 static int ath10k_qmi_host_cap_send_sync(struct ath10k_qmi *qmi)
657 struct ath10k *ar = qmi->ar;
665 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, wlfw_host_cap_resp_msg_v01_ei,
675 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
697 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi host capability request completed\n");
708 struct ath10k_qmi *qmi = ar_snoc->qmi;
716 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, wlfw_ini_resp_msg_v01_ei,
721 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
741 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi fw log request completed, mode: %d\n",
750 ath10k_qmi_ind_register_send_sync_msg(struct ath10k_qmi *qmi)
754 struct ath10k *ar = qmi->ar;
771 ret = qmi_txn_init(&qmi->qmi_hdl, &txn,
776 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn,
798 qmi->fw_ready = true;
800 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi indication register request completed\n");
807 static void ath10k_qmi_event_server_arrive(struct ath10k_qmi *qmi)
809 struct ath10k *ar = qmi->ar;
812 ret = ath10k_qmi_ind_register_send_sync_msg(qmi);
816 if (qmi->fw_ready) {
821 ret = ath10k_qmi_host_cap_send_sync(qmi);
825 ret = ath10k_qmi_msa_mem_info_send_sync_msg(qmi);
836 ret = ath10k_qmi_setup_msa_permissions(qmi);
840 ret = ath10k_qmi_msa_ready_send_sync_msg(qmi);
844 ret = ath10k_qmi_cap_send_sync_msg(qmi);
851 ath10k_qmi_remove_msa_permission(qmi);
854 static int ath10k_qmi_fetch_board_file(struct ath10k_qmi *qmi)
856 struct ath10k *ar = qmi->ar;
861 ar->id.qmi_board_id = qmi->board_info.board_id;
862 ar->id.qmi_chip_id = qmi->chip_info.chip_id;
869 return ath10k_core_fetch_board_file(qmi->ar, ATH10K_BD_IE_BOARD);
873 ath10k_qmi_driver_event_post(struct ath10k_qmi *qmi,
886 spin_lock(&qmi->event_lock);
887 list_add_tail(&event->list, &qmi->event_list);
888 spin_unlock(&qmi->event_lock);
890 queue_work(qmi->event_wq, &qmi->event_work);
895 static void ath10k_qmi_event_server_exit(struct ath10k_qmi *qmi)
897 struct ath10k *ar = qmi->ar;
900 ath10k_qmi_remove_msa_permission(qmi);
907 ath10k_dbg(ar, ATH10K_DBG_QMI, "wifi fw qmi service disconnected\n");
910 static void ath10k_qmi_event_msa_ready(struct ath10k_qmi *qmi)
914 ret = ath10k_qmi_fetch_board_file(qmi);
918 ret = ath10k_qmi_bdf_dnld_send_sync(qmi);
922 ret = ath10k_qmi_send_cal_report_req(qmi);
928 static int ath10k_qmi_event_fw_ready_ind(struct ath10k_qmi *qmi)
930 struct ath10k *ar = qmi->ar;
942 struct ath10k_qmi *qmi = container_of(qmi_hdl, struct ath10k_qmi, qmi_hdl);
944 ath10k_qmi_driver_event_post(qmi, ATH10K_QMI_EVENT_FW_READY_IND, NULL);
951 struct ath10k_qmi *qmi = container_of(qmi_hdl, struct ath10k_qmi, qmi_hdl);
953 ath10k_qmi_driver_event_post(qmi, ATH10K_QMI_EVENT_MSA_READY_IND, NULL);
977 struct ath10k_qmi *qmi = container_of(qmi_hdl, struct ath10k_qmi, qmi_hdl);
978 struct sockaddr_qrtr *sq = &qmi->sq;
979 struct ath10k *ar = qmi->ar;
986 ath10k_dbg(ar, ATH10K_DBG_QMI, "wifi fw qmi service found\n");
988 ret = kernel_connect(qmi_hdl->sock, (struct sockaddr *)&qmi->sq,
989 sizeof(qmi->sq), 0);
995 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi wifi fw qmi service connected\n");
996 ath10k_qmi_driver_event_post(qmi, ATH10K_QMI_EVENT_SERVER_ARRIVE, NULL);
1004 struct ath10k_qmi *qmi =
1007 qmi->fw_ready = false;
1011 * the qmi server. The qmi infrastructure sends del_server, when
1012 * any client releases the qmi handle. In this case do not process
1015 if (qmi->state == ATH10K_QMI_STATE_INIT_DONE)
1016 ath10k_qmi_driver_event_post(qmi, ATH10K_QMI_EVENT_SERVER_EXIT,
1027 struct ath10k_qmi *qmi = container_of(work, struct ath10k_qmi,
1030 struct ath10k *ar = qmi->ar;
1032 spin_lock(&qmi->event_lock);
1033 while (!list_empty(&qmi->event_list)) {
1034 event = list_first_entry(&qmi->event_list,
1037 spin_unlock(&qmi->event_lock);
1041 ath10k_qmi_event_server_arrive(qmi);
1044 ath10k_qmi_event_server_exit(qmi);
1047 ath10k_qmi_event_fw_ready_ind(qmi);
1050 ath10k_qmi_event_msa_ready(qmi);
1057 spin_lock(&qmi->event_lock);
1059 spin_unlock(&qmi->event_lock);
1066 struct ath10k_qmi *qmi;
1069 qmi = kzalloc(sizeof(*qmi), GFP_KERNEL);
1070 if (!qmi)
1073 qmi->ar = ar;
1074 ar_snoc->qmi = qmi;
1077 qmi->msa_fixed_perm = true;
1079 ret = qmi_handle_init(&qmi->qmi_hdl,
1085 qmi->event_wq = alloc_ordered_workqueue("ath10k_qmi_driver_event", 0);
1086 if (!qmi->event_wq) {
1092 INIT_LIST_HEAD(&qmi->event_list);
1093 spin_lock_init(&qmi->event_lock);
1094 INIT_WORK(&qmi->event_work, ath10k_qmi_driver_event_work);
1096 ret = qmi_add_lookup(&qmi->qmi_hdl, WLFW_SERVICE_ID_V01,
1101 qmi->state = ATH10K_QMI_STATE_INIT_DONE;
1105 destroy_workqueue(qmi->event_wq);
1108 qmi_handle_release(&qmi->qmi_hdl);
1111 kfree(qmi);
1118 struct ath10k_qmi *qmi = ar_snoc->qmi;
1120 qmi->state = ATH10K_QMI_STATE_DEINIT;
1121 qmi_handle_release(&qmi->qmi_hdl);
1122 cancel_work_sync(&qmi->event_work);
1123 destroy_workqueue(qmi->event_wq);
1124 kfree(qmi);
1125 ar_snoc->qmi = NULL;