1  /*
2   * Copyright (c) 2017-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  /**
21   * DOC: wlan_reg_tgt_api.h
22   * This file provides prototypes of the regulatory component target
23   * interface routines
24   */
25  
26  #ifndef __WLAN_REG_TGT_API_H
27  #define __WLAN_REG_TGT_API_H
28  
29  /**
30   * tgt_reg_process_master_chan_list() - process master channel list
31   * @reg_info: regulatory info
32   *
33   * Return: QDF_STATUS
34   */
35  QDF_STATUS tgt_reg_process_master_chan_list(struct cur_regulatory_info
36  					    *reg_info);
37  
38  #ifdef CONFIG_BAND_6GHZ
39  /**
40   * tgt_reg_process_master_chan_list_ext() - process master ext channel list
41   * @reg_info: regulatory info
42   *
43   * Return: QDF_STATUS
44   */
45  QDF_STATUS tgt_reg_process_master_chan_list_ext(struct cur_regulatory_info
46  						*reg_info);
47  
48  #ifdef CONFIG_AFC_SUPPORT
49  /**
50   * tgt_reg_process_afc_event() - process the AFC event
51   * @afc_info: AFC regulatory info
52   *
53   * Return: QDF_STATUS
54   */
55  QDF_STATUS
56  tgt_reg_process_afc_event(struct afc_regulatory_info *afc_info);
57  #endif
58  #endif
59  
60  /**
61   * tgt_reg_process_11d_new_country() - process new 11d country event
62   * @psoc: pointer to psoc
63   * @reg_11d_new_cc: new 11d country pointer
64   *
65   * Return: QDF_STATUS
66   */
67  QDF_STATUS tgt_reg_process_11d_new_country(struct wlan_objmgr_psoc *psoc,
68  		struct reg_11d_new_country *reg_11d_new_cc);
69  
70  /**
71   * tgt_reg_set_regdb_offloaded() - set/clear regulatory offloaded flag
72   * @psoc: psoc pointer
73   * @val: flag value to set
74   *
75   * Return: Success or Failure
76   */
77  QDF_STATUS tgt_reg_set_regdb_offloaded(struct wlan_objmgr_psoc *psoc,
78  				       bool val);
79  
80  /**
81   * tgt_reg_set_11d_offloaded() - set/clear 11d offloaded flag
82   * @psoc: psoc pointer
83   * @val: flag value to set
84   *
85   * Return: Success or Failure
86   */
87  QDF_STATUS tgt_reg_set_11d_offloaded(struct wlan_objmgr_psoc *psoc,
88  				     bool val);
89  /**
90   * tgt_reg_process_ch_avoid_event() - process new ch avoid event
91   * @psoc: pointer to psoc
92   * @ch_avoid_evnt: channel avoid event
93   *
94   * Return: QDF_STATUS
95   */
96  QDF_STATUS tgt_reg_process_ch_avoid_event(struct wlan_objmgr_psoc *psoc,
97  		struct ch_avoid_ind_type *ch_avoid_evnt);
98  
99  /**
100   * tgt_reg_ignore_fw_reg_offload_ind() - Check whether regdb offload indication
101   * from FW needs to be ignored.
102   * @psoc: Pointer to psoc
103   */
104  bool tgt_reg_ignore_fw_reg_offload_ind(struct wlan_objmgr_psoc *psoc);
105  
106  /**
107   * tgt_reg_set_6ghz_supported() - Whether 6ghz is supported by the chip
108   * @psoc: Pointer to psoc
109   * @val: value
110   */
111  QDF_STATUS tgt_reg_set_6ghz_supported(struct wlan_objmgr_psoc *psoc,
112  				      bool val);
113  
114  /**
115   * tgt_reg_set_5dot9_ghz_supported() - Whether 5.9ghz is supported by the chip
116   * @psoc: Pointer to psoc
117   * @val: value
118   */
119  QDF_STATUS tgt_reg_set_5dot9_ghz_supported(struct wlan_objmgr_psoc *psoc,
120  					   bool val);
121  
122  /**
123   * tgt_reg_set_ext_tpc_supported() - Whether FW supports new WMI cmd for TPC
124   * @psoc: Pointer to psoc
125   * @val: value
126   *
127   * Return: QDF_STATUS
128   */
129  QDF_STATUS tgt_reg_set_ext_tpc_supported(struct wlan_objmgr_psoc *psoc,
130  					 bool val);
131  
132  #if defined(CONFIG_BAND_6GHZ)
133  /**
134   * tgt_reg_set_lower_6g_edge_ch_supp() - Assign the value set by FW for lower
135   * 6ghz edge channel (5935 MHz) support
136   * @psoc: Pointer to psoc
137   * @val: value
138   */
139  QDF_STATUS tgt_reg_set_lower_6g_edge_ch_supp(struct wlan_objmgr_psoc *psoc,
140  					     bool val);
141  
142  /**
143   * tgt_reg_set_disable_upper_6g_edge_ch_supp() - Assign the value set by FW
144   * for upper 6G edge channel {7115MHz) disablement
145   * @psoc: Pointer to psoc
146   * @val: value
147   */
148  QDF_STATUS
149  tgt_reg_set_disable_upper_6g_edge_ch_supp(struct wlan_objmgr_psoc *psoc,
150  					  bool val);
151  #else
152  static inline
tgt_reg_set_lower_6g_edge_ch_supp(struct wlan_objmgr_psoc * psoc,bool val)153  QDF_STATUS tgt_reg_set_lower_6g_edge_ch_supp(struct wlan_objmgr_psoc *psoc,
154  					     bool val)
155  {
156  	return QDF_STATUS_E_FAILURE;
157  }
158  
159  static inline QDF_STATUS
tgt_reg_set_disable_upper_6g_edge_ch_supp(struct wlan_objmgr_psoc * psoc,bool val)160  tgt_reg_set_disable_upper_6g_edge_ch_supp(struct wlan_objmgr_psoc *psoc,
161  					  bool val)
162  
163  {
164  	return QDF_STATUS_E_FAILURE;
165  }
166  #endif
167  
168  #ifdef CONFIG_AFC_SUPPORT
169  /**
170   * tgt_reg_set_afc_dev_type() - set target afc device type
171   * @psoc: Pointer to psoc
172   * @reg_afc_dev_type: afc device deployment type
173   *
174   * Return: QDF_STATUS
175   */
176  QDF_STATUS
177  tgt_reg_set_afc_dev_type(struct wlan_objmgr_psoc *psoc,
178  			 enum reg_afc_dev_deploy_type reg_afc_dev_type);
179  
180  /**
181   * tgt_reg_get_afc_dev_type() - get target afc device type
182   * @psoc: Pointer to psoc
183   * @reg_afc_dev_type: Pointer to afc device deploymenttype
184   *
185   * Return: QDF_STATUS
186   */
187  QDF_STATUS
188  tgt_reg_get_afc_dev_type(struct wlan_objmgr_psoc *psoc,
189  			 enum reg_afc_dev_deploy_type *reg_afc_dev_type);
190  
191  /**
192   * tgt_reg_set_eirp_preferred_support() - Set EIRP as the preferred
193   * support for TPC power command
194   * @psoc: psoc pointer
195   * @reg_is_eirp_support_preferred: Boolean to indicate if target prefers EIRP
196   * support for TPC power command
197   *
198   * Return: Success or Failure
199   */
200  QDF_STATUS
201  tgt_reg_set_eirp_preferred_support(struct wlan_objmgr_psoc *psoc,
202  				   bool reg_is_eirp_support_preferred);
203  
204  /**
205   * tgt_reg_get_eirp_preferred_support() - Check if is EIRP support is
206   * preferred by the target for TPC power command
207   * @psoc: psoc pointer
208   * @reg_is_eirp_support_preferred: Pointer to reg_is_eirp_support_preferred
209   *
210   * Return: Success or Failure
211   */
212  QDF_STATUS
213  tgt_reg_get_eirp_preferred_support(struct wlan_objmgr_psoc *psoc,
214  				   bool *reg_is_eirp_support_preferred);
215  #endif
216  
217  /**
218   * tgt_reg_process_r2p_table_update_response() - process rate2power table update
219   * response
220   * @psoc: pointer to psoc
221   * @pdev_id: pdev id from target
222   *
223   * Return: QDF_STATUS
224   */
225  QDF_STATUS tgt_reg_process_r2p_table_update_response(
226  						struct wlan_objmgr_psoc *psoc,
227  						uint32_t pdev_id);
228  #endif
229