xref: /wlan-dirver/qca-wifi-host-cmn/umac/regulatory/core/src/reg_build_chan_list.h (revision 2f4b444fb7e689b83a4ab0e7b3b38f0bf4def8e0)
1 /*
2  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
3  *
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 /**
21  * DOC: reg_build_chan_list.h
22  * This file provides prototypes of the regulatory component to build master
23  * and current channel list.
24  */
25 
26 #ifndef __REG_BUILD_CHAN_LIST_H__
27 #define __REG_BUILD_CHAN_LIST_H__
28 
29 #define CHAN_12_CENT_FREQ 2467
30 #define CHAN_13_CENT_FREQ 2472
31 #define REG_MAX_20M_SUB_CH   8
32 #ifdef CONFIG_AFC_SUPPORT
33 #define MIN_AFC_BW 2
34 #define MAX_AFC_BW 160
35 #endif
36 
37 /**
38  * reg_reset_reg_rules() - provides the reg domain rules info
39  * @reg_rules: reg rules pointer
40  *
41  * Return: None
42  */
43 void reg_reset_reg_rules(struct reg_rule_info *reg_rules);
44 
45 /**
46  * reg_init_pdev_mas_chan_list() - Initialize pdev master channel list
47  * @pdev_priv_obj: Pointer to regdb pdev private object.
48  * @mas_chan_params: Master channel params.
49  */
50 void reg_init_pdev_mas_chan_list(
51 		struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj,
52 		struct mas_chan_params *mas_chan_params);
53 
54 #ifdef CONFIG_REG_CLIENT
55 /**
56  * reg_save_reg_rules_to_pdev() - Save psoc reg-rules to pdev.
57  * @pdev_priv_obj: Pointer to regdb pdev private object.
58  */
59 void reg_save_reg_rules_to_pdev(
60 		struct reg_rule_info *psoc_reg_rules,
61 		struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj);
62 #else
63 static inline void
64 reg_save_reg_rules_to_pdev(struct reg_rule_info *psoc_reg_rules,
65 			   struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj)
66 {
67 }
68 #endif
69 
70 /**
71  * reg_compute_pdev_current_chan_list() - Compute pdev current channel list.
72  * @pdev_priv_obj: Pointer to regdb pdev private object.
73  */
74 void reg_compute_pdev_current_chan_list(
75 		struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj);
76 
77 /**
78  * reg_propagate_mas_chan_list_to_pdev() - Propagate master channel list to pdev
79  * @psoc: Pointer to psoc object.
80  * @object: Void pointer to pdev object.
81  * @arg: Pointer to direction.
82  */
83 void reg_propagate_mas_chan_list_to_pdev(struct wlan_objmgr_psoc *psoc,
84 					 void *object, void *arg);
85 
86 #ifdef CONFIG_BAND_6GHZ
87 /**
88  * reg_process_master_chan_list_ext() - Compute master channel extended list
89  * based on the regulatory rules.
90  * @reg_info: Pointer to regulatory info
91  *
92  * Return: QDF_STATUS
93  */
94 QDF_STATUS
95 reg_process_master_chan_list_ext(struct cur_regulatory_info *reg_info);
96 
97 #ifdef CONFIG_AFC_SUPPORT
98 /**
99  * reg_process_afc_event() - Process the afc event and compute the 6G AFC
100  * channel list based on the frequency range and channel frequency indices set.
101  * @reg_info: Pointer to regulatory info
102  *
103  * Return: QDF_STATUS
104  */
105 QDF_STATUS
106 reg_process_afc_event(struct afc_regulatory_info *afc_info);
107 #endif
108 #endif
109 /**
110  * reg_process_master_chan_list() - Compute master channel list based on the
111  * regulatory rules.
112  * @reg_info: Pointer to regulatory info
113  *
114  * Return: QDF_STATUS
115  */
116 QDF_STATUS reg_process_master_chan_list(struct cur_regulatory_info *reg_info);
117 
118 /**
119  * reg_get_current_chan_list() - provide the pdev current channel list
120  * @pdev: pdev pointer
121  * @chan_list: channel list pointer
122  *
123  * Return: QDF_STATUS
124  */
125 QDF_STATUS reg_get_current_chan_list(struct wlan_objmgr_pdev *pdev,
126 				     struct regulatory_channel *chan_list);
127 
128 #if defined(CONFIG_AFC_SUPPORT) && defined(CONFIG_BAND_6GHZ)
129 /**
130  * reg_get_6g_ap_master_chan_list() - Get  an ap  master channel list depending
131  * on * ap power type
132  * @ap_pwr_type: Power type (LPI/VLP/SP)
133  * @chan_list: Pointer to the channel list. The output channel list
134  *
135  * Return: QDF_STATUS
136  */
137 QDF_STATUS reg_get_6g_ap_master_chan_list(struct wlan_objmgr_pdev *pdev,
138 					  enum reg_6g_ap_type ap_pwr_type,
139 					  struct regulatory_channel *chan_list);
140 
141 /**
142  * reg_get_6g_afc_chan_list() - provide the pdev afc channel list
143  * @pdev: pdev pointer
144  * @chan_list: channel list pointer
145  *
146  * Return: QDF_STATUS
147  */
148 QDF_STATUS reg_get_6g_afc_chan_list(struct wlan_objmgr_pdev *pdev,
149 				    struct regulatory_channel *chan_list);
150 
151 /**
152  * reg_get_6g_afc_mas_chan_list() - provide the pdev afc master channel list
153  * @pdev: pdev pointer
154  * @chan_list: channel list pointer
155  *
156  * Return: QDF_STATUS
157  */
158 QDF_STATUS
159 reg_get_6g_afc_mas_chan_list(struct wlan_objmgr_pdev *pdev,
160 			     struct regulatory_channel *chan_list);
161 
162 /**
163  * reg_psd_2_eirp() - Calculate EIRP from PSD and bandwidth
164  * channel list
165  * @pdev: pdev pointer
166  * @psd: Power Spectral Density in dBm/MHz
167  * @ch_bw: Bandwdith of a channel in MHz (20/40/80/160/320 etc)
168  * @eirp:  EIRP power  in dBm
169  *
170  * Return: QDF_STATUS
171  */
172 QDF_STATUS reg_psd_2_eirp(struct wlan_objmgr_pdev *pdev,
173 			  int16_t psd,
174 			  uint16_t ch_bw,
175 			  int16_t *eirp);
176 #endif
177 
178 #ifdef CONFIG_REG_CLIENT
179 /**
180  * reg_get_secondary_current_chan_list() - provide the pdev secondary current
181  * channel list
182  * @pdev: pdev pointer
183  * @chan_list: channel list pointer
184  *
185  * Return: QDF_STATUS
186  */
187 QDF_STATUS
188 reg_get_secondary_current_chan_list(struct wlan_objmgr_pdev *pdev,
189 				    struct regulatory_channel *chan_list);
190 #endif
191 #endif
192