1 /*
2  * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-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 _CFR_DEFS_I_H_
21 #define _CFR_DEFS_I_H_
22 
23 #include <wlan_objmgr_cmn.h>
24 #include <wlan_objmgr_global_obj.h>
25 #include <wlan_objmgr_psoc_obj.h>
26 #include <wlan_objmgr_pdev_obj.h>
27 #include <wlan_objmgr_vdev_obj.h>
28 #include <wlan_objmgr_peer_obj.h>
29 #include <qdf_list.h>
30 #include <qdf_timer.h>
31 #include <qdf_util.h>
32 #include <qdf_types.h>
33 #include <wlan_cfr_utils_api.h>
34 
35 #define CFR_STOP_STR           "CFR-CAPTURE-STOPPED"
36 
37 /**
38  * wlan_cfr_psoc_obj_create_handler() - psoc object create handler for cfr
39  * @psoc: pointer to psoc object
40  * @arg: void pointer in case it needs arguments
41  *
42  * Return: status of object creation
43  */
44 QDF_STATUS
45 wlan_cfr_psoc_obj_create_handler(struct wlan_objmgr_psoc *psoc, void *arg);
46 
47 /**
48  * wlan_cfr_psoc_obj_destroy_handler() - psoc object destroy handler for cfr
49  * @psoc: pointer to psoc object
50  * @arg: void pointer in case it needs arguments
51  *
52  * Return: status of destroy object
53  */
54 QDF_STATUS
55 wlan_cfr_psoc_obj_destroy_handler(struct wlan_objmgr_psoc *psoc, void *arg);
56 
57 /**
58  * wlan_cfr_pdev_obj_create_handler() - pdev object create handler for cfr
59  * @pdev: pointer to pdev object
60  * @arg: void pointer in case it needs arguments
61  *
62  * Return: status of object creation
63  */
64 QDF_STATUS
65 wlan_cfr_pdev_obj_create_handler(struct wlan_objmgr_pdev *pdev, void *arg);
66 
67 /**
68  * wlan_cfr_pdev_obj_destroy_handler() - pdev object destroy handler for cfr
69  * @pdev: pointer to pdev object
70  * @arg: void pointer in case it needs arguments
71  *
72  * Return: status of destroy object
73  */
74 QDF_STATUS
75 wlan_cfr_pdev_obj_destroy_handler(struct wlan_objmgr_pdev *pdev, void *arg);
76 
77 /**
78  * wlan_cfr_peer_obj_create_handler() - peer object create handler for cfr
79  * @peer: pointer to peer object
80  * @arg: void pointer in case it needs arguments
81  *
82  * Return: status of object creation
83  */
84 QDF_STATUS
85 wlan_cfr_peer_obj_create_handler(struct wlan_objmgr_peer *peer, void *arg);
86 
87 /**
88  * wlan_cfr_peer_obj_destroy_handler() - peer object destroy handler for cfr
89  * @peer: pointer to peer object
90  * @arg: void pointer in case it needs arguments
91  *
92  * Return: status ofi destroy object
93  */
94 QDF_STATUS
95 wlan_cfr_peer_obj_destroy_handler(struct wlan_objmgr_peer *peer, void *arg);
96 
97 /**
98  * cfr_streamfs_init() - stream filesystem init
99  * @pdev: pointer to pdev object
100  *
101  * Return: status of fs init
102  */
103 QDF_STATUS
104 cfr_streamfs_init(struct wlan_objmgr_pdev *pdev);
105 
106 /**
107  * cfr_streamfs_remove() - stream filesystem remove
108  * @pdev: pointer to pdev object
109  *
110  * Return: status of fs remove
111  */
112 QDF_STATUS
113 cfr_streamfs_remove(struct wlan_objmgr_pdev *pdev);
114 
115 /**
116  * cfr_streamfs_write() - write to stream filesystem
117  * @pa: pointer to pdev_cfr object
118  * @write_data: Pointer to data
119  * @write_len: data len
120  *
121  * Return: status of fs write
122  */
123 QDF_STATUS
124 cfr_streamfs_write(struct pdev_cfr *pa, const void *write_data,
125 		   size_t write_len);
126 
127 /**
128  * cfr_streamfs_flush() - flush the write to streamfs
129  * @pa: pointer to pdev_cfr object
130  *
131  * Return: status of fs flush
132  */
133 QDF_STATUS
134 cfr_streamfs_flush(struct pdev_cfr *pa);
135 
136 /**
137  * cfr_stop_indication() - write cfr stop string
138  * @vdev: pointer to vdev object
139  *
140  * Write stop string and indicate to up layer.
141  *
142  * Return: status of write CFR stop string
143  */
144 QDF_STATUS cfr_stop_indication(struct wlan_objmgr_vdev *vdev);
145 
146 #ifdef WLAN_CFR_PM
147 /**
148  * cfr_prevent_suspend() - Acquire wake lock and prevent suspend
149  * @pcfr: pointer to pdev_cfr object
150  *
151  * Return: QDF status
152  */
153 QDF_STATUS cfr_prevent_suspend(struct pdev_cfr *pcfr);
154 
155 /**
156  * cfr_allow_suspend() - Release wake lock and allow suspend
157  * @pcfr: pointer to pdev_cfr object
158  *
159  * Return: QDF status
160  */
161 QDF_STATUS cfr_allow_suspend(struct pdev_cfr *pcfr);
162 #endif
163 #endif
164