1 // SPDX-License-Identifier: BSD-3-Clause-Clear 2 /* 3 * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. 4 * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. 5 */ 6 7 #include <linux/module.h> 8 #include "../ahb.h" 9 #include "../pci.h" 10 #include "pci.h" 11 #include "ahb.h" 12 #include "core.h" 13 #include "dp.h" 14 #include "../debug.h" 15 16 static int ahb_err, pci_err; 17 18 int ath12k_wifi7_arch_init(struct ath12k_base *ab) 19 { 20 struct ath12k_dp *dp; 21 22 dp = ath12k_wifi7_dp_device_alloc(ab); 23 if (!dp) { 24 ath12k_err(ab, "dp alloc failed"); 25 return -EINVAL; 26 } 27 28 ab->dp = dp; 29 30 return 0; 31 } 32 33 void ath12k_wifi7_arch_deinit(struct ath12k_base *ab) 34 { 35 ath12k_wifi7_dp_device_free(ab->dp); 36 ab->dp = NULL; 37 } 38 39 static int ath12k_wifi7_init(void) 40 { 41 ahb_err = ath12k_wifi7_ahb_init(); 42 if (ahb_err) 43 pr_warn("Failed to initialize ath12k Wi-Fi 7 AHB device: %d\n", 44 ahb_err); 45 46 pci_err = ath12k_wifi7_pci_init(); 47 if (pci_err) 48 pr_warn("Failed to initialize ath12k Wi-Fi 7 PCI device: %d\n", 49 pci_err); 50 51 /* If both failed, return one of the failures (arbitrary) */ 52 return ahb_err && pci_err ? ahb_err : 0; 53 } 54 55 static void ath12k_wifi7_exit(void) 56 { 57 if (!pci_err) 58 ath12k_wifi7_pci_exit(); 59 60 if (!ahb_err) 61 ath12k_wifi7_ahb_exit(); 62 } 63 64 module_init(ath12k_wifi7_init); 65 module_exit(ath12k_wifi7_exit); 66 67 MODULE_DESCRIPTION("Driver support for Qualcomm Technologies 802.11be WLAN devices"); 68 MODULE_LICENSE("Dual BSD/GPL"); 69