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 for (i = 0; i < qmi->nr_mem_region; i++) { in ath10k_qmi_setup_msa_permissions()
88 ret = ath10k_qmi_map_msa_permission(qmi, &qmi->mem_region[i]); in ath10k_qmi_setup_msa_permissions()
97 ath10k_qmi_unmap_msa_permission(qmi, &qmi->mem_region[i]); in ath10k_qmi_setup_msa_permissions()
101 static void ath10k_qmi_remove_msa_permission(struct ath10k_qmi *qmi) in ath10k_qmi_remove_msa_permission() argument
105 for (i = 0; i < qmi->nr_mem_region; i++) in ath10k_qmi_remove_msa_permission()
106 ath10k_qmi_unmap_msa_permission(qmi, &qmi->mem_region[i]); in ath10k_qmi_remove_msa_permission()
109 static int ath10k_qmi_msa_mem_info_send_sync_msg(struct ath10k_qmi *qmi) in ath10k_qmi_msa_mem_info_send_sync_msg() argument
113 struct ath10k *ar = qmi->ar; in ath10k_qmi_msa_mem_info_send_sync_msg()
118 req.msa_addr = qmi->msa_pa; in ath10k_qmi_msa_mem_info_send_sync_msg()
119 req.size = qmi->msa_mem_size; in ath10k_qmi_msa_mem_info_send_sync_msg()
121 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, in ath10k_qmi_msa_mem_info_send_sync_msg()
126 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn, in ath10k_qmi_msa_mem_info_send_sync_msg()
153 qmi->nr_mem_region = resp.mem_region_info_len; in ath10k_qmi_msa_mem_info_send_sync_msg()
155 qmi->mem_region[i].addr = resp.mem_region_info[i].region_addr; in ath10k_qmi_msa_mem_info_send_sync_msg()
156 qmi->mem_region[i].size = resp.mem_region_info[i].size; in ath10k_qmi_msa_mem_info_send_sync_msg()
157 qmi->mem_region[i].secure = resp.mem_region_info[i].secure_flag; in ath10k_qmi_msa_mem_info_send_sync_msg()
160 i, &qmi->mem_region[i].addr, in ath10k_qmi_msa_mem_info_send_sync_msg()
161 qmi->mem_region[i].size, in ath10k_qmi_msa_mem_info_send_sync_msg()
162 qmi->mem_region[i].secure); in ath10k_qmi_msa_mem_info_send_sync_msg()
172 static int ath10k_qmi_msa_ready_send_sync_msg(struct ath10k_qmi *qmi) in ath10k_qmi_msa_ready_send_sync_msg() argument
176 struct ath10k *ar = qmi->ar; in ath10k_qmi_msa_ready_send_sync_msg()
180 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, in ath10k_qmi_msa_ready_send_sync_msg()
185 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn, in ath10k_qmi_msa_ready_send_sync_msg()
211 static int ath10k_qmi_bdf_dnld_send_sync(struct ath10k_qmi *qmi) in ath10k_qmi_bdf_dnld_send_sync() argument
215 struct ath10k *ar = qmi->ar; in ath10k_qmi_bdf_dnld_send_sync()
247 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, in ath10k_qmi_bdf_dnld_send_sync()
253 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn, in ath10k_qmi_bdf_dnld_send_sync()
289 static int ath10k_qmi_send_cal_report_req(struct ath10k_qmi *qmi) in ath10k_qmi_send_cal_report_req() argument
293 struct ath10k *ar = qmi->ar; in ath10k_qmi_send_cal_report_req()
298 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, wlfw_cal_report_resp_msg_v01_ei, in ath10k_qmi_send_cal_report_req()
304 if (qmi->cal_data[i].total_size && in ath10k_qmi_send_cal_report_req()
305 qmi->cal_data[i].data) { in ath10k_qmi_send_cal_report_req()
306 req.meta_data[j] = qmi->cal_data[i].cal_id; in ath10k_qmi_send_cal_report_req()
312 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn, in ath10k_qmi_send_cal_report_req()
343 struct ath10k_qmi *qmi = ar_snoc->qmi; in ath10k_qmi_mode_send_sync_msg() local
349 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, in ath10k_qmi_mode_send_sync_msg()
359 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn, in ath10k_qmi_mode_send_sync_msg()
392 struct ath10k_qmi *qmi = ar_snoc->qmi; in ath10k_qmi_cfg_send_sync_msg() local
403 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, in ath10k_qmi_cfg_send_sync_msg()
445 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn, in ath10k_qmi_cfg_send_sync_msg()
504 static int ath10k_qmi_cap_send_sync_msg(struct ath10k_qmi *qmi) in ath10k_qmi_cap_send_sync_msg() argument
508 struct ath10k *ar = qmi->ar; in ath10k_qmi_cap_send_sync_msg()
517 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, wlfw_cap_resp_msg_v01_ei, resp); in ath10k_qmi_cap_send_sync_msg()
521 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn, in ath10k_qmi_cap_send_sync_msg()
542 qmi->chip_info.chip_id = resp->chip_info.chip_id; in ath10k_qmi_cap_send_sync_msg()
543 qmi->chip_info.chip_family = resp->chip_info.chip_family; in ath10k_qmi_cap_send_sync_msg()
547 qmi->board_info.board_id = resp->board_info.board_id; in ath10k_qmi_cap_send_sync_msg()
549 qmi->board_info.board_id = 0xFF; in ath10k_qmi_cap_send_sync_msg()
552 qmi->soc_info.soc_id = resp->soc_info.soc_id; in ath10k_qmi_cap_send_sync_msg()
555 qmi->fw_version = resp->fw_version_info.fw_version; in ath10k_qmi_cap_send_sync_msg()
556 strlcpy(qmi->fw_build_timestamp, resp->fw_version_info.fw_build_timestamp, in ath10k_qmi_cap_send_sync_msg()
557 sizeof(qmi->fw_build_timestamp)); in ath10k_qmi_cap_send_sync_msg()
561 strlcpy(qmi->fw_build_id, resp->fw_build_id, in ath10k_qmi_cap_send_sync_msg()
566 qmi->chip_info.chip_id, qmi->chip_info.chip_family, in ath10k_qmi_cap_send_sync_msg()
567 qmi->board_info.board_id, qmi->soc_info.soc_id); in ath10k_qmi_cap_send_sync_msg()
569 qmi->fw_version, qmi->fw_build_timestamp, qmi->fw_build_id); in ath10k_qmi_cap_send_sync_msg()
580 static int ath10k_qmi_host_cap_send_sync(struct ath10k_qmi *qmi) in ath10k_qmi_host_cap_send_sync() argument
584 struct ath10k *ar = qmi->ar; in ath10k_qmi_host_cap_send_sync()
591 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, in ath10k_qmi_host_cap_send_sync()
596 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn, in ath10k_qmi_host_cap_send_sync()
627 struct ath10k_qmi *qmi = ar_snoc->qmi; in ath10k_qmi_set_fw_log_mode() local
635 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, wlfw_ini_resp_msg_v01_ei, in ath10k_qmi_set_fw_log_mode()
640 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn, in ath10k_qmi_set_fw_log_mode()
669 ath10k_qmi_ind_register_send_sync_msg(struct ath10k_qmi *qmi) in ath10k_qmi_ind_register_send_sync_msg() argument
673 struct ath10k *ar = qmi->ar; in ath10k_qmi_ind_register_send_sync_msg()
684 ret = qmi_txn_init(&qmi->qmi_hdl, &txn, in ath10k_qmi_ind_register_send_sync_msg()
689 ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn, in ath10k_qmi_ind_register_send_sync_msg()
711 qmi->fw_ready = true; in ath10k_qmi_ind_register_send_sync_msg()
720 static void ath10k_qmi_event_server_arrive(struct ath10k_qmi *qmi) in ath10k_qmi_event_server_arrive() argument
722 struct ath10k *ar = qmi->ar; in ath10k_qmi_event_server_arrive()
725 ret = ath10k_qmi_ind_register_send_sync_msg(qmi); in ath10k_qmi_event_server_arrive()
729 if (qmi->fw_ready) { in ath10k_qmi_event_server_arrive()
734 ret = ath10k_qmi_host_cap_send_sync(qmi); in ath10k_qmi_event_server_arrive()
738 ret = ath10k_qmi_msa_mem_info_send_sync_msg(qmi); in ath10k_qmi_event_server_arrive()
742 ret = ath10k_qmi_setup_msa_permissions(qmi); in ath10k_qmi_event_server_arrive()
746 ret = ath10k_qmi_msa_ready_send_sync_msg(qmi); in ath10k_qmi_event_server_arrive()
750 ret = ath10k_qmi_cap_send_sync_msg(qmi); in ath10k_qmi_event_server_arrive()
757 ath10k_qmi_remove_msa_permission(qmi); in ath10k_qmi_event_server_arrive()
760 static int ath10k_qmi_fetch_board_file(struct ath10k_qmi *qmi) in ath10k_qmi_fetch_board_file() argument
762 struct ath10k *ar = qmi->ar; in ath10k_qmi_fetch_board_file()
766 ar->id.qmi_board_id = qmi->board_info.board_id; in ath10k_qmi_fetch_board_file()
769 return ath10k_core_fetch_board_file(qmi->ar, ATH10K_BD_IE_BOARD); in ath10k_qmi_fetch_board_file()
773 ath10k_qmi_driver_event_post(struct ath10k_qmi *qmi, in ath10k_qmi_driver_event_post() argument
786 spin_lock(&qmi->event_lock); in ath10k_qmi_driver_event_post()
787 list_add_tail(&event->list, &qmi->event_list); in ath10k_qmi_driver_event_post()
788 spin_unlock(&qmi->event_lock); in ath10k_qmi_driver_event_post()
790 queue_work(qmi->event_wq, &qmi->event_work); in ath10k_qmi_driver_event_post()
795 static void ath10k_qmi_event_server_exit(struct ath10k_qmi *qmi) in ath10k_qmi_event_server_exit() argument
797 struct ath10k *ar = qmi->ar; in ath10k_qmi_event_server_exit()
799 ath10k_qmi_remove_msa_permission(qmi); in ath10k_qmi_event_server_exit()
805 static void ath10k_qmi_event_msa_ready(struct ath10k_qmi *qmi) in ath10k_qmi_event_msa_ready() argument
809 ret = ath10k_qmi_fetch_board_file(qmi); in ath10k_qmi_event_msa_ready()
813 ret = ath10k_qmi_bdf_dnld_send_sync(qmi); in ath10k_qmi_event_msa_ready()
817 ret = ath10k_qmi_send_cal_report_req(qmi); in ath10k_qmi_event_msa_ready()
823 static int ath10k_qmi_event_fw_ready_ind(struct ath10k_qmi *qmi) in ath10k_qmi_event_fw_ready_ind() argument
825 struct ath10k *ar = qmi->ar; in ath10k_qmi_event_fw_ready_ind()
837 struct ath10k_qmi *qmi = container_of(qmi_hdl, struct ath10k_qmi, qmi_hdl); in ath10k_qmi_fw_ready_ind() local
839 ath10k_qmi_driver_event_post(qmi, ATH10K_QMI_EVENT_FW_READY_IND, NULL); in ath10k_qmi_fw_ready_ind()
846 struct ath10k_qmi *qmi = container_of(qmi_hdl, struct ath10k_qmi, qmi_hdl); in ath10k_qmi_msa_ready_ind() local
848 ath10k_qmi_driver_event_post(qmi, ATH10K_QMI_EVENT_MSA_READY_IND, NULL); in ath10k_qmi_msa_ready_ind()
872 struct ath10k_qmi *qmi = container_of(qmi_hdl, struct ath10k_qmi, qmi_hdl); in ath10k_qmi_new_server() local
873 struct sockaddr_qrtr *sq = &qmi->sq; in ath10k_qmi_new_server()
874 struct ath10k *ar = qmi->ar; in ath10k_qmi_new_server()
883 ret = kernel_connect(qmi_hdl->sock, (struct sockaddr *)&qmi->sq, in ath10k_qmi_new_server()
884 sizeof(qmi->sq), 0); in ath10k_qmi_new_server()
891 ath10k_qmi_driver_event_post(qmi, ATH10K_QMI_EVENT_SERVER_ARRIVE, NULL); in ath10k_qmi_new_server()
899 struct ath10k_qmi *qmi = in ath10k_qmi_del_server() local
902 qmi->fw_ready = false; in ath10k_qmi_del_server()
903 ath10k_qmi_driver_event_post(qmi, ATH10K_QMI_EVENT_SERVER_EXIT, NULL); in ath10k_qmi_del_server()
913 struct ath10k_qmi *qmi = container_of(work, struct ath10k_qmi, in ath10k_qmi_driver_event_work() local
916 struct ath10k *ar = qmi->ar; in ath10k_qmi_driver_event_work()
918 spin_lock(&qmi->event_lock); in ath10k_qmi_driver_event_work()
919 while (!list_empty(&qmi->event_list)) { in ath10k_qmi_driver_event_work()
920 event = list_first_entry(&qmi->event_list, in ath10k_qmi_driver_event_work()
923 spin_unlock(&qmi->event_lock); in ath10k_qmi_driver_event_work()
927 ath10k_qmi_event_server_arrive(qmi); in ath10k_qmi_driver_event_work()
930 ath10k_qmi_event_server_exit(qmi); in ath10k_qmi_driver_event_work()
933 ath10k_qmi_event_fw_ready_ind(qmi); in ath10k_qmi_driver_event_work()
936 ath10k_qmi_event_msa_ready(qmi); in ath10k_qmi_driver_event_work()
943 spin_lock(&qmi->event_lock); in ath10k_qmi_driver_event_work()
945 spin_unlock(&qmi->event_lock); in ath10k_qmi_driver_event_work()
948 static int ath10k_qmi_setup_msa_resources(struct ath10k_qmi *qmi, u32 msa_size) in ath10k_qmi_setup_msa_resources() argument
950 struct ath10k *ar = qmi->ar; in ath10k_qmi_setup_msa_resources()
965 qmi->msa_pa = r.start; in ath10k_qmi_setup_msa_resources()
966 qmi->msa_mem_size = resource_size(&r); in ath10k_qmi_setup_msa_resources()
967 qmi->msa_va = devm_memremap(dev, qmi->msa_pa, qmi->msa_mem_size, in ath10k_qmi_setup_msa_resources()
969 if (IS_ERR(qmi->msa_va)) { in ath10k_qmi_setup_msa_resources()
971 return PTR_ERR(qmi->msa_va); in ath10k_qmi_setup_msa_resources()
974 qmi->msa_va = dmam_alloc_coherent(dev, msa_size, in ath10k_qmi_setup_msa_resources()
975 &qmi->msa_pa, GFP_KERNEL); in ath10k_qmi_setup_msa_resources()
976 if (!qmi->msa_va) { in ath10k_qmi_setup_msa_resources()
980 qmi->msa_mem_size = msa_size; in ath10k_qmi_setup_msa_resources()
984 &qmi->msa_pa, in ath10k_qmi_setup_msa_resources()
985 qmi->msa_va); in ath10k_qmi_setup_msa_resources()
993 struct ath10k_qmi *qmi; in ath10k_qmi_init() local
996 qmi = kzalloc(sizeof(*qmi), GFP_KERNEL); in ath10k_qmi_init()
997 if (!qmi) in ath10k_qmi_init()
1000 qmi->ar = ar; in ath10k_qmi_init()
1001 ar_snoc->qmi = qmi; in ath10k_qmi_init()
1003 ret = ath10k_qmi_setup_msa_resources(qmi, msa_size); in ath10k_qmi_init()
1007 ret = qmi_handle_init(&qmi->qmi_hdl, in ath10k_qmi_init()
1013 qmi->event_wq = alloc_workqueue("ath10k_qmi_driver_event", in ath10k_qmi_init()
1015 if (!qmi->event_wq) { in ath10k_qmi_init()
1021 INIT_LIST_HEAD(&qmi->event_list); in ath10k_qmi_init()
1022 spin_lock_init(&qmi->event_lock); in ath10k_qmi_init()
1023 INIT_WORK(&qmi->event_work, ath10k_qmi_driver_event_work); in ath10k_qmi_init()
1025 ret = qmi_add_lookup(&qmi->qmi_hdl, WLFW_SERVICE_ID_V01, in ath10k_qmi_init()
1033 destroy_workqueue(qmi->event_wq); in ath10k_qmi_init()
1036 qmi_handle_release(&qmi->qmi_hdl); in ath10k_qmi_init()
1039 kfree(qmi); in ath10k_qmi_init()
1046 struct ath10k_qmi *qmi = ar_snoc->qmi; in ath10k_qmi_deinit() local
1048 qmi_handle_release(&qmi->qmi_hdl); in ath10k_qmi_deinit()
1049 cancel_work_sync(&qmi->event_work); in ath10k_qmi_deinit()
1050 destroy_workqueue(qmi->event_wq); in ath10k_qmi_deinit()
1051 kfree(qmi); in ath10k_qmi_deinit()
1052 ar_snoc->qmi = NULL; in ath10k_qmi_deinit()