1 /*
2  * Copyright (c) 2020 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 #ifndef _CFG_HIF_H_
21 #define _CFG_HIF_H_
22 
23 /* Min/Max/default CE status srng timer threshold */
24 #define WLAN_CFG_CE_STATUS_RING_TIMER_THRESH_MIN 0
25 #define WLAN_CFG_CE_STATUS_RING_TIMER_THRESH_MAX 4096
26 #ifdef WLAN_WAR_CE_DISABLE_SRNG_TIMER_IRQ
27 #define WLAN_CFG_CE_STATUS_RING_TIMER_THRESH_DEFAULT 0
28 #else
29 #define WLAN_CFG_CE_STATUS_RING_TIMER_THRESH_DEFAULT 4096
30 #endif
31 
32 /* Min/Max/default CE status srng batch count threshold */
33 #define WLAN_CFG_CE_STATUS_RING_BATCH_COUNT_THRESH_MIN 0
34 #define WLAN_CFG_CE_STATUS_RING_BATCH_COUNT_THRESH_MAX 512
35 #define WLAN_CFG_CE_STATUS_RING_BATCH_COUNT_THRESH_DEFAULT 1
36 
37 #ifdef WLAN_CE_INTERRUPT_THRESHOLD_CONFIG
38 /*
39  * <ini>
40  * ce_status_ring_timer_thresh - ce status srng timer threshold
41  * @Min: 0
42  * @Max: 4096
43  * @Default: 0
44  *
45  * This ini specifies the timer threshold for CE status srng to
46  * indicate the interrupt to be fired whenever the timer threshold
47  * runs out.
48  *
49  * Supported Feature: interrupt threshold for CE status srng
50  *
51  * Usage: Internal
52  *
53  * </ini>
54  */
55 #define CFG_CE_STATUS_RING_TIMER_THRESHOLD \
56 	CFG_INI_UINT("ce_status_ring_timer_threshold", \
57 		     WLAN_CFG_CE_STATUS_RING_TIMER_THRESH_MIN, \
58 		     WLAN_CFG_CE_STATUS_RING_TIMER_THRESH_MAX, \
59 		     WLAN_CFG_CE_STATUS_RING_TIMER_THRESH_DEFAULT, \
60 		     CFG_VALUE_OR_DEFAULT, \
61 		     "CE Status ring timer threshold")
62 
63 #define CFG_RING_TIMER_THRESHOLD CFG(CFG_CE_STATUS_RING_TIMER_THRESHOLD)
64 
65 /*
66  * <ini>
67  * ce_status_ring_batch_count_thresh - ce status srng batch count threshold
68  * @Min: 0
69  * @Max: 512
70  * @Default: 1
71  *
72  * This ini specifies the batch count threshold for CE status srng to
73  * indicate the interrupt to be fired for a given number of packets in
74  * the ring.
75  *
76  * Supported Feature: interrupt threshold for CE status srng
77  *
78  * Usage: Internal
79  *
80  * </ini>
81  */
82 #define CFG_CE_STATUS_RING_BATCH_COUNT_THRESHOLD \
83 	CFG_INI_UINT("ce_status_ring_batch_count_threshold", \
84 		     WLAN_CFG_CE_STATUS_RING_BATCH_COUNT_THRESH_MIN, \
85 		     WLAN_CFG_CE_STATUS_RING_BATCH_COUNT_THRESH_MAX, \
86 		     WLAN_CFG_CE_STATUS_RING_BATCH_COUNT_THRESH_DEFAULT, \
87 		     CFG_VALUE_OR_DEFAULT, \
88 		     "CE Status ring batch count threshold")
89 
90 #define CFG_BATCH_COUNT_THRESHOLD CFG(CFG_CE_STATUS_RING_BATCH_COUNT_THRESHOLD)
91 
92 #else
93 #define CFG_RING_TIMER_THRESHOLD
94 #define CFG_BATCH_COUNT_THRESHOLD
95 #endif /* WLAN_CE_INTERRUPT_THRESHOLD_CONFIG */
96 
97 /*
98  * <ini>
99  * gDisableWakeIrq - Disable wake IRQ or not
100  * @Min: 0
101  * @Max: 1
102  * @Default: 0
103  *
104  * This ini controls driver to disable wake IRQ or not.
105  * Disable wake IRQ for one MSI mode.
106  * If you want to support wake IRQ. Please allocate at least
107  * 2 MSI vector. The first is for wake IRQ while the others
108  * share the second vector.
109  *
110  * Related: None.
111  *
112  * Supported Feature: wake IRQ
113  *
114  * Usage: Internal/External
115  *
116  * </ini>
117  */
118 #define CFG_DISABLE_WAKE_IRQ CFG_INI_BOOL( \
119 	"gDisableWakeIrq", \
120 	0, \
121 	"Disable wake IRQ")
122 
123 /*
124  * <ini>
125  * irq_affine_audio_use_case - IRQ affinity for audio use case supported
126  * @Min: 0
127  * @Max: 1
128  * @Default: 0
129  *
130  * This ini controls driver to enable IRQ affinity for Pro audio use case.
131  *
132  * Related: None.
133  *
134  * Supported Feature: IRQ Affinity
135  *
136  * Usage: External
137  *
138  * </ini>
139  */
140 #define CFG_IRQ_AFFINE_AUDIO_USE_CASE CFG_INI_BOOL( \
141 	"irq_affine_audio_use_case", \
142 	0, \
143 	"Enable IRQ affinity for audio use case")
144 
145 #define CFG_HIF \
146 	CFG_RING_TIMER_THRESHOLD \
147 	CFG_BATCH_COUNT_THRESHOLD \
148 	CFG(CFG_DISABLE_WAKE_IRQ) \
149 	CFG(CFG_IRQ_AFFINE_AUDIO_USE_CASE)
150 
151 #endif /* _CFG_HIF_H_ */
152