1 /*
2 * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
3 * Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18 #ifndef _WLAN_HDD_PRE_CAC_H_
19 #define _WLAN_HDD_PRE_CAC_H_
20
21 #ifdef PRE_CAC_SUPPORT
22
23 /* default pre cac channel bandwidth */
24 #define DEFAULT_PRE_CAC_BANDWIDTH CH_WIDTH_80MHZ
25
26 /**
27 * wlan_hdd_request_pre_cac() - Start pre CAC in the driver
28 * @hdd_ctx: the HDD context to operate against
29 * @chan_freq: channel freq option provided by userspace
30 *
31 * Sets the driver to the required hardware mode and start an adapter for
32 * pre CAC which will mimic an AP.
33 *
34 * Return: Zero on success, non-zero value on error
35 */
36 int wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx, uint32_t chan_freq);
37
38 /**
39 * hdd_close_pre_cac_adapter() - Close pre CAC adapter
40 * @hdd_ctx: the HDD context to operate against
41 *
42 * Return: None
43 */
44 void hdd_close_pre_cac_adapter(struct hdd_context *hdd_ctx);
45
46 /**
47 * hdd_pre_cac_register_cb() - Sets legacy callbacks to osif
48 *
49 * API to set legacy callbacks to osif
50 *
51 * Return: QDF_STATUS
52 */
53 QDF_STATUS hdd_pre_cac_register_cb(void);
54
55 /**
56 * hdd_pre_cac_unregister_cb() - Resets legacy callbacks to osif
57 *
58 * API to reset legacy callbacks to osif
59 *
60 * Return: QDF_STATUS
61 */
62 void hdd_pre_cac_unregister_cb(void);
63 #else
64 static inline int
wlan_hdd_request_pre_cac(struct hdd_context * hdd_ctx,uint32_t chan_freq)65 wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx, uint32_t chan_freq)
66 {
67 return 0;
68 }
69
70 static inline void
hdd_close_pre_cac_adapter(struct hdd_context * hdd_ctx)71 hdd_close_pre_cac_adapter(struct hdd_context *hdd_ctx)
72 {
73 }
74
hdd_pre_cac_register_cb(void)75 static inline QDF_STATUS hdd_pre_cac_register_cb(void)
76 {
77 return QDF_STATUS_SUCCESS;
78 }
79
hdd_pre_cac_unregister_cb(void)80 static inline void hdd_pre_cac_unregister_cb(void)
81 {
82 }
83 #endif /* PRE_CAC_SUPPORT */
84 #endif /* _WLAN_HDD_PRE_CAC_H_ */
85