xref: /wlan-driver/qcacld-3.0/core/pld/src/pld_pcie_fw_sim.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2016-2021 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_PCIE_FW_SIM_H__
21 #define __PLD_PCIE_FW_SIM_H__
22 
23 #include "pld_internal.h"
24 
25 #if !defined(CONFIG_PLD_PCIE_FW_SIM) && !defined(CONFIG_PLD_IPCIE_FW_SIM)
26 
pld_pcie_fw_sim_register_driver(void)27 static inline int pld_pcie_fw_sim_register_driver(void)
28 {
29 	return 0;
30 }
31 
pld_pcie_fw_sim_unregister_driver(void)32 static inline void pld_pcie_fw_sim_unregister_driver(void)
33 {
34 }
35 
pld_pcie_fw_sim_wlan_enable(struct device * dev,struct pld_wlan_enable_cfg * cfg,enum pld_driver_mode mode,const char * host_version)36 static inline int pld_pcie_fw_sim_wlan_enable(struct device *dev,
37 					      struct pld_wlan_enable_cfg *cfg,
38 					      enum pld_driver_mode mode,
39 					      const char *host_version)
40 {
41 	return 0;
42 }
43 
pld_pcie_fw_sim_wlan_disable(struct device * dev,enum pld_driver_mode mode)44 static inline int pld_pcie_fw_sim_wlan_disable(struct device *dev,
45 					       enum pld_driver_mode mode)
46 {
47 	return 0;
48 }
49 
pld_pcie_fw_sim_link_down(struct device * dev)50 static inline void pld_pcie_fw_sim_link_down(struct device *dev)
51 {
52 }
53 
pld_pcie_fw_sim_is_fw_down(struct device * dev)54 static inline int pld_pcie_fw_sim_is_fw_down(struct device *dev)
55 {
56 	return 0;
57 }
58 
pld_pcie_fw_sim_get_platform_cap(struct device * dev,struct pld_platform_cap * cap)59 static inline int pld_pcie_fw_sim_get_platform_cap(struct device *dev,
60 						   struct pld_platform_cap *cap)
61 {
62 	return 0;
63 }
64 
pld_pcie_fw_sim_get_soc_info(struct device * dev,struct pld_soc_info * info)65 static inline int pld_pcie_fw_sim_get_soc_info(struct device *dev,
66 					       struct pld_soc_info *info)
67 {
68 	return 0;
69 }
70 
pld_pcie_fw_sim_get_user_msi_assignment(struct device * dev,char * user_name,int * num_vectors,uint32_t * base_data,uint32_t * base_vector)71 static inline int pld_pcie_fw_sim_get_user_msi_assignment(struct device *dev,
72 							  char *user_name,
73 							  int *num_vectors,
74 							  uint32_t *base_data,
75 							  uint32_t *base_vector)
76 {
77 	return -EINVAL;
78 }
79 
pld_pcie_fw_sim_get_msi_irq(struct device * dev,unsigned int vector)80 static inline int pld_pcie_fw_sim_get_msi_irq(struct device *dev,
81 					      unsigned int vector)
82 {
83 	return 0;
84 }
85 
pld_pcie_fw_sim_get_msi_address(struct device * dev,uint32_t * msi_addr_low,uint32_t * msi_addr_high)86 static inline void pld_pcie_fw_sim_get_msi_address(struct device *dev,
87 						   uint32_t *msi_addr_low,
88 						   uint32_t *msi_addr_high)
89 {
90 }
91 
pld_pcie_fw_sim_request_irq(struct device * dev,int irq,irq_handler_t handler,unsigned long irqflags,const char * devname,void * dev_data)92 static inline int pld_pcie_fw_sim_request_irq(struct device *dev, int irq,
93 					      irq_handler_t handler,
94 					      unsigned long irqflags,
95 					      const char *devname,
96 					      void *dev_data)
97 {
98 	return 0;
99 }
100 
pld_pcie_fw_sim_read_config_word(struct device * dev,int offset,uint16_t * val)101 static inline int pld_pcie_fw_sim_read_config_word(struct device *dev,
102 						   int offset, uint16_t *val)
103 {
104 	return 0;
105 }
106 
pld_pcie_fw_sim_free_irq(struct device * dev,unsigned int ce_id,void * ctx)107 static inline int pld_pcie_fw_sim_free_irq(struct device *dev,
108 					   unsigned int ce_id, void *ctx)
109 {
110 	return 0;
111 }
112 
pld_pcie_fw_sim_enable_irq(struct device * dev,unsigned int irq)113 static inline void pld_pcie_fw_sim_enable_irq(struct device *dev,
114 					      unsigned int irq)
115 {
116 }
117 
pld_pcie_fw_sim_disable_irq(struct device * dev,unsigned int irq)118 static inline void pld_pcie_fw_sim_disable_irq(struct device *dev,
119 					       unsigned int irq)
120 {
121 }
122 
pld_pcie_fw_sim_idle_shutdown(struct device * dev)123 static inline int pld_pcie_fw_sim_idle_shutdown(struct device *dev)
124 {
125 	return 0;
126 }
127 
pld_pcie_fw_sim_idle_restart(struct device * dev)128 static inline int pld_pcie_fw_sim_idle_restart(struct device *dev)
129 {
130 	return 0;
131 }
132 
pld_pcie_fw_sim_thermal_register(struct device * dev,unsigned long max_state,int mon_id)133 static inline int pld_pcie_fw_sim_thermal_register(struct device *dev,
134 						   unsigned long max_state,
135 						   int mon_id)
136 {
137 	return 0;
138 }
139 
pld_pcie_fw_sim_thermal_unregister(struct device * dev,int mon_id)140 static inline void pld_pcie_fw_sim_thermal_unregister(struct device *dev,
141 						      int mon_id)
142 {
143 }
144 
pld_pcie_fw_sim_get_thermal_state(struct device * dev,unsigned long * therm_state,int mon_id)145 static inline int pld_pcie_fw_sim_get_thermal_state(struct device *dev,
146 						    unsigned long *therm_state,
147 						    int mon_id)
148 {
149 	return 0;
150 }
151 
pld_pcie_fw_sim_exit_power_save(struct device * dev)152 static inline int pld_pcie_fw_sim_exit_power_save(struct device *dev)
153 {
154 	return 0;
155 }
156 
pld_pcie_fw_sim_get_irq(struct device * dev,int ce_id)157 static inline int pld_pcie_fw_sim_get_irq(struct device *dev, int ce_id)
158 {
159 	return 0;
160 }
161 #else
162 #include <net/cnss2.h>
163 
164 int pld_pcie_fw_sim_wlan_enable(struct device *dev,
165 				struct pld_wlan_enable_cfg *config,
166 				enum pld_driver_mode mode,
167 				const char *host_version);
168 int pld_pcie_fw_sim_wlan_disable(struct device *dev, enum pld_driver_mode mode);
169 int pld_pcie_fw_sim_register_driver(void);
170 void pld_pcie_fw_sim_unregister_driver(void);
171 int pld_pcie_fw_sim_get_platform_cap(struct device *dev,
172 				     struct pld_platform_cap *cap);
173 int pld_pcie_fw_sim_get_soc_info(struct device *dev, struct pld_soc_info *info);
174 int pld_pcie_fw_sim_get_irq(struct device *dev, int ce_id);
175 
pld_pcie_fw_sim_get_user_msi_assignment(struct device * dev,char * user_name,int * num_vectors,uint32_t * base_data,uint32_t * base_vector)176 static inline int pld_pcie_fw_sim_get_user_msi_assignment(struct device *dev,
177 							  char *user_name,
178 							  int *num_vectors,
179 							  uint32_t *base_data,
180 							  uint32_t *base_vector)
181 {
182 	return cnss_fw_sim_get_user_msi_assignment(dev, user_name, num_vectors,
183 					    base_data, base_vector);
184 }
185 
pld_pcie_fw_sim_get_msi_irq(struct device * dev,unsigned int vector)186 static inline int pld_pcie_fw_sim_get_msi_irq(struct device *dev,
187 					      unsigned int vector)
188 {
189 	return cnss_fw_sim_get_msi_irq(dev, vector);
190 }
191 
pld_pcie_fw_sim_get_msi_address(struct device * dev,uint32_t * msi_addr_low,uint32_t * msi_addr_high)192 static inline void pld_pcie_fw_sim_get_msi_address(struct device *dev,
193 						   uint32_t *msi_addr_low,
194 						   uint32_t *msi_addr_high)
195 {
196 	cnss_fw_sim_get_msi_address(dev, msi_addr_low, msi_addr_high);
197 }
198 
pld_pcie_fw_sim_request_irq(struct device * dev,int irq,irq_handler_t handler,unsigned long irqflags,const char * devname,void * dev_data)199 static inline int pld_pcie_fw_sim_request_irq(struct device *dev, int irq,
200 					      irq_handler_t handler,
201 					      unsigned long irqflags,
202 					      const char *devname,
203 					      void *dev_data)
204 {
205 	return cnss_fw_sim_request_irq(dev, irq, handler,
206 				       irqflags, devname, dev_data);
207 }
208 
pld_pcie_fw_sim_read_config_word(struct device * dev,int offset,uint16_t * val)209 static inline int pld_pcie_fw_sim_read_config_word(struct device *dev,
210 						   int offset, uint16_t *val)
211 {
212 	return cnss_fw_sim_read_config_word(dev, offset, val);
213 }
214 
pld_pcie_fw_sim_free_irq(struct device * dev,int irq,void * dev_data)215 static inline int pld_pcie_fw_sim_free_irq(struct device *dev,
216 					   int irq, void *dev_data)
217 {
218 	return cnss_fw_sim_free_irq(dev, irq, dev_data);
219 }
220 
pld_pcie_fw_sim_enable_irq(struct device * dev,int irq)221 static inline void pld_pcie_fw_sim_enable_irq(struct device *dev, int irq)
222 {
223 	cnss_fw_sim_enable_irq(dev, irq);
224 }
225 
pld_pcie_fw_sim_disable_irq(struct device * dev,int irq)226 static inline void pld_pcie_fw_sim_disable_irq(struct device *dev, int irq)
227 {
228 	cnss_fw_sim_disable_irq(dev, irq);
229 }
230 
pld_pcie_fw_sim_idle_shutdown(struct device * dev)231 static inline int pld_pcie_fw_sim_idle_shutdown(struct device *dev)
232 {
233 	return cnss_fw_sim_idle_shutdown(dev);
234 }
235 
pld_pcie_fw_sim_idle_restart(struct device * dev)236 static inline int pld_pcie_fw_sim_idle_restart(struct device *dev)
237 {
238 	return cnss_fw_sim_idle_restart(dev);
239 }
240 
pld_pcie_fw_sim_thermal_register(struct device * dev,unsigned long max_state,int mon_id)241 static inline int pld_pcie_fw_sim_thermal_register(struct device *dev,
242 						   unsigned long max_state,
243 						   int mon_id)
244 {
245 	return cnss_fw_sim_thermal_cdev_register(dev, max_state, mon_id);
246 }
247 
pld_pcie_fw_sim_thermal_unregister(struct device * dev,int mon_id)248 static inline void pld_pcie_fw_sim_thermal_unregister(struct device *dev,
249 						      int mon_id)
250 {
251 	cnss_fw_sim_thermal_cdev_unregister(dev, mon_id);
252 }
253 
pld_pcie_fw_sim_get_thermal_state(struct device * dev,unsigned long * therm_state,int mon_id)254 static inline int pld_pcie_fw_sim_get_thermal_state(struct device *dev,
255 						    unsigned long *therm_state,
256 						    int mon_id)
257 {
258 	return cnss_fw_sim_get_curr_therm_cdev_state(dev, therm_state,
259 						     mon_id);
260 }
261 
pld_pcie_fw_sim_exit_power_save(struct device * dev)262 static inline int pld_pcie_fw_sim_exit_power_save(struct device *dev)
263 {
264 	return cnss_fw_sim_exit_power_save(dev);
265 }
266 
267 #endif
268 #endif
269