xref: /wlan-dirver/qca-wifi-host-cmn/qal/inc/qal_vbus_dev.h (revision 1b9674e21e24478fba4530f5ae7396b9555e9c6a)
1 /*
2  * Copyright (c) 2018 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 /**
20  * DOC: qal_vbus_dev
21  * QCA abstraction layer (QAL) virtual bus management APIs
22  */
23 
24 #if !defined(__QDF_VBUS_DEV_H)
25 #define __QDF_VBUS_DEV_H
26 
27 /* Include Files */
28 #include <qdf_types.h>
29 
30 struct qdf_vbus_resource;
31 struct qdf_vbus_rstctl;
32 struct qdf_dev_clk;
33 struct qdf_pfm_hndl;
34 struct qdf_pfm_drv;
35 
36 /**
37  * qal_vbus_get_iorsc() - acquire io resource
38  * @devnum: Device Number
39  * @flag: Property bitmap for the io resource
40  * @devname: Device name string
41  *
42  * This function will allocate the io resource for a device
43  *
44  * Return: QDF_STATUS_SUCCESS on success
45  */
46 QDF_STATUS
47 qal_vbus_get_iorsc(int devnum, uint32_t flag, char *devname);
48 
49 /**
50  * qdf_vbus_release_iorsc() - release io resource
51  * @devnum: Device Number
52  *
53  * This function will release the io resource attached to a device
54  *
55  * Return: QDF_STATUS_SUCCESS on success
56  */
57 QDF_STATUS
58 qal_vbus_release_iorsc(int devnum);
59 
60 /**
61  * qal_vbus_enable_devclk() - enable device clock
62  * @clk: Device clock
63  *
64  * This function will enable the clock for a device
65  *
66  * Return: QDF_STATUS_SUCCESS on success
67  */
68 QDF_STATUS
69 qal_vbus_enable_devclk(struct qdf_dev_clk *clk);
70 
71 /**
72  * qal_vbus_disable_devclk() - disable device clock
73  * @clk: Device clock
74  *
75  * This function will disable the clock for a device
76  *
77  * Return: QDF_STATUS_SUCCESS on success
78  */
79 QDF_STATUS
80 qal_vbus_disable_devclk(struct qdf_dev_clk *clk);
81 
82 /**
83  * qal_vbus_acquire_dev_rstctl() - get device reset control
84  * @pfhndl: Device handle
85  * @state: Device state information
86  * @rstctl: Device reset control handle
87  *
88  * This function will acquire the control to reset the device
89  *
90  * Return: QDF_STATUS_SUCCESS on success
91  */
92 QDF_STATUS
93 qal_vbus_get_dev_rstctl(struct qdf_pfm_hndl *pfhndl, const char *state,
94 			struct qdf_vbus_rstctl **rstctl);
95 
96 /**
97  * qal_vbus_release_dev_rstctl() - release device reset control
98  * @pfhndl: Device handle
99  * @rstctl: Device reset control handle
100  *
101  * This function will release the control to reset the device
102  *
103  * Return: QDF_STATUS_SUCCESS on success
104  */
105 QDF_STATUS
106 qal_vbus_release_dev_rstctl(struct qdf_pfm_hndl *pfhndl,
107 			    struct qdf_vbus_rstctl *rstctl);
108 
109 /**
110  * qal_vbus_activate_dev_rstctl() - activate device reset control
111  * @pfhndl: Device handle
112  * @rstctl: Device reset control handle
113  *
114  * This function will activate the reset control for the device
115  *
116  * Return: QDF_STATUS_SUCCESS on success
117  */
118 QDF_STATUS
119 qal_vbus_activate_dev_rstctl(struct qdf_pfm_hndl *pfhndl,
120 			     struct qdf_vbus_rstctl *rstctl);
121 
122 /**
123  * qal_vbus_deactivate_dev_rstctl() - deactivate device reset control
124  * @pfhndl: Device handle
125  * @rstctl: Device reset control handle
126  *
127  * This function will deactivate the reset control for the device
128  *
129  * Return: QDF_STATUS_SUCCESS on success
130  */
131 QDF_STATUS
132 qal_vbus_deactivate_dev_rstctl(struct qdf_pfm_hndl *pfhndl,
133 			       struct qdf_vbus_rstctl *rstctl);
134 
135 /**
136  * qal_vbus_get_resource() - get resource
137  * @pfhndl: Device handle
138  * @rsc: Resource handle
139  * @restype: Resource type
140  * @residx: Resource index
141  *
142  * This function will acquire a particular resource and attach it to the device
143  *
144  * Return: QDF_STATUS_SUCCESS on success
145  */
146 QDF_STATUS
147 qal_vbus_get_resource(struct qdf_pfm_hndl *pfhndl,
148 		      struct qdf_vbus_resource **rsc, uint32_t restype,
149 		      uint32_t residx);
150 
151 /**
152  * qal_vbus_get_irq() - get irq
153  * @pfhndl: Device handle
154  * @str: Device identifier
155  * @irq: irq number
156  *
157  * This function will acquire an irq for the device
158  *
159  * Return: QDF_STATUS_SUCCESS on success
160  */
161 QDF_STATUS
162 qal_vbus_get_irq(struct qdf_pfm_hndl *pfhndl, const char *str, int *irq);
163 
164 /**
165  * qal_vbus_register_driver() - register driver
166  * @pfdev: Device handle
167  *
168  * This function will initialize a device
169  *
170  * Return: QDF_STATUS_SUCCESS on success
171  */
172 QDF_STATUS
173 qal_vbus_register_driver(struct qdf_pfm_drv *pfdev);
174 
175 /**
176  * qal_vbus_deregister_driver() - deregister driver
177  * @pfdev: Device handle
178  *
179  * This function will deregister the driver for a device
180  *
181  * Return: QDF_STATUS_SUCCESS on success
182  */
183 QDF_STATUS
184 qal_vbus_deregister_driver(struct qdf_pfm_drv *pfdev);
185 #endif
186