xref: /wlan-driver/qca-wifi-host-cmn/qal/inc/qal_devnode.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2021 The Linux Foundation. All rights reserved.
3*5113495bSYour Name  *
4*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for
5*5113495bSYour Name  * any purpose with or without fee is hereby granted, provided that the
6*5113495bSYour Name  * above copyright notice and this permission notice appear in all
7*5113495bSYour Name  * copies.
8*5113495bSYour Name  *
9*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10*5113495bSYour Name  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11*5113495bSYour Name  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12*5113495bSYour Name  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13*5113495bSYour Name  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14*5113495bSYour Name  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15*5113495bSYour Name  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16*5113495bSYour Name  * PERFORMANCE OF THIS SOFTWARE.
17*5113495bSYour Name  */
18*5113495bSYour Name 
19*5113495bSYour Name /**
20*5113495bSYour Name  * DOC: qal_devnode
21*5113495bSYour Name  * QCA driver framework for device node related APIs prototype
22*5113495bSYour Name  */
23*5113495bSYour Name 
24*5113495bSYour Name #ifndef __QAL_DEVNODE_H
25*5113495bSYour Name #define __QAL_DEVNODE_H
26*5113495bSYour Name 
27*5113495bSYour Name /* Include Files */
28*5113495bSYour Name #include "qdf_types.h"
29*5113495bSYour Name #include "qdf_trace.h"
30*5113495bSYour Name #include "i_qal_devnode.h"
31*5113495bSYour Name 
32*5113495bSYour Name #define PCI_DOMAIN_ID_MIN   0x0000
33*5113495bSYour Name #define PCI_DOMAIN_ID_MAX   0xFFFF
34*5113495bSYour Name 
35*5113495bSYour Name typedef __qdf_devnode_t qdf_devnode_t;
36*5113495bSYour Name 
37*5113495bSYour Name #ifdef ENHANCED_OS_ABSTRACTION
38*5113495bSYour Name 
39*5113495bSYour Name /**
40*5113495bSYour Name  * qal_devnode_read_u32_array() - Find and read an array of 32 bit integers
41*5113495bSYour Name  * from a property.
42*5113495bSYour Name  * @devnode: device node from which the property value is to be read.
43*5113495bSYour Name  * @pname: name of the property to be searched.
44*5113495bSYour Name  * @u32_val: pointer to return value, modified only if return value is 0.
45*5113495bSYour Name  * @elem: number of array elements to read
46*5113495bSYour Name  *
47*5113495bSYour Name  * Return: QDF_STATUS_SUCCESS on success, error code
48*5113495bSYour Name  */
49*5113495bSYour Name QDF_STATUS
50*5113495bSYour Name qal_devnode_read_u32_array(const qdf_devnode_t devnode,
51*5113495bSYour Name 			   const char *pname, uint32_t *u32_val, size_t elem);
52*5113495bSYour Name /**
53*5113495bSYour Name  * qal_devnode_read_u32() - Find and read 32 bit integer from a property.
54*5113495bSYour Name  * @devnode: device node from which the property value is to be read.
55*5113495bSYour Name  * @pname: name of the property to be searched.
56*5113495bSYour Name  * @u32_val: pointer to return value, modified only if return value is 0.
57*5113495bSYour Name  *
58*5113495bSYour Name  * Return: QDF_STATUS_SUCCESS on success, error code
59*5113495bSYour Name  */
60*5113495bSYour Name QDF_STATUS
61*5113495bSYour Name qal_devnode_read_u32(const qdf_devnode_t devnode,
62*5113495bSYour Name 		     const char *pname, uint32_t *u32_val);
63*5113495bSYour Name #else
64*5113495bSYour Name 
65*5113495bSYour Name static inline QDF_STATUS
qal_devnode_read_u32_array(const qdf_devnode_t devnode,const char * pname,uint32_t * u32_val,size_t elem)66*5113495bSYour Name qal_devnode_read_u32_array(const qdf_devnode_t devnode,
67*5113495bSYour Name 			   const char *pname, uint32_t *u32_val, size_t elem)
68*5113495bSYour Name {
69*5113495bSYour Name 	return __qal_devnode_read_u32_array(devnode, pname, u32_val, elem);
70*5113495bSYour Name }
71*5113495bSYour Name 
72*5113495bSYour Name static inline QDF_STATUS
qal_devnode_read_u32(const qdf_devnode_t devnode,const char * pname,uint32_t * u32_val)73*5113495bSYour Name qal_devnode_read_u32(const qdf_devnode_t devnode,
74*5113495bSYour Name 		     const char *pname, uint32_t *u32_val)
75*5113495bSYour Name {
76*5113495bSYour Name 	return __qal_devnode_read_u32(devnode, pname, u32_val);
77*5113495bSYour Name }
78*5113495bSYour Name #endif
79*5113495bSYour Name 
80*5113495bSYour Name #endif /* __QAL_DEVNODE_H */
81