1 /*
2  * Copyright (c) 2012-2018,2020-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-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 __CFG_THERMAL_TEMP_H
25 #define __CFG_THERMAL_TEMP_H
26 
27 /*
28  * <ini>
29  * gThermalTempMinLevel0 - Set Thermal Temp Min Level0
30  * @Min: 0
31  * @Max: 1000
32  * @Default: 0
33  *
34  * Usage: External
35  *
36  * </ini>
37  */
38 #define CFG_THERMAL_TEMP_MIN_LEVEL0 CFG_INI_UINT( \
39 			"gThermalTempMinLevel0", \
40 			0, \
41 			1000, \
42 			0, \
43 			CFG_VALUE_OR_DEFAULT, \
44 			"Thermal Temp Min Level0")
45 
46 /*
47  * <ini>
48  * gThermalTempMaxLevel0 - Set Thermal Temp Max Level0
49  * @Min: 0
50  * @Max: 1000
51  * @Default: 90
52  *
53  * Usage: External
54  *
55  * </ini>
56  */
57 #define CFG_THERMAL_TEMP_MAX_LEVEL0 CFG_INI_UINT( \
58 			"gThermalTempMaxLevel0", \
59 			0, \
60 			1000, \
61 			90, \
62 			CFG_VALUE_OR_DEFAULT, \
63 			"Thermal Temp Max Level0")
64 
65 /*
66  * <ini>
67  * gThermalTempMinLevel1 - Set Thermal Temp Min Level1
68  * @Min: 0
69  * @Max: 1000
70  * @Default: 70
71  *
72  * Usage: External
73  *
74  * </ini>
75  */
76 #define CFG_THERMAL_TEMP_MIN_LEVEL1 CFG_INI_UINT( \
77 			"gThermalTempMinLevel1", \
78 			0, \
79 			1000, \
80 			70, \
81 			CFG_VALUE_OR_DEFAULT, \
82 			"Thermal Temp Min Level1")
83 
84 /*
85  * <ini>
86  * gThermalTempMaxLevel1 - Set Thermal Temp Max Level1
87  * @Min: 0
88  * @Max: 1000
89  * @Default: 110
90  *
91  * Usage: External
92  *
93  * </ini>
94  */
95 #define CFG_THERMAL_TEMP_MAX_LEVEL1 CFG_INI_UINT( \
96 			"gThermalTempMaxLevel1", \
97 			0, \
98 			1000, \
99 			110, \
100 			CFG_VALUE_OR_DEFAULT, \
101 			"Thermal Temp Max Level1")
102 
103 /*
104  * <ini>
105  * gThermalTempMinLevel2 - Set Thermal Temp Min Level2
106  * @Min: 0
107  * @Max: 1000
108  * @Default: 90
109  *
110  * Usage: External
111  *
112  * </ini>
113  */
114 #define CFG_THERMAL_TEMP_MIN_LEVEL2 CFG_INI_UINT( \
115 			"gThermalTempMinLevel2", \
116 			0, \
117 			1000, \
118 			90, \
119 			CFG_VALUE_OR_DEFAULT, \
120 			"Thermal Temp Min Level2")
121 
122 /*
123  * <ini>
124  * gThermalTempMaxLevel2 - Set Thermal Temp Max Level2
125  * @Min: 0
126  * @Max: 1000
127  * @Default: 125
128  *
129  * Usage: External
130  *
131  * </ini>
132  */
133 #define CFG_THERMAL_TEMP_MAX_LEVEL2 CFG_INI_UINT( \
134 			"gThermalTempMaxLevel2", \
135 			0, \
136 			1000, \
137 			125, \
138 			CFG_VALUE_OR_DEFAULT, \
139 			"Thermal Temp Max Level2")
140 
141 /*
142  * <ini>
143  * gThermalTempMinLevel3 - Set Thermal Temp Min Level3
144  * @Min: 0
145  * @Max: 1000
146  * @Default: 110
147  *
148  * Usage: External
149  *
150  * </ini>
151  */
152 #define CFG_THERMAL_TEMP_MIN_LEVEL3 CFG_INI_UINT( \
153 			"gThermalTempMinLevel3", \
154 			0, \
155 			1000, \
156 			110, \
157 			CFG_VALUE_OR_DEFAULT, \
158 			"Thermal Temp Min Level3")
159 
160 /*
161  * <ini>
162  * gThermalTempMaxLevel3 - Set Thermal Temp Max Level3
163  * @Min: 0
164  * @Max: 1000
165  * @Default: 0
166  *
167  * Usage: External
168  *
169  * </ini>
170  */
171 #define CFG_THERMAL_TEMP_MAX_LEVEL3 CFG_INI_UINT( \
172 			"gThermalTempMaxLevel3", \
173 			0, \
174 			1000, \
175 			0, \
176 			CFG_VALUE_OR_DEFAULT, \
177 			"Thermal Temp Max Level3")
178 
179 /*
180  * <ini>
181  * gThermalTempMinLevel4 - Set Thermal Temp Min Level
182  * for TX OFF
183  * @Min: 0
184  * @Max: 1000
185  * @Default: 116
186  *
187  * Usage: External
188  *
189  * </ini>
190  */
191 #define CFG_THERMAL_TEMP_MIN_LEVEL4 CFG_INI_UINT( \
192 			"gThermalTempMinLevel4", \
193 			0, \
194 			1000, \
195 			116, \
196 			CFG_VALUE_OR_DEFAULT, \
197 			"Thermal Temp Min Level4")
198 
199 /*
200  * <ini>
201  * gThermalTempMaxLevel4 - Set Thermal Temp Max Level
202  * for TX OFF
203  * @Min: 0
204  * @Max: 1000
205  * @Default: 117
206  *
207  * Usage: External
208  *
209  * </ini>
210  */
211 #define CFG_THERMAL_TEMP_MAX_LEVEL4 CFG_INI_UINT( \
212 			"gThermalTempMaxLevel4", \
213 			0, \
214 			1000, \
215 			117, \
216 			CFG_VALUE_OR_DEFAULT, \
217 			"Thermal Temp Max Level4")
218 
219 /*
220  * <ini>
221  * gThermalTempMinLevel5 - Set Thermal Temp Min Level
222  * for target shutdown
223  * @Min: 0
224  * @Max: 1000
225  * @Default: 118
226  *
227  * Usage: External
228  *
229  * </ini>
230  */
231 #define CFG_THERMAL_TEMP_MIN_LEVEL5 CFG_INI_UINT( \
232 			"gThermalTempMinLevel5", \
233 			0, \
234 			1000, \
235 			118, \
236 			CFG_VALUE_OR_DEFAULT, \
237 			"Thermal Temp Min Level5")
238 
239 /*
240  * <ini>
241  * gThermalTempMaxLevel5 - Set Thermal Temp Max Level
242  * for target shutdown
243  * @Min: 0
244  * @Max: 1000
245  * @Default: 120
246  *
247  * Usage: External
248  *
249  * </ini>
250  */
251 #define CFG_THERMAL_TEMP_MAX_LEVEL5 CFG_INI_UINT( \
252 			"gThermalTempMaxLevel5", \
253 			0, \
254 			1000, \
255 			120, \
256 			CFG_VALUE_OR_DEFAULT, \
257 			"Thermal Temp Max Level5")
258 
259 /*
260  * <ini>
261  * gThermalMitigationEnable - Set Thermal mitigation feature control
262  * @Min: 0
263  * @Max: 1
264  * @Default: 0
265  *
266  * Usage: External
267  *
268  * </ini>
269  */
270 #define CFG_THERMAL_MITIGATION_ENABLE CFG_INI_BOOL( \
271 			"gThermalMitigationEnable", \
272 			0, \
273 			"Thermal mitigation feature control")
274 
275 /*
276  * <ini>
277  * gThrottlePeriod - Set Thermal mitigation throttle period
278  * @Min: 10
279  * @Max: 10000
280  * @Default: 4000
281  *
282  * Usage: External
283  *
284  * </ini>
285  */
286 #define CFG_THROTTLE_PERIOD CFG_INI_UINT( \
287 			"gThrottlePeriod", \
288 			10, \
289 			10000, \
290 			4000, \
291 			CFG_VALUE_OR_DEFAULT, \
292 			"Thermal mitigation throttle period")
293 
294 /*
295  * <ini>
296  * gThrottleDutyCycleLevel0 - Set Thermal mitigation throttle duty cycle level0
297  * @Min: 0
298  * @Max: 0
299  * @Default: 0
300  *
301  * Usage: External
302  *
303  * </ini>
304  */
305 #define CFG_THROTTLE_DUTY_CYCLE_LEVEL0 CFG_INI_UINT( \
306 			"gThrottleDutyCycleLevel0", \
307 			0, \
308 			0, \
309 			0, \
310 			CFG_VALUE_OR_DEFAULT, \
311 			"Thermal mitigation throttle duty cycle level0")
312 
313 /*
314  * <ini>
315  * gThrottleDutyCycleLevel1 - Set Thermal mitigation throttle duty cycle level1
316  * @Min: 0
317  * @Max: 100
318  * @Default: 10
319  *
320  * Usage: External
321  *
322  * </ini>
323  */
324 #define CFG_THROTTLE_DUTY_CYCLE_LEVEL1 CFG_INI_UINT( \
325 			"gThrottleDutyCycleLevel1", \
326 			0, \
327 			100, \
328 			10, \
329 			CFG_VALUE_OR_DEFAULT, \
330 			"Thermal mitigation throttle duty cycle level1")
331 
332 /*
333  * <ini>
334  * gThrottleDutyCycleLevel2 - Set Thermal mitigation throttle duty cycle level2
335  * @Min: 0
336  * @Max: 100
337  * @Default: 30
338  *
339  * Usage: External
340  *
341  * </ini>
342  */
343 #define CFG_THROTTLE_DUTY_CYCLE_LEVEL2 CFG_INI_UINT( \
344 			"gThrottleDutyCycleLevel2", \
345 			0, \
346 			100, \
347 			30, \
348 			CFG_VALUE_OR_DEFAULT, \
349 			"Thermal mitigation throttle duty cycle level2")
350 
351 /*
352  * <ini>
353  * gThrottleDutyCycleLevel3 - Set Thermal mitigation throttle duty cycle level3
354  * @Min: 0
355  * @Max: 100
356  * @Default: 50
357  *
358  * Usage: External
359  *
360  * </ini>
361  */
362 #define CFG_THROTTLE_DUTY_CYCLE_LEVEL3 CFG_INI_UINT( \
363 			"gThrottleDutyCycleLevel3", \
364 			0, \
365 			100, \
366 			50, \
367 			CFG_VALUE_OR_DEFAULT, \
368 			"Thermal mitigation throttle duty cycle level3")
369 
370 /*
371  * <ini>
372  * gThrottleDutyCycleLevel4 - Set Thermal mitigation throttle duty cycle level4
373  * @Min: 0
374  * @Max: 100
375  * @Default: 70
376  *
377  * This ini will apply the thermal throttle duty cycle value in FW
378  * Usage: External
379  *
380  * </ini>
381  */
382 #define CFG_THROTTLE_DUTY_CYCLE_LEVEL4 CFG_INI_UINT( \
383 			"gThrottleDutyCycleLevel4", \
384 			0, \
385 			100, \
386 			70, \
387 			CFG_VALUE_OR_DEFAULT, \
388 			"Thermal mitigation throttle duty cycle level4")
389 
390 /*
391  * <ini>
392  * gThrottleDutyCycleLevel5 - Set Thermal mitigation throttle duty cycle level5
393  * @Min: 0
394  * @Max: 100
395  * @Default: 90
396  *
397  * This ini will apply the thermal throttle duty cycle value in FW
398  * Usage: External
399  *
400  * </ini>
401  */
402 #define CFG_THROTTLE_DUTY_CYCLE_LEVEL5 CFG_INI_UINT( \
403 			"gThrottleDutyCycleLevel5", \
404 			0, \
405 			100, \
406 			90, \
407 			CFG_VALUE_OR_DEFAULT, \
408 			"Thermal mitigation throttle duty cycle level5")
409 
410 /* <ini>
411  *gThermalSamplingTime - Configure the thermal mitigation sampling time in ms.
412  *
413  * @Min: 10
414  * @Max: 100
415  * @Default: 100
416  *
417  * This ini will control the sampling time that the thermal mitigation in FW
418  * will consider while applying the duty cycle.
419  *
420  * Usage: External
421  *
422  * Supported features: Thermal Mitigation
423  *
424  * </ini>
425  */
426 #define CFG_THERMAL_SAMPLING_TIME CFG_INI_UINT( \
427 				"gThermalSamplingTime", \
428 				10, \
429 				100, \
430 				100, \
431 				CFG_VALUE_OR_DEFAULT, \
432 				"Thermal mitigation sampling time")
433 
434 /* <ini>
435  * gThermalAppsPriority - Configure the thermal mitigation APPS priority
436  *
437  * @Min: 1
438  * @Max: 10
439  * @Default: 1
440  *
441  * This ini will control the priority of the thermal mitigation in FW.
442  * FW will consider this priority while applying the duty cycle from the
443  * multiple clients. 1 being the least priority and 10 being highest.
444  *
445  * Usage: External
446  *
447  * Supported features: Thermal Mitigation
448  *
449  * </ini>
450  */
451 #define CFG_THERMAL_APPS_PRIORITY CFG_INI_UINT( \
452 				"gThermalAppsPriority", \
453 				1, \
454 				10, \
455 				1, \
456 				CFG_VALUE_OR_DEFAULT, \
457 				"Thermal mitigation priority for APPS")
458 
459 /* <ini>
460  * gThermalWppsPriority - Configure the thermal mitigation WPPS priority
461  *
462  * @Min: 1
463  * @Max: 10
464  * @Default: 1
465  *
466  * This ini will control the priority of the thermal mitigation in FW.
467  * FW will consider this priority while applying the duty cycle from the
468  * multiple clients. 1 being the least priority and 10 being highest.
469  *
470  * Usage: External
471  *
472  * Supported features: Thermal Mitigation
473  *
474  * </ini>
475  */
476 #define CFG_THERMAL_WPPS_PRIOITY CFG_INI_UINT( \
477 				"gThermalWppsPriority", \
478 				1, \
479 				10, \
480 				1, \
481 				CFG_VALUE_OR_DEFAULT, \
482 				"Thermal mitigation priority for WPPS")
483 
484 /* <ini>
485  * gThermalMgmtAction - Configure the thermal management action
486  *
487  * @Min: 0
488  * @Max: 3
489  * @Default: 0
490  *
491  * This ini will control the thermal throttle action to be performed by target
492  * when the thermal temperature increase/decrease to threshold.
493  * The valid thermal mgmt action INI value is defined as
494  * enum thermal_mgmt_action_code.
495  * 0 - THERMAL_MGMT_ACTION_DEFAULT: target default throttle behaviour
496  * 1 - THERMAL_MGMT_ACTION_HALT_TRAFFIC: Halt tx traffic
497  * 2 - THERMAL_MGMT_ACTION_NOTIFY_HOST: Notify host
498  * 3 - THERMAL_MGMT_ACTION_CHAINSCALING: Tx Chain scaling
499  *
500  * Usage: External
501  *
502  * Supported features: Thermal Mitigation
503  *
504  * </ini>
505  */
506 #define CFG_THERMAL_MGMT_ACTION CFG_INI_UINT( \
507 				"gThermalMgmtAction", \
508 				0, \
509 				3, \
510 				0, \
511 				CFG_VALUE_OR_DEFAULT, \
512 				"Thermal management action")
513 
514 /* <ini>
515  * gThermalStatsTempOffset - Configure the thermal stats offset
516  *
517  * @Min: 0
518  * @Max: 10
519  * @Default: 5
520  *
521  * This ini will configure Thermal temperature offset value for capturing
522  * thermal stats in  thermal range.
523  * Thermal STATS start capturing from temperature threshold to temperature
524  * threshold + offset.
525  * If the value 0 is given then then thermal STATS capture is disabled
526  *
527  * Usage: External
528  *
529  * </ini>
530  */
531 #define CFG_THERMAL_STATS_TEMP_OFFSET CFG_INI_UINT( \
532 					"gThermalStatsTempOffset", \
533 					0, \
534 					10, \
535 					5, \
536 					CFG_VALUE_OR_DEFAULT, \
537 					"Thermal Stats Temperature Offset")
538 
539 #define CFG_THERMAL_TEMP_ALL \
540 	CFG(CFG_THERMAL_TEMP_MIN_LEVEL0) \
541 	CFG(CFG_THERMAL_TEMP_MAX_LEVEL0) \
542 	CFG(CFG_THERMAL_TEMP_MIN_LEVEL1) \
543 	CFG(CFG_THERMAL_TEMP_MAX_LEVEL1) \
544 	CFG(CFG_THERMAL_TEMP_MIN_LEVEL2) \
545 	CFG(CFG_THERMAL_TEMP_MAX_LEVEL2) \
546 	CFG(CFG_THERMAL_TEMP_MIN_LEVEL3) \
547 	CFG(CFG_THERMAL_TEMP_MAX_LEVEL3) \
548 	CFG(CFG_THERMAL_TEMP_MIN_LEVEL4) \
549 	CFG(CFG_THERMAL_TEMP_MAX_LEVEL4) \
550 	CFG(CFG_THERMAL_TEMP_MIN_LEVEL5) \
551 	CFG(CFG_THERMAL_TEMP_MAX_LEVEL5) \
552 	CFG(CFG_THERMAL_MITIGATION_ENABLE) \
553 	CFG(CFG_THROTTLE_PERIOD) \
554 	CFG(CFG_THROTTLE_DUTY_CYCLE_LEVEL0) \
555 	CFG(CFG_THROTTLE_DUTY_CYCLE_LEVEL1) \
556 	CFG(CFG_THROTTLE_DUTY_CYCLE_LEVEL2) \
557 	CFG(CFG_THROTTLE_DUTY_CYCLE_LEVEL3) \
558 	CFG(CFG_THROTTLE_DUTY_CYCLE_LEVEL4) \
559 	CFG(CFG_THROTTLE_DUTY_CYCLE_LEVEL5) \
560 	CFG(CFG_THERMAL_SAMPLING_TIME) \
561 	CFG(CFG_THERMAL_APPS_PRIORITY) \
562 	CFG(CFG_THERMAL_WPPS_PRIOITY) \
563 	CFG(CFG_THERMAL_MGMT_ACTION) \
564 	CFG(CFG_THERMAL_STATS_TEMP_OFFSET)\
565 
566 #endif
567