Lines Matching defs:ab

814 static inline struct ath11k_pdev *ath11k_core_get_single_pdev(struct ath11k_base *ab)
816 WARN_ON(!ab->hw_params.single_pdev_only);
818 return &ab->pdevs[0];
867 bool ath11k_core_coldboot_cal_support(struct ath11k_base *ab)
873 return ab->hw_params.coldboot_cal_ftm;
876 return ab->hw_params.coldboot_cal_mm;
879 int ath11k_core_suspend(struct ath11k_base *ab)
885 if (!ab->hw_params.supports_suspend)
891 pdev = ath11k_core_get_single_pdev(ab);
896 ret = ath11k_dp_rx_pktlog_stop(ab, true);
898 ath11k_warn(ab, "failed to stop dp rx (and timer) pktlog during suspend: %d\n",
905 ath11k_warn(ab, "failed to wait tx complete: %d\n", ret);
909 ret = ath11k_dp_rx_pktlog_stop(ab, false);
911 ath11k_warn(ab, "failed to stop dp rx pktlog during suspend: %d\n",
916 ath11k_ce_stop_shadow_timers(ab);
917 ath11k_dp_stop_shadow_timers(ab);
924 * no chance to call complete(&ab->restart_completed) in
930 complete(&ab->restart_completed);
936 int ath11k_core_suspend_late(struct ath11k_base *ab)
941 if (!ab->hw_params.supports_suspend)
947 pdev = ath11k_core_get_single_pdev(ab);
952 ath11k_hif_irq_disable(ab);
953 ath11k_hif_ce_irq_disable(ab);
955 ath11k_hif_power_down(ab, true);
961 int ath11k_core_resume_early(struct ath11k_base *ab)
967 if (!ab->hw_params.supports_suspend)
973 pdev = ath11k_core_get_single_pdev(ab);
978 reinit_completion(&ab->restart_completed);
979 ret = ath11k_hif_power_up(ab);
981 ath11k_warn(ab, "failed to power up hif during resume: %d\n", ret);
987 int ath11k_core_resume(struct ath11k_base *ab)
994 if (!ab->hw_params.supports_suspend)
1000 pdev = ath11k_core_get_single_pdev(ab);
1005 time_left = wait_for_completion_timeout(&ab->restart_completed,
1008 ath11k_warn(ab, "timeout while waiting for restart complete");
1012 ret = ath11k_dp_rx_pktlog_start(ab);
1014 ath11k_warn(ab, "failed to start rx pktlog during resume: %d\n",
1023 struct ath11k_base *ab = data;
1030 if (ab->qmi.target.bdf_ext[0] != '\0')
1037 ath11k_dbg(ab, ATH11K_DBG_BOOT,
1043 spin_lock_bh(&ab->base_lock);
1047 ab->new_alpha2[0] = (smbios->cc_code >> 8) & 0xff;
1048 ab->new_alpha2[1] = smbios->cc_code & 0xff;
1049 ath11k_dbg(ab, ATH11K_DBG_BOOT, "smbios cc_code %c%c\n",
1050 ab->new_alpha2[0], ab->new_alpha2[1]);
1053 ab->new_alpha2[0] = '0';
1054 ab->new_alpha2[1] = '0';
1055 ath11k_dbg(ab, ATH11K_DBG_BOOT, "smbios worldwide regdomain\n");
1058 ath11k_dbg(ab, ATH11K_DBG_BOOT, "ignore smbios country code setting %d\n",
1063 spin_unlock_bh(&ab->base_lock);
1066 ath11k_dbg(ab, ATH11K_DBG_BOOT, "bdf variant name not found.\n");
1072 ath11k_dbg(ab, ATH11K_DBG_BOOT,
1078 strlen(smbios->bdf_ext), sizeof(ab->qmi.target.bdf_ext));
1081 ath11k_dbg(ab, ATH11K_DBG_BOOT,
1088 copied = strscpy(ab->qmi.target.bdf_ext, smbios->bdf_ext + strlen(magic),
1089 sizeof(ab->qmi.target.bdf_ext));
1091 ath11k_dbg(ab, ATH11K_DBG_BOOT,
1096 ath11k_dbg(ab, ATH11K_DBG_BOOT,
1098 ATH11K_SMBIOS_BDF_EXT_TYPE, ab->qmi.target.bdf_ext);
1101 int ath11k_core_check_smbios(struct ath11k_base *ab)
1103 ab->qmi.target.bdf_ext[0] = '\0';
1104 dmi_walk(ath11k_core_check_cc_code_bdfext, ab);
1106 if (ab->qmi.target.bdf_ext[0] == '\0')
1112 int ath11k_core_check_dt(struct ath11k_base *ab)
1114 size_t max_len = sizeof(ab->qmi.target.bdf_ext);
1118 node = ab->dev->of_node;
1127 if (strscpy(ab->qmi.target.bdf_ext, variant, max_len) < 0)
1128 ath11k_dbg(ab, ATH11K_DBG_BOOT,
1141 static int __ath11k_core_create_board_name(struct ath11k_base *ab, char *name,
1145 /* strlen(',variant=') + strlen(ab->qmi.target.bdf_ext) */
1148 if (with_variant && ab->qmi.target.bdf_ext[0] != '\0')
1150 ab->qmi.target.bdf_ext);
1152 switch (ab->id.bdf_search) {
1158 ath11k_bus_str(ab->hif.bus),
1159 ab->id.vendor, ab->id.device,
1160 ab->id.subsystem_vendor,
1161 ab->id.subsystem_device,
1162 ab->qmi.target.chip_id,
1163 ab->qmi.target.board_id,
1169 ath11k_bus_str(ab->hif.bus));
1174 ath11k_bus_str(ab->hif.bus),
1175 ab->qmi.target.chip_id);
1182 ath11k_bus_str(ab->hif.bus),
1183 ab->qmi.target.chip_id,
1184 ab->qmi.target.board_id, variant);
1188 ath11k_dbg(ab, ATH11K_DBG_BOOT, "using board name '%s'\n", name);
1193 static int ath11k_core_create_board_name(struct ath11k_base *ab, char *name,
1196 return __ath11k_core_create_board_name(ab, name, name_len, true,
1200 static int ath11k_core_create_fallback_board_name(struct ath11k_base *ab, char *name,
1203 return __ath11k_core_create_board_name(ab, name, name_len, false,
1207 static int ath11k_core_create_bus_type_board_name(struct ath11k_base *ab, char *name,
1210 return __ath11k_core_create_board_name(ab, name, name_len, false,
1214 static int ath11k_core_create_chip_id_board_name(struct ath11k_base *ab, char *name,
1217 return __ath11k_core_create_board_name(ab, name, name_len, false,
1221 const struct firmware *ath11k_core_firmware_request(struct ath11k_base *ab,
1231 ath11k_core_create_firmware_path(ab, file, path, sizeof(path));
1233 ret = firmware_request_nowarn(&fw, path, ab->dev);
1237 ath11k_dbg(ab, ATH11K_DBG_BOOT, "firmware request %s size %zu\n",
1243 void ath11k_core_free_bdf(struct ath11k_base *ab, struct ath11k_board_data *bd)
1251 static int ath11k_core_parse_bd_ie_board(struct ath11k_base *ab,
1278 ath11k_err(ab, "invalid %s length: %zu < %zu\n",
1286 ath11k_dbg_dump(ab, ATH11K_DBG_BOOT, "board name", "",
1297 ath11k_dbg(ab, ATH11K_DBG_BOOT,
1306 ath11k_dbg(ab, ATH11K_DBG_BOOT,
1317 ath11k_warn(ab, "unknown %s id found: %d\n",
1336 static int ath11k_core_fetch_board_data_api_n(struct ath11k_base *ab,
1353 bd->fw = ath11k_core_firmware_request(ab, filename);
1361 ath11k_core_create_firmware_path(ab, filename,
1367 ath11k_err(ab, "failed to find magic value in %s, file too short: %zu\n",
1374 ath11k_err(ab, "found invalid board magic\n");
1382 ath11k_err(ab, "failed: %s too small to contain board data, len: %zu\n",
1400 ath11k_err(ab, "invalid length for board ie_id %d ie_len %zu len %zu\n",
1407 ret = ath11k_core_parse_bd_ie_board(ab, bd, data,
1432 ath11k_dbg(ab, ATH11K_DBG_BOOT,
1443 ath11k_core_free_bdf(ab, bd);
1447 int ath11k_core_fetch_board_data_api_1(struct ath11k_base *ab,
1451 bd->fw = ath11k_core_firmware_request(ab, name);
1463 int ath11k_core_fetch_bdf(struct ath11k_base *ab, struct ath11k_board_data *bd)
1477 ret = ath11k_core_create_board_name(ab, boardname, BOARD_NAME_SIZE);
1479 ath11k_err(ab, "failed to create board name: %d", ret);
1484 ret = ath11k_core_fetch_board_data_api_n(ab, bd, boardname,
1497 ret = ath11k_core_create_fallback_board_name(ab, fallback_boardname,
1500 ath11k_err(ab, "failed to create fallback board name: %d", ret);
1504 ret = ath11k_core_fetch_board_data_api_n(ab, bd, fallback_boardname,
1517 ret = ath11k_core_create_chip_id_board_name(ab, chip_id_boardname,
1520 ath11k_err(ab, "failed to create chip id board name: %d", ret);
1524 ret = ath11k_core_fetch_board_data_api_n(ab, bd, chip_id_boardname,
1533 ret = ath11k_core_fetch_board_data_api_1(ab, bd, ATH11K_DEFAULT_BOARD_FILE);
1535 ath11k_core_create_firmware_path(ab, filename,
1537 ath11k_err(ab, "failed to fetch board data for %s from %s\n",
1540 ath11k_err(ab, "failed to fetch board data for %s from %s\n",
1543 ath11k_err(ab, "failed to fetch board data for %s from %s\n",
1546 ath11k_err(ab, "failed to fetch board.bin from %s\n",
1547 ab->hw_params.fw.dir);
1556 ath11k_dbg(ab, ATH11K_DBG_BOOT, "using board api %d\n", bd_api);
1561 int ath11k_core_fetch_regdb(struct ath11k_base *ab, struct ath11k_board_data *bd)
1566 ret = ath11k_core_create_board_name(ab, boardname, BOARD_NAME_SIZE);
1568 ath11k_dbg(ab, ATH11K_DBG_BOOT,
1573 ret = ath11k_core_fetch_board_data_api_n(ab, bd, boardname,
1580 ret = ath11k_core_create_bus_type_board_name(ab, default_boardname,
1583 ath11k_dbg(ab, ATH11K_DBG_BOOT,
1588 ret = ath11k_core_fetch_board_data_api_n(ab, bd, default_boardname,
1595 ret = ath11k_core_fetch_board_data_api_1(ab, bd, ATH11K_REGDB_FILE_NAME);
1597 ath11k_dbg(ab, ATH11K_DBG_BOOT, "failed to fetch %s from %s\n",
1598 ATH11K_REGDB_FILE_NAME, ab->hw_params.fw.dir);
1602 ath11k_dbg(ab, ATH11K_DBG_BOOT, "fetched regdb\n");
1607 static void ath11k_core_stop(struct ath11k_base *ab)
1609 if (!test_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags))
1610 ath11k_qmi_firmware_stop(ab);
1612 ath11k_hif_stop(ab);
1613 ath11k_wmi_detach(ab);
1614 ath11k_dp_pdev_reo_cleanup(ab);
1619 static int ath11k_core_soc_create(struct ath11k_base *ab)
1624 ab->fw_mode = ATH11K_FIRMWARE_MODE_FTM;
1625 ath11k_info(ab, "Booting in factory test mode\n");
1628 ret = ath11k_qmi_init_service(ab);
1630 ath11k_err(ab, "failed to initialize qmi :%d\n", ret);
1634 ret = ath11k_debugfs_soc_create(ab);
1636 ath11k_err(ab, "failed to create ath11k debugfs\n");
1640 ret = ath11k_hif_power_up(ab);
1642 ath11k_err(ab, "failed to power up :%d\n", ret);
1649 ath11k_debugfs_soc_destroy(ab);
1651 ath11k_qmi_deinit_service(ab);
1655 static void ath11k_core_soc_destroy(struct ath11k_base *ab)
1657 ath11k_debugfs_soc_destroy(ab);
1658 ath11k_dp_free(ab);
1659 ath11k_reg_free(ab);
1660 ath11k_qmi_deinit_service(ab);
1663 static int ath11k_core_pdev_create(struct ath11k_base *ab)
1667 ret = ath11k_debugfs_pdev_create(ab);
1669 ath11k_err(ab, "failed to create core pdev debugfs: %d\n", ret);
1673 ret = ath11k_dp_pdev_alloc(ab);
1675 ath11k_err(ab, "failed to attach DP pdev: %d\n", ret);
1679 ret = ath11k_mac_register(ab);
1681 ath11k_err(ab, "failed register the radio with mac80211: %d\n", ret);
1685 ret = ath11k_thermal_register(ab);
1687 ath11k_err(ab, "could not register thermal device: %d\n",
1692 ret = ath11k_spectral_init(ab);
1694 ath11k_err(ab, "failed to init spectral %d\n", ret);
1701 ath11k_thermal_unregister(ab);
1703 ath11k_mac_unregister(ab);
1705 ath11k_dp_pdev_free(ab);
1707 ath11k_debugfs_pdev_destroy(ab);
1712 static void ath11k_core_pdev_destroy(struct ath11k_base *ab)
1714 ath11k_spectral_deinit(ab);
1715 ath11k_thermal_unregister(ab);
1716 ath11k_mac_unregister(ab);
1717 ath11k_hif_irq_disable(ab);
1718 ath11k_dp_pdev_free(ab);
1719 ath11k_debugfs_pdev_destroy(ab);
1722 static int ath11k_core_start(struct ath11k_base *ab)
1726 ret = ath11k_wmi_attach(ab);
1728 ath11k_err(ab, "failed to attach wmi: %d\n", ret);
1732 ret = ath11k_htc_init(ab);
1734 ath11k_err(ab, "failed to init htc: %d\n", ret);
1738 ret = ath11k_hif_start(ab);
1740 ath11k_err(ab, "failed to start HIF: %d\n", ret);
1744 ret = ath11k_htc_wait_target(&ab->htc);
1746 ath11k_err(ab, "failed to connect to HTC: %d\n", ret);
1750 ret = ath11k_dp_htt_connect(&ab->dp);
1752 ath11k_err(ab, "failed to connect to HTT: %d\n", ret);
1756 ret = ath11k_wmi_connect(ab);
1758 ath11k_err(ab, "failed to connect wmi: %d\n", ret);
1762 ret = ath11k_htc_start(&ab->htc);
1764 ath11k_err(ab, "failed to start HTC: %d\n", ret);
1768 ret = ath11k_wmi_wait_for_service_ready(ab);
1770 ath11k_err(ab, "failed to receive wmi service ready event: %d\n",
1775 ret = ath11k_mac_allocate(ab);
1777 ath11k_err(ab, "failed to create new hw device with mac80211 :%d\n",
1782 ath11k_dp_pdev_pre_alloc(ab);
1784 ret = ath11k_dp_pdev_reo_setup(ab);
1786 ath11k_err(ab, "failed to initialize reo destination rings: %d\n", ret);
1790 ret = ath11k_wmi_cmd_init(ab);
1792 ath11k_err(ab, "failed to send wmi init cmd: %d\n", ret);
1796 ret = ath11k_wmi_wait_for_unified_ready(ab);
1798 ath11k_err(ab, "failed to receive wmi unified ready event: %d\n",
1804 if (ab->hw_params.single_pdev_only && ab->hw_params.num_rxmda_per_pdev > 1) {
1805 ret = ath11k_wmi_set_hw_mode(ab, WMI_HOST_HW_MODE_DBS);
1807 ath11k_err(ab, "failed to send dbs mode: %d\n", ret);
1812 ret = ath11k_dp_tx_htt_h2t_ver_req_msg(ab);
1814 ath11k_err(ab, "failed to send htt version request message: %d\n",
1822 ath11k_dp_pdev_reo_cleanup(ab);
1824 ath11k_mac_destroy(ab);
1826 ath11k_hif_stop(ab);
1828 ath11k_wmi_detach(ab);
1833 static int ath11k_core_start_firmware(struct ath11k_base *ab,
1838 ath11k_ce_get_shadow_config(ab, &ab->qmi.ce_cfg.shadow_reg_v2,
1839 &ab->qmi.ce_cfg.shadow_reg_v2_len);
1841 ret = ath11k_qmi_firmware_start(ab, mode);
1843 ath11k_err(ab, "failed to send firmware start: %d\n", ret);
1850 int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab)
1854 ret = ath11k_core_start_firmware(ab, ab->fw_mode);
1856 ath11k_err(ab, "failed to start firmware: %d\n", ret);
1860 ret = ath11k_ce_init_pipes(ab);
1862 ath11k_err(ab, "failed to initialize CE: %d\n", ret);
1866 ret = ath11k_dp_alloc(ab);
1868 ath11k_err(ab, "failed to init DP: %d\n", ret);
1874 set_bit(ATH11K_FLAG_HW_CRYPTO_DISABLED, &ab->dev_flags);
1875 set_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags);
1878 clear_bit(ATH11K_FLAG_HW_CRYPTO_DISABLED, &ab->dev_flags);
1879 clear_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags);
1882 ath11k_info(ab, "invalid crypto_mode: %d\n", ath11k_crypto_mode);
1887 set_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags);
1889 mutex_lock(&ab->core_lock);
1890 ret = ath11k_core_start(ab);
1892 ath11k_err(ab, "failed to start core: %d\n", ret);
1896 ret = ath11k_core_pdev_create(ab);
1898 ath11k_err(ab, "failed to create pdev core: %d\n", ret);
1901 ath11k_hif_irq_enable(ab);
1902 mutex_unlock(&ab->core_lock);
1907 ath11k_core_stop(ab);
1908 ath11k_mac_destroy(ab);
1910 ath11k_dp_free(ab);
1911 mutex_unlock(&ab->core_lock);
1913 ath11k_qmi_firmware_stop(ab);
1918 static int ath11k_core_reconfigure_on_crash(struct ath11k_base *ab)
1922 mutex_lock(&ab->core_lock);
1923 ath11k_thermal_unregister(ab);
1924 ath11k_dp_pdev_free(ab);
1925 ath11k_spectral_deinit(ab);
1926 ath11k_ce_cleanup_pipes(ab);
1927 ath11k_wmi_detach(ab);
1928 ath11k_dp_pdev_reo_cleanup(ab);
1929 mutex_unlock(&ab->core_lock);
1931 ath11k_dp_free(ab);
1932 ath11k_hal_srng_deinit(ab);
1934 ab->free_vdev_map = (1LL << (ab->num_radios * TARGET_NUM_VDEVS(ab))) - 1;
1936 ret = ath11k_hal_srng_init(ab);
1940 clear_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags);
1942 ret = ath11k_core_qmi_firmware_ready(ab);
1946 clear_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags);
1951 ath11k_hal_srng_deinit(ab);
1957 struct ath11k_base *ab = ar->ab;
1968 cancel_work_sync(&ab->update_11d_work);
1970 rcu_assign_pointer(ab->pdevs_active[ar->pdev_idx], NULL);
1978 struct ath11k_base *ab = container_of(work, struct ath11k_base, update_11d_work);
1984 spin_lock_bh(&ab->base_lock);
1985 memcpy(&set_current_param.alpha2, &ab->new_alpha2, 2);
1986 spin_unlock_bh(&ab->base_lock);
1988 ath11k_dbg(ab, ATH11K_DBG_WMI, "update 11d new cc %c%c\n",
1992 for (i = 0; i < ab->num_radios; i++) {
1993 pdev = &ab->pdevs[i];
1999 ath11k_warn(ar->ab,
2005 void ath11k_core_pre_reconfigure_recovery(struct ath11k_base *ab)
2011 spin_lock_bh(&ab->base_lock);
2012 ab->stats.fw_crash_counter++;
2013 spin_unlock_bh(&ab->base_lock);
2015 for (i = 0; i < ab->num_radios; i++) {
2016 pdev = &ab->pdevs[i];
2048 wake_up(&ab->wmi_ab.tx_credits_wq);
2049 wake_up(&ab->peer_mapping_wq);
2051 reinit_completion(&ab->driver_recovery);
2054 static void ath11k_core_post_reconfigure_recovery(struct ath11k_base *ab)
2060 for (i = 0; i < ab->num_radios; i++) {
2061 pdev = &ab->pdevs[i];
2075 ath11k_warn(ab,
2085 ath11k_warn(ab,
2089 ath11k_dbg(ab, ATH11K_DBG_TESTMODE,
2096 complete(&ab->driver_recovery);
2101 struct ath11k_base *ab = container_of(work, struct ath11k_base, restart_work);
2104 ret = ath11k_core_reconfigure_on_crash(ab);
2106 ath11k_err(ab, "failed to reconfigure driver on crash recovery\n");
2110 if (ab->is_reset)
2111 complete_all(&ab->reconfigure_complete);
2113 if (!ab->is_reset)
2114 ath11k_core_post_reconfigure_recovery(ab);
2116 complete(&ab->restart_completed);
2121 struct ath11k_base *ab = container_of(work, struct ath11k_base, reset_work);
2125 if (!(test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags))) {
2126 ath11k_warn(ab, "ignore reset dev flags 0x%lx\n", ab->dev_flags);
2133 fail_cont_count = atomic_read(&ab->fail_cont_count);
2139 time_before(jiffies, ab->reset_fail_timeout))
2142 reset_count = atomic_inc_return(&ab->reset_count);
2149 ath11k_warn(ab, "already resetting count %d\n", reset_count);
2151 reinit_completion(&ab->reset_complete);
2152 time_left = wait_for_completion_timeout(&ab->reset_complete,
2156 ath11k_dbg(ab, ATH11K_DBG_BOOT, "to skip reset\n");
2157 atomic_dec(&ab->reset_count);
2161 ab->reset_fail_timeout = jiffies + ATH11K_RESET_FAIL_TIMEOUT_HZ;
2163 atomic_inc(&ab->fail_cont_count);
2166 ath11k_dbg(ab, ATH11K_DBG_BOOT, "reset starting\n");
2168 ab->is_reset = true;
2169 atomic_set(&ab->recovery_count, 0);
2170 reinit_completion(&ab->recovery_start);
2171 atomic_set(&ab->recovery_start_count, 0);
2173 ath11k_core_pre_reconfigure_recovery(ab);
2175 reinit_completion(&ab->reconfigure_complete);
2176 ath11k_core_post_reconfigure_recovery(ab);
2178 ath11k_dbg(ab, ATH11K_DBG_BOOT, "waiting recovery start...\n");
2180 time_left = wait_for_completion_timeout(&ab->recovery_start,
2183 ath11k_hif_irq_disable(ab);
2184 ath11k_hif_ce_irq_disable(ab);
2186 ath11k_hif_power_down(ab, false);
2187 ath11k_hif_power_up(ab);
2189 ath11k_dbg(ab, ATH11K_DBG_BOOT, "reset started\n");
2192 static int ath11k_init_hw_params(struct ath11k_base *ab)
2200 if (hw_params->hw_rev == ab->hw_rev)
2205 ath11k_err(ab, "Unsupported hardware version: 0x%x\n", ab->hw_rev);
2209 ab->hw_params = *hw_params;
2211 ath11k_info(ab, "%s\n", ab->hw_params.name);
2216 int ath11k_core_pre_init(struct ath11k_base *ab)
2220 ret = ath11k_init_hw_params(ab);
2222 ath11k_err(ab, "failed to get hw params: %d\n", ret);
2226 ret = ath11k_fw_pre_init(ab);
2228 ath11k_err(ab, "failed to pre init firmware: %d", ret);
2236 int ath11k_core_init(struct ath11k_base *ab)
2240 ret = ath11k_core_soc_create(ab);
2242 ath11k_err(ab, "failed to create soc core: %d\n", ret);
2250 void ath11k_core_deinit(struct ath11k_base *ab)
2252 mutex_lock(&ab->core_lock);
2254 ath11k_core_pdev_destroy(ab);
2255 ath11k_core_stop(ab);
2257 mutex_unlock(&ab->core_lock);
2259 ath11k_hif_power_down(ab, false);
2260 ath11k_mac_destroy(ab);
2261 ath11k_core_soc_destroy(ab);
2262 ath11k_fw_destroy(ab);
2266 void ath11k_core_free(struct ath11k_base *ab)
2268 destroy_workqueue(ab->workqueue_aux);
2269 destroy_workqueue(ab->workqueue);
2271 kfree(ab);
2278 struct ath11k_base *ab;
2280 ab = kzalloc(sizeof(*ab) + priv_size, GFP_KERNEL);
2281 if (!ab)
2284 init_completion(&ab->driver_recovery);
2286 ab->workqueue = create_singlethread_workqueue("ath11k_wq");
2287 if (!ab->workqueue)
2290 ab->workqueue_aux = create_singlethread_workqueue("ath11k_aux_wq");
2291 if (!ab->workqueue_aux)
2294 mutex_init(&ab->core_lock);
2295 mutex_init(&ab->tbl_mtx_lock);
2296 spin_lock_init(&ab->base_lock);
2297 mutex_init(&ab->vdev_id_11d_lock);
2298 init_completion(&ab->reset_complete);
2299 init_completion(&ab->reconfigure_complete);
2300 init_completion(&ab->recovery_start);
2302 INIT_LIST_HEAD(&ab->peers);
2303 init_waitqueue_head(&ab->peer_mapping_wq);
2304 init_waitqueue_head(&ab->wmi_ab.tx_credits_wq);
2305 init_waitqueue_head(&ab->qmi.cold_boot_waitq);
2306 INIT_WORK(&ab->restart_work, ath11k_core_restart);
2307 INIT_WORK(&ab->update_11d_work, ath11k_update_11d);
2308 INIT_WORK(&ab->reset_work, ath11k_core_reset);
2309 timer_setup(&ab->rx_replenish_retry, ath11k_ce_rx_replenish_retry, 0);
2310 init_completion(&ab->htc_suspend);
2311 init_completion(&ab->wow.wakeup_completed);
2312 init_completion(&ab->restart_completed);
2314 ab->dev = dev;
2315 ab->hif.bus = bus;
2317 return ab;
2320 destroy_workqueue(ab->workqueue);
2322 kfree(ab);