1 /*
2 * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
3 * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
4 *
5 *
6 * Permission to use, copy, modify, and/or distribute this software for
7 * any purpose with or without fee is hereby granted, provided that the
8 * above copyright notice and this permission notice appear in all
9 * copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
12 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
13 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
14 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
15 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
16 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
17 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
18 * PERFORMANCE OF THIS SOFTWARE.
19 */
20
21 /**
22 * DOC: These APIs are used by DFS core functions to call lmac/offload
23 * functions.
24 */
25
26 #ifndef _WLAN_DFS_LMAC_API_H_
27 #define _WLAN_DFS_LMAC_API_H_
28
29 #include <wlan_objmgr_psoc_obj.h>
30 #include <wlan_objmgr_pdev_obj.h>
31 #include <wlan_dfs_ioctl.h>
32
33 /**
34 * lmac_get_caps() - Get DFS capabilities.
35 * @pdev: Pointer to PDEV structure.
36 * @dfs_caps: Pointer to dfs_caps structure
37 */
38 void lmac_get_caps(struct wlan_objmgr_pdev *pdev,
39 struct wlan_dfs_caps *dfs_caps);
40
41 /**
42 * lmac_get_tsf64() - Get tsf64 value.
43 * @pdev: Pointer to PDEV structure.
44 *
45 * Return: tsf64 timer value.
46 */
47 uint64_t lmac_get_tsf64(struct wlan_objmgr_pdev *pdev);
48
49 /**
50 * lmac_dfs_disable() - Disable DFS.
51 * @pdev: Pointer to PDEV structure.
52 * @no_cac: no_cac flag.
53 */
54 void lmac_dfs_disable(struct wlan_objmgr_pdev *pdev, int no_cac);
55
56 /**
57 * lmac_dfs_enable() - Enable DFS.
58 * @pdev: Pointer to PDEV structure.
59 * @is_fastclk: fastclk value.
60 * @param: Pointer to wlan_dfs_phyerr_param structure.
61 * @dfsdomain: DFS domain.
62 */
63 void lmac_dfs_enable(struct wlan_objmgr_pdev *pdev,
64 int *is_fastclk,
65 struct wlan_dfs_phyerr_param *param,
66 int dfsdomain);
67
68 /**
69 * lmac_dfs_get_thresholds() - Get thresholds.
70 * @pdev: Pointer to PDEV structure.
71 * @param: Pointer to wlan_dfs_phyerr_param structure.
72 */
73 void lmac_dfs_get_thresholds(struct wlan_objmgr_pdev *pdev,
74 struct wlan_dfs_phyerr_param *param);
75
76 /**
77 * lmac_get_ah_devid() - Get ah devid.
78 * @pdev: Pointer to PDEV structure.
79 */
80 uint16_t lmac_get_ah_devid(struct wlan_objmgr_pdev *pdev);
81
82 /**
83 * lmac_get_ext_busy() - Get ext_busy.
84 * @pdev: Pointer to PDEV structure.
85 */
86 uint32_t lmac_get_ext_busy(struct wlan_objmgr_pdev *pdev);
87
88 /**
89 * lmac_set_use_cac_prssi() - Set use_cac_prssi value.
90 * @pdev: Pointer to PDEV structure.
91 */
92 void lmac_set_use_cac_prssi(struct wlan_objmgr_pdev *pdev);
93
94 /**
95 * lmac_get_target_type() - Get target type.
96 * @pdev: Pointer to PDEV structure.
97 */
98 uint32_t lmac_get_target_type(struct wlan_objmgr_pdev *pdev);
99
100 /**
101 * lmac_get_phymode_info() - Get phymode info.
102 * @pdev: Pointer to PDEV structure.
103 * @chan_mode: Channel mode
104 */
105 uint32_t lmac_get_phymode_info(struct wlan_objmgr_pdev *pdev,
106 uint32_t chan_mode);
107
108 /**
109 * lmac_is_host_dfs_check_support_enabled() - Check if Host DFS confirmation
110 * feature is supported.
111 * @pdev: Pointer to PDEV structure.
112 *
113 * Return: true, host dfs check supported, else false.
114 */
115 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST)
116 bool lmac_is_host_dfs_check_support_enabled(struct wlan_objmgr_pdev *pdev);
117 #else
lmac_is_host_dfs_check_support_enabled(struct wlan_objmgr_pdev * pdev)118 static inline bool lmac_is_host_dfs_check_support_enabled(
119 struct wlan_objmgr_pdev *pdev)
120 {
121 return false;
122 }
123 #endif
124
125 /**
126 * lmac_dfs_is_hw_mode_switch_in_progress() - Check if HW mode switch is in
127 * progress.
128 * @pdev: Pointer to PDEV structure.
129 *
130 * Return: true if HW mode switch is in progress, else false.
131 */
132 bool lmac_dfs_is_hw_mode_switch_in_progress(struct wlan_objmgr_pdev *pdev);
133 #endif /* _WLAN_DFS_LMAC_API_H_ */
134