xref: /wlan-dirver/qca-wifi-host-cmn/hif/src/dispatcher/pci_api.h (revision 6d768494e5ce14eb1603a695c86739d12ecc6ec2)
1 /*
2  * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 #ifndef _PCI_API_H_
20 #define _PCI_API_H_
21 struct hif_exec_context;
22 
23 QDF_STATUS hif_pci_open(struct hif_softc *hif_ctx,
24 			enum qdf_bus_type bus_type);
25 void hif_pci_close(struct hif_softc *hif_ctx);
26 void hif_pci_prevent_linkdown(struct hif_softc *scn, bool flag);
27 void hif_pci_reset_soc(struct hif_softc *ol_sc);
28 int hif_pci_bus_suspend(struct hif_softc *scn);
29 int hif_pci_bus_suspend_noirq(struct hif_softc *scn);
30 int hif_pci_bus_resume(struct hif_softc *scn);
31 int hif_pci_bus_resume_noirq(struct hif_softc *scn);
32 int hif_pci_target_sleep_state_adjust(struct hif_softc *scn,
33 			bool sleep_ok, bool wait_for_it);
34 
35 void hif_pci_disable_isr(struct hif_softc *scn);
36 void hif_pci_nointrs(struct hif_softc *scn);
37 QDF_STATUS hif_pci_enable_bus(struct hif_softc *scn,
38 			struct device *dev, void *bdev,
39 			const struct hif_bus_id *bid,
40 			enum hif_enable_type type);
41 void hif_pci_disable_bus(struct hif_softc *scn);
42 #ifdef FEATURE_RUNTIME_PM
43 struct hif_runtime_pm_ctx *hif_pci_get_rpm_ctx(struct hif_softc *hif_sc);
44 struct device *hif_pci_get_dev(struct hif_softc *hif_sc);
45 #endif
46 int hif_pci_bus_configure(struct hif_softc *scn);
47 void hif_pci_irq_disable(struct hif_softc *scn, int ce_id);
48 void hif_pci_irq_enable(struct hif_softc *scn, int ce_id);
49 int hif_pci_dump_registers(struct hif_softc *scn);
50 void hif_pci_enable_power_management(struct hif_softc *hif_ctx,
51 				 bool is_packet_log_enabled);
52 void hif_pci_disable_power_management(struct hif_softc *hif_ctx);
53 int hif_pci_configure_grp_irq(struct hif_softc *scn,
54 			      struct hif_exec_context *exec);
55 void hif_pci_display_stats(struct hif_softc *hif_ctx);
56 void hif_pci_clear_stats(struct hif_softc *hif_ctx);
57 int hif_pci_legacy_map_ce_to_irq(struct hif_softc *scn, int ce_id);
58 bool hif_pci_needs_bmi(struct hif_softc *scn);
59 const char *hif_pci_get_irq_name(int irq_no);
60 
61 /** hif_pci_config_irq_affinity() - Set the IRQ affinity
62  * @scn: hif context
63  *
64  * Set IRQ affinity hint for WLAN IRQs to gold cores only for
65  * defconfig builds.
66  *
67  * Return: None
68  */
69 void hif_pci_config_irq_affinity(struct hif_softc *scn);
70 #endif /* _PCI_API_H_ */
71