Lines Matching +full:segment +full:- +full:gpios

1 // SPDX-License-Identifier: BSD-3-Clause-Clear
3 * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
4 * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
126 gpios),
2026 if (!(ab->mlo_capable_flags & ATH12K_INTRA_DEVICE_MLO_SUPPORT)) { in ath12k_host_cap_parse_mlo()
2032 if (!ab->qmi.num_radios || ab->qmi.num_radios == U8_MAX) { in ath12k_host_cap_parse_mlo()
2033 ab->mlo_capable_flags = 0; in ath12k_host_cap_parse_mlo()
2037 ab->qmi.num_radios); in ath12k_host_cap_parse_mlo()
2041 req->mlo_capable_valid = 1; in ath12k_host_cap_parse_mlo()
2042 req->mlo_capable = 1; in ath12k_host_cap_parse_mlo()
2043 req->mlo_chip_id_valid = 1; in ath12k_host_cap_parse_mlo()
2044 req->mlo_chip_id = ab->device_id; in ath12k_host_cap_parse_mlo()
2045 req->mlo_group_id_valid = 1; in ath12k_host_cap_parse_mlo()
2046 req->mlo_group_id = 0; in ath12k_host_cap_parse_mlo()
2047 req->max_mlo_peer_valid = 1; in ath12k_host_cap_parse_mlo()
2051 req->max_mlo_peer = ab->hw_params->max_mlo_peer; in ath12k_host_cap_parse_mlo()
2052 req->mlo_num_chips_valid = 1; in ath12k_host_cap_parse_mlo()
2053 req->mlo_num_chips = 1; in ath12k_host_cap_parse_mlo()
2055 info = &req->mlo_chip_info[0]; in ath12k_host_cap_parse_mlo()
2056 info->chip_id = ab->device_id; in ath12k_host_cap_parse_mlo()
2057 info->num_local_links = ab->qmi.num_radios; in ath12k_host_cap_parse_mlo()
2059 for (i = 0; i < info->num_local_links; i++) { in ath12k_host_cap_parse_mlo()
2060 info->hw_link_id[i] = hw_link_id; in ath12k_host_cap_parse_mlo()
2061 info->valid_mlo_link_id[i] = 1; in ath12k_host_cap_parse_mlo()
2066 req->mlo_chip_info_valid = 1; in ath12k_host_cap_parse_mlo()
2078 req.mem_cfg_mode = ab->qmi.target_mem_mode; in ath12k_qmi_host_cap_send()
2089 req.cal_done = ab->qmi.cal_done; in ath12k_qmi_host_cap_send()
2091 if (ab->hw_params->qmi_cnss_feature_bitmap) { in ath12k_qmi_host_cap_send()
2093 req.feature_list = ab->hw_params->qmi_cnss_feature_bitmap; in ath12k_qmi_host_cap_send()
2099 if (ab->hw_params->internal_sleep_clock) { in ath12k_qmi_host_cap_send()
2102 /* Notify firmware that this is non-qualcomm platform. */ in ath12k_qmi_host_cap_send()
2107 * non-qualcomm platforms should select internal sleep in ath12k_qmi_host_cap_send()
2116 ret = qmi_txn_init(&ab->qmi.handle, &txn, in ath12k_qmi_host_cap_send()
2121 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath12k_qmi_host_cap_send()
2138 ret = -EINVAL; in ath12k_qmi_host_cap_send()
2153 ret = qmi_txn_init(&ab->qmi.handle, &txn, in ath12k_qmi_phy_cap_send()
2158 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath12k_qmi_phy_cap_send()
2173 ret = -EOPNOTSUPP; in ath12k_qmi_phy_cap_send()
2179 ab->mlo_capable_flags |= ATH12K_INTRA_DEVICE_MLO_SUPPORT; in ath12k_qmi_phy_cap_send()
2181 ab->mlo_capable_flags &= ~ATH12K_INTRA_DEVICE_MLO_SUPPORT; in ath12k_qmi_phy_cap_send()
2185 ret = -ENODATA; in ath12k_qmi_phy_cap_send()
2189 ab->qmi.num_radios = resp.num_phy; in ath12k_qmi_phy_cap_send()
2201 ab->qmi.num_radios = ab->hw_params->def_num_link; in ath12k_qmi_phy_cap_send()
2205 ab->qmi.num_radios); in ath12k_qmi_phy_cap_send()
2212 struct qmi_handle *handle = &ab->qmi.handle; in ath12k_qmi_fw_ind_register_send()
2218 return -ENOMEM; in ath12k_qmi_fw_ind_register_send()
2222 ret = -ENOMEM; in ath12k_qmi_fw_ind_register_send()
2226 req->client_id_valid = 1; in ath12k_qmi_fw_ind_register_send()
2227 req->client_id = QMI_WLANFW_CLIENT_ID; in ath12k_qmi_fw_ind_register_send()
2228 req->fw_ready_enable_valid = 1; in ath12k_qmi_fw_ind_register_send()
2229 req->fw_ready_enable = 1; in ath12k_qmi_fw_ind_register_send()
2230 req->request_mem_enable_valid = 1; in ath12k_qmi_fw_ind_register_send()
2231 req->request_mem_enable = 1; in ath12k_qmi_fw_ind_register_send()
2232 req->fw_mem_ready_enable_valid = 1; in ath12k_qmi_fw_ind_register_send()
2233 req->fw_mem_ready_enable = 1; in ath12k_qmi_fw_ind_register_send()
2234 req->cal_done_enable_valid = 1; in ath12k_qmi_fw_ind_register_send()
2235 req->cal_done_enable = 1; in ath12k_qmi_fw_ind_register_send()
2236 req->fw_init_done_enable_valid = 1; in ath12k_qmi_fw_ind_register_send()
2237 req->fw_init_done_enable = 1; in ath12k_qmi_fw_ind_register_send()
2239 req->pin_connect_result_enable_valid = 0; in ath12k_qmi_fw_ind_register_send()
2240 req->pin_connect_result_enable = 0; in ath12k_qmi_fw_ind_register_send()
2247 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath12k_qmi_fw_ind_register_send()
2264 if (resp->resp.result != QMI_RESULT_SUCCESS_V01) { in ath12k_qmi_fw_ind_register_send()
2266 resp->resp.result, resp->resp.error); in ath12k_qmi_fw_ind_register_send()
2267 ret = -EINVAL; in ath12k_qmi_fw_ind_register_send()
2288 return -ENOMEM; in ath12k_qmi_respond_fw_mem_request()
2295 if (ab->qmi.target_mem_delayed) { in ath12k_qmi_respond_fw_mem_request()
2298 ab->qmi.mem_seg_count); in ath12k_qmi_respond_fw_mem_request()
2301 req->mem_seg_len = ab->qmi.mem_seg_count; in ath12k_qmi_respond_fw_mem_request()
2302 for (i = 0; i < req->mem_seg_len ; i++) { in ath12k_qmi_respond_fw_mem_request()
2303 req->mem_seg[i].addr = ab->qmi.target_mem[i].paddr; in ath12k_qmi_respond_fw_mem_request()
2304 req->mem_seg[i].size = ab->qmi.target_mem[i].size; in ath12k_qmi_respond_fw_mem_request()
2305 req->mem_seg[i].type = ab->qmi.target_mem[i].type; in ath12k_qmi_respond_fw_mem_request()
2308 &ab->qmi.target_mem[i].paddr, in ath12k_qmi_respond_fw_mem_request()
2309 ab->qmi.target_mem[i].size, in ath12k_qmi_respond_fw_mem_request()
2310 ab->qmi.target_mem[i].type); in ath12k_qmi_respond_fw_mem_request()
2314 ret = qmi_txn_init(&ab->qmi.handle, &txn, in ath12k_qmi_respond_fw_mem_request()
2319 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath12k_qmi_respond_fw_mem_request()
2345 ret = -EINVAL; in ath12k_qmi_respond_fw_mem_request()
2357 for (i = 0; i < ab->qmi.mem_seg_count; i++) { in ath12k_qmi_free_target_mem_chunk()
2358 if (!ab->qmi.target_mem[i].v.addr) in ath12k_qmi_free_target_mem_chunk()
2361 dma_free_coherent(ab->dev, in ath12k_qmi_free_target_mem_chunk()
2362 ab->qmi.target_mem[i].prev_size, in ath12k_qmi_free_target_mem_chunk()
2363 ab->qmi.target_mem[i].v.addr, in ath12k_qmi_free_target_mem_chunk()
2364 ab->qmi.target_mem[i].paddr); in ath12k_qmi_free_target_mem_chunk()
2365 ab->qmi.target_mem[i].v.addr = NULL; in ath12k_qmi_free_target_mem_chunk()
2374 ab->qmi.target_mem_delayed = false; in ath12k_qmi_alloc_target_mem_chunk()
2376 for (i = 0; i < ab->qmi.mem_seg_count; i++) { in ath12k_qmi_alloc_target_mem_chunk()
2377 chunk = &ab->qmi.target_mem[i]; in ath12k_qmi_alloc_target_mem_chunk()
2380 * on the host. For the non-supported memory region, host does not in ath12k_qmi_alloc_target_mem_chunk()
2383 switch (chunk->type) { in ath12k_qmi_alloc_target_mem_chunk()
2391 if (chunk->v.addr) { in ath12k_qmi_alloc_target_mem_chunk()
2392 if (chunk->prev_type == chunk->type && in ath12k_qmi_alloc_target_mem_chunk()
2393 chunk->prev_size == chunk->size) in ath12k_qmi_alloc_target_mem_chunk()
2397 dma_free_coherent(ab->dev, chunk->prev_size, in ath12k_qmi_alloc_target_mem_chunk()
2398 chunk->v.addr, chunk->paddr); in ath12k_qmi_alloc_target_mem_chunk()
2399 chunk->v.addr = NULL; in ath12k_qmi_alloc_target_mem_chunk()
2402 chunk->v.addr = dma_alloc_coherent(ab->dev, in ath12k_qmi_alloc_target_mem_chunk()
2403 chunk->size, in ath12k_qmi_alloc_target_mem_chunk()
2404 &chunk->paddr, in ath12k_qmi_alloc_target_mem_chunk()
2406 if (!chunk->v.addr) { in ath12k_qmi_alloc_target_mem_chunk()
2407 if (chunk->size > ATH12K_QMI_MAX_CHUNK_SIZE) { in ath12k_qmi_alloc_target_mem_chunk()
2408 ab->qmi.target_mem_delayed = true; in ath12k_qmi_alloc_target_mem_chunk()
2411 chunk->size, in ath12k_qmi_alloc_target_mem_chunk()
2412 chunk->type); in ath12k_qmi_alloc_target_mem_chunk()
2417 chunk->type, chunk->size); in ath12k_qmi_alloc_target_mem_chunk()
2418 return -ENOMEM; in ath12k_qmi_alloc_target_mem_chunk()
2421 chunk->prev_type = chunk->type; in ath12k_qmi_alloc_target_mem_chunk()
2422 chunk->prev_size = chunk->size; in ath12k_qmi_alloc_target_mem_chunk()
2427 chunk->type); in ath12k_qmi_alloc_target_mem_chunk()
2428 chunk->paddr = 0; in ath12k_qmi_alloc_target_mem_chunk()
2429 chunk->v.addr = NULL; in ath12k_qmi_alloc_target_mem_chunk()
2446 ret = qmi_txn_init(&ab->qmi.handle, &txn, in ath12k_qmi_request_target_cap()
2451 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath12k_qmi_request_target_cap()
2471 ret = -EINVAL; in ath12k_qmi_request_target_cap()
2476 ab->qmi.target.chip_id = resp.chip_info.chip_id; in ath12k_qmi_request_target_cap()
2477 ab->qmi.target.chip_family = resp.chip_info.chip_family; in ath12k_qmi_request_target_cap()
2481 ab->qmi.target.board_id = resp.board_info.board_id; in ath12k_qmi_request_target_cap()
2483 ab->qmi.target.board_id = board_id; in ath12k_qmi_request_target_cap()
2486 ab->qmi.target.soc_id = resp.soc_info.soc_id; in ath12k_qmi_request_target_cap()
2489 ab->qmi.target.fw_version = resp.fw_version_info.fw_version; in ath12k_qmi_request_target_cap()
2490 strscpy(ab->qmi.target.fw_build_timestamp, in ath12k_qmi_request_target_cap()
2492 sizeof(ab->qmi.target.fw_build_timestamp)); in ath12k_qmi_request_target_cap()
2496 strscpy(ab->qmi.target.fw_build_id, resp.fw_build_id, in ath12k_qmi_request_target_cap()
2497 sizeof(ab->qmi.target.fw_build_id)); in ath12k_qmi_request_target_cap()
2501 ab->qmi.dev_mem[i].start = in ath12k_qmi_request_target_cap()
2503 ab->qmi.dev_mem[i].size = in ath12k_qmi_request_target_cap()
2507 ab->qmi.dev_mem[i].start, in ath12k_qmi_request_target_cap()
2508 ab->qmi.dev_mem[i].size); in ath12k_qmi_request_target_cap()
2513 ab->qmi.target.eeprom_caldata = resp.eeprom_caldata_read_timeout; in ath12k_qmi_request_target_cap()
2518 ab->qmi.target.chip_id, ab->qmi.target.chip_family, in ath12k_qmi_request_target_cap()
2519 ab->qmi.target.board_id, ab->qmi.target.soc_id); in ath12k_qmi_request_target_cap()
2522 ab->qmi.target.fw_version, in ath12k_qmi_request_target_cap()
2523 ab->qmi.target.fw_build_timestamp, in ath12k_qmi_request_target_cap()
2524 ab->qmi.target.fw_build_id); in ath12k_qmi_request_target_cap()
2546 return -ENOMEM; in ath12k_qmi_load_file_target_mem()
2549 req->valid = 1; in ath12k_qmi_load_file_target_mem()
2550 req->file_id_valid = 1; in ath12k_qmi_load_file_target_mem()
2551 req->file_id = ab->qmi.target.board_id; in ath12k_qmi_load_file_target_mem()
2552 req->total_size_valid = 1; in ath12k_qmi_load_file_target_mem()
2553 req->total_size = remaining; in ath12k_qmi_load_file_target_mem()
2554 req->seg_id_valid = 1; in ath12k_qmi_load_file_target_mem()
2555 req->data_valid = 1; in ath12k_qmi_load_file_target_mem()
2556 req->bdf_type = type; in ath12k_qmi_load_file_target_mem()
2557 req->bdf_type_valid = 1; in ath12k_qmi_load_file_target_mem()
2558 req->end_valid = 1; in ath12k_qmi_load_file_target_mem()
2559 req->end = 0; in ath12k_qmi_load_file_target_mem()
2562 req->data_len = QMI_WLANFW_MAX_DATA_SIZE_V01; in ath12k_qmi_load_file_target_mem()
2564 req->data_len = remaining; in ath12k_qmi_load_file_target_mem()
2565 req->end = 1; in ath12k_qmi_load_file_target_mem()
2569 req->data_valid = 0; in ath12k_qmi_load_file_target_mem()
2570 req->end = 1; in ath12k_qmi_load_file_target_mem()
2571 req->data_len = ATH12K_QMI_MAX_BDF_FILE_NAME_SIZE; in ath12k_qmi_load_file_target_mem()
2573 memcpy(req->data, temp, req->data_len); in ath12k_qmi_load_file_target_mem()
2576 ret = qmi_txn_init(&ab->qmi.handle, &txn, in ath12k_qmi_load_file_target_mem()
2585 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath12k_qmi_load_file_target_mem()
2601 ret = -EINVAL; in ath12k_qmi_load_file_target_mem()
2608 remaining -= req->data_len; in ath12k_qmi_load_file_target_mem()
2609 temp += req->data_len; in ath12k_qmi_load_file_target_mem()
2610 req->seg_id++; in ath12k_qmi_load_file_target_mem()
2625 struct device *dev = ab->dev; in ath12k_qmi_load_bdf_qmi()
2658 if (ab->qmi.target.eeprom_caldata) { in ath12k_qmi_load_bdf_qmi()
2665 /* cal-<bus>-<id>.bin */ in ath12k_qmi_load_bdf_qmi()
2666 snprintf(filename, sizeof(filename), "cal-%s-%s.bin", in ath12k_qmi_load_bdf_qmi()
2667 ath12k_bus_str(ab->hif.bus), dev_name(dev)); in ath12k_qmi_load_bdf_qmi()
2683 fw_size = min_t(u32, ab->hw_params->fw.board_size, in ath12k_qmi_load_bdf_qmi()
2684 fw_entry->size); in ath12k_qmi_load_bdf_qmi()
2685 tmp = fw_entry->data; in ath12k_qmi_load_bdf_qmi()
2697 if (!ab->qmi.target.eeprom_caldata) in ath12k_qmi_load_bdf_qmi()
2707 fw_size = min_t(u32, ab->hw_params->fw.board_size, bd.len); in ath12k_qmi_load_bdf_qmi()
2722 struct m3_mem_region *m3_mem = &ab->qmi.m3_mem; in ath12k_qmi_m3_free()
2724 if (!m3_mem->vaddr) in ath12k_qmi_m3_free()
2727 dma_free_coherent(ab->dev, m3_mem->size, in ath12k_qmi_m3_free()
2728 m3_mem->vaddr, m3_mem->paddr); in ath12k_qmi_m3_free()
2729 m3_mem->vaddr = NULL; in ath12k_qmi_m3_free()
2730 m3_mem->size = 0; in ath12k_qmi_m3_free()
2735 struct m3_mem_region *m3_mem = &ab->qmi.m3_mem; in ath12k_qmi_m3_load()
2742 if (ab->fw.m3_data && ab->fw.m3_len > 0) { in ath12k_qmi_m3_load()
2743 /* firmware-N.bin had a m3 firmware file so use that */ in ath12k_qmi_m3_load()
2744 m3_data = ab->fw.m3_data; in ath12k_qmi_m3_load()
2745 m3_len = ab->fw.m3_len; in ath12k_qmi_m3_load()
2747 /* No m3 file in firmware-N.bin so try to request old in ath12k_qmi_m3_load()
2759 m3_data = fw->data; in ath12k_qmi_m3_load()
2760 m3_len = fw->size; in ath12k_qmi_m3_load()
2764 if (m3_mem->vaddr) { in ath12k_qmi_m3_load()
2765 if (m3_mem->size >= m3_len) in ath12k_qmi_m3_load()
2772 m3_mem->vaddr = dma_alloc_coherent(ab->dev, in ath12k_qmi_m3_load()
2773 m3_len, &m3_mem->paddr, in ath12k_qmi_m3_load()
2775 if (!m3_mem->vaddr) { in ath12k_qmi_m3_load()
2777 fw->size); in ath12k_qmi_m3_load()
2778 ret = -ENOMEM; in ath12k_qmi_m3_load()
2783 memcpy(m3_mem->vaddr, m3_data, m3_len); in ath12k_qmi_m3_load()
2784 m3_mem->size = m3_len; in ath12k_qmi_m3_load()
2796 struct m3_mem_region *m3_mem = &ab->qmi.m3_mem; in ath12k_qmi_wlanfw_m3_info_send()
2808 req.addr = m3_mem->paddr; in ath12k_qmi_wlanfw_m3_info_send()
2809 req.size = m3_mem->size; in ath12k_qmi_wlanfw_m3_info_send()
2811 ret = qmi_txn_init(&ab->qmi.handle, &txn, in ath12k_qmi_wlanfw_m3_info_send()
2816 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath12k_qmi_wlanfw_m3_info_send()
2836 ret = -EINVAL; in ath12k_qmi_wlanfw_m3_info_send()
2855 ret = qmi_txn_init(&ab->qmi.handle, &txn, in ath12k_qmi_wlanfw_mode_send()
2860 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath12k_qmi_wlanfw_mode_send()
2873 if (mode == ATH12K_FIRMWARE_MODE_OFF && ret == -ENETRESET) { in ath12k_qmi_wlanfw_mode_send()
2874 ath12k_warn(ab, "WLFW service is dis-connected\n"); in ath12k_qmi_wlanfw_mode_send()
2885 ret = -EINVAL; in ath12k_qmi_wlanfw_mode_send()
2902 ce_cfg = (struct ce_pipe_config *)ab->qmi.ce_cfg.tgt_ce; in ath12k_qmi_wlanfw_wlan_cfg_send()
2903 svc_cfg = (struct service_to_pipe *)ab->qmi.ce_cfg.svc_to_ce_map; in ath12k_qmi_wlanfw_wlan_cfg_send()
2907 return -ENOMEM; in ath12k_qmi_wlanfw_wlan_cfg_send()
2909 req->host_version_valid = 1; in ath12k_qmi_wlanfw_wlan_cfg_send()
2910 strscpy(req->host_version, ATH12K_HOST_VERSION_STRING, in ath12k_qmi_wlanfw_wlan_cfg_send()
2911 sizeof(req->host_version)); in ath12k_qmi_wlanfw_wlan_cfg_send()
2913 req->tgt_cfg_valid = 1; in ath12k_qmi_wlanfw_wlan_cfg_send()
2915 req->tgt_cfg_len = ab->qmi.ce_cfg.tgt_ce_len; in ath12k_qmi_wlanfw_wlan_cfg_send()
2916 for (pipe_num = 0; pipe_num < req->tgt_cfg_len ; pipe_num++) { in ath12k_qmi_wlanfw_wlan_cfg_send()
2917 req->tgt_cfg[pipe_num].pipe_num = ce_cfg[pipe_num].pipenum; in ath12k_qmi_wlanfw_wlan_cfg_send()
2918 req->tgt_cfg[pipe_num].pipe_dir = ce_cfg[pipe_num].pipedir; in ath12k_qmi_wlanfw_wlan_cfg_send()
2919 req->tgt_cfg[pipe_num].nentries = ce_cfg[pipe_num].nentries; in ath12k_qmi_wlanfw_wlan_cfg_send()
2920 req->tgt_cfg[pipe_num].nbytes_max = ce_cfg[pipe_num].nbytes_max; in ath12k_qmi_wlanfw_wlan_cfg_send()
2921 req->tgt_cfg[pipe_num].flags = ce_cfg[pipe_num].flags; in ath12k_qmi_wlanfw_wlan_cfg_send()
2924 req->svc_cfg_valid = 1; in ath12k_qmi_wlanfw_wlan_cfg_send()
2926 req->svc_cfg_len = ab->qmi.ce_cfg.svc_to_ce_map_len; in ath12k_qmi_wlanfw_wlan_cfg_send()
2927 for (pipe_num = 0; pipe_num < req->svc_cfg_len; pipe_num++) { in ath12k_qmi_wlanfw_wlan_cfg_send()
2928 req->svc_cfg[pipe_num].service_id = svc_cfg[pipe_num].service_id; in ath12k_qmi_wlanfw_wlan_cfg_send()
2929 req->svc_cfg[pipe_num].pipe_dir = svc_cfg[pipe_num].pipedir; in ath12k_qmi_wlanfw_wlan_cfg_send()
2930 req->svc_cfg[pipe_num].pipe_num = svc_cfg[pipe_num].pipenum; in ath12k_qmi_wlanfw_wlan_cfg_send()
2934 if (ab->hw_params->supports_shadow_regs) { in ath12k_qmi_wlanfw_wlan_cfg_send()
2935 req->shadow_reg_v3_valid = 1; in ath12k_qmi_wlanfw_wlan_cfg_send()
2936 req->shadow_reg_v3_len = min_t(u32, in ath12k_qmi_wlanfw_wlan_cfg_send()
2937 ab->qmi.ce_cfg.shadow_reg_v3_len, in ath12k_qmi_wlanfw_wlan_cfg_send()
2939 memcpy(&req->shadow_reg_v3, ab->qmi.ce_cfg.shadow_reg_v3, in ath12k_qmi_wlanfw_wlan_cfg_send()
2940 sizeof(u32) * req->shadow_reg_v3_len); in ath12k_qmi_wlanfw_wlan_cfg_send()
2942 req->shadow_reg_v3_valid = 0; in ath12k_qmi_wlanfw_wlan_cfg_send()
2945 ret = qmi_txn_init(&ab->qmi.handle, &txn, in ath12k_qmi_wlanfw_wlan_cfg_send()
2950 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath12k_qmi_wlanfw_wlan_cfg_send()
2970 ret = -EINVAL; in ath12k_qmi_wlanfw_wlan_cfg_send()
2989 ret = qmi_txn_init(&ab->qmi.handle, &txn, in ath12k_qmi_wlanfw_wlan_ini_send()
2994 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath12k_qmi_wlanfw_wlan_ini_send()
3014 ret = -EINVAL; in ath12k_qmi_wlanfw_wlan_ini_send()
3068 return -ENOMEM; in ath12k_qmi_driver_event_post()
3070 event->type = type; in ath12k_qmi_driver_event_post()
3071 event->data = data; in ath12k_qmi_driver_event_post()
3073 spin_lock(&qmi->event_lock); in ath12k_qmi_driver_event_post()
3074 list_add_tail(&event->list, &qmi->event_list); in ath12k_qmi_driver_event_post()
3075 spin_unlock(&qmi->event_lock); in ath12k_qmi_driver_event_post()
3077 queue_work(qmi->event_wq, &qmi->event_work); in ath12k_qmi_driver_event_post()
3084 struct ath12k_base *ab = qmi->ab; in ath12k_qmi_event_server_arrive()
3106 struct ath12k_base *ab = qmi->ab; in ath12k_qmi_event_mem_request()
3120 struct ath12k_base *ab = qmi->ab; in ath12k_qmi_event_load_bdf()
3141 if (ab->hw_params->download_calib) { in ath12k_qmi_event_load_bdf()
3162 struct ath12k_base *ab = qmi->ab; in ath12k_qmi_msg_mem_request_cb()
3168 if (msg->mem_seg_len == 0 || in ath12k_qmi_msg_mem_request_cb()
3169 msg->mem_seg_len > ATH12K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01) in ath12k_qmi_msg_mem_request_cb()
3170 ath12k_warn(ab, "Invalid memory segment length: %u\n", in ath12k_qmi_msg_mem_request_cb()
3171 msg->mem_seg_len); in ath12k_qmi_msg_mem_request_cb()
3173 ab->qmi.mem_seg_count = msg->mem_seg_len; in ath12k_qmi_msg_mem_request_cb()
3175 for (i = 0; i < qmi->mem_seg_count ; i++) { in ath12k_qmi_msg_mem_request_cb()
3176 ab->qmi.target_mem[i].type = msg->mem_seg[i].type; in ath12k_qmi_msg_mem_request_cb()
3177 ab->qmi.target_mem[i].size = msg->mem_seg[i].size; in ath12k_qmi_msg_mem_request_cb()
3179 msg->mem_seg[i].type, msg->mem_seg[i].size); in ath12k_qmi_msg_mem_request_cb()
3198 struct ath12k_base *ab = qmi->ab; in ath12k_qmi_msg_mem_ready_cb()
3210 struct ath12k_base *ab = qmi->ab; in ath12k_qmi_msg_fw_ready_cb()
3247 struct ath12k_base *ab = qmi->ab; in ath12k_qmi_ops_new_server()
3248 struct sockaddr_qrtr *sq = &qmi->sq; in ath12k_qmi_ops_new_server()
3251 sq->sq_family = AF_QIPCRTR; in ath12k_qmi_ops_new_server()
3252 sq->sq_node = service->node; in ath12k_qmi_ops_new_server()
3253 sq->sq_port = service->port; in ath12k_qmi_ops_new_server()
3255 ret = kernel_connect(qmi_hdl->sock, (struct sockaddr *)sq, in ath12k_qmi_ops_new_server()
3272 struct ath12k_base *ab = qmi->ab; in ath12k_qmi_ops_del_server()
3288 struct ath12k_base *ab = qmi->ab; in ath12k_qmi_driver_event_work()
3291 spin_lock(&qmi->event_lock); in ath12k_qmi_driver_event_work()
3292 while (!list_empty(&qmi->event_list)) { in ath12k_qmi_driver_event_work()
3293 event = list_first_entry(&qmi->event_list, in ath12k_qmi_driver_event_work()
3295 list_del(&event->list); in ath12k_qmi_driver_event_work()
3296 spin_unlock(&qmi->event_lock); in ath12k_qmi_driver_event_work()
3298 if (test_bit(ATH12K_FLAG_UNREGISTERING, &ab->dev_flags)) in ath12k_qmi_driver_event_work()
3301 switch (event->type) { in ath12k_qmi_driver_event_work()
3305 set_bit(ATH12K_FLAG_QMI_FAIL, &ab->dev_flags); in ath12k_qmi_driver_event_work()
3308 set_bit(ATH12K_FLAG_CRASH_FLUSH, &ab->dev_flags); in ath12k_qmi_driver_event_work()
3309 set_bit(ATH12K_FLAG_RECOVERY, &ab->dev_flags); in ath12k_qmi_driver_event_work()
3314 set_bit(ATH12K_FLAG_QMI_FAIL, &ab->dev_flags); in ath12k_qmi_driver_event_work()
3319 set_bit(ATH12K_FLAG_QMI_FAIL, &ab->dev_flags); in ath12k_qmi_driver_event_work()
3322 clear_bit(ATH12K_FLAG_QMI_FAIL, &ab->dev_flags); in ath12k_qmi_driver_event_work()
3323 if (test_bit(ATH12K_FLAG_REGISTERED, &ab->dev_flags)) { in ath12k_qmi_driver_event_work()
3324 if (ab->is_reset) in ath12k_qmi_driver_event_work()
3326 queue_work(ab->workqueue, &ab->restart_work); in ath12k_qmi_driver_event_work()
3331 &ab->dev_flags); in ath12k_qmi_driver_event_work()
3332 clear_bit(ATH12K_FLAG_RECOVERY, &ab->dev_flags); in ath12k_qmi_driver_event_work()
3334 set_bit(ATH12K_FLAG_REGISTERED, &ab->dev_flags); in ath12k_qmi_driver_event_work()
3338 ath12k_warn(ab, "invalid event type: %d", event->type); in ath12k_qmi_driver_event_work()
3344 spin_lock(&qmi->event_lock); in ath12k_qmi_driver_event_work()
3346 spin_unlock(&qmi->event_lock); in ath12k_qmi_driver_event_work()
3353 memset(&ab->qmi.target, 0, sizeof(struct target_info)); in ath12k_qmi_init_service()
3354 memset(&ab->qmi.target_mem, 0, sizeof(struct target_mem_chunk)); in ath12k_qmi_init_service()
3355 ab->qmi.ab = ab; in ath12k_qmi_init_service()
3357 ab->qmi.target_mem_mode = ATH12K_QMI_TARGET_MEM_MODE_DEFAULT; in ath12k_qmi_init_service()
3358 ret = qmi_handle_init(&ab->qmi.handle, ATH12K_QMI_RESP_LEN_MAX, in ath12k_qmi_init_service()
3365 ab->qmi.event_wq = alloc_ordered_workqueue("ath12k_qmi_driver_event", 0); in ath12k_qmi_init_service()
3366 if (!ab->qmi.event_wq) { in ath12k_qmi_init_service()
3368 return -EFAULT; in ath12k_qmi_init_service()
3371 INIT_LIST_HEAD(&ab->qmi.event_list); in ath12k_qmi_init_service()
3372 spin_lock_init(&ab->qmi.event_lock); in ath12k_qmi_init_service()
3373 INIT_WORK(&ab->qmi.event_work, ath12k_qmi_driver_event_work); in ath12k_qmi_init_service()
3375 ret = qmi_add_lookup(&ab->qmi.handle, ATH12K_QMI_WLFW_SERVICE_ID_V01, in ath12k_qmi_init_service()
3377 ab->qmi.service_ins_id); in ath12k_qmi_init_service()
3380 destroy_workqueue(ab->qmi.event_wq); in ath12k_qmi_init_service()
3389 qmi_handle_release(&ab->qmi.handle); in ath12k_qmi_deinit_service()
3390 cancel_work_sync(&ab->qmi.event_work); in ath12k_qmi_deinit_service()
3391 destroy_workqueue(ab->qmi.event_wq); in ath12k_qmi_deinit_service()