xref: /wlan-driver/qcacld-3.0/core/pld/src/pld_usb.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2016-2020 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 #ifndef __PLD_USB_H__
20 #define __PLD_USB_H__
21 
22 #include "pld_common.h"
23 
24 #ifdef HIF_USB
25 /**
26  * pld_usb_register_driver() - registration routine for wlan usb drive
27  *
28  * Return: int negative error code on failure and 0 on success
29  */
30 int pld_usb_register_driver(void);
31 
32 /**
33  * pld_usb_unregister_driver() - de-registration routine for wlan usb driver
34  *
35  * Return: void
36  */
37 void pld_usb_unregister_driver(void);
38 
39 int pld_usb_get_ce_id(int irq);
40 int pld_usb_wlan_enable(struct device *dev, struct pld_wlan_enable_cfg *config,
41 			enum pld_driver_mode mode, const char *host_version);
42 int pld_usb_is_fw_down(struct device *dev);
43 
44 /**
45  * pld_usb_athdiag_read() - Read data from WLAN FW through USB interface
46  * @dev: pointer of device
47  * @offset: address offset
48  * @memtype: memory type
49  * @datalen: data length
50  * @output: pointer of output buffer
51  *
52  * Return: 0 for success
53  *         Non zero failure code for errors
54  */
55 int pld_usb_athdiag_read(struct device *dev, uint32_t offset,
56 			 uint32_t memtype, uint32_t datalen,
57 			 uint8_t *output);
58 
59 /**
60  * pld_usb_athdiag_write() - Write data to WLAN FW through USB interface
61  * @dev: pointer of device
62  * @offset: address offset
63  * @memtype: memory type
64  * @datalen: data length
65  * @input: pointer of input buffer
66  *
67  * Return: 0 for success
68  *         Non zero failure code for errors
69  */
70 int pld_usb_athdiag_write(struct device *dev, uint32_t offset,
71 			  uint32_t memtype, uint32_t datalen,
72 			  uint8_t *input);
73 
74 #else
pld_usb_register_driver(void)75 static inline int pld_usb_register_driver(void)
76 {
77 	return 0;
78 }
79 
pld_usb_unregister_driver(void)80 static inline void pld_usb_unregister_driver(void)
81 {}
82 
pld_usb_wlan_enable(struct device * dev,struct pld_wlan_enable_cfg * config,enum pld_driver_mode mode,const char * host_version)83 static inline int pld_usb_wlan_enable(struct device *dev,
84 				      struct pld_wlan_enable_cfg *config,
85 				      enum pld_driver_mode mode,
86 				      const char *host_version)
87 {
88 	return 0;
89 }
90 
pld_usb_is_fw_down(struct device * dev)91 static inline int pld_usb_is_fw_down(struct device *dev)
92 {
93 	return  0;
94 }
95 
pld_usb_athdiag_read(struct device * dev,uint32_t offset,uint32_t memtype,uint32_t datalen,uint8_t * output)96 static inline int pld_usb_athdiag_read(struct device *dev, uint32_t offset,
97 				       uint32_t memtype, uint32_t datalen,
98 				       uint8_t *output)
99 {
100 	return 0;
101 }
102 
pld_usb_athdiag_write(struct device * dev,uint32_t offset,uint32_t memtype,uint32_t datalen,uint8_t * input)103 static inline int pld_usb_athdiag_write(struct device *dev, uint32_t offset,
104 					uint32_t memtype, uint32_t datalen,
105 					uint8_t *input)
106 {
107 	return 0;
108 }
109 #endif
110 
111 static inline int
pld_usb_get_fw_files_for_target(struct pld_fw_files * pfw_files,u32 target_type,u32 target_version)112 pld_usb_get_fw_files_for_target(struct pld_fw_files *pfw_files,
113 				 u32 target_type, u32 target_version)
114 {
115 	pld_get_default_fw_files(pfw_files);
116 	return 0;
117 }
118 
119 #endif /*__PLD_USB_H__*/
120