xref: /wlan-driver/qcacld-3.0/core/hdd/inc/hdd_sar_safety_config.h (revision 5113495b16420b49004c444715d2daae2066e7dc) !
1 /*
2  * Copyright (c) 2020 The Linux Foundation. All rights reserved.
3  * Copyright (c) 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: This file contains centralized definitions of converged configuration.
22  */
23 
24 #ifndef __HDD_SAR_SAFETY_CONFIG_H
25 #define __HDD_SAR_SAFETY_CONFIG_H
26 
27 #ifdef SAR_SAFETY_FEATURE
28 
29 /*
30  * SAR_SAFETY_DISABLED - feature disabled
31  * SAR_SAFETY_ENABLED_TIMER - SAR feature enabled with timer mechanism
32  * SAR_SAFETY_ENABLED_INIT - SAR feature enabled at init time
33  * SAR_SAFETY_ENABLED_MAX - SAR max valid value
34  */
35 #define SAR_SAFETY_DISABLED        0x0
36 #define SAR_SAFETY_ENABLED_TIMER   BIT(0)
37 #define SAR_SAFETY_ENABLED_INIT    BIT(1)
38 #define SAR_SAFETY_ENABLED_MAX     0x3
39 /*
40  * <ini>
41  * gSarSafetyTimeout - Specify SAR safety timeout value in milliseconds
42  *
43  * @Min: 120000
44  * @Max: 600000
45  * Default: 300000
46  *
47  * This ini is used to define SAR safety timeout value in milliseconds.
48  * This timer is started when the QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITS
49  * is received first time.
50  * SAR safety timer will wait for the gSarSafetyTimeout for
51  * QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITS vendor command and if
52  * SAR safety timer timeouts host will configure the gSarSafetyIndex
53  * to the FW.
54  *
55  * Usage: External
56  *
57  * </ini>
58  */
59 
60 #define CFG_SAR_SAFETY_TIMEOUT  CFG_INI_UINT( \
61 			"gSarSafetyTimeout", \
62 			120000, \
63 			600000, \
64 			300000, \
65 			CFG_VALUE_OR_DEFAULT, \
66 			"Timeout value for SAR safety timer")
67 
68 /*
69  * <ini>
70  * gSarSafetyUnsolicitedTimeout - Specify SAR safety unsolicited timeout value
71  * in milliseconds
72  *
73  * @Min: 5000
74  * @Max: 30000
75  * Default: 15000
76  *
77  * This ini is used to define SAR safety unsolicited timeout value in
78  * milliseconds. This timer is started on first data tx.
79  * SAR unsolicited timer will wait for the
80  * gSarSafetyUnsolicitedTimeout for QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITS
81  * vendor command and if SAR unsolicited timer timeouts host will indicate
82  * user space with QCA_NL80211_VENDOR_SUBCMD_REQUEST_SAR_LIMITS_EVENT to send
83  * QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITS vendor command.
84  *
85  * Usage: External
86  *
87  * </ini>
88  */
89 
90 #define CFG_SAR_SAFETY_UNSOLICITED_TIMEOUT  CFG_INI_UINT( \
91 			"gSarSafetyUnsolicitedTimeout", \
92 			5000, \
93 			30000, \
94 			15000, \
95 			CFG_VALUE_OR_DEFAULT, \
96 			"Timeout value for SAR Unsolicited timer")
97 
98 /*
99  * <ini>
100  * gSarSafetyReqRespTimeout - Specify SAR safety request response timeout value
101  * in milliseconds
102  *
103  * @Min: 500
104  * @Max: 3000
105  * Default: 1000
106  *
107  * This ini is used to define SAR request-response timeout value
108  * in milliseconds. SAR request-response timer will wait for the
109  * gSarSafetyReqRespTimeout for QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITS
110  * vendor command and if SAR request-response timer timeouts host will
111  * indicate user space with QCA_NL80211_VENDOR_SUBCMD_REQUEST_SAR_LIMITS_EVENT
112  * for gSarSafetyReqRespRetry number of times to send
113  * QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITS vendor command and still if host
114  * does not get QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITS vendor command, host
115  * will configure the gSarSafetyIndex to the FW.
116  *
117  * Usage: External
118  *
119  * </ini>
120  */
121 
122 #define CFG_SAR_SAFETY_REQ_RESP_TIMEOUT  CFG_INI_UINT( \
123 			"gSarSafetyReqRespTimeout", \
124 			500, \
125 			1000, \
126 			1000, \
127 			CFG_VALUE_OR_DEFAULT, \
128 			"Timeout value for SAR safety request response timer")
129 
130 /*
131  * <ini>
132  * gSarSafetyReqRespRetry - Specify SAR request response retries value
133  *
134  * @Min: 1
135  * @Max: 10
136  * Default: 5
137  *
138  * This ini is used to define SAR request-response retries value.
139  * SAR request-response timer will wait for the gSarReqRespTimeout for
140  * QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITS vendor command and if
141  * SAR request-response timer timeouts host will indicate user space
142  * for gSarSafetyReqRespRetry number of times to send
143  * QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITS vendor command and still if
144  * host does not get QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITS vendor
145  * command, host will configure the gSarSafetyIndex to the FW.
146  *
147  * Usage: External
148  *
149  * </ini>
150  */
151 
152 #define CFG_SAR_SAFETY_REQ_RESP_RETRIES  CFG_INI_UINT( \
153 			"gSarSafetyReqRespRetry", \
154 			1, \
155 			5, \
156 			5, \
157 			CFG_VALUE_OR_DEFAULT, \
158 			"Max Number of SAR Request Response Retries")
159 
160 /*
161  * <ini>
162  * gSarSafetyIndex - Specify SAR safety index
163  *
164  * @Min: 0
165  * @Max: 11
166  * Default: 11
167  *
168  * This ini is used to define SAR safety index, when sar safety timer
169  * timeouts or sar request response timer timeouts for gSarSafetyReqRespRetry
170  * number of times, host will configure gSarSafetyIndex value to the FW.
171  *
172  * Usage: External
173  *
174  * </ini>
175  */
176 
177 #define CFG_SAR_SAFETY_INDEX  CFG_INI_UINT( \
178 			"gSarSafetyIndex", \
179 			0, \
180 			11, \
181 			11, \
182 			CFG_VALUE_OR_DEFAULT, \
183 			"SAR safety index value")
184 /*
185  * <ini>
186  * gSarSafetySleepIndex - Specify SAR Safety sleep index
187  *
188  * @Min: 0
189  * @Max: 11
190  * Default: 11
191  *
192  * This ini is used to define SAR sleep index, when device goes into the
193  * sleep mode, before going into the sleep mode host configures
194  * gSarSafetySleepIndex value to the FW.
195  *
196  * Usage: External
197  *
198  * </ini>
199  */
200 
201 #define CFG_SAR_SAFETY_SLEEP_INDEX  CFG_INI_UINT( \
202 			"gSarSafetySleepIndex", \
203 			0, \
204 			11, \
205 			11, \
206 			CFG_VALUE_OR_DEFAULT, \
207 			"SAR safety sleep index value")
208 
209 /*
210  * <ini>
211  * gEnableSarSafety - Enable/Disable SAR safety feature
212  * this ini is also used to set SAR index at init time
213  *
214  * @Min: 0
215  * @Max: 3
216  * Default: 0
217  *
218  * This ini is used to enable/disable SAR safety feature
219  * Value 0 of this ini disables SAR safety feature and
220  * value 1 of this ini enables SAR safety feature and
221  * value 2 of this ini enable setting SAR index at init time
222  * value 3 of this enables both modes
223  *
224  * Usage: External
225  *
226  * </ini>
227  */
228 
229 #define CFG_ENABLE_SAR_SAFETY_FEATURE CFG_INI_UINT( \
230 			"gEnableSarSafety", \
231 			SAR_SAFETY_DISABLED, \
232 			SAR_SAFETY_ENABLED_MAX, \
233 			SAR_SAFETY_DISABLED, \
234 			CFG_VALUE_OR_DEFAULT, \
235 			"Enable/Disable SAR safety feature type")
236 
237 /*
238  * <ini>
239  * gConfigSarSafetySleepIndex - Enable/Disable SAR Safety sleep index
240  *
241  * @Min: 0
242  * @Max: 1
243  * Default: 0
244  *
245  * This Configuration is to decide that before going to
246  * sleep mode whether to maintain high RF power
247  * (SAR disable) or to configure SAR sleep mode index
248  *
249  * Value 0 for this ini indicates to maintain high
250  * RF power (SAR disable)
251  * Value 1 for this ini indicates to configure SAR
252  * sleep mode index.
253  *
254  * Usage: External
255  *
256  * </ini>
257  */
258 
259 #define CFG_CONFIG_SAR_SAFETY_SLEEP_MODE_INDEX CFG_INI_BOOL( \
260 			"gConfigSarSafetySleepIndex", \
261 			0, \
262 			"Config SAR sleep Index")
263 
264 #define SAR_SAFETY_FEATURE_ALL \
265 	CFG(CFG_SAR_SAFETY_TIMEOUT) \
266 	CFG(CFG_SAR_SAFETY_UNSOLICITED_TIMEOUT) \
267 	CFG(CFG_SAR_SAFETY_REQ_RESP_TIMEOUT) \
268 	CFG(CFG_SAR_SAFETY_REQ_RESP_RETRIES) \
269 	CFG(CFG_SAR_SAFETY_INDEX) \
270 	CFG(CFG_SAR_SAFETY_SLEEP_INDEX) \
271 	CFG(CFG_ENABLE_SAR_SAFETY_FEATURE) \
272 	CFG(CFG_CONFIG_SAR_SAFETY_SLEEP_MODE_INDEX) \
273 
274 #else
275 #define SAR_SAFETY_FEATURE_ALL
276 #endif
277 
278 #endif
279