1*5113495bSYour Name /*
2*5113495bSYour Name * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
3*5113495bSYour Name * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
4*5113495bSYour Name *
5*5113495bSYour Name * Permission to use, copy, modify, and/or distribute this software for
6*5113495bSYour Name * any purpose with or without fee is hereby granted, provided that the
7*5113495bSYour Name * above copyright notice and this permission notice appear in all
8*5113495bSYour Name * copies.
9*5113495bSYour Name *
10*5113495bSYour Name * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11*5113495bSYour Name * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12*5113495bSYour Name * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13*5113495bSYour Name * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14*5113495bSYour Name * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15*5113495bSYour Name * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16*5113495bSYour Name * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17*5113495bSYour Name * PERFORMANCE OF THIS SOFTWARE.
18*5113495bSYour Name */
19*5113495bSYour Name
20*5113495bSYour Name /**
21*5113495bSYour Name * DOC: qal_vbus_dev
22*5113495bSYour Name * QCA abstraction layer (QAL) virtual bus management APIs
23*5113495bSYour Name */
24*5113495bSYour Name
25*5113495bSYour Name #if !defined(__I_QAL_VBUS_DEV_H)
26*5113495bSYour Name #define __I_QAL_VBUS_DEV_H
27*5113495bSYour Name
28*5113495bSYour Name /* Include Files */
29*5113495bSYour Name #include <qdf_types.h>
30*5113495bSYour Name #include "qdf_util.h"
31*5113495bSYour Name #include "qdf_module.h"
32*5113495bSYour Name #include <linux/of_gpio.h>
33*5113495bSYour Name #include <linux/clk.h>
34*5113495bSYour Name #include <linux/platform_device.h>
35*5113495bSYour Name #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
36*5113495bSYour Name #include <linux/reset.h>
37*5113495bSYour Name #endif
38*5113495bSYour Name
39*5113495bSYour Name struct qdf_vbus_resource;
40*5113495bSYour Name struct qdf_vbus_rstctl;
41*5113495bSYour Name struct qdf_dev_clk;
42*5113495bSYour Name struct qdf_pfm_hndl;
43*5113495bSYour Name struct qdf_pfm_drv;
44*5113495bSYour Name struct qdf_device_node;
45*5113495bSYour Name typedef enum of_gpio_flags __qdf_of_gpio_flags;
46*5113495bSYour Name /**
47*5113495bSYour Name * __qal_vbus_get_iorsc() - acquire io resource
48*5113495bSYour Name * @devnum: Device Number
49*5113495bSYour Name * @flag: Property bitmap for the io resource
50*5113495bSYour Name * @devname: Device name string
51*5113495bSYour Name *
52*5113495bSYour Name * This function will allocate the io resource for a device
53*5113495bSYour Name *
54*5113495bSYour Name * Return: QDF_STATUS_SUCCESS on success
55*5113495bSYour Name */
56*5113495bSYour Name static inline QDF_STATUS
__qal_vbus_get_iorsc(int devnum,uint32_t flag,char * devname)57*5113495bSYour Name __qal_vbus_get_iorsc(int devnum, uint32_t flag, char *devname)
58*5113495bSYour Name {
59*5113495bSYour Name int ret;
60*5113495bSYour Name
61*5113495bSYour Name ret = gpio_request_one(devnum, flag, devname);
62*5113495bSYour Name
63*5113495bSYour Name return qdf_status_from_os_return(ret);
64*5113495bSYour Name }
65*5113495bSYour Name
66*5113495bSYour Name /**
67*5113495bSYour Name * __qal_vbus_release_iorsc() - release io resource
68*5113495bSYour Name * @devnum: Device Number
69*5113495bSYour Name *
70*5113495bSYour Name * This function will release the io resource attached to a device
71*5113495bSYour Name *
72*5113495bSYour Name * Return: QDF_STATUS_SUCCESS on success
73*5113495bSYour Name */
74*5113495bSYour Name static inline QDF_STATUS
__qal_vbus_release_iorsc(int devnum)75*5113495bSYour Name __qal_vbus_release_iorsc(int devnum)
76*5113495bSYour Name {
77*5113495bSYour Name gpio_free(devnum);
78*5113495bSYour Name return QDF_STATUS_SUCCESS;
79*5113495bSYour Name }
80*5113495bSYour Name
81*5113495bSYour Name /**
82*5113495bSYour Name * __qal_vbus_allocate_iorsc() - allocate io resource
83*5113495bSYour Name * @pinnum: pin Number
84*5113495bSYour Name * @label: name of pin
85*5113495bSYour Name *
86*5113495bSYour Name * This function will allocate io resource
87*5113495bSYour Name *
88*5113495bSYour Name * Return: QDF_STATUS_SUCCESS on success
89*5113495bSYour Name */
90*5113495bSYour Name static inline QDF_STATUS
__qal_vbus_allocate_iorsc(unsigned int pinnum,const char * label)91*5113495bSYour Name __qal_vbus_allocate_iorsc(unsigned int pinnum, const char *label)
92*5113495bSYour Name {
93*5113495bSYour Name int ret;
94*5113495bSYour Name
95*5113495bSYour Name ret = gpio_request(pinnum, label);
96*5113495bSYour Name
97*5113495bSYour Name return qdf_status_from_os_return(ret);
98*5113495bSYour Name }
99*5113495bSYour Name
100*5113495bSYour Name /**
101*5113495bSYour Name * __qal_vbus_iorsc_dir_output() - set pin dirction to output
102*5113495bSYour Name * @pin: pin Number
103*5113495bSYour Name * @val: value
104*5113495bSYour Name *
105*5113495bSYour Name * This function set the gpio pin direction to output
106*5113495bSYour Name *
107*5113495bSYour Name * Return: 0 on success, error no on failure
108*5113495bSYour Name */
109*5113495bSYour Name static inline QDF_STATUS
__qal_vbus_iorsc_dir_output(unsigned int pin,int val)110*5113495bSYour Name __qal_vbus_iorsc_dir_output(unsigned int pin, int val)
111*5113495bSYour Name {
112*5113495bSYour Name int ret;
113*5113495bSYour Name
114*5113495bSYour Name ret = gpio_direction_output(pin, val);
115*5113495bSYour Name
116*5113495bSYour Name return qdf_status_from_os_return(ret);
117*5113495bSYour Name }
118*5113495bSYour Name
119*5113495bSYour Name /**
120*5113495bSYour Name * __qal_vbus_iorsc_set_value() - set pin direction
121*5113495bSYour Name * @pin: pin Number
122*5113495bSYour Name * @val: value
123*5113495bSYour Name *
124*5113495bSYour Name * This function set the gpio pin direction based on value
125*5113495bSYour Name *
126*5113495bSYour Name * Return: QDF_STATUS_SUCCESS on success
127*5113495bSYour Name */
128*5113495bSYour Name static inline QDF_STATUS
__qal_vbus_iorsc_set_value(unsigned int pin,int val)129*5113495bSYour Name __qal_vbus_iorsc_set_value(unsigned int pin, int val)
130*5113495bSYour Name {
131*5113495bSYour Name gpio_set_value(pin, val);
132*5113495bSYour Name return QDF_STATUS_SUCCESS;
133*5113495bSYour Name }
134*5113495bSYour Name
135*5113495bSYour Name /**
136*5113495bSYour Name * __qal_vbus_iorsc_toirq() - set irq number to gpio
137*5113495bSYour Name * @pin: pin Number
138*5113495bSYour Name *
139*5113495bSYour Name * This function set the irq number to gpio pin
140*5113495bSYour Name *
141*5113495bSYour Name * Return: QDF_STATUS_SUCCESS on success
142*5113495bSYour Name */
143*5113495bSYour Name static inline QDF_STATUS
__qal_vbus_iorsc_toirq(unsigned int pin)144*5113495bSYour Name __qal_vbus_iorsc_toirq(unsigned int pin)
145*5113495bSYour Name {
146*5113495bSYour Name int ret;
147*5113495bSYour Name
148*5113495bSYour Name ret = gpio_to_irq(pin);
149*5113495bSYour Name
150*5113495bSYour Name return qdf_status_from_os_return(ret);
151*5113495bSYour Name }
152*5113495bSYour Name
153*5113495bSYour Name /**
154*5113495bSYour Name * __qal_vbus_request_irq() - set interrupt handler
155*5113495bSYour Name * @irqnum: irq Number
156*5113495bSYour Name * @handler: function handler to be called
157*5113495bSYour Name * @flags: irq flags
158*5113495bSYour Name * @dev_name: device name
159*5113495bSYour Name * @ctx: pointer to device context
160*5113495bSYour Name *
161*5113495bSYour Name * This function set up the handling of the interrupt
162*5113495bSYour Name *
163*5113495bSYour Name * Return: QDF_STATUS_SUCCESS on success, Error code on failure
164*5113495bSYour Name */
165*5113495bSYour Name static inline QDF_STATUS
__qal_vbus_request_irq(unsigned int irqnum,irqreturn_t (* handler)(int irq,void * arg),unsigned long flags,const char * dev_name,void * ctx)166*5113495bSYour Name __qal_vbus_request_irq(unsigned int irqnum,
167*5113495bSYour Name irqreturn_t (*handler)(int irq, void *arg),
168*5113495bSYour Name unsigned long flags, const char *dev_name, void *ctx)
169*5113495bSYour Name {
170*5113495bSYour Name int ret;
171*5113495bSYour Name
172*5113495bSYour Name ret = request_irq(irqnum, handler, flags, dev_name, ctx);
173*5113495bSYour Name return qdf_status_from_os_return(ret);
174*5113495bSYour Name }
175*5113495bSYour Name
176*5113495bSYour Name /**
177*5113495bSYour Name * __qal_vbus_free_irq() - free irq
178*5113495bSYour Name * @irqnum: irq Number
179*5113495bSYour Name * @ctx: pointer to device context
180*5113495bSYour Name *
181*5113495bSYour Name * This function free the irq number set to gpio pin
182*5113495bSYour Name *
183*5113495bSYour Name * Return: QDF_STATUS_SUCCESS on success
184*5113495bSYour Name */
185*5113495bSYour Name static inline QDF_STATUS
__qal_vbus_free_irq(unsigned int irqnum,void * ctx)186*5113495bSYour Name __qal_vbus_free_irq(unsigned int irqnum, void *ctx)
187*5113495bSYour Name {
188*5113495bSYour Name free_irq(irqnum, ctx);
189*5113495bSYour Name return QDF_STATUS_SUCCESS;
190*5113495bSYour Name }
191*5113495bSYour Name
192*5113495bSYour Name /**
193*5113495bSYour Name * __qal_vbus_enable_devclk() - enable device clock
194*5113495bSYour Name * @clk: Device clock
195*5113495bSYour Name *
196*5113495bSYour Name * This function will enable the clock for a device
197*5113495bSYour Name *
198*5113495bSYour Name * Return: QDF_STATUS_SUCCESS on success
199*5113495bSYour Name */
200*5113495bSYour Name static inline QDF_STATUS
__qal_vbus_enable_devclk(struct qdf_dev_clk * clk)201*5113495bSYour Name __qal_vbus_enable_devclk(struct qdf_dev_clk *clk)
202*5113495bSYour Name {
203*5113495bSYour Name int ret;
204*5113495bSYour Name
205*5113495bSYour Name ret = clk_prepare_enable((struct clk *)clk);
206*5113495bSYour Name
207*5113495bSYour Name return qdf_status_from_os_return(ret);
208*5113495bSYour Name }
209*5113495bSYour Name
210*5113495bSYour Name /**
211*5113495bSYour Name * __qal_vbus_disable_devclk() - disable device clock
212*5113495bSYour Name * @clk: Device clock
213*5113495bSYour Name *
214*5113495bSYour Name * This function will disable the clock for a device
215*5113495bSYour Name *
216*5113495bSYour Name * Return: QDF_STATUS_SUCCESS on success
217*5113495bSYour Name */
218*5113495bSYour Name static inline QDF_STATUS
__qal_vbus_disable_devclk(struct qdf_dev_clk * clk)219*5113495bSYour Name __qal_vbus_disable_devclk(struct qdf_dev_clk *clk)
220*5113495bSYour Name {
221*5113495bSYour Name clk_disable_unprepare((struct clk *)clk);
222*5113495bSYour Name
223*5113495bSYour Name return QDF_STATUS_SUCCESS;
224*5113495bSYour Name }
225*5113495bSYour Name
226*5113495bSYour Name /**
227*5113495bSYour Name * __qal_vbus_get_dev_rstctl() - get device reset control
228*5113495bSYour Name * @pfhndl: Device handle
229*5113495bSYour Name * @state: Device state information
230*5113495bSYour Name * @rstctl: Device reset control handle
231*5113495bSYour Name *
232*5113495bSYour Name * This function will acquire the control to reset the device
233*5113495bSYour Name *
234*5113495bSYour Name * Return: QDF_STATUS_SUCCESS on success
235*5113495bSYour Name */
236*5113495bSYour Name static inline QDF_STATUS
__qal_vbus_get_dev_rstctl(struct qdf_pfm_hndl * pfhndl,const char * state,struct qdf_vbus_rstctl ** rstctl)237*5113495bSYour Name __qal_vbus_get_dev_rstctl(struct qdf_pfm_hndl *pfhndl, const char *state,
238*5113495bSYour Name struct qdf_vbus_rstctl **rstctl)
239*5113495bSYour Name {
240*5113495bSYour Name struct reset_control *rsctl;
241*5113495bSYour Name #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
242*5113495bSYour Name rsctl = devm_reset_control_get_optional((struct device *)pfhndl, state);
243*5113495bSYour Name #elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
244*5113495bSYour Name rsctl = reset_control_get_optional((struct device *)pfhndl, state);
245*5113495bSYour Name #else
246*5113495bSYour Name rsctl = NULL;
247*5113495bSYour Name #endif
248*5113495bSYour Name *rstctl = (struct qdf_vbus_rstctl *)rsctl;
249*5113495bSYour Name return QDF_STATUS_SUCCESS;
250*5113495bSYour Name }
251*5113495bSYour Name
252*5113495bSYour Name /**
253*5113495bSYour Name * __qal_vbus_release_dev_rstctl() - release device reset control
254*5113495bSYour Name * @pfhndl: Device handle
255*5113495bSYour Name * @rstctl: Device reset control handle
256*5113495bSYour Name *
257*5113495bSYour Name * This function will release the control to reset the device
258*5113495bSYour Name *
259*5113495bSYour Name * Return: QDF_STATUS_SUCCESS on success
260*5113495bSYour Name */
261*5113495bSYour Name static inline QDF_STATUS
__qal_vbus_release_dev_rstctl(struct qdf_pfm_hndl * pfhndl,struct qdf_vbus_rstctl * rstctl)262*5113495bSYour Name __qal_vbus_release_dev_rstctl(struct qdf_pfm_hndl *pfhndl,
263*5113495bSYour Name struct qdf_vbus_rstctl *rstctl)
264*5113495bSYour Name {
265*5113495bSYour Name reset_control_put((struct reset_control *)rstctl);
266*5113495bSYour Name return QDF_STATUS_SUCCESS;
267*5113495bSYour Name }
268*5113495bSYour Name
269*5113495bSYour Name /**
270*5113495bSYour Name * __qal_vbus_activate_dev_rstctl() - activate device reset control
271*5113495bSYour Name * @pfhndl: Device handle
272*5113495bSYour Name * @rstctl: Device reset control handle
273*5113495bSYour Name *
274*5113495bSYour Name * This function will activate the reset control for the device
275*5113495bSYour Name *
276*5113495bSYour Name * Return: QDF_STATUS_SUCCESS on success
277*5113495bSYour Name */
278*5113495bSYour Name static inline QDF_STATUS
__qal_vbus_activate_dev_rstctl(struct qdf_pfm_hndl * pfhndl,struct qdf_vbus_rstctl * rstctl)279*5113495bSYour Name __qal_vbus_activate_dev_rstctl(struct qdf_pfm_hndl *pfhndl,
280*5113495bSYour Name struct qdf_vbus_rstctl *rstctl)
281*5113495bSYour Name {
282*5113495bSYour Name reset_control_assert((struct reset_control *)rstctl);
283*5113495bSYour Name return QDF_STATUS_SUCCESS;
284*5113495bSYour Name }
285*5113495bSYour Name
286*5113495bSYour Name /**
287*5113495bSYour Name * __qal_vbus_deactivate_dev_rstctl() - deactivate device reset control
288*5113495bSYour Name * @pfhndl: Device handle
289*5113495bSYour Name * @rstctl: Device reset control handle
290*5113495bSYour Name *
291*5113495bSYour Name * This function will deactivate the reset control for the device
292*5113495bSYour Name *
293*5113495bSYour Name * Return: QDF_STATUS_SUCCESS on success
294*5113495bSYour Name */
295*5113495bSYour Name static inline QDF_STATUS
__qal_vbus_deactivate_dev_rstctl(struct qdf_pfm_hndl * pfhndl,struct qdf_vbus_rstctl * rstctl)296*5113495bSYour Name __qal_vbus_deactivate_dev_rstctl(struct qdf_pfm_hndl *pfhndl,
297*5113495bSYour Name struct qdf_vbus_rstctl *rstctl)
298*5113495bSYour Name {
299*5113495bSYour Name reset_control_deassert((struct reset_control *)rstctl);
300*5113495bSYour Name return QDF_STATUS_SUCCESS;
301*5113495bSYour Name }
302*5113495bSYour Name
303*5113495bSYour Name /**
304*5113495bSYour Name * __qal_vbus_get_resource() - get resource
305*5113495bSYour Name * @pfhndl: Device handle
306*5113495bSYour Name * @rsc: Resource handle
307*5113495bSYour Name * @restype: Resource type
308*5113495bSYour Name * @residx: Resource index
309*5113495bSYour Name *
310*5113495bSYour Name * This function will acquire a particular resource and attach it to the device
311*5113495bSYour Name *
312*5113495bSYour Name * Return: QDF_STATUS_SUCCESS on success
313*5113495bSYour Name */
314*5113495bSYour Name static inline QDF_STATUS
__qal_vbus_get_resource(struct qdf_pfm_hndl * pfhndl,struct qdf_vbus_resource ** rsc,uint32_t restype,uint32_t residx)315*5113495bSYour Name __qal_vbus_get_resource(struct qdf_pfm_hndl *pfhndl,
316*5113495bSYour Name struct qdf_vbus_resource **rsc, uint32_t restype,
317*5113495bSYour Name uint32_t residx)
318*5113495bSYour Name {
319*5113495bSYour Name struct resource *rsrc;
320*5113495bSYour Name
321*5113495bSYour Name rsrc = platform_get_resource((struct platform_device *)pfhndl,
322*5113495bSYour Name restype, residx);
323*5113495bSYour Name *rsc = (struct qdf_vbus_resource *)rsrc;
324*5113495bSYour Name return QDF_STATUS_SUCCESS;
325*5113495bSYour Name }
326*5113495bSYour Name
327*5113495bSYour Name /**
328*5113495bSYour Name * __qal_vbus_get_irq() - get irq
329*5113495bSYour Name * @pfhndl: Device handle
330*5113495bSYour Name * @str: Device identifier
331*5113495bSYour Name * @irq: irq number
332*5113495bSYour Name *
333*5113495bSYour Name * This function will acquire an irq for the device
334*5113495bSYour Name *
335*5113495bSYour Name * Return: QDF_STATUS_SUCCESS on success
336*5113495bSYour Name */
337*5113495bSYour Name static inline QDF_STATUS
__qal_vbus_get_irq(struct qdf_pfm_hndl * pfhndl,const char * str,int * irq)338*5113495bSYour Name __qal_vbus_get_irq(struct qdf_pfm_hndl *pfhndl, const char *str, int *irq)
339*5113495bSYour Name {
340*5113495bSYour Name *irq = platform_get_irq_byname((struct platform_device *)pfhndl, str);
341*5113495bSYour Name
342*5113495bSYour Name if (*irq < 0)
343*5113495bSYour Name return QDF_STATUS_E_FAULT;
344*5113495bSYour Name
345*5113495bSYour Name return QDF_STATUS_SUCCESS;
346*5113495bSYour Name }
347*5113495bSYour Name
348*5113495bSYour Name /**
349*5113495bSYour Name * __qal_vbus_register_driver() - register driver
350*5113495bSYour Name * @pfdev: Device handle
351*5113495bSYour Name *
352*5113495bSYour Name * This function will initialize a device
353*5113495bSYour Name *
354*5113495bSYour Name * Return: QDF_STATUS_SUCCESS on success
355*5113495bSYour Name */
356*5113495bSYour Name static inline QDF_STATUS
__qal_vbus_register_driver(struct qdf_pfm_drv * pfdev)357*5113495bSYour Name __qal_vbus_register_driver(struct qdf_pfm_drv *pfdev)
358*5113495bSYour Name {
359*5113495bSYour Name int ret;
360*5113495bSYour Name
361*5113495bSYour Name ret = platform_driver_register((struct platform_driver *)pfdev);
362*5113495bSYour Name
363*5113495bSYour Name return qdf_status_from_os_return(ret);
364*5113495bSYour Name }
365*5113495bSYour Name
366*5113495bSYour Name /**
367*5113495bSYour Name * __qal_vbus_deregister_driver() - deregister driver
368*5113495bSYour Name * @pfdev: Device handle
369*5113495bSYour Name *
370*5113495bSYour Name * This function will deregister the driver for a device
371*5113495bSYour Name *
372*5113495bSYour Name * Return: QDF_STATUS_SUCCESS on success
373*5113495bSYour Name */
374*5113495bSYour Name static inline QDF_STATUS
__qal_vbus_deregister_driver(struct qdf_pfm_drv * pfdev)375*5113495bSYour Name __qal_vbus_deregister_driver(struct qdf_pfm_drv *pfdev)
376*5113495bSYour Name {
377*5113495bSYour Name platform_driver_unregister((struct platform_driver *)pfdev);
378*5113495bSYour Name
379*5113495bSYour Name return QDF_STATUS_SUCCESS;
380*5113495bSYour Name }
381*5113495bSYour Name
382*5113495bSYour Name /**
383*5113495bSYour Name * __qal_vbus_gpio_set_value_cansleep() - assign a gpio's raw value
384*5113495bSYour Name * @gpio: gpio whose value will be assigned
385*5113495bSYour Name * @value: value to assign
386*5113495bSYour Name *
387*5113495bSYour Name * Return: QDF_STATUS_SUCCESS on success
388*5113495bSYour Name */
389*5113495bSYour Name #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)
390*5113495bSYour Name static inline QDF_STATUS
__qal_vbus_gpio_set_value_cansleep(unsigned int gpio,int value)391*5113495bSYour Name __qal_vbus_gpio_set_value_cansleep(unsigned int gpio, int value)
392*5113495bSYour Name {
393*5113495bSYour Name gpio_set_value_cansleep(gpio, value);
394*5113495bSYour Name
395*5113495bSYour Name return QDF_STATUS_SUCCESS;
396*5113495bSYour Name }
397*5113495bSYour Name #else
398*5113495bSYour Name static inline QDF_STATUS
__qal_vbus_gpio_set_value_cansleep(unsigned int gpio,int value)399*5113495bSYour Name __qal_vbus_gpio_set_value_cansleep(unsigned int gpio, int value)
400*5113495bSYour Name {
401*5113495bSYour Name return QDF_STATUS_SUCCESS;
402*5113495bSYour Name }
403*5113495bSYour Name #endif
404*5113495bSYour Name
405*5113495bSYour Name /**
406*5113495bSYour Name * __qal_vbus_rcu_read_lock() - mark the beginning of an RCU read-side critical
407*5113495bSYour Name * section
408*5113495bSYour Name *
409*5113495bSYour Name * Return: QDF_STATUS_SUCCESS on success
410*5113495bSYour Name */
411*5113495bSYour Name static inline QDF_STATUS
__qal_vbus_rcu_read_lock(void)412*5113495bSYour Name __qal_vbus_rcu_read_lock(void)
413*5113495bSYour Name {
414*5113495bSYour Name rcu_read_lock();
415*5113495bSYour Name
416*5113495bSYour Name return QDF_STATUS_SUCCESS;
417*5113495bSYour Name }
418*5113495bSYour Name
419*5113495bSYour Name /**
420*5113495bSYour Name * __qal_vbus_rcu_read_unlock() - marks the end of an RCU read-side critical
421*5113495bSYour Name * section.
422*5113495bSYour Name *
423*5113495bSYour Name * Return: QDF_STATUS_SUCCESS on success
424*5113495bSYour Name */
425*5113495bSYour Name static inline QDF_STATUS
__qal_vbus_rcu_read_unlock(void)426*5113495bSYour Name __qal_vbus_rcu_read_unlock(void)
427*5113495bSYour Name {
428*5113495bSYour Name rcu_read_unlock();
429*5113495bSYour Name
430*5113495bSYour Name return QDF_STATUS_SUCCESS;
431*5113495bSYour Name }
432*5113495bSYour Name
433*5113495bSYour Name #if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0))
434*5113495bSYour Name /**
435*5113495bSYour Name * __qal_vbus_of_get_named_gpio_flags() - Get a GPIO descriptor and flags
436*5113495bSYour Name * for GPIO API
437*5113495bSYour Name * @np: device node to get GPIO from
438*5113495bSYour Name * @list_name: property name containing gpio specifier(s)
439*5113495bSYour Name * @index: index of the GPIO
440*5113495bSYour Name * @flags: a flags pointer to fill in
441*5113495bSYour Name *
442*5113495bSYour Name * The global GPIO number for the GPIO specified by its descriptor.
443*5113495bSYour Name */
444*5113495bSYour Name static inline int
__qal_vbus_of_get_named_gpio_flags(struct qdf_device_node * np,const char * list_name,int index,__qdf_of_gpio_flags * flags)445*5113495bSYour Name __qal_vbus_of_get_named_gpio_flags(struct qdf_device_node *np,
446*5113495bSYour Name const char *list_name,
447*5113495bSYour Name int index, __qdf_of_gpio_flags *flags)
448*5113495bSYour Name {
449*5113495bSYour Name return of_get_named_gpio_flags((struct device_node *)np,
450*5113495bSYour Name list_name, index, flags);
451*5113495bSYour Name }
452*5113495bSYour Name #else
453*5113495bSYour Name static inline int
__qal_vbus_of_get_named_gpio_flags(struct qdf_device_node * np,const char * list_name,int index,__qdf_of_gpio_flags * flags)454*5113495bSYour Name __qal_vbus_of_get_named_gpio_flags(struct qdf_device_node *np,
455*5113495bSYour Name const char *list_name,
456*5113495bSYour Name int index, __qdf_of_gpio_flags *flags)
457*5113495bSYour Name {
458*5113495bSYour Name QDF_ASSERT(0);
459*5113495bSYour Name return QDF_STATUS_E_NOSUPPORT;
460*5113495bSYour Name }
461*5113495bSYour Name #endif
462*5113495bSYour Name
463*5113495bSYour Name #endif /* __I_QAL_VBUS_DEV_H */
464