Lines Matching refs:qmi
26 static int ath10k_qmi_map_msa_permission(struct ath10k_qmi *qmi, in ath10k_qmi_map_msa_permission() argument
30 struct ath10k *ar = qmi->ar; in ath10k_qmi_map_msa_permission()
58 static int ath10k_qmi_unmap_msa_permission(struct ath10k_qmi *qmi, in ath10k_qmi_unmap_msa_permission() argument
62 struct ath10k *ar = qmi->ar; in ath10k_qmi_unmap_msa_permission()
82 static int ath10k_qmi_setup_msa_permissions(struct ath10k_qmi *qmi) in ath10k_qmi_setup_msa_permissions() argument
87 if (qmi->msa_fixed_perm) in ath10k_qmi_setup_msa_permissions()
90 for (i = 0; i < qmi->nr_mem_region; i++) { in ath10k_qmi_setup_msa_permissions()
91 ret = ath10k_qmi_map_msa_permission(qmi, &qmi->mem_region[i]); in ath10k_qmi_setup_msa_permissions()
100 ath10k_qmi_unmap_msa_permission(qmi, &qmi->mem_region[i]); in ath10k_qmi_setup_msa_permissions()
104 static void ath10k_qmi_remove_msa_permission(struct ath10k_qmi *qmi) in ath10k_qmi_remove_msa_permission() argument
108 if (qmi->msa_fixed_perm) in ath10k_qmi_remove_msa_permission()
111 for (i = 0; i < qmi->nr_mem_region; i++) in ath10k_qmi_remove_msa_permission()
112 ath10k_qmi_unmap_msa_permission(qmi, &qmi->mem_region[i]); in ath10k_qmi_remove_msa_permission()
115 static int ath10k_qmi_msa_mem_info_send_sync_msg(struct ath10k_qmi *qmi) in ath10k_qmi_msa_mem_info_send_sync_msg() argument
119 struct ath10k *ar = qmi->ar; in ath10k_qmi_msa_mem_info_send_sync_msg()
128 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, in ath10k_qmi_msa_mem_info_send_sync_msg()
133 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn, in ath10k_qmi_msa_mem_info_send_sync_msg()
161 qmi->nr_mem_region = resp.mem_region_info_len; in ath10k_qmi_msa_mem_info_send_sync_msg()
174 qmi->mem_region[i].addr = resp.mem_region_info[i].region_addr; in ath10k_qmi_msa_mem_info_send_sync_msg()
175 qmi->mem_region[i].size = resp.mem_region_info[i].size; in ath10k_qmi_msa_mem_info_send_sync_msg()
176 qmi->mem_region[i].secure = resp.mem_region_info[i].secure_flag; in ath10k_qmi_msa_mem_info_send_sync_msg()
179 i, &qmi->mem_region[i].addr, in ath10k_qmi_msa_mem_info_send_sync_msg()
180 qmi->mem_region[i].size, in ath10k_qmi_msa_mem_info_send_sync_msg()
181 qmi->mem_region[i].secure); in ath10k_qmi_msa_mem_info_send_sync_msg()
188 memset(&qmi->mem_region[0], 0, sizeof(qmi->mem_region[0]) * i); in ath10k_qmi_msa_mem_info_send_sync_msg()
193 static int ath10k_qmi_msa_ready_send_sync_msg(struct ath10k_qmi *qmi) in ath10k_qmi_msa_ready_send_sync_msg() argument
197 struct ath10k *ar = qmi->ar; in ath10k_qmi_msa_ready_send_sync_msg()
201 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, in ath10k_qmi_msa_ready_send_sync_msg()
206 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn, in ath10k_qmi_msa_ready_send_sync_msg()
232 static int ath10k_qmi_bdf_dnld_send_sync(struct ath10k_qmi *qmi) in ath10k_qmi_bdf_dnld_send_sync() argument
236 struct ath10k *ar = qmi->ar; in ath10k_qmi_bdf_dnld_send_sync()
268 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, in ath10k_qmi_bdf_dnld_send_sync()
274 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn, in ath10k_qmi_bdf_dnld_send_sync()
318 static int ath10k_qmi_send_cal_report_req(struct ath10k_qmi *qmi) in ath10k_qmi_send_cal_report_req() argument
322 struct ath10k *ar = qmi->ar; in ath10k_qmi_send_cal_report_req()
333 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, wlfw_cal_report_resp_msg_v01_ei, in ath10k_qmi_send_cal_report_req()
339 if (qmi->cal_data[i].total_size && in ath10k_qmi_send_cal_report_req()
340 qmi->cal_data[i].data) { in ath10k_qmi_send_cal_report_req()
341 req.meta_data[j] = qmi->cal_data[i].cal_id; in ath10k_qmi_send_cal_report_req()
347 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn, in ath10k_qmi_send_cal_report_req()
378 struct ath10k_qmi *qmi = ar_snoc->qmi; in ath10k_qmi_mode_send_sync_msg() local
384 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, in ath10k_qmi_mode_send_sync_msg()
394 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn, in ath10k_qmi_mode_send_sync_msg()
427 struct ath10k_qmi *qmi = ar_snoc->qmi; in ath10k_qmi_cfg_send_sync_msg() local
438 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, in ath10k_qmi_cfg_send_sync_msg()
480 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn, in ath10k_qmi_cfg_send_sync_msg()
539 static int ath10k_qmi_cap_send_sync_msg(struct ath10k_qmi *qmi) in ath10k_qmi_cap_send_sync_msg() argument
543 struct ath10k *ar = qmi->ar; in ath10k_qmi_cap_send_sync_msg()
552 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, wlfw_cap_resp_msg_v01_ei, resp); in ath10k_qmi_cap_send_sync_msg()
556 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn, in ath10k_qmi_cap_send_sync_msg()
577 qmi->chip_info.chip_id = resp->chip_info.chip_id; in ath10k_qmi_cap_send_sync_msg()
578 qmi->chip_info.chip_family = resp->chip_info.chip_family; in ath10k_qmi_cap_send_sync_msg()
580 qmi->chip_info.chip_id = 0xFF; in ath10k_qmi_cap_send_sync_msg()
584 qmi->board_info.board_id = resp->board_info.board_id; in ath10k_qmi_cap_send_sync_msg()
586 qmi->board_info.board_id = 0xFF; in ath10k_qmi_cap_send_sync_msg()
589 qmi->soc_info.soc_id = resp->soc_info.soc_id; in ath10k_qmi_cap_send_sync_msg()
592 qmi->fw_version = resp->fw_version_info.fw_version; in ath10k_qmi_cap_send_sync_msg()
593 strscpy(qmi->fw_build_timestamp, resp->fw_version_info.fw_build_timestamp, in ath10k_qmi_cap_send_sync_msg()
594 sizeof(qmi->fw_build_timestamp)); in ath10k_qmi_cap_send_sync_msg()
598 strscpy(qmi->fw_build_id, resp->fw_build_id, in ath10k_qmi_cap_send_sync_msg()
603 qmi->chip_info.chip_id, qmi->chip_info.chip_family, in ath10k_qmi_cap_send_sync_msg()
604 qmi->board_info.board_id, qmi->soc_info.soc_id); in ath10k_qmi_cap_send_sync_msg()
606 qmi->fw_version, qmi->fw_build_timestamp, qmi->fw_build_id); in ath10k_qmi_cap_send_sync_msg()
617 static int ath10k_qmi_host_cap_send_sync(struct ath10k_qmi *qmi) in ath10k_qmi_host_cap_send_sync() argument
622 struct ath10k *ar = qmi->ar; in ath10k_qmi_host_cap_send_sync()
630 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, wlfw_host_cap_resp_msg_v01_ei, in ath10k_qmi_host_cap_send_sync()
640 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn, in ath10k_qmi_host_cap_send_sync()
673 struct ath10k_qmi *qmi = ar_snoc->qmi; in ath10k_qmi_set_fw_log_mode() local
681 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, wlfw_ini_resp_msg_v01_ei, in ath10k_qmi_set_fw_log_mode()
686 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn, in ath10k_qmi_set_fw_log_mode()
715 ath10k_qmi_ind_register_send_sync_msg(struct ath10k_qmi *qmi) in ath10k_qmi_ind_register_send_sync_msg() argument
719 struct ath10k *ar = qmi->ar; in ath10k_qmi_ind_register_send_sync_msg()
736 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, in ath10k_qmi_ind_register_send_sync_msg()
741 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn, in ath10k_qmi_ind_register_send_sync_msg()
763 qmi->fw_ready = true; in ath10k_qmi_ind_register_send_sync_msg()
772 static void ath10k_qmi_event_server_arrive(struct ath10k_qmi *qmi) in ath10k_qmi_event_server_arrive() argument
774 struct ath10k *ar = qmi->ar; in ath10k_qmi_event_server_arrive()
777 ret = ath10k_qmi_ind_register_send_sync_msg(qmi); in ath10k_qmi_event_server_arrive()
781 if (qmi->fw_ready) { in ath10k_qmi_event_server_arrive()
786 ret = ath10k_qmi_host_cap_send_sync(qmi); in ath10k_qmi_event_server_arrive()
790 ret = ath10k_qmi_msa_mem_info_send_sync_msg(qmi); in ath10k_qmi_event_server_arrive()
801 ret = ath10k_qmi_setup_msa_permissions(qmi); in ath10k_qmi_event_server_arrive()
805 ret = ath10k_qmi_msa_ready_send_sync_msg(qmi); in ath10k_qmi_event_server_arrive()
809 ret = ath10k_qmi_cap_send_sync_msg(qmi); in ath10k_qmi_event_server_arrive()
816 ath10k_qmi_remove_msa_permission(qmi); in ath10k_qmi_event_server_arrive()
819 static int ath10k_qmi_fetch_board_file(struct ath10k_qmi *qmi) in ath10k_qmi_fetch_board_file() argument
821 struct ath10k *ar = qmi->ar; in ath10k_qmi_fetch_board_file()
826 ar->id.qmi_board_id = qmi->board_info.board_id; in ath10k_qmi_fetch_board_file()
827 ar->id.qmi_chip_id = qmi->chip_info.chip_id; in ath10k_qmi_fetch_board_file()
834 return ath10k_core_fetch_board_file(qmi->ar, ATH10K_BD_IE_BOARD); in ath10k_qmi_fetch_board_file()
838 ath10k_qmi_driver_event_post(struct ath10k_qmi *qmi, in ath10k_qmi_driver_event_post() argument
851 spin_lock(&qmi->event_lock); in ath10k_qmi_driver_event_post()
852 list_add_tail(&event->list, &qmi->event_list); in ath10k_qmi_driver_event_post()
853 spin_unlock(&qmi->event_lock); in ath10k_qmi_driver_event_post()
855 queue_work(qmi->event_wq, &qmi->event_work); in ath10k_qmi_driver_event_post()
860 static void ath10k_qmi_event_server_exit(struct ath10k_qmi *qmi) in ath10k_qmi_event_server_exit() argument
862 struct ath10k *ar = qmi->ar; in ath10k_qmi_event_server_exit()
865 ath10k_qmi_remove_msa_permission(qmi); in ath10k_qmi_event_server_exit()
875 static void ath10k_qmi_event_msa_ready(struct ath10k_qmi *qmi) in ath10k_qmi_event_msa_ready() argument
879 ret = ath10k_qmi_fetch_board_file(qmi); in ath10k_qmi_event_msa_ready()
883 ret = ath10k_qmi_bdf_dnld_send_sync(qmi); in ath10k_qmi_event_msa_ready()
887 ret = ath10k_qmi_send_cal_report_req(qmi); in ath10k_qmi_event_msa_ready()
893 static int ath10k_qmi_event_fw_ready_ind(struct ath10k_qmi *qmi) in ath10k_qmi_event_fw_ready_ind() argument
895 struct ath10k *ar = qmi->ar; in ath10k_qmi_event_fw_ready_ind()
907 struct ath10k_qmi *qmi = container_of(qmi_hdl, struct ath10k_qmi, qmi_hdl); in ath10k_qmi_fw_ready_ind() local
909 ath10k_qmi_driver_event_post(qmi, ATH10K_QMI_EVENT_FW_READY_IND, NULL); in ath10k_qmi_fw_ready_ind()
916 struct ath10k_qmi *qmi = container_of(qmi_hdl, struct ath10k_qmi, qmi_hdl); in ath10k_qmi_msa_ready_ind() local
918 ath10k_qmi_driver_event_post(qmi, ATH10K_QMI_EVENT_MSA_READY_IND, NULL); in ath10k_qmi_msa_ready_ind()
942 struct ath10k_qmi *qmi = container_of(qmi_hdl, struct ath10k_qmi, qmi_hdl); in ath10k_qmi_new_server() local
943 struct sockaddr_qrtr *sq = &qmi->sq; in ath10k_qmi_new_server()
944 struct ath10k *ar = qmi->ar; in ath10k_qmi_new_server()
953 ret = kernel_connect(qmi_hdl->sock, (struct sockaddr *)&qmi->sq, in ath10k_qmi_new_server()
954 sizeof(qmi->sq), 0); in ath10k_qmi_new_server()
961 ath10k_qmi_driver_event_post(qmi, ATH10K_QMI_EVENT_SERVER_ARRIVE, NULL); in ath10k_qmi_new_server()
969 struct ath10k_qmi *qmi = in ath10k_qmi_del_server() local
972 qmi->fw_ready = false; in ath10k_qmi_del_server()
980 if (qmi->state == ATH10K_QMI_STATE_INIT_DONE) in ath10k_qmi_del_server()
981 ath10k_qmi_driver_event_post(qmi, ATH10K_QMI_EVENT_SERVER_EXIT, in ath10k_qmi_del_server()
992 struct ath10k_qmi *qmi = container_of(work, struct ath10k_qmi, in ath10k_qmi_driver_event_work() local
995 struct ath10k *ar = qmi->ar; in ath10k_qmi_driver_event_work()
997 spin_lock(&qmi->event_lock); in ath10k_qmi_driver_event_work()
998 while (!list_empty(&qmi->event_list)) { in ath10k_qmi_driver_event_work()
999 event = list_first_entry(&qmi->event_list, in ath10k_qmi_driver_event_work()
1002 spin_unlock(&qmi->event_lock); in ath10k_qmi_driver_event_work()
1006 ath10k_qmi_event_server_arrive(qmi); in ath10k_qmi_driver_event_work()
1009 ath10k_qmi_event_server_exit(qmi); in ath10k_qmi_driver_event_work()
1012 ath10k_qmi_event_fw_ready_ind(qmi); in ath10k_qmi_driver_event_work()
1015 ath10k_qmi_event_msa_ready(qmi); in ath10k_qmi_driver_event_work()
1022 spin_lock(&qmi->event_lock); in ath10k_qmi_driver_event_work()
1024 spin_unlock(&qmi->event_lock); in ath10k_qmi_driver_event_work()
1031 struct ath10k_qmi *qmi; in ath10k_qmi_init() local
1034 qmi = kzalloc(sizeof(*qmi), GFP_KERNEL); in ath10k_qmi_init()
1035 if (!qmi) in ath10k_qmi_init()
1038 qmi->ar = ar; in ath10k_qmi_init()
1039 ar_snoc->qmi = qmi; in ath10k_qmi_init()
1042 qmi->msa_fixed_perm = true; in ath10k_qmi_init()
1044 ret = qmi_handle_init(&qmi->qmi_hdl, in ath10k_qmi_init()
1050 qmi->event_wq = alloc_workqueue("ath10k_qmi_driver_event", in ath10k_qmi_init()
1052 if (!qmi->event_wq) { in ath10k_qmi_init()
1058 INIT_LIST_HEAD(&qmi->event_list); in ath10k_qmi_init()
1059 spin_lock_init(&qmi->event_lock); in ath10k_qmi_init()
1060 INIT_WORK(&qmi->event_work, ath10k_qmi_driver_event_work); in ath10k_qmi_init()
1062 ret = qmi_add_lookup(&qmi->qmi_hdl, WLFW_SERVICE_ID_V01, in ath10k_qmi_init()
1067 qmi->state = ATH10K_QMI_STATE_INIT_DONE; in ath10k_qmi_init()
1071 destroy_workqueue(qmi->event_wq); in ath10k_qmi_init()
1074 qmi_handle_release(&qmi->qmi_hdl); in ath10k_qmi_init()
1077 kfree(qmi); in ath10k_qmi_init()
1084 struct ath10k_qmi *qmi = ar_snoc->qmi; in ath10k_qmi_deinit() local
1086 qmi->state = ATH10K_QMI_STATE_DEINIT; in ath10k_qmi_deinit()
1087 qmi_handle_release(&qmi->qmi_hdl); in ath10k_qmi_deinit()
1088 cancel_work_sync(&qmi->event_work); in ath10k_qmi_deinit()
1089 destroy_workqueue(qmi->event_wq); in ath10k_qmi_deinit()
1090 kfree(qmi); in ath10k_qmi_deinit()
1091 ar_snoc->qmi = NULL; in ath10k_qmi_deinit()