1 /*
2 * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
3 * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for
6 * any purpose with or without fee is hereby granted, provided that the
7 * above copyright notice and this permission notice appear in all
8 * copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
18 */
19
20 #ifndef __PLD_SNOC_FW_SIM_H__
21 #define __PLD_SNOC_FW_SIM_H__
22
23 #include "pld_internal.h"
24
25 #ifndef CONFIG_PLD_SNOC_FW_SIM
pld_snoc_fw_sim_register_driver(void)26 static inline int pld_snoc_fw_sim_register_driver(void)
27 {
28 return 0;
29 }
30
pld_snoc_fw_sim_unregister_driver(void)31 static inline void pld_snoc_fw_sim_unregister_driver(void)
32 {
33 }
34
pld_snoc_fw_sim_wlan_enable(struct device * dev,struct pld_wlan_enable_cfg * cfg,enum pld_driver_mode mode,const char * host_version)35 static inline int pld_snoc_fw_sim_wlan_enable(struct device *dev,
36 struct pld_wlan_enable_cfg *cfg,
37 enum pld_driver_mode mode,
38 const char *host_version)
39 {
40 return 0;
41 }
42
pld_snoc_fw_sim_wlan_disable(struct device * dev,enum pld_driver_mode mode)43 static inline int pld_snoc_fw_sim_wlan_disable(struct device *dev,
44 enum pld_driver_mode mode)
45 {
46 return 0;
47 }
48
pld_snoc_fw_sim_ce_request_irq(struct device * dev,unsigned int ce_id,irqreturn_t (* handler)(int,void *),unsigned long flags,const char * name,void * ctx)49 static inline int pld_snoc_fw_sim_ce_request_irq(struct device *dev,
50 unsigned int ce_id,
51 irqreturn_t (*handler)(int, void *),
52 unsigned long flags,
53 const char *name, void *ctx)
54 {
55 return 0;
56 }
57
pld_snoc_fw_sim_ce_free_irq(struct device * dev,unsigned int ce_id,void * ctx)58 static inline int pld_snoc_fw_sim_ce_free_irq(struct device *dev,
59 unsigned int ce_id, void *ctx)
60 {
61 return 0;
62 }
63
pld_snoc_fw_sim_enable_irq(struct device * dev,unsigned int ce_id)64 static inline void pld_snoc_fw_sim_enable_irq(struct device *dev,
65 unsigned int ce_id)
66 {
67 }
68
pld_snoc_fw_sim_disable_irq(struct device * dev,unsigned int ce_id)69 static inline void pld_snoc_fw_sim_disable_irq(struct device *dev,
70 unsigned int ce_id)
71 {
72 }
73
pld_snoc_fw_sim_get_soc_info(struct device * dev,struct pld_soc_info * info)74 static inline int pld_snoc_fw_sim_get_soc_info(struct device *dev,
75 struct pld_soc_info *info)
76 {
77 return 0;
78 }
79
pld_snoc_fw_sim_get_ce_id(struct device * dev,int irq)80 static inline int pld_snoc_fw_sim_get_ce_id(struct device *dev, int irq)
81 {
82 return 0;
83 }
84
pld_snoc_fw_sim_get_irq(struct device * dev,int ce_id)85 static inline int pld_snoc_fw_sim_get_irq(struct device *dev, int ce_id)
86 {
87 return 0;
88 }
89
pld_snoc_fw_sim_is_fw_down(struct device * dev)90 static inline int pld_snoc_fw_sim_is_fw_down(struct device *dev)
91 {
92 return 0;
93 }
94
pld_snoc_fw_sim_idle_shutdown(struct device * dev)95 static inline int pld_snoc_fw_sim_idle_shutdown(struct device *dev)
96 {
97 return 0;
98 }
99
pld_snoc_fw_sim_idle_restart(struct device * dev)100 static inline int pld_snoc_fw_sim_idle_restart(struct device *dev)
101 {
102 return 0;
103 }
104
105 #else
106 #include <soc/icnss.h>
107
108 int pld_snoc_fw_sim_register_driver(void);
109 void pld_snoc_fw_sim_unregister_driver(void);
110 int pld_snoc_fw_sim_wlan_enable(struct device *dev,
111 struct pld_wlan_enable_cfg *config,
112 enum pld_driver_mode mode,
113 const char *host_version);
114 int pld_snoc_fw_sim_wlan_disable(struct device *dev, enum pld_driver_mode mode);
115 int pld_snoc_fw_sim_get_soc_info(struct device *dev, struct pld_soc_info *info);
116
pld_snoc_fw_sim_ce_request_irq(struct device * dev,unsigned int ce_id,irqreturn_t (* handler)(int,void *),unsigned long flags,const char * name,void * ctx)117 static inline int pld_snoc_fw_sim_ce_request_irq(struct device *dev,
118 unsigned int ce_id,
119 irqreturn_t (*handler)(int, void *),
120 unsigned long flags,
121 const char *name, void *ctx)
122 {
123 if (!dev)
124 return -ENODEV;
125
126 return icnss_ce_request_irq(dev, ce_id, handler, flags, name, ctx);
127 }
128
pld_snoc_fw_sim_ce_free_irq(struct device * dev,unsigned int ce_id,void * ctx)129 static inline int pld_snoc_fw_sim_ce_free_irq(struct device *dev,
130 unsigned int ce_id, void *ctx)
131 {
132 if (!dev)
133 return -ENODEV;
134
135 return icnss_ce_free_irq(dev, ce_id, ctx);
136 }
137
pld_snoc_fw_sim_enable_irq(struct device * dev,unsigned int ce_id)138 static inline void pld_snoc_fw_sim_enable_irq(struct device *dev,
139 unsigned int ce_id)
140 {
141 if (dev)
142 icnss_enable_irq(dev, ce_id);
143 }
144
pld_snoc_fw_sim_disable_irq(struct device * dev,unsigned int ce_id)145 static inline void pld_snoc_fw_sim_disable_irq(struct device *dev,
146 unsigned int ce_id)
147 {
148 if (dev)
149 icnss_disable_irq(dev, ce_id);
150 }
151
pld_snoc_fw_sim_get_ce_id(struct device * dev,int irq)152 static inline int pld_snoc_fw_sim_get_ce_id(struct device *dev, int irq)
153 {
154 if (!dev)
155 return -ENODEV;
156
157 return icnss_get_ce_id(dev, irq);
158 }
159
pld_snoc_fw_sim_get_irq(struct device * dev,int ce_id)160 static inline int pld_snoc_fw_sim_get_irq(struct device *dev, int ce_id)
161 {
162 if (!dev)
163 return -ENODEV;
164
165 return icnss_get_irq(dev, ce_id);
166 }
167
pld_snoc_fw_sim_is_fw_down(struct device * dev)168 static inline int pld_snoc_fw_sim_is_fw_down(struct device *dev)
169 {
170 return icnss_is_fw_down();
171 }
172
pld_snoc_fw_sim_idle_shutdown(struct device * dev)173 static inline int pld_snoc_fw_sim_idle_shutdown(struct device *dev)
174 {
175 return icnss_idle_shutdown(dev);
176 }
177
pld_snoc_fw_sim_idle_restart(struct device * dev)178 static inline int pld_snoc_fw_sim_idle_restart(struct device *dev)
179 {
180 return icnss_idle_restart(dev);
181 }
182
183 #endif
184 #endif
185