xref: /linux/drivers/net/wireless/ath/ath12k/qmi.c (revision ae6ec4a38aa4da73f5d80f61138e03500f00f898)
1d8899132SKalle Valo // SPDX-License-Identifier: BSD-3-Clause-Clear
2d8899132SKalle Valo /*
3d8899132SKalle Valo  * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
459cf57abSJeff Johnson  * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
5d8899132SKalle Valo  */
6d8899132SKalle Valo 
7d8899132SKalle Valo #include <linux/elf.h>
8d8899132SKalle Valo 
9d8899132SKalle Valo #include "qmi.h"
10d8899132SKalle Valo #include "core.h"
11d8899132SKalle Valo #include "debug.h"
12d8899132SKalle Valo #include <linux/of.h>
13d8899132SKalle Valo #include <linux/firmware.h>
14d8899132SKalle Valo 
15d8899132SKalle Valo #define SLEEP_CLOCK_SELECT_INTERNAL_BIT	0x02
16d8899132SKalle Valo #define HOST_CSTATE_BIT			0x04
17d8899132SKalle Valo #define PLATFORM_CAP_PCIE_GLOBAL_RESET	0x08
18d8899132SKalle Valo #define ATH12K_QMI_MAX_CHUNK_SIZE	2097152
19d8899132SKalle Valo 
20e7ab40b7SJeff Johnson static const struct qmi_elem_info wlfw_host_mlo_chip_info_s_v01_ei[] = {
21d8899132SKalle Valo 	{
22d8899132SKalle Valo 		.data_type      = QMI_UNSIGNED_1_BYTE,
23d8899132SKalle Valo 		.elem_len       = 1,
24d8899132SKalle Valo 		.elem_size      = sizeof(u8),
25d8899132SKalle Valo 		.array_type	= NO_ARRAY,
26d8899132SKalle Valo 		.tlv_type       = 0,
27d8899132SKalle Valo 		.offset         = offsetof(struct wlfw_host_mlo_chip_info_s_v01,
28d8899132SKalle Valo 					   chip_id),
29d8899132SKalle Valo 	},
30d8899132SKalle Valo 	{
31d8899132SKalle Valo 		.data_type      = QMI_UNSIGNED_1_BYTE,
32d8899132SKalle Valo 		.elem_len       = 1,
33d8899132SKalle Valo 		.elem_size      = sizeof(u8),
34d8899132SKalle Valo 		.array_type	= NO_ARRAY,
35d8899132SKalle Valo 		.tlv_type       = 0,
36d8899132SKalle Valo 		.offset         = offsetof(struct wlfw_host_mlo_chip_info_s_v01,
37d8899132SKalle Valo 					   num_local_links),
38d8899132SKalle Valo 	},
39d8899132SKalle Valo 	{
40d8899132SKalle Valo 		.data_type      = QMI_UNSIGNED_1_BYTE,
41d8899132SKalle Valo 		.elem_len       = QMI_WLFW_MAX_NUM_MLO_LINKS_PER_CHIP_V01,
42d8899132SKalle Valo 		.elem_size      = sizeof(u8),
43d8899132SKalle Valo 		.array_type     = STATIC_ARRAY,
44d8899132SKalle Valo 		.tlv_type       = 0,
45d8899132SKalle Valo 		.offset         = offsetof(struct wlfw_host_mlo_chip_info_s_v01,
46d8899132SKalle Valo 					   hw_link_id),
47d8899132SKalle Valo 	},
48d8899132SKalle Valo 	{
49d8899132SKalle Valo 		.data_type      = QMI_UNSIGNED_1_BYTE,
50d8899132SKalle Valo 		.elem_len       = QMI_WLFW_MAX_NUM_MLO_LINKS_PER_CHIP_V01,
51d8899132SKalle Valo 		.elem_size      = sizeof(u8),
52d8899132SKalle Valo 		.array_type     = STATIC_ARRAY,
53d8899132SKalle Valo 		.tlv_type       = 0,
54d8899132SKalle Valo 		.offset         = offsetof(struct wlfw_host_mlo_chip_info_s_v01,
55d8899132SKalle Valo 					   valid_mlo_link_id),
56d8899132SKalle Valo 	},
57d8899132SKalle Valo 	{
58d8899132SKalle Valo 		.data_type      = QMI_EOTI,
59d8899132SKalle Valo 		.array_type	= NO_ARRAY,
60d8899132SKalle Valo 		.tlv_type       = QMI_COMMON_TLV_TYPE,
61d8899132SKalle Valo 	},
62d8899132SKalle Valo };
63d8899132SKalle Valo 
64e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_host_cap_req_msg_v01_ei[] = {
65d8899132SKalle Valo 	{
66d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
67d8899132SKalle Valo 		.elem_len	= 1,
68d8899132SKalle Valo 		.elem_size	= sizeof(u8),
69d8899132SKalle Valo 		.array_type	= NO_ARRAY,
70d8899132SKalle Valo 		.tlv_type	= 0x10,
71d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
72d8899132SKalle Valo 					   num_clients_valid),
73d8899132SKalle Valo 	},
74d8899132SKalle Valo 	{
75d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_4_BYTE,
76d8899132SKalle Valo 		.elem_len	= 1,
77d8899132SKalle Valo 		.elem_size	= sizeof(u32),
78d8899132SKalle Valo 		.array_type	= NO_ARRAY,
79d8899132SKalle Valo 		.tlv_type	= 0x10,
80d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
81d8899132SKalle Valo 					   num_clients),
82d8899132SKalle Valo 	},
83d8899132SKalle Valo 	{
84d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
85d8899132SKalle Valo 		.elem_len	= 1,
86d8899132SKalle Valo 		.elem_size	= sizeof(u8),
87d8899132SKalle Valo 		.array_type	= NO_ARRAY,
88d8899132SKalle Valo 		.tlv_type	= 0x11,
89d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
90d8899132SKalle Valo 					   wake_msi_valid),
91d8899132SKalle Valo 	},
92d8899132SKalle Valo 	{
93d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_4_BYTE,
94d8899132SKalle Valo 		.elem_len	= 1,
95d8899132SKalle Valo 		.elem_size	= sizeof(u32),
96d8899132SKalle Valo 		.array_type	= NO_ARRAY,
97d8899132SKalle Valo 		.tlv_type	= 0x11,
98d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
99d8899132SKalle Valo 					   wake_msi),
100d8899132SKalle Valo 	},
101d8899132SKalle Valo 	{
102d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
103d8899132SKalle Valo 		.elem_len	= 1,
104d8899132SKalle Valo 		.elem_size	= sizeof(u8),
105d8899132SKalle Valo 		.array_type	= NO_ARRAY,
106d8899132SKalle Valo 		.tlv_type	= 0x12,
107d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
108d8899132SKalle Valo 					   gpios_valid),
109d8899132SKalle Valo 	},
110d8899132SKalle Valo 	{
111d8899132SKalle Valo 		.data_type	= QMI_DATA_LEN,
112d8899132SKalle Valo 		.elem_len	= 1,
113d8899132SKalle Valo 		.elem_size	= sizeof(u8),
114d8899132SKalle Valo 		.array_type	= NO_ARRAY,
115d8899132SKalle Valo 		.tlv_type	= 0x12,
116d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
117d8899132SKalle Valo 					   gpios_len),
118d8899132SKalle Valo 	},
119d8899132SKalle Valo 	{
120d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_4_BYTE,
121d8899132SKalle Valo 		.elem_len	= QMI_WLFW_MAX_NUM_GPIO_V01,
122d8899132SKalle Valo 		.elem_size	= sizeof(u32),
123d8899132SKalle Valo 		.array_type	= VAR_LEN_ARRAY,
124d8899132SKalle Valo 		.tlv_type	= 0x12,
125d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
126d8899132SKalle Valo 					   gpios),
127d8899132SKalle Valo 	},
128d8899132SKalle Valo 	{
129d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
130d8899132SKalle Valo 		.elem_len	= 1,
131d8899132SKalle Valo 		.elem_size	= sizeof(u8),
132d8899132SKalle Valo 		.array_type	= NO_ARRAY,
133d8899132SKalle Valo 		.tlv_type	= 0x13,
134d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
135d8899132SKalle Valo 					   nm_modem_valid),
136d8899132SKalle Valo 	},
137d8899132SKalle Valo 	{
138d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
139d8899132SKalle Valo 		.elem_len	= 1,
140d8899132SKalle Valo 		.elem_size	= sizeof(u8),
141d8899132SKalle Valo 		.array_type	= NO_ARRAY,
142d8899132SKalle Valo 		.tlv_type	= 0x13,
143d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
144d8899132SKalle Valo 					   nm_modem),
145d8899132SKalle Valo 	},
146d8899132SKalle Valo 	{
147d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
148d8899132SKalle Valo 		.elem_len	= 1,
149d8899132SKalle Valo 		.elem_size	= sizeof(u8),
150d8899132SKalle Valo 		.array_type	= NO_ARRAY,
151d8899132SKalle Valo 		.tlv_type	= 0x14,
152d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
153d8899132SKalle Valo 					   bdf_support_valid),
154d8899132SKalle Valo 	},
155d8899132SKalle Valo 	{
156d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
157d8899132SKalle Valo 		.elem_len	= 1,
158d8899132SKalle Valo 		.elem_size	= sizeof(u8),
159d8899132SKalle Valo 		.array_type	= NO_ARRAY,
160d8899132SKalle Valo 		.tlv_type	= 0x14,
161d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
162d8899132SKalle Valo 					   bdf_support),
163d8899132SKalle Valo 	},
164d8899132SKalle Valo 	{
165d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
166d8899132SKalle Valo 		.elem_len	= 1,
167d8899132SKalle Valo 		.elem_size	= sizeof(u8),
168d8899132SKalle Valo 		.array_type	= NO_ARRAY,
169d8899132SKalle Valo 		.tlv_type	= 0x15,
170d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
171d8899132SKalle Valo 					   bdf_cache_support_valid),
172d8899132SKalle Valo 	},
173d8899132SKalle Valo 	{
174d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
175d8899132SKalle Valo 		.elem_len	= 1,
176d8899132SKalle Valo 		.elem_size	= sizeof(u8),
177d8899132SKalle Valo 		.array_type	= NO_ARRAY,
178d8899132SKalle Valo 		.tlv_type	= 0x15,
179d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
180d8899132SKalle Valo 					   bdf_cache_support),
181d8899132SKalle Valo 	},
182d8899132SKalle Valo 	{
183d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
184d8899132SKalle Valo 		.elem_len	= 1,
185d8899132SKalle Valo 		.elem_size	= sizeof(u8),
186d8899132SKalle Valo 		.array_type	= NO_ARRAY,
187d8899132SKalle Valo 		.tlv_type	= 0x16,
188d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
189d8899132SKalle Valo 					   m3_support_valid),
190d8899132SKalle Valo 	},
191d8899132SKalle Valo 	{
192d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
193d8899132SKalle Valo 		.elem_len	= 1,
194d8899132SKalle Valo 		.elem_size	= sizeof(u8),
195d8899132SKalle Valo 		.array_type	= NO_ARRAY,
196d8899132SKalle Valo 		.tlv_type	= 0x16,
197d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
198d8899132SKalle Valo 					   m3_support),
199d8899132SKalle Valo 	},
200d8899132SKalle Valo 	{
201d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
202d8899132SKalle Valo 		.elem_len	= 1,
203d8899132SKalle Valo 		.elem_size	= sizeof(u8),
204d8899132SKalle Valo 		.array_type	= NO_ARRAY,
205d8899132SKalle Valo 		.tlv_type	= 0x17,
206d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
207d8899132SKalle Valo 					   m3_cache_support_valid),
208d8899132SKalle Valo 	},
209d8899132SKalle Valo 	{
210d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
211d8899132SKalle Valo 		.elem_len	= 1,
212d8899132SKalle Valo 		.elem_size	= sizeof(u8),
213d8899132SKalle Valo 		.array_type	= NO_ARRAY,
214d8899132SKalle Valo 		.tlv_type	= 0x17,
215d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
216d8899132SKalle Valo 					   m3_cache_support),
217d8899132SKalle Valo 	},
218d8899132SKalle Valo 	{
219d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
220d8899132SKalle Valo 		.elem_len	= 1,
221d8899132SKalle Valo 		.elem_size	= sizeof(u8),
222d8899132SKalle Valo 		.array_type	= NO_ARRAY,
223d8899132SKalle Valo 		.tlv_type	= 0x18,
224d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
225d8899132SKalle Valo 					   cal_filesys_support_valid),
226d8899132SKalle Valo 	},
227d8899132SKalle Valo 	{
228d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
229d8899132SKalle Valo 		.elem_len	= 1,
230d8899132SKalle Valo 		.elem_size	= sizeof(u8),
231d8899132SKalle Valo 		.array_type	= NO_ARRAY,
232d8899132SKalle Valo 		.tlv_type	= 0x18,
233d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
234d8899132SKalle Valo 					   cal_filesys_support),
235d8899132SKalle Valo 	},
236d8899132SKalle Valo 	{
237d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
238d8899132SKalle Valo 		.elem_len	= 1,
239d8899132SKalle Valo 		.elem_size	= sizeof(u8),
240d8899132SKalle Valo 		.array_type	= NO_ARRAY,
241d8899132SKalle Valo 		.tlv_type	= 0x19,
242d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
243d8899132SKalle Valo 					   cal_cache_support_valid),
244d8899132SKalle Valo 	},
245d8899132SKalle Valo 	{
246d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
247d8899132SKalle Valo 		.elem_len	= 1,
248d8899132SKalle Valo 		.elem_size	= sizeof(u8),
249d8899132SKalle Valo 		.array_type	= NO_ARRAY,
250d8899132SKalle Valo 		.tlv_type	= 0x19,
251d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
252d8899132SKalle Valo 					   cal_cache_support),
253d8899132SKalle Valo 	},
254d8899132SKalle Valo 	{
255d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
256d8899132SKalle Valo 		.elem_len	= 1,
257d8899132SKalle Valo 		.elem_size	= sizeof(u8),
258d8899132SKalle Valo 		.array_type	= NO_ARRAY,
259d8899132SKalle Valo 		.tlv_type	= 0x1A,
260d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
261d8899132SKalle Valo 					   cal_done_valid),
262d8899132SKalle Valo 	},
263d8899132SKalle Valo 	{
264d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
265d8899132SKalle Valo 		.elem_len	= 1,
266d8899132SKalle Valo 		.elem_size	= sizeof(u8),
267d8899132SKalle Valo 		.array_type	= NO_ARRAY,
268d8899132SKalle Valo 		.tlv_type	= 0x1A,
269d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
270d8899132SKalle Valo 					   cal_done),
271d8899132SKalle Valo 	},
272d8899132SKalle Valo 	{
273d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
274d8899132SKalle Valo 		.elem_len	= 1,
275d8899132SKalle Valo 		.elem_size	= sizeof(u8),
276d8899132SKalle Valo 		.array_type	= NO_ARRAY,
277d8899132SKalle Valo 		.tlv_type	= 0x1B,
278d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
279d8899132SKalle Valo 					   mem_bucket_valid),
280d8899132SKalle Valo 	},
281d8899132SKalle Valo 	{
282d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_4_BYTE,
283d8899132SKalle Valo 		.elem_len	= 1,
284d8899132SKalle Valo 		.elem_size	= sizeof(u32),
285d8899132SKalle Valo 		.array_type	= NO_ARRAY,
286d8899132SKalle Valo 		.tlv_type	= 0x1B,
287d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
288d8899132SKalle Valo 					   mem_bucket),
289d8899132SKalle Valo 	},
290d8899132SKalle Valo 	{
291d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
292d8899132SKalle Valo 		.elem_len	= 1,
293d8899132SKalle Valo 		.elem_size	= sizeof(u8),
294d8899132SKalle Valo 		.array_type	= NO_ARRAY,
295d8899132SKalle Valo 		.tlv_type	= 0x1C,
296d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
297d8899132SKalle Valo 					   mem_cfg_mode_valid),
298d8899132SKalle Valo 	},
299d8899132SKalle Valo 	{
300d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
301d8899132SKalle Valo 		.elem_len	= 1,
302d8899132SKalle Valo 		.elem_size	= sizeof(u8),
303d8899132SKalle Valo 		.array_type	= NO_ARRAY,
304d8899132SKalle Valo 		.tlv_type	= 0x1C,
305d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
306d8899132SKalle Valo 					   mem_cfg_mode),
307d8899132SKalle Valo 	},
308d8899132SKalle Valo 	{
309d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
310d8899132SKalle Valo 		.elem_len	= 1,
311d8899132SKalle Valo 		.elem_size	= sizeof(u8),
312d8899132SKalle Valo 		.array_type	= NO_ARRAY,
313d8899132SKalle Valo 		.tlv_type	= 0x1D,
314d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
315d8899132SKalle Valo 					   cal_duration_valid),
316d8899132SKalle Valo 	},
317d8899132SKalle Valo 	{
318d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_2_BYTE,
319d8899132SKalle Valo 		.elem_len	= 1,
320d8899132SKalle Valo 		.elem_size	= sizeof(u16),
321d8899132SKalle Valo 		.array_type	= NO_ARRAY,
322d8899132SKalle Valo 		.tlv_type	= 0x1D,
323d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
324d8899132SKalle Valo 					   cal_duraiton),
325d8899132SKalle Valo 	},
326d8899132SKalle Valo 	{
327d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
328d8899132SKalle Valo 		.elem_len	= 1,
329d8899132SKalle Valo 		.elem_size	= sizeof(u8),
330d8899132SKalle Valo 		.array_type	= NO_ARRAY,
331d8899132SKalle Valo 		.tlv_type	= 0x1E,
332d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
333d8899132SKalle Valo 					   platform_name_valid),
334d8899132SKalle Valo 	},
335d8899132SKalle Valo 	{
336d8899132SKalle Valo 		.data_type	= QMI_STRING,
337d8899132SKalle Valo 		.elem_len	= QMI_WLANFW_MAX_PLATFORM_NAME_LEN_V01 + 1,
338d8899132SKalle Valo 		.elem_size	= sizeof(char),
339d8899132SKalle Valo 		.array_type	= NO_ARRAY,
340d8899132SKalle Valo 		.tlv_type	= 0x1E,
341d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
342d8899132SKalle Valo 					   platform_name),
343d8899132SKalle Valo 	},
344d8899132SKalle Valo 	{
345d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
346d8899132SKalle Valo 		.elem_len	= 1,
347d8899132SKalle Valo 		.elem_size	= sizeof(u8),
348d8899132SKalle Valo 		.array_type	= NO_ARRAY,
349d8899132SKalle Valo 		.tlv_type	= 0x1F,
350d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
351d8899132SKalle Valo 					   ddr_range_valid),
352d8899132SKalle Valo 	},
353d8899132SKalle Valo 	{
354d8899132SKalle Valo 		.data_type	= QMI_STRUCT,
355d8899132SKalle Valo 		.elem_len	= QMI_WLANFW_MAX_HOST_DDR_RANGE_SIZE_V01,
356d8899132SKalle Valo 		.elem_size	= sizeof(struct qmi_wlanfw_host_ddr_range),
357d8899132SKalle Valo 		.array_type	= STATIC_ARRAY,
358d8899132SKalle Valo 		.tlv_type	= 0x1F,
359d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
360d8899132SKalle Valo 					   ddr_range),
361d8899132SKalle Valo 	},
362d8899132SKalle Valo 	{
363d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
364d8899132SKalle Valo 		.elem_len	= 1,
365d8899132SKalle Valo 		.elem_size	= sizeof(u8),
366d8899132SKalle Valo 		.array_type	= NO_ARRAY,
367d8899132SKalle Valo 		.tlv_type	= 0x20,
368d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
369d8899132SKalle Valo 					   host_build_type_valid),
370d8899132SKalle Valo 	},
371d8899132SKalle Valo 	{
372d8899132SKalle Valo 		.data_type	= QMI_SIGNED_4_BYTE_ENUM,
373d8899132SKalle Valo 		.elem_len	= 1,
374d8899132SKalle Valo 		.elem_size	= sizeof(enum qmi_wlanfw_host_build_type),
375d8899132SKalle Valo 		.array_type	= NO_ARRAY,
376d8899132SKalle Valo 		.tlv_type	= 0x20,
377d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
378d8899132SKalle Valo 					   host_build_type),
379d8899132SKalle Valo 	},
380d8899132SKalle Valo 	{
381d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
382d8899132SKalle Valo 		.elem_len	= 1,
383d8899132SKalle Valo 		.elem_size	= sizeof(u8),
384d8899132SKalle Valo 		.array_type	= NO_ARRAY,
385d8899132SKalle Valo 		.tlv_type	= 0x21,
386d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
387d8899132SKalle Valo 					   mlo_capable_valid),
388d8899132SKalle Valo 	},
389d8899132SKalle Valo 	{
39015c8441dSWen Gong 		.data_type	= QMI_UNSIGNED_1_BYTE,
391d8899132SKalle Valo 		.elem_len	= 1,
392d8899132SKalle Valo 		.elem_size	= sizeof(u8),
393d8899132SKalle Valo 		.array_type	= NO_ARRAY,
394d8899132SKalle Valo 		.tlv_type	= 0x21,
395d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
396d8899132SKalle Valo 					   mlo_capable),
397d8899132SKalle Valo 	},
398d8899132SKalle Valo 	{
399d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
400d8899132SKalle Valo 		.elem_len	= 1,
401d8899132SKalle Valo 		.elem_size	= sizeof(u8),
402d8899132SKalle Valo 		.array_type	= NO_ARRAY,
403d8899132SKalle Valo 		.tlv_type	= 0x22,
404d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
405d8899132SKalle Valo 					   mlo_chip_id_valid),
406d8899132SKalle Valo 	},
407d8899132SKalle Valo 	{
408d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_2_BYTE,
409d8899132SKalle Valo 		.elem_len	= 1,
410d8899132SKalle Valo 		.elem_size	= sizeof(u16),
411d8899132SKalle Valo 		.array_type	= NO_ARRAY,
412d8899132SKalle Valo 		.tlv_type	= 0x22,
413d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
414d8899132SKalle Valo 					   mlo_chip_id),
415d8899132SKalle Valo 	},
416d8899132SKalle Valo 	{
417d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
418d8899132SKalle Valo 		.elem_len	= 1,
419d8899132SKalle Valo 		.elem_size	= sizeof(u8),
420d8899132SKalle Valo 		.array_type	= NO_ARRAY,
421d8899132SKalle Valo 		.tlv_type	= 0x23,
422d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
423d8899132SKalle Valo 					   mlo_group_id_valid),
424d8899132SKalle Valo 	},
425d8899132SKalle Valo 	{
426d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
427d8899132SKalle Valo 		.elem_len	= 1,
428d8899132SKalle Valo 		.elem_size	= sizeof(u8),
429d8899132SKalle Valo 		.array_type	= NO_ARRAY,
430d8899132SKalle Valo 		.tlv_type	= 0x23,
431d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
432d8899132SKalle Valo 					   mlo_group_id),
433d8899132SKalle Valo 	},
434d8899132SKalle Valo 	{
435d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
436d8899132SKalle Valo 		.elem_len	= 1,
437d8899132SKalle Valo 		.elem_size	= sizeof(u8),
438d8899132SKalle Valo 		.array_type	= NO_ARRAY,
439d8899132SKalle Valo 		.tlv_type	= 0x24,
440d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
441d8899132SKalle Valo 					   max_mlo_peer_valid),
442d8899132SKalle Valo 	},
443d8899132SKalle Valo 	{
444d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_2_BYTE,
445d8899132SKalle Valo 		.elem_len	= 1,
446d8899132SKalle Valo 		.elem_size	= sizeof(u16),
447d8899132SKalle Valo 		.array_type	= NO_ARRAY,
448d8899132SKalle Valo 		.tlv_type	= 0x24,
449d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
450d8899132SKalle Valo 					   max_mlo_peer),
451d8899132SKalle Valo 	},
452d8899132SKalle Valo 	{
453d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
454d8899132SKalle Valo 		.elem_len	= 1,
455d8899132SKalle Valo 		.elem_size	= sizeof(u8),
456d8899132SKalle Valo 		.array_type	= NO_ARRAY,
457d8899132SKalle Valo 		.tlv_type	= 0x25,
458d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
459d8899132SKalle Valo 					   mlo_num_chips_valid),
460d8899132SKalle Valo 	},
461d8899132SKalle Valo 	{
462d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
463d8899132SKalle Valo 		.elem_len	= 1,
464d8899132SKalle Valo 		.elem_size	= sizeof(u8),
465d8899132SKalle Valo 		.array_type	= NO_ARRAY,
466d8899132SKalle Valo 		.tlv_type	= 0x25,
467d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
468d8899132SKalle Valo 					   mlo_num_chips),
469d8899132SKalle Valo 	},
470d8899132SKalle Valo 	{
471d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
472d8899132SKalle Valo 		.elem_len	= 1,
473d8899132SKalle Valo 		.elem_size	= sizeof(u8),
474d8899132SKalle Valo 		.array_type	= NO_ARRAY,
475d8899132SKalle Valo 		.tlv_type	= 0x26,
476d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
477d8899132SKalle Valo 					   mlo_chip_info_valid),
478d8899132SKalle Valo 	},
479d8899132SKalle Valo 	{
480d8899132SKalle Valo 		.data_type	= QMI_STRUCT,
481d8899132SKalle Valo 		.elem_len	= QMI_WLFW_MAX_NUM_MLO_CHIPS_V01,
482d8899132SKalle Valo 		.elem_size	= sizeof(struct wlfw_host_mlo_chip_info_s_v01),
483d8899132SKalle Valo 		.array_type	= STATIC_ARRAY,
484d8899132SKalle Valo 		.tlv_type	= 0x26,
485d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
486d8899132SKalle Valo 					   mlo_chip_info),
487d8899132SKalle Valo 		.ei_array	= wlfw_host_mlo_chip_info_s_v01_ei,
488d8899132SKalle Valo 	},
489d8899132SKalle Valo 	{
490d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
491d8899132SKalle Valo 		.elem_len	= 1,
492d8899132SKalle Valo 		.elem_size	= sizeof(u8),
493d8899132SKalle Valo 		.array_type	= NO_ARRAY,
494d8899132SKalle Valo 		.tlv_type	= 0x27,
495d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
496d8899132SKalle Valo 					   feature_list_valid),
497d8899132SKalle Valo 	},
498d8899132SKalle Valo 	{
499d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_8_BYTE,
500d8899132SKalle Valo 		.elem_len	= 1,
501d8899132SKalle Valo 		.elem_size	= sizeof(u64),
502d8899132SKalle Valo 		.array_type	= NO_ARRAY,
503d8899132SKalle Valo 		.tlv_type	= 0x27,
504d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01,
505d8899132SKalle Valo 					   feature_list),
506d8899132SKalle Valo 	},
507d8899132SKalle Valo 	{
508d8899132SKalle Valo 		.data_type	= QMI_EOTI,
509d8899132SKalle Valo 		.array_type	= NO_ARRAY,
510d8899132SKalle Valo 		.tlv_type	= QMI_COMMON_TLV_TYPE,
511d8899132SKalle Valo 	},
512d8899132SKalle Valo };
513d8899132SKalle Valo 
514e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_host_cap_resp_msg_v01_ei[] = {
515d8899132SKalle Valo 	{
516d8899132SKalle Valo 		.data_type	= QMI_STRUCT,
517d8899132SKalle Valo 		.elem_len	= 1,
518d8899132SKalle Valo 		.elem_size	= sizeof(struct qmi_response_type_v01),
519d8899132SKalle Valo 		.array_type	= NO_ARRAY,
520d8899132SKalle Valo 		.tlv_type	= 0x02,
521d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_host_cap_resp_msg_v01, resp),
522d8899132SKalle Valo 		.ei_array	= qmi_response_type_v01_ei,
523d8899132SKalle Valo 	},
524d8899132SKalle Valo 	{
525d8899132SKalle Valo 		.data_type	= QMI_EOTI,
526d8899132SKalle Valo 		.array_type	= NO_ARRAY,
527d8899132SKalle Valo 		.tlv_type	= QMI_COMMON_TLV_TYPE,
528d8899132SKalle Valo 	},
529d8899132SKalle Valo };
530d8899132SKalle Valo 
53153a65445SKarthikeyan Periyasamy static const struct qmi_elem_info qmi_wlanfw_phy_cap_req_msg_v01_ei[] = {
53253a65445SKarthikeyan Periyasamy 	{
53353a65445SKarthikeyan Periyasamy 		.data_type	= QMI_EOTI,
53453a65445SKarthikeyan Periyasamy 		.array_type	= NO_ARRAY,
53553a65445SKarthikeyan Periyasamy 		.tlv_type	= QMI_COMMON_TLV_TYPE,
53653a65445SKarthikeyan Periyasamy 	},
53753a65445SKarthikeyan Periyasamy };
53853a65445SKarthikeyan Periyasamy 
53953a65445SKarthikeyan Periyasamy static const struct qmi_elem_info qmi_wlanfw_phy_cap_resp_msg_v01_ei[] = {
54053a65445SKarthikeyan Periyasamy 	{
54153a65445SKarthikeyan Periyasamy 		.data_type	= QMI_STRUCT,
54253a65445SKarthikeyan Periyasamy 		.elem_len	= 1,
54353a65445SKarthikeyan Periyasamy 		.elem_size	= sizeof(struct qmi_response_type_v01),
54453a65445SKarthikeyan Periyasamy 		.array_type	= NO_ARRAY,
54553a65445SKarthikeyan Periyasamy 		.tlv_type	= 0x02,
54653a65445SKarthikeyan Periyasamy 		.offset		= offsetof(struct qmi_wlanfw_phy_cap_resp_msg_v01, resp),
54753a65445SKarthikeyan Periyasamy 		.ei_array	= qmi_response_type_v01_ei,
54853a65445SKarthikeyan Periyasamy 	},
54953a65445SKarthikeyan Periyasamy 	{
55053a65445SKarthikeyan Periyasamy 		.data_type	= QMI_OPT_FLAG,
55153a65445SKarthikeyan Periyasamy 		.elem_len	= 1,
55253a65445SKarthikeyan Periyasamy 		.elem_size	= sizeof(u8),
55353a65445SKarthikeyan Periyasamy 		.array_type	= NO_ARRAY,
55453a65445SKarthikeyan Periyasamy 		.tlv_type	= 0x10,
55553a65445SKarthikeyan Periyasamy 		.offset		= offsetof(struct qmi_wlanfw_phy_cap_resp_msg_v01,
55653a65445SKarthikeyan Periyasamy 					   num_phy_valid),
55753a65445SKarthikeyan Periyasamy 	},
55853a65445SKarthikeyan Periyasamy 	{
55953a65445SKarthikeyan Periyasamy 		.data_type	= QMI_UNSIGNED_1_BYTE,
56053a65445SKarthikeyan Periyasamy 		.elem_len	= 1,
56153a65445SKarthikeyan Periyasamy 		.elem_size	= sizeof(u8),
56253a65445SKarthikeyan Periyasamy 		.array_type	= NO_ARRAY,
56353a65445SKarthikeyan Periyasamy 		.tlv_type	= 0x10,
56453a65445SKarthikeyan Periyasamy 		.offset		= offsetof(struct qmi_wlanfw_phy_cap_resp_msg_v01,
56553a65445SKarthikeyan Periyasamy 					   num_phy),
56653a65445SKarthikeyan Periyasamy 	},
56753a65445SKarthikeyan Periyasamy 	{
56853a65445SKarthikeyan Periyasamy 		.data_type	= QMI_OPT_FLAG,
56953a65445SKarthikeyan Periyasamy 		.elem_len	= 1,
57053a65445SKarthikeyan Periyasamy 		.elem_size	= sizeof(u8),
57153a65445SKarthikeyan Periyasamy 		.array_type	= NO_ARRAY,
57253a65445SKarthikeyan Periyasamy 		.tlv_type	= 0x11,
57353a65445SKarthikeyan Periyasamy 		.offset		= offsetof(struct qmi_wlanfw_phy_cap_resp_msg_v01,
57453a65445SKarthikeyan Periyasamy 					   board_id_valid),
57553a65445SKarthikeyan Periyasamy 	},
57653a65445SKarthikeyan Periyasamy 	{
57753a65445SKarthikeyan Periyasamy 		.data_type	= QMI_UNSIGNED_4_BYTE,
57853a65445SKarthikeyan Periyasamy 		.elem_len	= 1,
57953a65445SKarthikeyan Periyasamy 		.elem_size	= sizeof(u32),
58053a65445SKarthikeyan Periyasamy 		.array_type	= NO_ARRAY,
58153a65445SKarthikeyan Periyasamy 		.tlv_type	= 0x11,
58253a65445SKarthikeyan Periyasamy 		.offset		= offsetof(struct qmi_wlanfw_phy_cap_resp_msg_v01,
58353a65445SKarthikeyan Periyasamy 					   board_id),
58453a65445SKarthikeyan Periyasamy 	},
58553a65445SKarthikeyan Periyasamy 	{
586*ae6ec4a3SRaj Kumar Bhagat 		.data_type      = QMI_OPT_FLAG,
587*ae6ec4a3SRaj Kumar Bhagat 		.elem_len       = 1,
588*ae6ec4a3SRaj Kumar Bhagat 		.elem_size      = sizeof(u8),
589*ae6ec4a3SRaj Kumar Bhagat 		.array_type     = NO_ARRAY,
590*ae6ec4a3SRaj Kumar Bhagat 		.tlv_type       = 0x13,
591*ae6ec4a3SRaj Kumar Bhagat 		.offset         = offsetof(struct qmi_wlanfw_phy_cap_resp_msg_v01,
592*ae6ec4a3SRaj Kumar Bhagat 					   single_chip_mlo_support_valid),
593*ae6ec4a3SRaj Kumar Bhagat 	},
594*ae6ec4a3SRaj Kumar Bhagat 	{
595*ae6ec4a3SRaj Kumar Bhagat 		.data_type      = QMI_UNSIGNED_1_BYTE,
596*ae6ec4a3SRaj Kumar Bhagat 		.elem_len       = 1,
597*ae6ec4a3SRaj Kumar Bhagat 		.elem_size      = sizeof(u8),
598*ae6ec4a3SRaj Kumar Bhagat 		.array_type     = NO_ARRAY,
599*ae6ec4a3SRaj Kumar Bhagat 		.tlv_type       = 0x13,
600*ae6ec4a3SRaj Kumar Bhagat 		.offset         = offsetof(struct qmi_wlanfw_phy_cap_resp_msg_v01,
601*ae6ec4a3SRaj Kumar Bhagat 					   single_chip_mlo_support),
602*ae6ec4a3SRaj Kumar Bhagat 	},
603*ae6ec4a3SRaj Kumar Bhagat 	{
60453a65445SKarthikeyan Periyasamy 		.data_type	= QMI_EOTI,
60553a65445SKarthikeyan Periyasamy 		.array_type	= NO_ARRAY,
60653a65445SKarthikeyan Periyasamy 		.tlv_type	= QMI_COMMON_TLV_TYPE,
60753a65445SKarthikeyan Periyasamy 	},
60853a65445SKarthikeyan Periyasamy };
60953a65445SKarthikeyan Periyasamy 
610e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_ind_register_req_msg_v01_ei[] = {
611d8899132SKalle Valo 	{
612d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
613d8899132SKalle Valo 		.elem_len	= 1,
614d8899132SKalle Valo 		.elem_size	= sizeof(u8),
615d8899132SKalle Valo 		.array_type	= NO_ARRAY,
616d8899132SKalle Valo 		.tlv_type	= 0x10,
617d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01,
618d8899132SKalle Valo 					   fw_ready_enable_valid),
619d8899132SKalle Valo 	},
620d8899132SKalle Valo 	{
621d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
622d8899132SKalle Valo 		.elem_len	= 1,
623d8899132SKalle Valo 		.elem_size	= sizeof(u8),
624d8899132SKalle Valo 		.array_type	= NO_ARRAY,
625d8899132SKalle Valo 		.tlv_type	= 0x10,
626d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01,
627d8899132SKalle Valo 					   fw_ready_enable),
628d8899132SKalle Valo 	},
629d8899132SKalle Valo 	{
630d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
631d8899132SKalle Valo 		.elem_len	= 1,
632d8899132SKalle Valo 		.elem_size	= sizeof(u8),
633d8899132SKalle Valo 		.array_type	= NO_ARRAY,
634d8899132SKalle Valo 		.tlv_type	= 0x11,
635d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01,
636d8899132SKalle Valo 					   initiate_cal_download_enable_valid),
637d8899132SKalle Valo 	},
638d8899132SKalle Valo 	{
639d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
640d8899132SKalle Valo 		.elem_len	= 1,
641d8899132SKalle Valo 		.elem_size	= sizeof(u8),
642d8899132SKalle Valo 		.array_type	= NO_ARRAY,
643d8899132SKalle Valo 		.tlv_type	= 0x11,
644d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01,
645d8899132SKalle Valo 					   initiate_cal_download_enable),
646d8899132SKalle Valo 	},
647d8899132SKalle Valo 	{
648d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
649d8899132SKalle Valo 		.elem_len	= 1,
650d8899132SKalle Valo 		.elem_size	= sizeof(u8),
651d8899132SKalle Valo 		.array_type	= NO_ARRAY,
652d8899132SKalle Valo 		.tlv_type	= 0x12,
653d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01,
654d8899132SKalle Valo 					   initiate_cal_update_enable_valid),
655d8899132SKalle Valo 	},
656d8899132SKalle Valo 	{
657d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
658d8899132SKalle Valo 		.elem_len	= 1,
659d8899132SKalle Valo 		.elem_size	= sizeof(u8),
660d8899132SKalle Valo 		.array_type	= NO_ARRAY,
661d8899132SKalle Valo 		.tlv_type	= 0x12,
662d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01,
663d8899132SKalle Valo 					   initiate_cal_update_enable),
664d8899132SKalle Valo 	},
665d8899132SKalle Valo 	{
666d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
667d8899132SKalle Valo 		.elem_len	= 1,
668d8899132SKalle Valo 		.elem_size	= sizeof(u8),
669d8899132SKalle Valo 		.array_type	= NO_ARRAY,
670d8899132SKalle Valo 		.tlv_type	= 0x13,
671d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01,
672d8899132SKalle Valo 					   msa_ready_enable_valid),
673d8899132SKalle Valo 	},
674d8899132SKalle Valo 	{
675d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
676d8899132SKalle Valo 		.elem_len	= 1,
677d8899132SKalle Valo 		.elem_size	= sizeof(u8),
678d8899132SKalle Valo 		.array_type	= NO_ARRAY,
679d8899132SKalle Valo 		.tlv_type	= 0x13,
680d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01,
681d8899132SKalle Valo 					   msa_ready_enable),
682d8899132SKalle Valo 	},
683d8899132SKalle Valo 	{
684d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
685d8899132SKalle Valo 		.elem_len	= 1,
686d8899132SKalle Valo 		.elem_size	= sizeof(u8),
687d8899132SKalle Valo 		.array_type	= NO_ARRAY,
688d8899132SKalle Valo 		.tlv_type	= 0x14,
689d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01,
690d8899132SKalle Valo 					   pin_connect_result_enable_valid),
691d8899132SKalle Valo 	},
692d8899132SKalle Valo 	{
693d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
694d8899132SKalle Valo 		.elem_len	= 1,
695d8899132SKalle Valo 		.elem_size	= sizeof(u8),
696d8899132SKalle Valo 		.array_type	= NO_ARRAY,
697d8899132SKalle Valo 		.tlv_type	= 0x14,
698d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01,
699d8899132SKalle Valo 					   pin_connect_result_enable),
700d8899132SKalle Valo 	},
701d8899132SKalle Valo 	{
702d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
703d8899132SKalle Valo 		.elem_len	= 1,
704d8899132SKalle Valo 		.elem_size	= sizeof(u8),
705d8899132SKalle Valo 		.array_type	= NO_ARRAY,
706d8899132SKalle Valo 		.tlv_type	= 0x15,
707d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01,
708d8899132SKalle Valo 					   client_id_valid),
709d8899132SKalle Valo 	},
710d8899132SKalle Valo 	{
711d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_4_BYTE,
712d8899132SKalle Valo 		.elem_len	= 1,
713d8899132SKalle Valo 		.elem_size	= sizeof(u32),
714d8899132SKalle Valo 		.array_type	= NO_ARRAY,
715d8899132SKalle Valo 		.tlv_type	= 0x15,
716d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01,
717d8899132SKalle Valo 					   client_id),
718d8899132SKalle Valo 	},
719d8899132SKalle Valo 	{
720d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
721d8899132SKalle Valo 		.elem_len	= 1,
722d8899132SKalle Valo 		.elem_size	= sizeof(u8),
723d8899132SKalle Valo 		.array_type	= NO_ARRAY,
724d8899132SKalle Valo 		.tlv_type	= 0x16,
725d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01,
726d8899132SKalle Valo 					   request_mem_enable_valid),
727d8899132SKalle Valo 	},
728d8899132SKalle Valo 	{
729d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
730d8899132SKalle Valo 		.elem_len	= 1,
731d8899132SKalle Valo 		.elem_size	= sizeof(u8),
732d8899132SKalle Valo 		.array_type	= NO_ARRAY,
733d8899132SKalle Valo 		.tlv_type	= 0x16,
734d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01,
735d8899132SKalle Valo 					   request_mem_enable),
736d8899132SKalle Valo 	},
737d8899132SKalle Valo 	{
738d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
739d8899132SKalle Valo 		.elem_len	= 1,
740d8899132SKalle Valo 		.elem_size	= sizeof(u8),
741d8899132SKalle Valo 		.array_type	= NO_ARRAY,
742d8899132SKalle Valo 		.tlv_type	= 0x17,
743d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01,
744d8899132SKalle Valo 					   fw_mem_ready_enable_valid),
745d8899132SKalle Valo 	},
746d8899132SKalle Valo 	{
747d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
748d8899132SKalle Valo 		.elem_len	= 1,
749d8899132SKalle Valo 		.elem_size	= sizeof(u8),
750d8899132SKalle Valo 		.array_type	= NO_ARRAY,
751d8899132SKalle Valo 		.tlv_type	= 0x17,
752d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01,
753d8899132SKalle Valo 					   fw_mem_ready_enable),
754d8899132SKalle Valo 	},
755d8899132SKalle Valo 	{
756d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
757d8899132SKalle Valo 		.elem_len	= 1,
758d8899132SKalle Valo 		.elem_size	= sizeof(u8),
759d8899132SKalle Valo 		.array_type	= NO_ARRAY,
760d8899132SKalle Valo 		.tlv_type	= 0x18,
761d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01,
762d8899132SKalle Valo 					   fw_init_done_enable_valid),
763d8899132SKalle Valo 	},
764d8899132SKalle Valo 	{
765d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
766d8899132SKalle Valo 		.elem_len	= 1,
767d8899132SKalle Valo 		.elem_size	= sizeof(u8),
768d8899132SKalle Valo 		.array_type	= NO_ARRAY,
769d8899132SKalle Valo 		.tlv_type	= 0x18,
770d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01,
771d8899132SKalle Valo 					   fw_init_done_enable),
772d8899132SKalle Valo 	},
773d8899132SKalle Valo 
774d8899132SKalle Valo 	{
775d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
776d8899132SKalle Valo 		.elem_len	= 1,
777d8899132SKalle Valo 		.elem_size	= sizeof(u8),
778d8899132SKalle Valo 		.array_type	= NO_ARRAY,
779d8899132SKalle Valo 		.tlv_type	= 0x19,
780d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01,
781d8899132SKalle Valo 					   rejuvenate_enable_valid),
782d8899132SKalle Valo 	},
783d8899132SKalle Valo 	{
784d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
785d8899132SKalle Valo 		.elem_len	= 1,
786d8899132SKalle Valo 		.elem_size	= sizeof(u8),
787d8899132SKalle Valo 		.array_type	= NO_ARRAY,
788d8899132SKalle Valo 		.tlv_type	= 0x19,
789d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01,
790d8899132SKalle Valo 					   rejuvenate_enable),
791d8899132SKalle Valo 	},
792d8899132SKalle Valo 	{
793d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
794d8899132SKalle Valo 		.elem_len	= 1,
795d8899132SKalle Valo 		.elem_size	= sizeof(u8),
796d8899132SKalle Valo 		.array_type	= NO_ARRAY,
797d8899132SKalle Valo 		.tlv_type	= 0x1A,
798d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01,
799d8899132SKalle Valo 					   xo_cal_enable_valid),
800d8899132SKalle Valo 	},
801d8899132SKalle Valo 	{
802d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
803d8899132SKalle Valo 		.elem_len	= 1,
804d8899132SKalle Valo 		.elem_size	= sizeof(u8),
805d8899132SKalle Valo 		.array_type	= NO_ARRAY,
806d8899132SKalle Valo 		.tlv_type	= 0x1A,
807d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01,
808d8899132SKalle Valo 					   xo_cal_enable),
809d8899132SKalle Valo 	},
810d8899132SKalle Valo 	{
811d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
812d8899132SKalle Valo 		.elem_len	= 1,
813d8899132SKalle Valo 		.elem_size	= sizeof(u8),
814d8899132SKalle Valo 		.array_type	= NO_ARRAY,
815d8899132SKalle Valo 		.tlv_type	= 0x1B,
816d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01,
817d8899132SKalle Valo 					   cal_done_enable_valid),
818d8899132SKalle Valo 	},
819d8899132SKalle Valo 	{
820d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
821d8899132SKalle Valo 		.elem_len	= 1,
822d8899132SKalle Valo 		.elem_size	= sizeof(u8),
823d8899132SKalle Valo 		.array_type	= NO_ARRAY,
824d8899132SKalle Valo 		.tlv_type	= 0x1B,
825d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01,
826d8899132SKalle Valo 					   cal_done_enable),
827d8899132SKalle Valo 	},
828d8899132SKalle Valo 	{
829d8899132SKalle Valo 		.data_type	= QMI_EOTI,
830d8899132SKalle Valo 		.array_type	= NO_ARRAY,
831d8899132SKalle Valo 		.tlv_type	= QMI_COMMON_TLV_TYPE,
832d8899132SKalle Valo 	},
833d8899132SKalle Valo };
834d8899132SKalle Valo 
835e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_ind_register_resp_msg_v01_ei[] = {
836d8899132SKalle Valo 	{
837d8899132SKalle Valo 		.data_type	= QMI_STRUCT,
838d8899132SKalle Valo 		.elem_len	= 1,
839d8899132SKalle Valo 		.elem_size	= sizeof(struct qmi_response_type_v01),
840d8899132SKalle Valo 		.array_type	= NO_ARRAY,
841d8899132SKalle Valo 		.tlv_type	= 0x02,
842d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ind_register_resp_msg_v01,
843d8899132SKalle Valo 					   resp),
844d8899132SKalle Valo 		.ei_array	= qmi_response_type_v01_ei,
845d8899132SKalle Valo 	},
846d8899132SKalle Valo 	{
847d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
848d8899132SKalle Valo 		.elem_len	= 1,
849d8899132SKalle Valo 		.elem_size	= sizeof(u8),
850d8899132SKalle Valo 		.array_type	= NO_ARRAY,
851d8899132SKalle Valo 		.tlv_type	= 0x10,
852d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ind_register_resp_msg_v01,
853d8899132SKalle Valo 					   fw_status_valid),
854d8899132SKalle Valo 	},
855d8899132SKalle Valo 	{
856d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_8_BYTE,
857d8899132SKalle Valo 		.elem_len	= 1,
858d8899132SKalle Valo 		.elem_size	= sizeof(u64),
859d8899132SKalle Valo 		.array_type	= NO_ARRAY,
860d8899132SKalle Valo 		.tlv_type	= 0x10,
861d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ind_register_resp_msg_v01,
862d8899132SKalle Valo 					   fw_status),
863d8899132SKalle Valo 	},
864d8899132SKalle Valo 	{
865d8899132SKalle Valo 		.data_type	= QMI_EOTI,
866d8899132SKalle Valo 		.array_type	= NO_ARRAY,
867d8899132SKalle Valo 		.tlv_type	= QMI_COMMON_TLV_TYPE,
868d8899132SKalle Valo 	},
869d8899132SKalle Valo };
870d8899132SKalle Valo 
871e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_mem_cfg_s_v01_ei[] = {
872d8899132SKalle Valo 	{
873d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_8_BYTE,
874d8899132SKalle Valo 		.elem_len	= 1,
875d8899132SKalle Valo 		.elem_size	= sizeof(u64),
876d8899132SKalle Valo 		.array_type	= NO_ARRAY,
877d8899132SKalle Valo 		.tlv_type	= 0,
878d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_mem_cfg_s_v01, offset),
879d8899132SKalle Valo 	},
880d8899132SKalle Valo 	{
881d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_4_BYTE,
882d8899132SKalle Valo 		.elem_len	= 1,
883d8899132SKalle Valo 		.elem_size	= sizeof(u32),
884d8899132SKalle Valo 		.array_type	= NO_ARRAY,
885d8899132SKalle Valo 		.tlv_type	= 0,
886d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_mem_cfg_s_v01, size),
887d8899132SKalle Valo 	},
888d8899132SKalle Valo 	{
889d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
890d8899132SKalle Valo 		.elem_len	= 1,
891d8899132SKalle Valo 		.elem_size	= sizeof(u8),
892d8899132SKalle Valo 		.array_type	= NO_ARRAY,
893d8899132SKalle Valo 		.tlv_type	= 0,
894d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_mem_cfg_s_v01, secure_flag),
895d8899132SKalle Valo 	},
896d8899132SKalle Valo 	{
897d8899132SKalle Valo 		.data_type	= QMI_EOTI,
898d8899132SKalle Valo 		.array_type	= NO_ARRAY,
899d8899132SKalle Valo 		.tlv_type	= QMI_COMMON_TLV_TYPE,
900d8899132SKalle Valo 	},
901d8899132SKalle Valo };
902d8899132SKalle Valo 
903e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_mem_seg_s_v01_ei[] = {
904d8899132SKalle Valo 	{
905d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_4_BYTE,
906d8899132SKalle Valo 		.elem_len	= 1,
907d8899132SKalle Valo 		.elem_size	= sizeof(u32),
908d8899132SKalle Valo 		.array_type	= NO_ARRAY,
909d8899132SKalle Valo 		.tlv_type	= 0,
910d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_mem_seg_s_v01,
911d8899132SKalle Valo 				  size),
912d8899132SKalle Valo 	},
913d8899132SKalle Valo 	{
914d8899132SKalle Valo 		.data_type	= QMI_SIGNED_4_BYTE_ENUM,
915d8899132SKalle Valo 		.elem_len	= 1,
916d8899132SKalle Valo 		.elem_size	= sizeof(enum qmi_wlanfw_mem_type_enum_v01),
917d8899132SKalle Valo 		.array_type	= NO_ARRAY,
918d8899132SKalle Valo 		.tlv_type	= 0,
919d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_mem_seg_s_v01, type),
920d8899132SKalle Valo 	},
921d8899132SKalle Valo 	{
922d8899132SKalle Valo 		.data_type	= QMI_DATA_LEN,
923d8899132SKalle Valo 		.elem_len	= 1,
924d8899132SKalle Valo 		.elem_size	= sizeof(u8),
925d8899132SKalle Valo 		.array_type	= NO_ARRAY,
926d8899132SKalle Valo 		.tlv_type	= 0,
927d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_mem_seg_s_v01, mem_cfg_len),
928d8899132SKalle Valo 	},
929d8899132SKalle Valo 	{
930d8899132SKalle Valo 		.data_type	= QMI_STRUCT,
931d8899132SKalle Valo 		.elem_len	= QMI_WLANFW_MAX_NUM_MEM_CFG_V01,
932d8899132SKalle Valo 		.elem_size	= sizeof(struct qmi_wlanfw_mem_cfg_s_v01),
933d8899132SKalle Valo 		.array_type	= VAR_LEN_ARRAY,
934d8899132SKalle Valo 		.tlv_type	= 0,
935d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_mem_seg_s_v01, mem_cfg),
936d8899132SKalle Valo 		.ei_array	= qmi_wlanfw_mem_cfg_s_v01_ei,
937d8899132SKalle Valo 	},
938d8899132SKalle Valo 	{
939d8899132SKalle Valo 		.data_type	= QMI_EOTI,
940d8899132SKalle Valo 		.array_type	= NO_ARRAY,
941d8899132SKalle Valo 		.tlv_type	= QMI_COMMON_TLV_TYPE,
942d8899132SKalle Valo 	},
943d8899132SKalle Valo };
944d8899132SKalle Valo 
945e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_request_mem_ind_msg_v01_ei[] = {
946d8899132SKalle Valo 	{
947d8899132SKalle Valo 		.data_type	= QMI_DATA_LEN,
948d8899132SKalle Valo 		.elem_len	= 1,
949d8899132SKalle Valo 		.elem_size	= sizeof(u8),
950d8899132SKalle Valo 		.array_type	= NO_ARRAY,
951d8899132SKalle Valo 		.tlv_type	= 0x01,
952d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_request_mem_ind_msg_v01,
953d8899132SKalle Valo 					   mem_seg_len),
954d8899132SKalle Valo 	},
955d8899132SKalle Valo 	{
956d8899132SKalle Valo 		.data_type	= QMI_STRUCT,
957d8899132SKalle Valo 		.elem_len	= ATH12K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01,
958d8899132SKalle Valo 		.elem_size	= sizeof(struct qmi_wlanfw_mem_seg_s_v01),
959d8899132SKalle Valo 		.array_type	= VAR_LEN_ARRAY,
960d8899132SKalle Valo 		.tlv_type	= 0x01,
961d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_request_mem_ind_msg_v01,
962d8899132SKalle Valo 					   mem_seg),
963d8899132SKalle Valo 		.ei_array	= qmi_wlanfw_mem_seg_s_v01_ei,
964d8899132SKalle Valo 	},
965d8899132SKalle Valo 	{
966d8899132SKalle Valo 		.data_type	= QMI_EOTI,
967d8899132SKalle Valo 		.array_type	= NO_ARRAY,
968d8899132SKalle Valo 		.tlv_type	= QMI_COMMON_TLV_TYPE,
969d8899132SKalle Valo 	},
970d8899132SKalle Valo };
971d8899132SKalle Valo 
972e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_mem_seg_resp_s_v01_ei[] = {
973d8899132SKalle Valo 	{
974d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_8_BYTE,
975d8899132SKalle Valo 		.elem_len	= 1,
976d8899132SKalle Valo 		.elem_size	= sizeof(u64),
977d8899132SKalle Valo 		.array_type	= NO_ARRAY,
978d8899132SKalle Valo 		.tlv_type	= 0,
979d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_mem_seg_resp_s_v01, addr),
980d8899132SKalle Valo 	},
981d8899132SKalle Valo 	{
982d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_4_BYTE,
983d8899132SKalle Valo 		.elem_len	= 1,
984d8899132SKalle Valo 		.elem_size	= sizeof(u32),
985d8899132SKalle Valo 		.array_type	= NO_ARRAY,
986d8899132SKalle Valo 		.tlv_type	= 0,
987d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_mem_seg_resp_s_v01, size),
988d8899132SKalle Valo 	},
989d8899132SKalle Valo 	{
990d8899132SKalle Valo 		.data_type	= QMI_SIGNED_4_BYTE_ENUM,
991d8899132SKalle Valo 		.elem_len	= 1,
992d8899132SKalle Valo 		.elem_size	= sizeof(enum qmi_wlanfw_mem_type_enum_v01),
993d8899132SKalle Valo 		.array_type	= NO_ARRAY,
994d8899132SKalle Valo 		.tlv_type	= 0,
995d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_mem_seg_resp_s_v01, type),
996d8899132SKalle Valo 	},
997d8899132SKalle Valo 	{
998d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
999d8899132SKalle Valo 		.elem_len	= 1,
1000d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1001d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1002d8899132SKalle Valo 		.tlv_type	= 0,
1003d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_mem_seg_resp_s_v01, restore),
1004d8899132SKalle Valo 	},
1005d8899132SKalle Valo 	{
1006d8899132SKalle Valo 		.data_type	= QMI_EOTI,
1007d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1008d8899132SKalle Valo 		.tlv_type	= QMI_COMMON_TLV_TYPE,
1009d8899132SKalle Valo 	},
1010d8899132SKalle Valo };
1011d8899132SKalle Valo 
1012e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_respond_mem_req_msg_v01_ei[] = {
1013d8899132SKalle Valo 	{
1014d8899132SKalle Valo 		.data_type	= QMI_DATA_LEN,
1015d8899132SKalle Valo 		.elem_len	= 1,
1016d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1017d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1018d8899132SKalle Valo 		.tlv_type	= 0x01,
1019d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_respond_mem_req_msg_v01,
1020d8899132SKalle Valo 					   mem_seg_len),
1021d8899132SKalle Valo 	},
1022d8899132SKalle Valo 	{
1023d8899132SKalle Valo 		.data_type	= QMI_STRUCT,
1024d8899132SKalle Valo 		.elem_len	= ATH12K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01,
1025d8899132SKalle Valo 		.elem_size	= sizeof(struct qmi_wlanfw_mem_seg_resp_s_v01),
1026d8899132SKalle Valo 		.array_type	= VAR_LEN_ARRAY,
1027d8899132SKalle Valo 		.tlv_type	= 0x01,
1028d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_respond_mem_req_msg_v01,
1029d8899132SKalle Valo 					   mem_seg),
1030d8899132SKalle Valo 		.ei_array	= qmi_wlanfw_mem_seg_resp_s_v01_ei,
1031d8899132SKalle Valo 	},
1032d8899132SKalle Valo 	{
1033d8899132SKalle Valo 		.data_type	= QMI_EOTI,
1034d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1035d8899132SKalle Valo 		.tlv_type	= QMI_COMMON_TLV_TYPE,
1036d8899132SKalle Valo 	},
1037d8899132SKalle Valo };
1038d8899132SKalle Valo 
1039e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_respond_mem_resp_msg_v01_ei[] = {
1040d8899132SKalle Valo 	{
1041d8899132SKalle Valo 		.data_type	= QMI_STRUCT,
1042d8899132SKalle Valo 		.elem_len	= 1,
1043d8899132SKalle Valo 		.elem_size	= sizeof(struct qmi_response_type_v01),
1044d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1045d8899132SKalle Valo 		.tlv_type	= 0x02,
1046d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_respond_mem_resp_msg_v01,
1047d8899132SKalle Valo 					   resp),
1048d8899132SKalle Valo 		.ei_array	= qmi_response_type_v01_ei,
1049d8899132SKalle Valo 	},
1050d8899132SKalle Valo 	{
1051d8899132SKalle Valo 		.data_type	= QMI_EOTI,
1052d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1053d8899132SKalle Valo 		.tlv_type	= QMI_COMMON_TLV_TYPE,
1054d8899132SKalle Valo 	},
1055d8899132SKalle Valo };
1056d8899132SKalle Valo 
1057e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_cap_req_msg_v01_ei[] = {
1058d8899132SKalle Valo 	{
1059d8899132SKalle Valo 		.data_type	= QMI_EOTI,
1060d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1061d8899132SKalle Valo 		.tlv_type	= QMI_COMMON_TLV_TYPE,
1062d8899132SKalle Valo 	},
1063d8899132SKalle Valo };
1064d8899132SKalle Valo 
1065e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_rf_chip_info_s_v01_ei[] = {
1066d8899132SKalle Valo 	{
1067d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_4_BYTE,
1068d8899132SKalle Valo 		.elem_len	= 1,
1069d8899132SKalle Valo 		.elem_size	= sizeof(u32),
1070d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1071d8899132SKalle Valo 		.tlv_type	= 0,
1072d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_rf_chip_info_s_v01,
1073d8899132SKalle Valo 					   chip_id),
1074d8899132SKalle Valo 	},
1075d8899132SKalle Valo 	{
1076d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_4_BYTE,
1077d8899132SKalle Valo 		.elem_len	= 1,
1078d8899132SKalle Valo 		.elem_size	= sizeof(u32),
1079d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1080d8899132SKalle Valo 		.tlv_type	= 0,
1081d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_rf_chip_info_s_v01,
1082d8899132SKalle Valo 					   chip_family),
1083d8899132SKalle Valo 	},
1084d8899132SKalle Valo 	{
1085d8899132SKalle Valo 		.data_type	= QMI_EOTI,
1086d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1087d8899132SKalle Valo 		.tlv_type	= QMI_COMMON_TLV_TYPE,
1088d8899132SKalle Valo 	},
1089d8899132SKalle Valo };
1090d8899132SKalle Valo 
1091e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_rf_board_info_s_v01_ei[] = {
1092d8899132SKalle Valo 	{
1093d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_4_BYTE,
1094d8899132SKalle Valo 		.elem_len	= 1,
1095d8899132SKalle Valo 		.elem_size	= sizeof(u32),
1096d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1097d8899132SKalle Valo 		.tlv_type	= 0,
1098d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_rf_board_info_s_v01,
1099d8899132SKalle Valo 					   board_id),
1100d8899132SKalle Valo 	},
1101d8899132SKalle Valo 	{
1102d8899132SKalle Valo 		.data_type	= QMI_EOTI,
1103d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1104d8899132SKalle Valo 		.tlv_type	= QMI_COMMON_TLV_TYPE,
1105d8899132SKalle Valo 	},
1106d8899132SKalle Valo };
1107d8899132SKalle Valo 
1108e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_soc_info_s_v01_ei[] = {
1109d8899132SKalle Valo 	{
1110d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_4_BYTE,
1111d8899132SKalle Valo 		.elem_len	= 1,
1112d8899132SKalle Valo 		.elem_size	= sizeof(u32),
1113d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1114d8899132SKalle Valo 		.tlv_type	= 0,
1115d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_soc_info_s_v01, soc_id),
1116d8899132SKalle Valo 	},
1117d8899132SKalle Valo 	{
1118d8899132SKalle Valo 		.data_type	= QMI_EOTI,
1119d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1120d8899132SKalle Valo 		.tlv_type	= QMI_COMMON_TLV_TYPE,
1121d8899132SKalle Valo 	},
1122d8899132SKalle Valo };
1123d8899132SKalle Valo 
1124e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_dev_mem_info_s_v01_ei[] = {
1125d8899132SKalle Valo 	{
1126d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_8_BYTE,
1127d8899132SKalle Valo 		.elem_len	= 1,
1128d8899132SKalle Valo 		.elem_size	= sizeof(u64),
1129d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1130d8899132SKalle Valo 		.tlv_type	= 0,
1131d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_dev_mem_info_s_v01,
1132d8899132SKalle Valo 					   start),
1133d8899132SKalle Valo 	},
1134d8899132SKalle Valo 	{
1135d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_8_BYTE,
1136d8899132SKalle Valo 		.elem_len	= 1,
1137d8899132SKalle Valo 		.elem_size	= sizeof(u64),
1138d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1139d8899132SKalle Valo 		.tlv_type	= 0,
1140d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_dev_mem_info_s_v01,
1141d8899132SKalle Valo 					   size),
1142d8899132SKalle Valo 	},
1143d8899132SKalle Valo 	{
1144d8899132SKalle Valo 		.data_type	= QMI_EOTI,
1145d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1146d8899132SKalle Valo 		.tlv_type	= QMI_COMMON_TLV_TYPE,
1147d8899132SKalle Valo 	},
1148d8899132SKalle Valo };
1149d8899132SKalle Valo 
1150e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_fw_version_info_s_v01_ei[] = {
1151d8899132SKalle Valo 	{
1152d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_4_BYTE,
1153d8899132SKalle Valo 		.elem_len	= 1,
1154d8899132SKalle Valo 		.elem_size	= sizeof(u32),
1155d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1156d8899132SKalle Valo 		.tlv_type	= 0,
1157d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_fw_version_info_s_v01,
1158d8899132SKalle Valo 					   fw_version),
1159d8899132SKalle Valo 	},
1160d8899132SKalle Valo 	{
1161d8899132SKalle Valo 		.data_type	= QMI_STRING,
1162d8899132SKalle Valo 		.elem_len	= ATH12K_QMI_WLANFW_MAX_TIMESTAMP_LEN_V01 + 1,
1163d8899132SKalle Valo 		.elem_size	= sizeof(char),
1164d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1165d8899132SKalle Valo 		.tlv_type	= 0,
1166d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_fw_version_info_s_v01,
1167d8899132SKalle Valo 					   fw_build_timestamp),
1168d8899132SKalle Valo 	},
1169d8899132SKalle Valo 	{
1170d8899132SKalle Valo 		.data_type	= QMI_EOTI,
1171d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1172d8899132SKalle Valo 		.tlv_type	= QMI_COMMON_TLV_TYPE,
1173d8899132SKalle Valo 	},
1174d8899132SKalle Valo };
1175d8899132SKalle Valo 
1176e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_cap_resp_msg_v01_ei[] = {
1177d8899132SKalle Valo 	{
1178d8899132SKalle Valo 		.data_type	= QMI_STRUCT,
1179d8899132SKalle Valo 		.elem_len	= 1,
1180d8899132SKalle Valo 		.elem_size	= sizeof(struct qmi_response_type_v01),
1181d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1182d8899132SKalle Valo 		.tlv_type	= 0x02,
1183d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_cap_resp_msg_v01, resp),
1184d8899132SKalle Valo 		.ei_array	= qmi_response_type_v01_ei,
1185d8899132SKalle Valo 	},
1186d8899132SKalle Valo 	{
1187d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
1188d8899132SKalle Valo 		.elem_len	= 1,
1189d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1190d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1191d8899132SKalle Valo 		.tlv_type	= 0x10,
1192d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_cap_resp_msg_v01,
1193d8899132SKalle Valo 					   chip_info_valid),
1194d8899132SKalle Valo 	},
1195d8899132SKalle Valo 	{
1196d8899132SKalle Valo 		.data_type	= QMI_STRUCT,
1197d8899132SKalle Valo 		.elem_len	= 1,
1198d8899132SKalle Valo 		.elem_size	= sizeof(struct qmi_wlanfw_rf_chip_info_s_v01),
1199d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1200d8899132SKalle Valo 		.tlv_type	= 0x10,
1201d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_cap_resp_msg_v01,
1202d8899132SKalle Valo 					   chip_info),
1203d8899132SKalle Valo 		.ei_array	= qmi_wlanfw_rf_chip_info_s_v01_ei,
1204d8899132SKalle Valo 	},
1205d8899132SKalle Valo 	{
1206d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
1207d8899132SKalle Valo 		.elem_len	= 1,
1208d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1209d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1210d8899132SKalle Valo 		.tlv_type	= 0x11,
1211d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_cap_resp_msg_v01,
1212d8899132SKalle Valo 					   board_info_valid),
1213d8899132SKalle Valo 	},
1214d8899132SKalle Valo 	{
1215d8899132SKalle Valo 		.data_type	= QMI_STRUCT,
1216d8899132SKalle Valo 		.elem_len	= 1,
1217d8899132SKalle Valo 		.elem_size	= sizeof(struct qmi_wlanfw_rf_board_info_s_v01),
1218d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1219d8899132SKalle Valo 		.tlv_type	= 0x11,
1220d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_cap_resp_msg_v01,
1221d8899132SKalle Valo 					   board_info),
1222d8899132SKalle Valo 		.ei_array	= qmi_wlanfw_rf_board_info_s_v01_ei,
1223d8899132SKalle Valo 	},
1224d8899132SKalle Valo 	{
1225d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
1226d8899132SKalle Valo 		.elem_len	= 1,
1227d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1228d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1229d8899132SKalle Valo 		.tlv_type	= 0x12,
1230d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_cap_resp_msg_v01,
1231d8899132SKalle Valo 					   soc_info_valid),
1232d8899132SKalle Valo 	},
1233d8899132SKalle Valo 	{
1234d8899132SKalle Valo 		.data_type	= QMI_STRUCT,
1235d8899132SKalle Valo 		.elem_len	= 1,
1236d8899132SKalle Valo 		.elem_size	= sizeof(struct qmi_wlanfw_soc_info_s_v01),
1237d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1238d8899132SKalle Valo 		.tlv_type	= 0x12,
1239d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_cap_resp_msg_v01,
1240d8899132SKalle Valo 					   soc_info),
1241d8899132SKalle Valo 		.ei_array	= qmi_wlanfw_soc_info_s_v01_ei,
1242d8899132SKalle Valo 	},
1243d8899132SKalle Valo 	{
1244d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
1245d8899132SKalle Valo 		.elem_len	= 1,
1246d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1247d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1248d8899132SKalle Valo 		.tlv_type	= 0x13,
1249d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_cap_resp_msg_v01,
1250d8899132SKalle Valo 					   fw_version_info_valid),
1251d8899132SKalle Valo 	},
1252d8899132SKalle Valo 	{
1253d8899132SKalle Valo 		.data_type	= QMI_STRUCT,
1254d8899132SKalle Valo 		.elem_len	= 1,
1255d8899132SKalle Valo 		.elem_size	= sizeof(struct qmi_wlanfw_fw_version_info_s_v01),
1256d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1257d8899132SKalle Valo 		.tlv_type	= 0x13,
1258d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_cap_resp_msg_v01,
1259d8899132SKalle Valo 					   fw_version_info),
1260d8899132SKalle Valo 		.ei_array	= qmi_wlanfw_fw_version_info_s_v01_ei,
1261d8899132SKalle Valo 	},
1262d8899132SKalle Valo 	{
1263d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
1264d8899132SKalle Valo 		.elem_len	= 1,
1265d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1266d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1267d8899132SKalle Valo 		.tlv_type	= 0x14,
1268d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_cap_resp_msg_v01,
1269d8899132SKalle Valo 					   fw_build_id_valid),
1270d8899132SKalle Valo 	},
1271d8899132SKalle Valo 	{
1272d8899132SKalle Valo 		.data_type	= QMI_STRING,
1273d8899132SKalle Valo 		.elem_len	= ATH12K_QMI_WLANFW_MAX_BUILD_ID_LEN_V01 + 1,
1274d8899132SKalle Valo 		.elem_size	= sizeof(char),
1275d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1276d8899132SKalle Valo 		.tlv_type	= 0x14,
1277d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_cap_resp_msg_v01,
1278d8899132SKalle Valo 					   fw_build_id),
1279d8899132SKalle Valo 	},
1280d8899132SKalle Valo 	{
1281d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
1282d8899132SKalle Valo 		.elem_len	= 1,
1283d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1284d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1285d8899132SKalle Valo 		.tlv_type	= 0x15,
1286d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_cap_resp_msg_v01,
1287d8899132SKalle Valo 					   num_macs_valid),
1288d8899132SKalle Valo 	},
1289d8899132SKalle Valo 	{
1290d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
1291d8899132SKalle Valo 		.elem_len	= 1,
1292d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1293d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1294d8899132SKalle Valo 		.tlv_type	= 0x15,
1295d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_cap_resp_msg_v01,
1296d8899132SKalle Valo 					   num_macs),
1297d8899132SKalle Valo 	},
1298d8899132SKalle Valo 	{
1299d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
1300d8899132SKalle Valo 		.elem_len	= 1,
1301d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1302d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1303d8899132SKalle Valo 		.tlv_type	= 0x16,
1304d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_cap_resp_msg_v01,
1305d8899132SKalle Valo 					   voltage_mv_valid),
1306d8899132SKalle Valo 	},
1307d8899132SKalle Valo 	{
1308d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_4_BYTE,
1309d8899132SKalle Valo 		.elem_len	= 1,
1310d8899132SKalle Valo 		.elem_size	= sizeof(u32),
1311d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1312d8899132SKalle Valo 		.tlv_type	= 0x16,
1313d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_cap_resp_msg_v01,
1314d8899132SKalle Valo 					   voltage_mv),
1315d8899132SKalle Valo 	},
1316d8899132SKalle Valo 	{
1317d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
1318d8899132SKalle Valo 		.elem_len	= 1,
1319d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1320d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1321d8899132SKalle Valo 		.tlv_type	= 0x17,
1322d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_cap_resp_msg_v01,
1323d8899132SKalle Valo 					   time_freq_hz_valid),
1324d8899132SKalle Valo 	},
1325d8899132SKalle Valo 	{
1326d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_4_BYTE,
1327d8899132SKalle Valo 		.elem_len	= 1,
1328d8899132SKalle Valo 		.elem_size	= sizeof(u32),
1329d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1330d8899132SKalle Valo 		.tlv_type	= 0x17,
1331d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_cap_resp_msg_v01,
1332d8899132SKalle Valo 					   time_freq_hz),
1333d8899132SKalle Valo 	},
1334d8899132SKalle Valo 	{
1335d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
1336d8899132SKalle Valo 		.elem_len	= 1,
1337d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1338d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1339d8899132SKalle Valo 		.tlv_type	= 0x18,
1340d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_cap_resp_msg_v01,
1341d8899132SKalle Valo 					   otp_version_valid),
1342d8899132SKalle Valo 	},
1343d8899132SKalle Valo 	{
1344d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_4_BYTE,
1345d8899132SKalle Valo 		.elem_len	= 1,
1346d8899132SKalle Valo 		.elem_size	= sizeof(u32),
1347d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1348d8899132SKalle Valo 		.tlv_type	= 0x18,
1349d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_cap_resp_msg_v01,
1350d8899132SKalle Valo 					   otp_version),
1351d8899132SKalle Valo 	},
1352d8899132SKalle Valo 	{
1353d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
1354d8899132SKalle Valo 		.elem_len	= 1,
1355d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1356d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1357d8899132SKalle Valo 		.tlv_type	= 0x19,
1358d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_cap_resp_msg_v01,
1359d8899132SKalle Valo 					   eeprom_caldata_read_timeout_valid),
1360d8899132SKalle Valo 	},
1361d8899132SKalle Valo 	{
1362d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_4_BYTE,
1363d8899132SKalle Valo 		.elem_len	= 1,
1364d8899132SKalle Valo 		.elem_size	= sizeof(u32),
1365d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1366d8899132SKalle Valo 		.tlv_type	= 0x19,
1367d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_cap_resp_msg_v01,
1368d8899132SKalle Valo 					   eeprom_caldata_read_timeout),
1369d8899132SKalle Valo 	},
1370d8899132SKalle Valo 	{
1371d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
1372d8899132SKalle Valo 		.elem_len	= 1,
1373d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1374d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1375d8899132SKalle Valo 		.tlv_type	= 0x1A,
1376d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_cap_resp_msg_v01,
1377d8899132SKalle Valo 					   fw_caps_valid),
1378d8899132SKalle Valo 	},
1379d8899132SKalle Valo 	{
1380d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_8_BYTE,
1381d8899132SKalle Valo 		.elem_len	= 1,
1382d8899132SKalle Valo 		.elem_size	= sizeof(u64),
1383d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1384d8899132SKalle Valo 		.tlv_type	= 0x1A,
1385d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_cap_resp_msg_v01, fw_caps),
1386d8899132SKalle Valo 	},
1387d8899132SKalle Valo 	{
1388d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
1389d8899132SKalle Valo 		.elem_len	= 1,
1390d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1391d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1392d8899132SKalle Valo 		.tlv_type	= 0x1B,
1393d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_cap_resp_msg_v01,
1394d8899132SKalle Valo 					   rd_card_chain_cap_valid),
1395d8899132SKalle Valo 	},
1396d8899132SKalle Valo 	{
1397d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_4_BYTE,
1398d8899132SKalle Valo 		.elem_len	= 1,
1399d8899132SKalle Valo 		.elem_size	= sizeof(u32),
1400d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1401d8899132SKalle Valo 		.tlv_type	= 0x1B,
1402d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_cap_resp_msg_v01,
1403d8899132SKalle Valo 					   rd_card_chain_cap),
1404d8899132SKalle Valo 	},
1405d8899132SKalle Valo 	{
1406d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
1407d8899132SKalle Valo 		.elem_len	= 1,
1408d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1409d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1410d8899132SKalle Valo 		.tlv_type	= 0x1C,
1411d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_cap_resp_msg_v01,
1412d8899132SKalle Valo 					   dev_mem_info_valid),
1413d8899132SKalle Valo 	},
1414d8899132SKalle Valo 	{
1415d8899132SKalle Valo 		.data_type	= QMI_STRUCT,
1416d8899132SKalle Valo 		.elem_len	= ATH12K_QMI_WLFW_MAX_DEV_MEM_NUM_V01,
1417d8899132SKalle Valo 		.elem_size	= sizeof(struct qmi_wlanfw_dev_mem_info_s_v01),
1418d8899132SKalle Valo 		.array_type	= STATIC_ARRAY,
1419d8899132SKalle Valo 		.tlv_type	= 0x1C,
1420d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_cap_resp_msg_v01, dev_mem),
1421d8899132SKalle Valo 		.ei_array	= qmi_wlanfw_dev_mem_info_s_v01_ei,
1422d8899132SKalle Valo 	},
1423d8899132SKalle Valo 	{
1424d8899132SKalle Valo 		.data_type	= QMI_EOTI,
1425d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1426d8899132SKalle Valo 		.tlv_type	= QMI_COMMON_TLV_TYPE,
1427d8899132SKalle Valo 	},
1428d8899132SKalle Valo };
1429d8899132SKalle Valo 
1430e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_bdf_download_req_msg_v01_ei[] = {
1431d8899132SKalle Valo 	{
1432d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
1433d8899132SKalle Valo 		.elem_len	= 1,
1434d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1435d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1436d8899132SKalle Valo 		.tlv_type	= 0x01,
1437d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01,
1438d8899132SKalle Valo 					   valid),
1439d8899132SKalle Valo 	},
1440d8899132SKalle Valo 	{
1441d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
1442d8899132SKalle Valo 		.elem_len	= 1,
1443d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1444d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1445d8899132SKalle Valo 		.tlv_type	= 0x10,
1446d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01,
1447d8899132SKalle Valo 					   file_id_valid),
1448d8899132SKalle Valo 	},
1449d8899132SKalle Valo 	{
1450d8899132SKalle Valo 		.data_type	= QMI_SIGNED_4_BYTE_ENUM,
1451d8899132SKalle Valo 		.elem_len	= 1,
1452d8899132SKalle Valo 		.elem_size	= sizeof(enum qmi_wlanfw_cal_temp_id_enum_v01),
1453d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1454d8899132SKalle Valo 		.tlv_type	= 0x10,
1455d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01,
1456d8899132SKalle Valo 					   file_id),
1457d8899132SKalle Valo 	},
1458d8899132SKalle Valo 	{
1459d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
1460d8899132SKalle Valo 		.elem_len	= 1,
1461d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1462d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1463d8899132SKalle Valo 		.tlv_type	= 0x11,
1464d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01,
1465d8899132SKalle Valo 					   total_size_valid),
1466d8899132SKalle Valo 	},
1467d8899132SKalle Valo 	{
1468d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_4_BYTE,
1469d8899132SKalle Valo 		.elem_len	= 1,
1470d8899132SKalle Valo 		.elem_size	= sizeof(u32),
1471d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1472d8899132SKalle Valo 		.tlv_type	= 0x11,
1473d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01,
1474d8899132SKalle Valo 					   total_size),
1475d8899132SKalle Valo 	},
1476d8899132SKalle Valo 	{
1477d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
1478d8899132SKalle Valo 		.elem_len	= 1,
1479d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1480d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1481d8899132SKalle Valo 		.tlv_type	= 0x12,
1482d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01,
1483d8899132SKalle Valo 					   seg_id_valid),
1484d8899132SKalle Valo 	},
1485d8899132SKalle Valo 	{
1486d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_4_BYTE,
1487d8899132SKalle Valo 		.elem_len	= 1,
1488d8899132SKalle Valo 		.elem_size	= sizeof(u32),
1489d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1490d8899132SKalle Valo 		.tlv_type	= 0x12,
1491d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01,
1492d8899132SKalle Valo 					   seg_id),
1493d8899132SKalle Valo 	},
1494d8899132SKalle Valo 	{
1495d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
1496d8899132SKalle Valo 		.elem_len	= 1,
1497d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1498d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1499d8899132SKalle Valo 		.tlv_type	= 0x13,
1500d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01,
1501d8899132SKalle Valo 					   data_valid),
1502d8899132SKalle Valo 	},
1503d8899132SKalle Valo 	{
1504d8899132SKalle Valo 		.data_type	= QMI_DATA_LEN,
1505d8899132SKalle Valo 		.elem_len	= 1,
1506d8899132SKalle Valo 		.elem_size	= sizeof(u16),
1507d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1508d8899132SKalle Valo 		.tlv_type	= 0x13,
1509d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01,
1510d8899132SKalle Valo 					   data_len),
1511d8899132SKalle Valo 	},
1512d8899132SKalle Valo 	{
1513d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
1514d8899132SKalle Valo 		.elem_len	= QMI_WLANFW_MAX_DATA_SIZE_V01,
1515d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1516d8899132SKalle Valo 		.array_type	= VAR_LEN_ARRAY,
1517d8899132SKalle Valo 		.tlv_type	= 0x13,
1518d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01,
1519d8899132SKalle Valo 					   data),
1520d8899132SKalle Valo 	},
1521d8899132SKalle Valo 	{
1522d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
1523d8899132SKalle Valo 		.elem_len	= 1,
1524d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1525d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1526d8899132SKalle Valo 		.tlv_type	= 0x14,
1527d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01,
1528d8899132SKalle Valo 					   end_valid),
1529d8899132SKalle Valo 	},
1530d8899132SKalle Valo 	{
1531d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
1532d8899132SKalle Valo 		.elem_len	= 1,
1533d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1534d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1535d8899132SKalle Valo 		.tlv_type	= 0x14,
1536d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01,
1537d8899132SKalle Valo 					   end),
1538d8899132SKalle Valo 	},
1539d8899132SKalle Valo 	{
1540d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
1541d8899132SKalle Valo 		.elem_len	= 1,
1542d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1543d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1544d8899132SKalle Valo 		.tlv_type	= 0x15,
1545d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01,
1546d8899132SKalle Valo 					   bdf_type_valid),
1547d8899132SKalle Valo 	},
1548d8899132SKalle Valo 	{
1549d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
1550d8899132SKalle Valo 		.elem_len	= 1,
1551d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1552d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1553d8899132SKalle Valo 		.tlv_type	= 0x15,
1554d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01,
1555d8899132SKalle Valo 					   bdf_type),
1556d8899132SKalle Valo 	},
1557d8899132SKalle Valo 
1558d8899132SKalle Valo 	{
1559d8899132SKalle Valo 		.data_type	= QMI_EOTI,
1560d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1561d8899132SKalle Valo 		.tlv_type	= QMI_COMMON_TLV_TYPE,
1562d8899132SKalle Valo 	},
1563d8899132SKalle Valo };
1564d8899132SKalle Valo 
1565e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_bdf_download_resp_msg_v01_ei[] = {
1566d8899132SKalle Valo 	{
1567d8899132SKalle Valo 		.data_type	= QMI_STRUCT,
1568d8899132SKalle Valo 		.elem_len	= 1,
1569d8899132SKalle Valo 		.elem_size	= sizeof(struct qmi_response_type_v01),
1570d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1571d8899132SKalle Valo 		.tlv_type	= 0x02,
1572d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_bdf_download_resp_msg_v01,
1573d8899132SKalle Valo 					   resp),
1574d8899132SKalle Valo 		.ei_array	= qmi_response_type_v01_ei,
1575d8899132SKalle Valo 	},
1576d8899132SKalle Valo 	{
1577d8899132SKalle Valo 		.data_type	= QMI_EOTI,
1578d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1579d8899132SKalle Valo 		.tlv_type	= QMI_COMMON_TLV_TYPE,
1580d8899132SKalle Valo 	},
1581d8899132SKalle Valo };
1582d8899132SKalle Valo 
1583e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_m3_info_req_msg_v01_ei[] = {
1584d8899132SKalle Valo 	{
1585d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_8_BYTE,
1586d8899132SKalle Valo 		.elem_len	= 1,
1587d8899132SKalle Valo 		.elem_size	= sizeof(u64),
1588d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1589d8899132SKalle Valo 		.tlv_type	= 0x01,
1590d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_m3_info_req_msg_v01, addr),
1591d8899132SKalle Valo 	},
1592d8899132SKalle Valo 	{
1593d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_4_BYTE,
1594d8899132SKalle Valo 		.elem_len	= 1,
1595d8899132SKalle Valo 		.elem_size	= sizeof(u32),
1596d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1597d8899132SKalle Valo 		.tlv_type	= 0x02,
1598d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_m3_info_req_msg_v01, size),
1599d8899132SKalle Valo 	},
1600d8899132SKalle Valo 	{
1601d8899132SKalle Valo 		.data_type	= QMI_EOTI,
1602d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1603d8899132SKalle Valo 		.tlv_type	= QMI_COMMON_TLV_TYPE,
1604d8899132SKalle Valo 	},
1605d8899132SKalle Valo };
1606d8899132SKalle Valo 
1607e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_m3_info_resp_msg_v01_ei[] = {
1608d8899132SKalle Valo 	{
1609d8899132SKalle Valo 		.data_type	= QMI_STRUCT,
1610d8899132SKalle Valo 		.elem_len	= 1,
1611d8899132SKalle Valo 		.elem_size	= sizeof(struct qmi_response_type_v01),
1612d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1613d8899132SKalle Valo 		.tlv_type	= 0x02,
1614d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_m3_info_resp_msg_v01, resp),
1615d8899132SKalle Valo 		.ei_array	= qmi_response_type_v01_ei,
1616d8899132SKalle Valo 	},
1617d8899132SKalle Valo 	{
1618d8899132SKalle Valo 		.data_type	= QMI_EOTI,
1619d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1620d8899132SKalle Valo 		.tlv_type	= QMI_COMMON_TLV_TYPE,
1621d8899132SKalle Valo 	},
1622d8899132SKalle Valo };
1623d8899132SKalle Valo 
1624e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_ce_tgt_pipe_cfg_s_v01_ei[] = {
1625d8899132SKalle Valo 	{
1626d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_4_BYTE,
1627d8899132SKalle Valo 		.elem_len	= 1,
1628d8899132SKalle Valo 		.elem_size	= sizeof(u32),
1629d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1630d8899132SKalle Valo 		.tlv_type	= 0,
1631d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01,
1632d8899132SKalle Valo 					   pipe_num),
1633d8899132SKalle Valo 	},
1634d8899132SKalle Valo 	{
1635d8899132SKalle Valo 		.data_type	= QMI_SIGNED_4_BYTE_ENUM,
1636d8899132SKalle Valo 		.elem_len	= 1,
1637d8899132SKalle Valo 		.elem_size	= sizeof(enum qmi_wlanfw_pipedir_enum_v01),
1638d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1639d8899132SKalle Valo 		.tlv_type	= 0,
1640d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01,
1641d8899132SKalle Valo 					   pipe_dir),
1642d8899132SKalle Valo 	},
1643d8899132SKalle Valo 	{
1644d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_4_BYTE,
1645d8899132SKalle Valo 		.elem_len	= 1,
1646d8899132SKalle Valo 		.elem_size	= sizeof(u32),
1647d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1648d8899132SKalle Valo 		.tlv_type	= 0,
1649d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01,
1650d8899132SKalle Valo 					   nentries),
1651d8899132SKalle Valo 	},
1652d8899132SKalle Valo 	{
1653d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_4_BYTE,
1654d8899132SKalle Valo 		.elem_len	= 1,
1655d8899132SKalle Valo 		.elem_size	= sizeof(u32),
1656d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1657d8899132SKalle Valo 		.tlv_type	= 0,
1658d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01,
1659d8899132SKalle Valo 					   nbytes_max),
1660d8899132SKalle Valo 	},
1661d8899132SKalle Valo 	{
1662d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_4_BYTE,
1663d8899132SKalle Valo 		.elem_len	= 1,
1664d8899132SKalle Valo 		.elem_size	= sizeof(u32),
1665d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1666d8899132SKalle Valo 		.tlv_type	= 0,
1667d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01,
1668d8899132SKalle Valo 					   flags),
1669d8899132SKalle Valo 	},
1670d8899132SKalle Valo 	{
1671d8899132SKalle Valo 		.data_type	= QMI_EOTI,
1672d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1673d8899132SKalle Valo 		.tlv_type	= QMI_COMMON_TLV_TYPE,
1674d8899132SKalle Valo 	},
1675d8899132SKalle Valo };
1676d8899132SKalle Valo 
1677e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_ce_svc_pipe_cfg_s_v01_ei[] = {
1678d8899132SKalle Valo 	{
1679d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_4_BYTE,
1680d8899132SKalle Valo 		.elem_len	= 1,
1681d8899132SKalle Valo 		.elem_size	= sizeof(u32),
1682d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1683d8899132SKalle Valo 		.tlv_type	= 0,
1684d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ce_svc_pipe_cfg_s_v01,
1685d8899132SKalle Valo 					   service_id),
1686d8899132SKalle Valo 	},
1687d8899132SKalle Valo 	{
1688d8899132SKalle Valo 		.data_type	= QMI_SIGNED_4_BYTE_ENUM,
1689d8899132SKalle Valo 		.elem_len	= 1,
1690d8899132SKalle Valo 		.elem_size	= sizeof(enum qmi_wlanfw_pipedir_enum_v01),
1691d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1692d8899132SKalle Valo 		.tlv_type	= 0,
1693d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ce_svc_pipe_cfg_s_v01,
1694d8899132SKalle Valo 					   pipe_dir),
1695d8899132SKalle Valo 	},
1696d8899132SKalle Valo 	{
1697d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_4_BYTE,
1698d8899132SKalle Valo 		.elem_len	= 1,
1699d8899132SKalle Valo 		.elem_size	= sizeof(u32),
1700d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1701d8899132SKalle Valo 		.tlv_type	= 0,
1702d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_ce_svc_pipe_cfg_s_v01,
1703d8899132SKalle Valo 					   pipe_num),
1704d8899132SKalle Valo 	},
1705d8899132SKalle Valo 	{
1706d8899132SKalle Valo 		.data_type	= QMI_EOTI,
1707d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1708d8899132SKalle Valo 		.tlv_type	= QMI_COMMON_TLV_TYPE,
1709d8899132SKalle Valo 	},
1710d8899132SKalle Valo };
1711d8899132SKalle Valo 
1712e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_shadow_reg_cfg_s_v01_ei[] = {
1713d8899132SKalle Valo 	{
1714d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_2_BYTE,
1715d8899132SKalle Valo 		.elem_len	= 1,
1716d8899132SKalle Valo 		.elem_size	= sizeof(u16),
1717d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1718d8899132SKalle Valo 		.tlv_type	= 0,
1719d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_shadow_reg_cfg_s_v01, id),
1720d8899132SKalle Valo 	},
1721d8899132SKalle Valo 	{
1722d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_2_BYTE,
1723d8899132SKalle Valo 		.elem_len	= 1,
1724d8899132SKalle Valo 		.elem_size	= sizeof(u16),
1725d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1726d8899132SKalle Valo 		.tlv_type	= 0,
1727d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_shadow_reg_cfg_s_v01,
1728d8899132SKalle Valo 					   offset),
1729d8899132SKalle Valo 	},
1730d8899132SKalle Valo 	{
1731d8899132SKalle Valo 		.data_type	= QMI_EOTI,
1732d8899132SKalle Valo 		.array_type	= QMI_COMMON_TLV_TYPE,
1733d8899132SKalle Valo 	},
1734d8899132SKalle Valo };
1735d8899132SKalle Valo 
1736e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_shadow_reg_v3_cfg_s_v01_ei[] = {
1737d8899132SKalle Valo 	{
1738d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_4_BYTE,
1739d8899132SKalle Valo 		.elem_len	= 1,
1740d8899132SKalle Valo 		.elem_size	= sizeof(u32),
1741d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1742d8899132SKalle Valo 		.tlv_type	= 0,
1743d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_shadow_reg_v3_cfg_s_v01,
1744d8899132SKalle Valo 					   addr),
1745d8899132SKalle Valo 	},
1746d8899132SKalle Valo 	{
1747d8899132SKalle Valo 		.data_type	= QMI_EOTI,
1748d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1749d8899132SKalle Valo 		.tlv_type	= QMI_COMMON_TLV_TYPE,
1750d8899132SKalle Valo 	},
1751d8899132SKalle Valo };
1752d8899132SKalle Valo 
1753e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_wlan_mode_req_msg_v01_ei[] = {
1754d8899132SKalle Valo 	{
1755d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_4_BYTE,
1756d8899132SKalle Valo 		.elem_len	= 1,
1757d8899132SKalle Valo 		.elem_size	= sizeof(u32),
1758d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1759d8899132SKalle Valo 		.tlv_type	= 0x01,
1760d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_wlan_mode_req_msg_v01,
1761d8899132SKalle Valo 					   mode),
1762d8899132SKalle Valo 	},
1763d8899132SKalle Valo 	{
1764d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
1765d8899132SKalle Valo 		.elem_len	= 1,
1766d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1767d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1768d8899132SKalle Valo 		.tlv_type	= 0x10,
1769d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_wlan_mode_req_msg_v01,
1770d8899132SKalle Valo 					   hw_debug_valid),
1771d8899132SKalle Valo 	},
1772d8899132SKalle Valo 	{
1773d8899132SKalle Valo 		.data_type	= QMI_UNSIGNED_1_BYTE,
1774d8899132SKalle Valo 		.elem_len	= 1,
1775d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1776d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1777d8899132SKalle Valo 		.tlv_type	= 0x10,
1778d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_wlan_mode_req_msg_v01,
1779d8899132SKalle Valo 					   hw_debug),
1780d8899132SKalle Valo 	},
1781d8899132SKalle Valo 	{
1782d8899132SKalle Valo 		.data_type	= QMI_EOTI,
1783d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1784d8899132SKalle Valo 		.tlv_type	= QMI_COMMON_TLV_TYPE,
1785d8899132SKalle Valo 	},
1786d8899132SKalle Valo };
1787d8899132SKalle Valo 
1788e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_wlan_mode_resp_msg_v01_ei[] = {
1789d8899132SKalle Valo 	{
1790d8899132SKalle Valo 		.data_type	= QMI_STRUCT,
1791d8899132SKalle Valo 		.elem_len	= 1,
1792d8899132SKalle Valo 		.elem_size	= sizeof(struct qmi_response_type_v01),
1793d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1794d8899132SKalle Valo 		.tlv_type	= 0x02,
1795d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_wlan_mode_resp_msg_v01,
1796d8899132SKalle Valo 					   resp),
1797d8899132SKalle Valo 		.ei_array	= qmi_response_type_v01_ei,
1798d8899132SKalle Valo 	},
1799d8899132SKalle Valo 	{
1800d8899132SKalle Valo 		.data_type	= QMI_EOTI,
1801d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1802d8899132SKalle Valo 		.tlv_type	= QMI_COMMON_TLV_TYPE,
1803d8899132SKalle Valo 	},
1804d8899132SKalle Valo };
1805d8899132SKalle Valo 
1806e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_wlan_cfg_req_msg_v01_ei[] = {
1807d8899132SKalle Valo 	{
1808d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
1809d8899132SKalle Valo 		.elem_len	= 1,
1810d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1811d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1812d8899132SKalle Valo 		.tlv_type	= 0x10,
1813d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01,
1814d8899132SKalle Valo 					   host_version_valid),
1815d8899132SKalle Valo 	},
1816d8899132SKalle Valo 	{
1817d8899132SKalle Valo 		.data_type	= QMI_STRING,
1818d8899132SKalle Valo 		.elem_len	= QMI_WLANFW_MAX_STR_LEN_V01 + 1,
1819d8899132SKalle Valo 		.elem_size	= sizeof(char),
1820d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1821d8899132SKalle Valo 		.tlv_type	= 0x10,
1822d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01,
1823d8899132SKalle Valo 					   host_version),
1824d8899132SKalle Valo 	},
1825d8899132SKalle Valo 	{
1826d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
1827d8899132SKalle Valo 		.elem_len	= 1,
1828d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1829d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1830d8899132SKalle Valo 		.tlv_type	= 0x11,
1831d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01,
1832d8899132SKalle Valo 					   tgt_cfg_valid),
1833d8899132SKalle Valo 	},
1834d8899132SKalle Valo 	{
1835d8899132SKalle Valo 		.data_type	= QMI_DATA_LEN,
1836d8899132SKalle Valo 		.elem_len	= 1,
1837d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1838d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1839d8899132SKalle Valo 		.tlv_type	= 0x11,
1840d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01,
1841d8899132SKalle Valo 					   tgt_cfg_len),
1842d8899132SKalle Valo 	},
1843d8899132SKalle Valo 	{
1844d8899132SKalle Valo 		.data_type	= QMI_STRUCT,
1845d8899132SKalle Valo 		.elem_len	= QMI_WLANFW_MAX_NUM_CE_V01,
1846d8899132SKalle Valo 		.elem_size	= sizeof(struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01),
1847d8899132SKalle Valo 		.array_type	= VAR_LEN_ARRAY,
1848d8899132SKalle Valo 		.tlv_type	= 0x11,
1849d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01,
1850d8899132SKalle Valo 					   tgt_cfg),
1851d8899132SKalle Valo 		.ei_array	= qmi_wlanfw_ce_tgt_pipe_cfg_s_v01_ei,
1852d8899132SKalle Valo 	},
1853d8899132SKalle Valo 	{
1854d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
1855d8899132SKalle Valo 		.elem_len	= 1,
1856d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1857d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1858d8899132SKalle Valo 		.tlv_type	= 0x12,
1859d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01,
1860d8899132SKalle Valo 					   svc_cfg_valid),
1861d8899132SKalle Valo 	},
1862d8899132SKalle Valo 	{
1863d8899132SKalle Valo 		.data_type	= QMI_DATA_LEN,
1864d8899132SKalle Valo 		.elem_len	= 1,
1865d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1866d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1867d8899132SKalle Valo 		.tlv_type	= 0x12,
1868d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01,
1869d8899132SKalle Valo 					   svc_cfg_len),
1870d8899132SKalle Valo 	},
1871d8899132SKalle Valo 	{
1872d8899132SKalle Valo 		.data_type	= QMI_STRUCT,
1873d8899132SKalle Valo 		.elem_len	= QMI_WLANFW_MAX_NUM_SVC_V01,
1874d8899132SKalle Valo 		.elem_size	= sizeof(struct qmi_wlanfw_ce_svc_pipe_cfg_s_v01),
1875d8899132SKalle Valo 		.array_type	= VAR_LEN_ARRAY,
1876d8899132SKalle Valo 		.tlv_type	= 0x12,
1877d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01,
1878d8899132SKalle Valo 					   svc_cfg),
1879d8899132SKalle Valo 		.ei_array	= qmi_wlanfw_ce_svc_pipe_cfg_s_v01_ei,
1880d8899132SKalle Valo 	},
1881d8899132SKalle Valo 	{
1882d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
1883d8899132SKalle Valo 		.elem_len	= 1,
1884d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1885d8899132SKalle Valo 		.array_type = NO_ARRAY,
1886d8899132SKalle Valo 		.tlv_type	= 0x13,
1887d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01,
1888d8899132SKalle Valo 					   shadow_reg_valid),
1889d8899132SKalle Valo 	},
1890d8899132SKalle Valo 	{
1891d8899132SKalle Valo 		.data_type	= QMI_DATA_LEN,
1892d8899132SKalle Valo 		.elem_len	= 1,
1893d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1894d8899132SKalle Valo 		.array_type = NO_ARRAY,
1895d8899132SKalle Valo 		.tlv_type	= 0x13,
1896d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01,
1897d8899132SKalle Valo 					   shadow_reg_len),
1898d8899132SKalle Valo 	},
1899d8899132SKalle Valo 	{
1900d8899132SKalle Valo 		.data_type	= QMI_STRUCT,
1901d8899132SKalle Valo 		.elem_len	= QMI_WLANFW_MAX_NUM_SHADOW_REG_V01,
1902d8899132SKalle Valo 		.elem_size	= sizeof(struct qmi_wlanfw_shadow_reg_cfg_s_v01),
1903d8899132SKalle Valo 		.array_type = VAR_LEN_ARRAY,
1904d8899132SKalle Valo 		.tlv_type	= 0x13,
1905d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01,
1906d8899132SKalle Valo 					   shadow_reg),
1907d8899132SKalle Valo 		.ei_array	= qmi_wlanfw_shadow_reg_cfg_s_v01_ei,
1908d8899132SKalle Valo 	},
1909d8899132SKalle Valo 	{
1910d8899132SKalle Valo 		.data_type	= QMI_OPT_FLAG,
1911d8899132SKalle Valo 		.elem_len	= 1,
1912d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1913d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1914d8899132SKalle Valo 		.tlv_type	= 0x17,
1915d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01,
1916d8899132SKalle Valo 					   shadow_reg_v3_valid),
1917d8899132SKalle Valo 	},
1918d8899132SKalle Valo 	{
1919d8899132SKalle Valo 		.data_type	= QMI_DATA_LEN,
1920d8899132SKalle Valo 		.elem_len	= 1,
1921d8899132SKalle Valo 		.elem_size	= sizeof(u8),
1922d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1923d8899132SKalle Valo 		.tlv_type	= 0x17,
1924d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01,
1925d8899132SKalle Valo 					   shadow_reg_v3_len),
1926d8899132SKalle Valo 	},
1927d8899132SKalle Valo 	{
1928d8899132SKalle Valo 		.data_type	= QMI_STRUCT,
1929d8899132SKalle Valo 		.elem_len	= QMI_WLANFW_MAX_NUM_SHADOW_REG_V3_V01,
1930d8899132SKalle Valo 		.elem_size	= sizeof(struct qmi_wlanfw_shadow_reg_v3_cfg_s_v01),
1931d8899132SKalle Valo 		.array_type	= VAR_LEN_ARRAY,
1932d8899132SKalle Valo 		.tlv_type	= 0x17,
1933d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01,
1934d8899132SKalle Valo 					   shadow_reg_v3),
1935d8899132SKalle Valo 		.ei_array	= qmi_wlanfw_shadow_reg_v3_cfg_s_v01_ei,
1936d8899132SKalle Valo 	},
1937d8899132SKalle Valo 	{
1938d8899132SKalle Valo 		.data_type	= QMI_EOTI,
1939d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1940d8899132SKalle Valo 		.tlv_type	= QMI_COMMON_TLV_TYPE,
1941d8899132SKalle Valo 	},
1942d8899132SKalle Valo };
1943d8899132SKalle Valo 
1944e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_wlan_cfg_resp_msg_v01_ei[] = {
1945d8899132SKalle Valo 	{
1946d8899132SKalle Valo 		.data_type	= QMI_STRUCT,
1947d8899132SKalle Valo 		.elem_len	= 1,
1948d8899132SKalle Valo 		.elem_size	= sizeof(struct qmi_response_type_v01),
1949d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1950d8899132SKalle Valo 		.tlv_type	= 0x02,
1951d8899132SKalle Valo 		.offset		= offsetof(struct qmi_wlanfw_wlan_cfg_resp_msg_v01, resp),
1952d8899132SKalle Valo 		.ei_array	= qmi_response_type_v01_ei,
1953d8899132SKalle Valo 	},
1954d8899132SKalle Valo 	{
1955d8899132SKalle Valo 		.data_type	= QMI_EOTI,
1956d8899132SKalle Valo 		.array_type	= NO_ARRAY,
1957d8899132SKalle Valo 		.tlv_type	= QMI_COMMON_TLV_TYPE,
1958d8899132SKalle Valo 	},
1959d8899132SKalle Valo };
1960d8899132SKalle Valo 
1961e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_mem_ready_ind_msg_v01_ei[] = {
1962d8899132SKalle Valo 	{
1963d8899132SKalle Valo 		.data_type = QMI_EOTI,
1964d8899132SKalle Valo 		.array_type = NO_ARRAY,
1965d8899132SKalle Valo 	},
1966d8899132SKalle Valo };
1967d8899132SKalle Valo 
1968e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_fw_ready_ind_msg_v01_ei[] = {
1969d8899132SKalle Valo 	{
1970d8899132SKalle Valo 		.data_type = QMI_EOTI,
1971d8899132SKalle Valo 		.array_type = NO_ARRAY,
1972d8899132SKalle Valo 	},
1973d8899132SKalle Valo };
1974d8899132SKalle Valo 
19759f9df1a2SBaochen Qiang static const struct qmi_elem_info qmi_wlanfw_wlan_ini_req_msg_v01_ei[] = {
19769f9df1a2SBaochen Qiang 	{
19779f9df1a2SBaochen Qiang 		.data_type	= QMI_OPT_FLAG,
19789f9df1a2SBaochen Qiang 		.elem_len	= 1,
19799f9df1a2SBaochen Qiang 		.elem_size	= sizeof(u8),
19809f9df1a2SBaochen Qiang 		.array_type	= NO_ARRAY,
19819f9df1a2SBaochen Qiang 		.tlv_type	= 0x10,
19829f9df1a2SBaochen Qiang 		.offset		= offsetof(struct qmi_wlanfw_wlan_ini_req_msg_v01,
19839f9df1a2SBaochen Qiang 					   enable_fwlog_valid),
19849f9df1a2SBaochen Qiang 	},
19859f9df1a2SBaochen Qiang 	{
19869f9df1a2SBaochen Qiang 		.data_type	= QMI_UNSIGNED_1_BYTE,
19879f9df1a2SBaochen Qiang 		.elem_len	= 1,
19889f9df1a2SBaochen Qiang 		.elem_size	= sizeof(u8),
19899f9df1a2SBaochen Qiang 		.array_type	= NO_ARRAY,
19909f9df1a2SBaochen Qiang 		.tlv_type	= 0x10,
19919f9df1a2SBaochen Qiang 		.offset		= offsetof(struct qmi_wlanfw_wlan_ini_req_msg_v01,
19929f9df1a2SBaochen Qiang 					   enable_fwlog),
19939f9df1a2SBaochen Qiang 	},
19949f9df1a2SBaochen Qiang 	{
19959f9df1a2SBaochen Qiang 		.data_type	= QMI_EOTI,
19969f9df1a2SBaochen Qiang 		.array_type	= NO_ARRAY,
19979f9df1a2SBaochen Qiang 		.tlv_type	= QMI_COMMON_TLV_TYPE,
19989f9df1a2SBaochen Qiang 	},
19999f9df1a2SBaochen Qiang };
20009f9df1a2SBaochen Qiang 
20019f9df1a2SBaochen Qiang static const struct qmi_elem_info qmi_wlanfw_wlan_ini_resp_msg_v01_ei[] = {
20029f9df1a2SBaochen Qiang 	{
20039f9df1a2SBaochen Qiang 		.data_type	= QMI_STRUCT,
20049f9df1a2SBaochen Qiang 		.elem_len	= 1,
20059f9df1a2SBaochen Qiang 		.elem_size	= sizeof(struct qmi_response_type_v01),
20069f9df1a2SBaochen Qiang 		.array_type	= NO_ARRAY,
20079f9df1a2SBaochen Qiang 		.tlv_type	= 0x02,
20089f9df1a2SBaochen Qiang 		.offset		= offsetof(struct qmi_wlanfw_wlan_ini_resp_msg_v01,
20099f9df1a2SBaochen Qiang 					   resp),
20109f9df1a2SBaochen Qiang 		.ei_array	= qmi_response_type_v01_ei,
20119f9df1a2SBaochen Qiang 	},
20129f9df1a2SBaochen Qiang 	{
20139f9df1a2SBaochen Qiang 		.data_type	= QMI_EOTI,
20149f9df1a2SBaochen Qiang 		.array_type	= NO_ARRAY,
20159f9df1a2SBaochen Qiang 		.tlv_type	= QMI_COMMON_TLV_TYPE,
20169f9df1a2SBaochen Qiang 	},
20179f9df1a2SBaochen Qiang };
20189f9df1a2SBaochen Qiang 
201976fece36SKarthikeyan Periyasamy static void ath12k_host_cap_parse_mlo(struct ath12k_base *ab,
202076fece36SKarthikeyan Periyasamy 				      struct qmi_wlanfw_host_cap_req_msg_v01 *req)
2021d8899132SKalle Valo {
202276fece36SKarthikeyan Periyasamy 	struct wlfw_host_mlo_chip_info_s_v01 *info;
202376fece36SKarthikeyan Periyasamy 	u8 hw_link_id = 0;
202476fece36SKarthikeyan Periyasamy 	int i;
202576fece36SKarthikeyan Periyasamy 
202653a65445SKarthikeyan Periyasamy 	if (!ab->qmi.num_radios || ab->qmi.num_radios == U8_MAX) {
2027b34389c3SKarthikeyan Periyasamy 		ab->mlo_capable_flags = 0;
2028b34389c3SKarthikeyan Periyasamy 
202953a65445SKarthikeyan Periyasamy 		ath12k_dbg(ab, ATH12K_DBG_QMI,
203053a65445SKarthikeyan Periyasamy 			   "skip QMI MLO cap due to invalid num_radio %d\n",
203153a65445SKarthikeyan Periyasamy 			   ab->qmi.num_radios);
203276fece36SKarthikeyan Periyasamy 		return;
203353a65445SKarthikeyan Periyasamy 	}
203476fece36SKarthikeyan Periyasamy 
2035d8899132SKalle Valo 	req->mlo_capable_valid = 1;
2036d8899132SKalle Valo 	req->mlo_capable = 1;
2037d8899132SKalle Valo 	req->mlo_chip_id_valid = 1;
2038d8899132SKalle Valo 	req->mlo_chip_id = 0;
2039d8899132SKalle Valo 	req->mlo_group_id_valid = 1;
2040d8899132SKalle Valo 	req->mlo_group_id = 0;
2041d8899132SKalle Valo 	req->max_mlo_peer_valid = 1;
2042d8899132SKalle Valo 	/* Max peer number generally won't change for the same device
2043d8899132SKalle Valo 	 * but needs to be synced with host driver.
2044d8899132SKalle Valo 	 */
204576fece36SKarthikeyan Periyasamy 	req->max_mlo_peer = ab->hw_params->max_mlo_peer;
2046d8899132SKalle Valo 	req->mlo_num_chips_valid = 1;
2047d8899132SKalle Valo 	req->mlo_num_chips = 1;
204876fece36SKarthikeyan Periyasamy 
204976fece36SKarthikeyan Periyasamy 	info = &req->mlo_chip_info[0];
205076fece36SKarthikeyan Periyasamy 	info->chip_id = 0;
205153a65445SKarthikeyan Periyasamy 	info->num_local_links = ab->qmi.num_radios;
205276fece36SKarthikeyan Periyasamy 
205376fece36SKarthikeyan Periyasamy 	for (i = 0; i < info->num_local_links; i++) {
205476fece36SKarthikeyan Periyasamy 		info->hw_link_id[i] = hw_link_id;
205576fece36SKarthikeyan Periyasamy 		info->valid_mlo_link_id[i] = 1;
205676fece36SKarthikeyan Periyasamy 
205776fece36SKarthikeyan Periyasamy 		hw_link_id++;
205876fece36SKarthikeyan Periyasamy 	}
205976fece36SKarthikeyan Periyasamy 
2060d8899132SKalle Valo 	req->mlo_chip_info_valid = 1;
2061d8899132SKalle Valo }
2062d8899132SKalle Valo 
2063d8899132SKalle Valo static int ath12k_qmi_host_cap_send(struct ath12k_base *ab)
2064d8899132SKalle Valo {
20656d2b0a06SJeff Johnson 	struct qmi_wlanfw_host_cap_req_msg_v01 req = {};
20666d2b0a06SJeff Johnson 	struct qmi_wlanfw_host_cap_resp_msg_v01 resp = {};
206759cf57abSJeff Johnson 	struct qmi_txn txn;
2068d8899132SKalle Valo 	int ret = 0;
2069d8899132SKalle Valo 
2070d8899132SKalle Valo 	req.num_clients_valid = 1;
2071d8899132SKalle Valo 	req.num_clients = 1;
2072d8899132SKalle Valo 	req.mem_cfg_mode = ab->qmi.target_mem_mode;
2073d8899132SKalle Valo 	req.mem_cfg_mode_valid = 1;
2074d8899132SKalle Valo 	req.bdf_support_valid = 1;
2075d8899132SKalle Valo 	req.bdf_support = 1;
2076d8899132SKalle Valo 
2077d8899132SKalle Valo 	req.m3_support_valid = 1;
2078d8899132SKalle Valo 	req.m3_support = 1;
2079d8899132SKalle Valo 	req.m3_cache_support_valid = 1;
2080d8899132SKalle Valo 	req.m3_cache_support = 1;
2081d8899132SKalle Valo 
2082d8899132SKalle Valo 	req.cal_done_valid = 1;
2083d8899132SKalle Valo 	req.cal_done = ab->qmi.cal_done;
2084d8899132SKalle Valo 
20859981a3acSCarl Huang 	if (ab->hw_params->qmi_cnss_feature_bitmap) {
2086d8899132SKalle Valo 		req.feature_list_valid = 1;
20879981a3acSCarl Huang 		req.feature_list = ab->hw_params->qmi_cnss_feature_bitmap;
20889981a3acSCarl Huang 	}
2089d8899132SKalle Valo 
2090d8899132SKalle Valo 	/* BRINGUP: here we are piggybacking a lot of stuff using
2091d8899132SKalle Valo 	 * internal_sleep_clock, should it be split?
2092d8899132SKalle Valo 	 */
2093d8899132SKalle Valo 	if (ab->hw_params->internal_sleep_clock) {
2094d8899132SKalle Valo 		req.nm_modem_valid = 1;
2095d8899132SKalle Valo 
2096d8899132SKalle Valo 		/* Notify firmware that this is non-qualcomm platform. */
2097d8899132SKalle Valo 		req.nm_modem |= HOST_CSTATE_BIT;
2098d8899132SKalle Valo 
2099d8899132SKalle Valo 		/* Notify firmware about the sleep clock selection,
2100d8899132SKalle Valo 		 * nm_modem_bit[1] is used for this purpose. Host driver on
2101d8899132SKalle Valo 		 * non-qualcomm platforms should select internal sleep
2102d8899132SKalle Valo 		 * clock.
2103d8899132SKalle Valo 		 */
2104d8899132SKalle Valo 		req.nm_modem |= SLEEP_CLOCK_SELECT_INTERNAL_BIT;
2105d8899132SKalle Valo 		req.nm_modem |= PLATFORM_CAP_PCIE_GLOBAL_RESET;
2106d8899132SKalle Valo 	}
2107d8899132SKalle Valo 
210876fece36SKarthikeyan Periyasamy 	ath12k_host_cap_parse_mlo(ab, &req);
210976fece36SKarthikeyan Periyasamy 
2110d8899132SKalle Valo 	ret = qmi_txn_init(&ab->qmi.handle, &txn,
2111d8899132SKalle Valo 			   qmi_wlanfw_host_cap_resp_msg_v01_ei, &resp);
2112d8899132SKalle Valo 	if (ret < 0)
2113d8899132SKalle Valo 		goto out;
2114d8899132SKalle Valo 
2115d8899132SKalle Valo 	ret = qmi_send_request(&ab->qmi.handle, NULL, &txn,
2116d8899132SKalle Valo 			       QMI_WLANFW_HOST_CAP_REQ_V01,
2117d8899132SKalle Valo 			       QMI_WLANFW_HOST_CAP_REQ_MSG_V01_MAX_LEN,
2118d8899132SKalle Valo 			       qmi_wlanfw_host_cap_req_msg_v01_ei, &req);
2119d8899132SKalle Valo 	if (ret < 0) {
21202e82b5f0SJeff Johnson 		qmi_txn_cancel(&txn);
2121d8899132SKalle Valo 		ath12k_warn(ab, "Failed to send host capability request,err = %d\n", ret);
2122d8899132SKalle Valo 		goto out;
2123d8899132SKalle Valo 	}
2124d8899132SKalle Valo 
2125d8899132SKalle Valo 	ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS));
2126d8899132SKalle Valo 	if (ret < 0)
2127d8899132SKalle Valo 		goto out;
2128d8899132SKalle Valo 
2129d8899132SKalle Valo 	if (resp.resp.result != QMI_RESULT_SUCCESS_V01) {
2130d8899132SKalle Valo 		ath12k_warn(ab, "Host capability request failed, result: %d, err: %d\n",
2131d8899132SKalle Valo 			    resp.resp.result, resp.resp.error);
2132d8899132SKalle Valo 		ret = -EINVAL;
2133d8899132SKalle Valo 		goto out;
2134d8899132SKalle Valo 	}
2135d8899132SKalle Valo 
2136d8899132SKalle Valo out:
2137d8899132SKalle Valo 	return ret;
2138d8899132SKalle Valo }
2139d8899132SKalle Valo 
214053a65445SKarthikeyan Periyasamy static void ath12k_qmi_phy_cap_send(struct ath12k_base *ab)
214153a65445SKarthikeyan Periyasamy {
214253a65445SKarthikeyan Periyasamy 	struct qmi_wlanfw_phy_cap_req_msg_v01 req = {};
214353a65445SKarthikeyan Periyasamy 	struct qmi_wlanfw_phy_cap_resp_msg_v01 resp = {};
214453a65445SKarthikeyan Periyasamy 	struct qmi_txn txn;
214553a65445SKarthikeyan Periyasamy 	int ret;
214653a65445SKarthikeyan Periyasamy 
214758e8ecdaSKarthikeyan Periyasamy 	if (!ab->mlo_capable_flags)
21482d3a7384SRaj Kumar Bhagat 		goto out;
21492d3a7384SRaj Kumar Bhagat 
215053a65445SKarthikeyan Periyasamy 	ret = qmi_txn_init(&ab->qmi.handle, &txn,
215153a65445SKarthikeyan Periyasamy 			   qmi_wlanfw_phy_cap_resp_msg_v01_ei, &resp);
215253a65445SKarthikeyan Periyasamy 	if (ret < 0)
215353a65445SKarthikeyan Periyasamy 		goto out;
215453a65445SKarthikeyan Periyasamy 
215553a65445SKarthikeyan Periyasamy 	ret = qmi_send_request(&ab->qmi.handle, NULL, &txn,
215653a65445SKarthikeyan Periyasamy 			       QMI_WLANFW_PHY_CAP_REQ_V01,
215753a65445SKarthikeyan Periyasamy 			       QMI_WLANFW_PHY_CAP_REQ_MSG_V01_MAX_LEN,
215853a65445SKarthikeyan Periyasamy 			       qmi_wlanfw_phy_cap_req_msg_v01_ei, &req);
215953a65445SKarthikeyan Periyasamy 	if (ret < 0) {
216053a65445SKarthikeyan Periyasamy 		qmi_txn_cancel(&txn);
216153a65445SKarthikeyan Periyasamy 		ath12k_warn(ab, "failed to send phy capability request: %d\n", ret);
216253a65445SKarthikeyan Periyasamy 		goto out;
216353a65445SKarthikeyan Periyasamy 	}
216453a65445SKarthikeyan Periyasamy 
216553a65445SKarthikeyan Periyasamy 	ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS));
216653a65445SKarthikeyan Periyasamy 	if (ret < 0)
216753a65445SKarthikeyan Periyasamy 		goto out;
216853a65445SKarthikeyan Periyasamy 
216953a65445SKarthikeyan Periyasamy 	if (resp.resp.result != QMI_RESULT_SUCCESS_V01) {
217053a65445SKarthikeyan Periyasamy 		ret = -EOPNOTSUPP;
217153a65445SKarthikeyan Periyasamy 		goto out;
217253a65445SKarthikeyan Periyasamy 	}
217353a65445SKarthikeyan Periyasamy 
217453a65445SKarthikeyan Periyasamy 	if (!resp.num_phy_valid) {
217553a65445SKarthikeyan Periyasamy 		ret = -ENODATA;
217653a65445SKarthikeyan Periyasamy 		goto out;
217753a65445SKarthikeyan Periyasamy 	}
217853a65445SKarthikeyan Periyasamy 
217953a65445SKarthikeyan Periyasamy 	ab->qmi.num_radios = resp.num_phy;
218053a65445SKarthikeyan Periyasamy 
2181*ae6ec4a3SRaj Kumar Bhagat 	ath12k_dbg(ab, ATH12K_DBG_QMI,
2182*ae6ec4a3SRaj Kumar Bhagat 		   "phy capability resp valid %d num_phy %d valid %d board_id %d valid %d single_chip_mlo_support %d\n",
218353a65445SKarthikeyan Periyasamy 		   resp.num_phy_valid, resp.num_phy,
2184*ae6ec4a3SRaj Kumar Bhagat 		   resp.board_id_valid, resp.board_id,
2185*ae6ec4a3SRaj Kumar Bhagat 		   resp.single_chip_mlo_support_valid, resp.single_chip_mlo_support);
218653a65445SKarthikeyan Periyasamy 
218753a65445SKarthikeyan Periyasamy 	return;
218853a65445SKarthikeyan Periyasamy 
218953a65445SKarthikeyan Periyasamy out:
219053a65445SKarthikeyan Periyasamy 	/* If PHY capability not advertised then rely on default num link */
219153a65445SKarthikeyan Periyasamy 	ab->qmi.num_radios = ab->hw_params->def_num_link;
219253a65445SKarthikeyan Periyasamy 
219353a65445SKarthikeyan Periyasamy 	ath12k_dbg(ab, ATH12K_DBG_QMI,
219453a65445SKarthikeyan Periyasamy 		   "no valid response from PHY capability, choose default num_phy %d\n",
219553a65445SKarthikeyan Periyasamy 		   ab->qmi.num_radios);
219653a65445SKarthikeyan Periyasamy }
219753a65445SKarthikeyan Periyasamy 
2198d8899132SKalle Valo static int ath12k_qmi_fw_ind_register_send(struct ath12k_base *ab)
2199d8899132SKalle Valo {
2200d8899132SKalle Valo 	struct qmi_wlanfw_ind_register_req_msg_v01 *req;
2201d8899132SKalle Valo 	struct qmi_wlanfw_ind_register_resp_msg_v01 *resp;
2202d8899132SKalle Valo 	struct qmi_handle *handle = &ab->qmi.handle;
2203d8899132SKalle Valo 	struct qmi_txn txn;
2204d8899132SKalle Valo 	int ret;
2205d8899132SKalle Valo 
2206d8899132SKalle Valo 	req = kzalloc(sizeof(*req), GFP_KERNEL);
2207d8899132SKalle Valo 	if (!req)
2208d8899132SKalle Valo 		return -ENOMEM;
2209d8899132SKalle Valo 
2210d8899132SKalle Valo 	resp = kzalloc(sizeof(*resp), GFP_KERNEL);
2211d8899132SKalle Valo 	if (!resp) {
2212d8899132SKalle Valo 		ret = -ENOMEM;
2213d8899132SKalle Valo 		goto resp_out;
2214d8899132SKalle Valo 	}
2215d8899132SKalle Valo 
2216d8899132SKalle Valo 	req->client_id_valid = 1;
2217d8899132SKalle Valo 	req->client_id = QMI_WLANFW_CLIENT_ID;
2218d8899132SKalle Valo 	req->fw_ready_enable_valid = 1;
2219d8899132SKalle Valo 	req->fw_ready_enable = 1;
2220d8899132SKalle Valo 	req->request_mem_enable_valid = 1;
2221d8899132SKalle Valo 	req->request_mem_enable = 1;
2222d8899132SKalle Valo 	req->fw_mem_ready_enable_valid = 1;
2223d8899132SKalle Valo 	req->fw_mem_ready_enable = 1;
2224d8899132SKalle Valo 	req->cal_done_enable_valid = 1;
2225d8899132SKalle Valo 	req->cal_done_enable = 1;
2226d8899132SKalle Valo 	req->fw_init_done_enable_valid = 1;
2227d8899132SKalle Valo 	req->fw_init_done_enable = 1;
2228d8899132SKalle Valo 
2229d8899132SKalle Valo 	req->pin_connect_result_enable_valid = 0;
2230d8899132SKalle Valo 	req->pin_connect_result_enable = 0;
2231d8899132SKalle Valo 
2232d8899132SKalle Valo 	ret = qmi_txn_init(handle, &txn,
2233d8899132SKalle Valo 			   qmi_wlanfw_ind_register_resp_msg_v01_ei, resp);
2234d8899132SKalle Valo 	if (ret < 0)
2235d8899132SKalle Valo 		goto out;
2236d8899132SKalle Valo 
2237d8899132SKalle Valo 	ret = qmi_send_request(&ab->qmi.handle, NULL, &txn,
2238d8899132SKalle Valo 			       QMI_WLANFW_IND_REGISTER_REQ_V01,
2239d8899132SKalle Valo 			       QMI_WLANFW_IND_REGISTER_REQ_MSG_V01_MAX_LEN,
2240d8899132SKalle Valo 			       qmi_wlanfw_ind_register_req_msg_v01_ei, req);
2241d8899132SKalle Valo 	if (ret < 0) {
22422e82b5f0SJeff Johnson 		qmi_txn_cancel(&txn);
2243d8899132SKalle Valo 		ath12k_warn(ab, "Failed to send indication register request, err = %d\n",
2244d8899132SKalle Valo 			    ret);
2245d8899132SKalle Valo 		goto out;
2246d8899132SKalle Valo 	}
2247d8899132SKalle Valo 
2248d8899132SKalle Valo 	ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS));
2249d8899132SKalle Valo 	if (ret < 0) {
2250d8899132SKalle Valo 		ath12k_warn(ab, "failed to register fw indication %d\n", ret);
2251d8899132SKalle Valo 		goto out;
2252d8899132SKalle Valo 	}
2253d8899132SKalle Valo 
2254d8899132SKalle Valo 	if (resp->resp.result != QMI_RESULT_SUCCESS_V01) {
2255d8899132SKalle Valo 		ath12k_warn(ab, "FW Ind register request failed, result: %d, err: %d\n",
2256d8899132SKalle Valo 			    resp->resp.result, resp->resp.error);
2257d8899132SKalle Valo 		ret = -EINVAL;
2258d8899132SKalle Valo 		goto out;
2259d8899132SKalle Valo 	}
2260d8899132SKalle Valo 
2261d8899132SKalle Valo out:
2262d8899132SKalle Valo 	kfree(resp);
2263d8899132SKalle Valo resp_out:
2264d8899132SKalle Valo 	kfree(req);
2265d8899132SKalle Valo 	return ret;
2266d8899132SKalle Valo }
2267d8899132SKalle Valo 
2268d8899132SKalle Valo static int ath12k_qmi_respond_fw_mem_request(struct ath12k_base *ab)
2269d8899132SKalle Valo {
2270d8899132SKalle Valo 	struct qmi_wlanfw_respond_mem_req_msg_v01 *req;
22716d2b0a06SJeff Johnson 	struct qmi_wlanfw_respond_mem_resp_msg_v01 resp = {};
227259cf57abSJeff Johnson 	struct qmi_txn txn;
2273d8899132SKalle Valo 	int ret = 0, i;
2274d8899132SKalle Valo 	bool delayed;
2275d8899132SKalle Valo 
2276d8899132SKalle Valo 	req = kzalloc(sizeof(*req), GFP_KERNEL);
2277d8899132SKalle Valo 	if (!req)
2278d8899132SKalle Valo 		return -ENOMEM;
2279d8899132SKalle Valo 
2280d8899132SKalle Valo 	/* Some targets by default request a block of big contiguous
2281d8899132SKalle Valo 	 * DMA memory, it's hard to allocate from kernel. So host returns
2282d8899132SKalle Valo 	 * failure to firmware and firmware then request multiple blocks of
2283d8899132SKalle Valo 	 * small chunk size memory.
2284d8899132SKalle Valo 	 */
2285d8899132SKalle Valo 	if (ab->qmi.target_mem_delayed) {
2286d8899132SKalle Valo 		delayed = true;
2287d8899132SKalle Valo 		ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi delays mem_request %d\n",
2288d8899132SKalle Valo 			   ab->qmi.mem_seg_count);
2289d8899132SKalle Valo 	} else {
2290d8899132SKalle Valo 		delayed = false;
2291d8899132SKalle Valo 		req->mem_seg_len = ab->qmi.mem_seg_count;
2292d8899132SKalle Valo 		for (i = 0; i < req->mem_seg_len ; i++) {
2293d8899132SKalle Valo 			req->mem_seg[i].addr = ab->qmi.target_mem[i].paddr;
2294d8899132SKalle Valo 			req->mem_seg[i].size = ab->qmi.target_mem[i].size;
2295d8899132SKalle Valo 			req->mem_seg[i].type = ab->qmi.target_mem[i].type;
2296d8899132SKalle Valo 			ath12k_dbg(ab, ATH12K_DBG_QMI,
2297d8899132SKalle Valo 				   "qmi req mem_seg[%d] %pad %u %u\n", i,
2298d8899132SKalle Valo 				   &ab->qmi.target_mem[i].paddr,
2299d8899132SKalle Valo 				   ab->qmi.target_mem[i].size,
2300d8899132SKalle Valo 				   ab->qmi.target_mem[i].type);
2301d8899132SKalle Valo 		}
2302d8899132SKalle Valo 	}
2303d8899132SKalle Valo 
2304d8899132SKalle Valo 	ret = qmi_txn_init(&ab->qmi.handle, &txn,
2305d8899132SKalle Valo 			   qmi_wlanfw_respond_mem_resp_msg_v01_ei, &resp);
2306d8899132SKalle Valo 	if (ret < 0)
2307d8899132SKalle Valo 		goto out;
2308d8899132SKalle Valo 
2309d8899132SKalle Valo 	ret = qmi_send_request(&ab->qmi.handle, NULL, &txn,
2310d8899132SKalle Valo 			       QMI_WLANFW_RESPOND_MEM_REQ_V01,
2311d8899132SKalle Valo 			       QMI_WLANFW_RESPOND_MEM_REQ_MSG_V01_MAX_LEN,
2312d8899132SKalle Valo 			       qmi_wlanfw_respond_mem_req_msg_v01_ei, req);
2313d8899132SKalle Valo 	if (ret < 0) {
23142e82b5f0SJeff Johnson 		qmi_txn_cancel(&txn);
2315d8899132SKalle Valo 		ath12k_warn(ab, "qmi failed to respond memory request, err = %d\n",
2316d8899132SKalle Valo 			    ret);
2317d8899132SKalle Valo 		goto out;
2318d8899132SKalle Valo 	}
2319d8899132SKalle Valo 
2320d8899132SKalle Valo 	ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS));
2321d8899132SKalle Valo 	if (ret < 0) {
2322d8899132SKalle Valo 		ath12k_warn(ab, "qmi failed memory request, err = %d\n", ret);
2323d8899132SKalle Valo 		goto out;
2324d8899132SKalle Valo 	}
2325d8899132SKalle Valo 
2326d8899132SKalle Valo 	if (resp.resp.result != QMI_RESULT_SUCCESS_V01) {
2327d8899132SKalle Valo 		/* the error response is expected when
2328d8899132SKalle Valo 		 * target_mem_delayed is true.
2329d8899132SKalle Valo 		 */
2330d8899132SKalle Valo 		if (delayed && resp.resp.error == 0)
2331d8899132SKalle Valo 			goto out;
2332d8899132SKalle Valo 
2333d8899132SKalle Valo 		ath12k_warn(ab, "Respond mem req failed, result: %d, err: %d\n",
2334d8899132SKalle Valo 			    resp.resp.result, resp.resp.error);
2335d8899132SKalle Valo 		ret = -EINVAL;
2336d8899132SKalle Valo 		goto out;
2337d8899132SKalle Valo 	}
2338d8899132SKalle Valo out:
2339d8899132SKalle Valo 	kfree(req);
2340d8899132SKalle Valo 	return ret;
2341d8899132SKalle Valo }
2342d8899132SKalle Valo 
2343d8899132SKalle Valo static void ath12k_qmi_free_target_mem_chunk(struct ath12k_base *ab)
2344d8899132SKalle Valo {
2345d8899132SKalle Valo 	int i;
2346d8899132SKalle Valo 
2347d8899132SKalle Valo 	for (i = 0; i < ab->qmi.mem_seg_count; i++) {
2348d8899132SKalle Valo 		if (!ab->qmi.target_mem[i].v.addr)
2349d8899132SKalle Valo 			continue;
2350303c0178SBaochen Qiang 
2351d8899132SKalle Valo 		dma_free_coherent(ab->dev,
2352303c0178SBaochen Qiang 				  ab->qmi.target_mem[i].prev_size,
2353d8899132SKalle Valo 				  ab->qmi.target_mem[i].v.addr,
2354d8899132SKalle Valo 				  ab->qmi.target_mem[i].paddr);
2355d8899132SKalle Valo 		ab->qmi.target_mem[i].v.addr = NULL;
2356d8899132SKalle Valo 	}
2357d8899132SKalle Valo }
2358d8899132SKalle Valo 
2359d8899132SKalle Valo static int ath12k_qmi_alloc_target_mem_chunk(struct ath12k_base *ab)
2360d8899132SKalle Valo {
2361d8899132SKalle Valo 	int i;
2362d8899132SKalle Valo 	struct target_mem_chunk *chunk;
2363d8899132SKalle Valo 
2364d8899132SKalle Valo 	ab->qmi.target_mem_delayed = false;
2365d8899132SKalle Valo 
2366d8899132SKalle Valo 	for (i = 0; i < ab->qmi.mem_seg_count; i++) {
2367d8899132SKalle Valo 		chunk = &ab->qmi.target_mem[i];
2368d8899132SKalle Valo 
2369d8899132SKalle Valo 		/* Allocate memory for the region and the functionality supported
2370d8899132SKalle Valo 		 * on the host. For the non-supported memory region, host does not
2371d8899132SKalle Valo 		 * allocate memory, assigns NULL and FW will handle this without crashing.
2372d8899132SKalle Valo 		 */
2373d8899132SKalle Valo 		switch (chunk->type) {
2374d8899132SKalle Valo 		case HOST_DDR_REGION_TYPE:
2375d8899132SKalle Valo 		case M3_DUMP_REGION_TYPE:
2376d8899132SKalle Valo 		case PAGEABLE_MEM_REGION_TYPE:
2377d8899132SKalle Valo 		case CALDB_MEM_REGION_TYPE:
2378303c0178SBaochen Qiang 			/* Firmware reloads in recovery/resume.
2379303c0178SBaochen Qiang 			 * In such cases, no need to allocate memory for FW again.
2380303c0178SBaochen Qiang 			 */
2381303c0178SBaochen Qiang 			if (chunk->v.addr) {
2382303c0178SBaochen Qiang 				if (chunk->prev_type == chunk->type &&
2383303c0178SBaochen Qiang 				    chunk->prev_size == chunk->size)
2384303c0178SBaochen Qiang 					goto this_chunk_done;
2385303c0178SBaochen Qiang 
2386303c0178SBaochen Qiang 				/* cannot reuse the existing chunk */
2387303c0178SBaochen Qiang 				dma_free_coherent(ab->dev, chunk->prev_size,
2388303c0178SBaochen Qiang 						  chunk->v.addr, chunk->paddr);
2389303c0178SBaochen Qiang 				chunk->v.addr = NULL;
2390303c0178SBaochen Qiang 			}
2391303c0178SBaochen Qiang 
2392d8899132SKalle Valo 			chunk->v.addr = dma_alloc_coherent(ab->dev,
2393d8899132SKalle Valo 							   chunk->size,
2394d8899132SKalle Valo 							   &chunk->paddr,
2395d8899132SKalle Valo 							   GFP_KERNEL | __GFP_NOWARN);
2396d8899132SKalle Valo 			if (!chunk->v.addr) {
2397d8899132SKalle Valo 				if (chunk->size > ATH12K_QMI_MAX_CHUNK_SIZE) {
2398d8899132SKalle Valo 					ab->qmi.target_mem_delayed = true;
2399d8899132SKalle Valo 					ath12k_warn(ab,
2400d8899132SKalle Valo 						    "qmi dma allocation failed (%d B type %u), will try later with small size\n",
2401d8899132SKalle Valo 						    chunk->size,
2402d8899132SKalle Valo 						    chunk->type);
2403d8899132SKalle Valo 					ath12k_qmi_free_target_mem_chunk(ab);
2404d8899132SKalle Valo 					return 0;
2405d8899132SKalle Valo 				}
2406d8899132SKalle Valo 				ath12k_warn(ab, "memory allocation failure for %u size: %d\n",
2407d8899132SKalle Valo 					    chunk->type, chunk->size);
2408d8899132SKalle Valo 				return -ENOMEM;
2409d8899132SKalle Valo 			}
2410303c0178SBaochen Qiang 
2411303c0178SBaochen Qiang 			chunk->prev_type = chunk->type;
2412303c0178SBaochen Qiang 			chunk->prev_size = chunk->size;
2413303c0178SBaochen Qiang this_chunk_done:
2414d8899132SKalle Valo 			break;
2415d8899132SKalle Valo 		default:
2416d8899132SKalle Valo 			ath12k_warn(ab, "memory type %u not supported\n",
2417d8899132SKalle Valo 				    chunk->type);
2418d8899132SKalle Valo 			chunk->paddr = 0;
2419d8899132SKalle Valo 			chunk->v.addr = NULL;
2420d8899132SKalle Valo 			break;
2421d8899132SKalle Valo 		}
2422d8899132SKalle Valo 	}
2423d8899132SKalle Valo 	return 0;
2424d8899132SKalle Valo }
2425d8899132SKalle Valo 
2426d8899132SKalle Valo static int ath12k_qmi_request_target_cap(struct ath12k_base *ab)
2427d8899132SKalle Valo {
24286d2b0a06SJeff Johnson 	struct qmi_wlanfw_cap_req_msg_v01 req = {};
24296d2b0a06SJeff Johnson 	struct qmi_wlanfw_cap_resp_msg_v01 resp = {};
243059cf57abSJeff Johnson 	struct qmi_txn txn;
2431d8899132SKalle Valo 	unsigned int board_id = ATH12K_BOARD_ID_DEFAULT;
2432d8899132SKalle Valo 	int ret = 0;
24337d9832e3SWen Gong 	int r;
2434d8899132SKalle Valo 	int i;
2435d8899132SKalle Valo 
2436d8899132SKalle Valo 	ret = qmi_txn_init(&ab->qmi.handle, &txn,
2437d8899132SKalle Valo 			   qmi_wlanfw_cap_resp_msg_v01_ei, &resp);
2438d8899132SKalle Valo 	if (ret < 0)
2439d8899132SKalle Valo 		goto out;
2440d8899132SKalle Valo 
2441d8899132SKalle Valo 	ret = qmi_send_request(&ab->qmi.handle, NULL, &txn,
2442d8899132SKalle Valo 			       QMI_WLANFW_CAP_REQ_V01,
2443d8899132SKalle Valo 			       QMI_WLANFW_CAP_REQ_MSG_V01_MAX_LEN,
2444d8899132SKalle Valo 			       qmi_wlanfw_cap_req_msg_v01_ei, &req);
2445d8899132SKalle Valo 	if (ret < 0) {
24462e82b5f0SJeff Johnson 		qmi_txn_cancel(&txn);
2447d8899132SKalle Valo 		ath12k_warn(ab, "qmi failed to send target cap request, err = %d\n",
2448d8899132SKalle Valo 			    ret);
2449d8899132SKalle Valo 		goto out;
2450d8899132SKalle Valo 	}
2451d8899132SKalle Valo 
2452d8899132SKalle Valo 	ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS));
2453d8899132SKalle Valo 	if (ret < 0) {
2454d8899132SKalle Valo 		ath12k_warn(ab, "qmi failed target cap request %d\n", ret);
2455d8899132SKalle Valo 		goto out;
2456d8899132SKalle Valo 	}
2457d8899132SKalle Valo 
2458d8899132SKalle Valo 	if (resp.resp.result != QMI_RESULT_SUCCESS_V01) {
2459d8899132SKalle Valo 		ath12k_warn(ab, "qmi targetcap req failed, result: %d, err: %d\n",
2460d8899132SKalle Valo 			    resp.resp.result, resp.resp.error);
2461d8899132SKalle Valo 		ret = -EINVAL;
2462d8899132SKalle Valo 		goto out;
2463d8899132SKalle Valo 	}
2464d8899132SKalle Valo 
2465d8899132SKalle Valo 	if (resp.chip_info_valid) {
2466d8899132SKalle Valo 		ab->qmi.target.chip_id = resp.chip_info.chip_id;
2467d8899132SKalle Valo 		ab->qmi.target.chip_family = resp.chip_info.chip_family;
2468d8899132SKalle Valo 	}
2469d8899132SKalle Valo 
2470d8899132SKalle Valo 	if (resp.board_info_valid)
2471d8899132SKalle Valo 		ab->qmi.target.board_id = resp.board_info.board_id;
2472d8899132SKalle Valo 	else
2473d8899132SKalle Valo 		ab->qmi.target.board_id = board_id;
2474d8899132SKalle Valo 
2475d8899132SKalle Valo 	if (resp.soc_info_valid)
2476d8899132SKalle Valo 		ab->qmi.target.soc_id = resp.soc_info.soc_id;
2477d8899132SKalle Valo 
2478d8899132SKalle Valo 	if (resp.fw_version_info_valid) {
2479d8899132SKalle Valo 		ab->qmi.target.fw_version = resp.fw_version_info.fw_version;
2480d8899132SKalle Valo 		strscpy(ab->qmi.target.fw_build_timestamp,
2481d8899132SKalle Valo 			resp.fw_version_info.fw_build_timestamp,
2482d8899132SKalle Valo 			sizeof(ab->qmi.target.fw_build_timestamp));
2483d8899132SKalle Valo 	}
2484d8899132SKalle Valo 
2485d8899132SKalle Valo 	if (resp.fw_build_id_valid)
2486d8899132SKalle Valo 		strscpy(ab->qmi.target.fw_build_id, resp.fw_build_id,
2487d8899132SKalle Valo 			sizeof(ab->qmi.target.fw_build_id));
2488d8899132SKalle Valo 
2489d8899132SKalle Valo 	if (resp.dev_mem_info_valid) {
2490d8899132SKalle Valo 		for (i = 0; i < ATH12K_QMI_WLFW_MAX_DEV_MEM_NUM_V01; i++) {
2491d8899132SKalle Valo 			ab->qmi.dev_mem[i].start =
2492d8899132SKalle Valo 				resp.dev_mem[i].start;
2493d8899132SKalle Valo 			ab->qmi.dev_mem[i].size =
2494d8899132SKalle Valo 				resp.dev_mem[i].size;
2495d8899132SKalle Valo 			ath12k_dbg(ab, ATH12K_DBG_QMI,
2496d8899132SKalle Valo 				   "devmem [%d] start ox%llx size %llu\n", i,
2497d8899132SKalle Valo 				   ab->qmi.dev_mem[i].start,
2498d8899132SKalle Valo 				   ab->qmi.dev_mem[i].size);
2499d8899132SKalle Valo 		}
2500d8899132SKalle Valo 	}
2501d8899132SKalle Valo 
2502d8899132SKalle Valo 	if (resp.eeprom_caldata_read_timeout_valid) {
2503d8899132SKalle Valo 		ab->qmi.target.eeprom_caldata = resp.eeprom_caldata_read_timeout;
2504d8899132SKalle Valo 		ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi cal data supported from eeprom\n");
2505d8899132SKalle Valo 	}
2506d8899132SKalle Valo 
2507d8899132SKalle Valo 	ath12k_info(ab, "chip_id 0x%x chip_family 0x%x board_id 0x%x soc_id 0x%x\n",
2508d8899132SKalle Valo 		    ab->qmi.target.chip_id, ab->qmi.target.chip_family,
2509d8899132SKalle Valo 		    ab->qmi.target.board_id, ab->qmi.target.soc_id);
2510d8899132SKalle Valo 
2511d8899132SKalle Valo 	ath12k_info(ab, "fw_version 0x%x fw_build_timestamp %s fw_build_id %s",
2512d8899132SKalle Valo 		    ab->qmi.target.fw_version,
2513d8899132SKalle Valo 		    ab->qmi.target.fw_build_timestamp,
2514d8899132SKalle Valo 		    ab->qmi.target.fw_build_id);
2515d8899132SKalle Valo 
25167d9832e3SWen Gong 	r = ath12k_core_check_smbios(ab);
25177d9832e3SWen Gong 	if (r)
25187d9832e3SWen Gong 		ath12k_dbg(ab, ATH12K_DBG_QMI, "SMBIOS bdf variant name not set.\n");
25197d9832e3SWen Gong 
2520d8899132SKalle Valo out:
2521d8899132SKalle Valo 	return ret;
2522d8899132SKalle Valo }
2523d8899132SKalle Valo 
2524d8899132SKalle Valo static int ath12k_qmi_load_file_target_mem(struct ath12k_base *ab,
2525d8899132SKalle Valo 					   const u8 *data, u32 len, u8 type)
2526d8899132SKalle Valo {
2527d8899132SKalle Valo 	struct qmi_wlanfw_bdf_download_req_msg_v01 *req;
25286d2b0a06SJeff Johnson 	struct qmi_wlanfw_bdf_download_resp_msg_v01 resp = {};
252959cf57abSJeff Johnson 	struct qmi_txn txn;
2530d8899132SKalle Valo 	const u8 *temp = data;
2531d8899132SKalle Valo 	int ret;
2532d8899132SKalle Valo 	u32 remaining = len;
2533d8899132SKalle Valo 
2534d8899132SKalle Valo 	req = kzalloc(sizeof(*req), GFP_KERNEL);
2535d8899132SKalle Valo 	if (!req)
2536d8899132SKalle Valo 		return -ENOMEM;
2537d8899132SKalle Valo 
2538d8899132SKalle Valo 	while (remaining) {
2539d8899132SKalle Valo 		req->valid = 1;
2540d8899132SKalle Valo 		req->file_id_valid = 1;
2541d8899132SKalle Valo 		req->file_id = ab->qmi.target.board_id;
2542d8899132SKalle Valo 		req->total_size_valid = 1;
2543d8899132SKalle Valo 		req->total_size = remaining;
2544d8899132SKalle Valo 		req->seg_id_valid = 1;
2545d8899132SKalle Valo 		req->data_valid = 1;
2546d8899132SKalle Valo 		req->bdf_type = type;
2547d8899132SKalle Valo 		req->bdf_type_valid = 1;
2548d8899132SKalle Valo 		req->end_valid = 1;
2549d8899132SKalle Valo 		req->end = 0;
2550d8899132SKalle Valo 
2551d8899132SKalle Valo 		if (remaining > QMI_WLANFW_MAX_DATA_SIZE_V01) {
2552d8899132SKalle Valo 			req->data_len = QMI_WLANFW_MAX_DATA_SIZE_V01;
2553d8899132SKalle Valo 		} else {
2554d8899132SKalle Valo 			req->data_len = remaining;
2555d8899132SKalle Valo 			req->end = 1;
2556d8899132SKalle Valo 		}
2557d8899132SKalle Valo 
2558d8899132SKalle Valo 		if (type == ATH12K_QMI_FILE_TYPE_EEPROM) {
2559d8899132SKalle Valo 			req->data_valid = 0;
2560d8899132SKalle Valo 			req->end = 1;
2561d8899132SKalle Valo 			req->data_len = ATH12K_QMI_MAX_BDF_FILE_NAME_SIZE;
2562d8899132SKalle Valo 		} else {
2563d8899132SKalle Valo 			memcpy(req->data, temp, req->data_len);
2564d8899132SKalle Valo 		}
2565d8899132SKalle Valo 
2566d8899132SKalle Valo 		ret = qmi_txn_init(&ab->qmi.handle, &txn,
2567d8899132SKalle Valo 				   qmi_wlanfw_bdf_download_resp_msg_v01_ei,
2568d8899132SKalle Valo 				   &resp);
2569d8899132SKalle Valo 		if (ret < 0)
2570d8899132SKalle Valo 			goto out;
2571d8899132SKalle Valo 
2572d8899132SKalle Valo 		ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi bdf download req fixed addr type %d\n",
2573d8899132SKalle Valo 			   type);
2574d8899132SKalle Valo 
2575d8899132SKalle Valo 		ret = qmi_send_request(&ab->qmi.handle, NULL, &txn,
2576d8899132SKalle Valo 				       QMI_WLANFW_BDF_DOWNLOAD_REQ_V01,
2577d8899132SKalle Valo 				       QMI_WLANFW_BDF_DOWNLOAD_REQ_MSG_V01_MAX_LEN,
2578d8899132SKalle Valo 				       qmi_wlanfw_bdf_download_req_msg_v01_ei, req);
2579d8899132SKalle Valo 		if (ret < 0) {
2580d8899132SKalle Valo 			qmi_txn_cancel(&txn);
2581d8899132SKalle Valo 			goto out;
2582d8899132SKalle Valo 		}
2583d8899132SKalle Valo 
2584d8899132SKalle Valo 		ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS));
2585d8899132SKalle Valo 		if (ret < 0)
2586d8899132SKalle Valo 			goto out;
2587d8899132SKalle Valo 
2588d8899132SKalle Valo 		if (resp.resp.result != QMI_RESULT_SUCCESS_V01) {
2589d8899132SKalle Valo 			ath12k_warn(ab, "qmi BDF download failed, result: %d, err: %d\n",
2590d8899132SKalle Valo 				    resp.resp.result, resp.resp.error);
2591d8899132SKalle Valo 			ret = -EINVAL;
2592d8899132SKalle Valo 			goto out;
2593d8899132SKalle Valo 		}
2594d8899132SKalle Valo 
2595801fc159SDinesh Karthikeyan 		if (type == ATH12K_QMI_FILE_TYPE_EEPROM) {
2596801fc159SDinesh Karthikeyan 			remaining = 0;
2597801fc159SDinesh Karthikeyan 		} else {
2598d8899132SKalle Valo 			remaining -= req->data_len;
2599d8899132SKalle Valo 			temp += req->data_len;
2600d8899132SKalle Valo 			req->seg_id++;
2601d8899132SKalle Valo 			ath12k_dbg(ab, ATH12K_DBG_QMI,
2602d8899132SKalle Valo 				   "qmi bdf download request remaining %i\n",
2603d8899132SKalle Valo 				   remaining);
2604d8899132SKalle Valo 		}
2605801fc159SDinesh Karthikeyan 	}
2606d8899132SKalle Valo 
2607d8899132SKalle Valo out:
2608d8899132SKalle Valo 	kfree(req);
2609d8899132SKalle Valo 	return ret;
2610d8899132SKalle Valo }
2611d8899132SKalle Valo 
2612d8899132SKalle Valo static int ath12k_qmi_load_bdf_qmi(struct ath12k_base *ab,
2613d8899132SKalle Valo 				   enum ath12k_qmi_bdf_type type)
2614d8899132SKalle Valo {
2615d8899132SKalle Valo 	struct device *dev = ab->dev;
2616d8899132SKalle Valo 	char filename[ATH12K_QMI_MAX_BDF_FILE_NAME_SIZE];
2617d8899132SKalle Valo 	const struct firmware *fw_entry;
2618d8899132SKalle Valo 	struct ath12k_board_data bd;
2619d8899132SKalle Valo 	u32 fw_size, file_type;
2620d8899132SKalle Valo 	int ret = 0;
2621d8899132SKalle Valo 	const u8 *tmp;
2622d8899132SKalle Valo 
2623d8899132SKalle Valo 	memset(&bd, 0, sizeof(bd));
2624d8899132SKalle Valo 
2625d8899132SKalle Valo 	switch (type) {
2626d8899132SKalle Valo 	case ATH12K_QMI_BDF_TYPE_ELF:
2627d8899132SKalle Valo 		ret = ath12k_core_fetch_bdf(ab, &bd);
2628d8899132SKalle Valo 		if (ret) {
2629d8899132SKalle Valo 			ath12k_warn(ab, "qmi failed to load bdf:\n");
2630d8899132SKalle Valo 			goto out;
2631d8899132SKalle Valo 		}
2632d8899132SKalle Valo 
2633d8899132SKalle Valo 		if (bd.len >= SELFMAG && memcmp(bd.data, ELFMAG, SELFMAG) == 0)
2634d8899132SKalle Valo 			type = ATH12K_QMI_BDF_TYPE_ELF;
2635d8899132SKalle Valo 		else
2636d8899132SKalle Valo 			type = ATH12K_QMI_BDF_TYPE_BIN;
2637d8899132SKalle Valo 
2638d8899132SKalle Valo 		break;
2639d8899132SKalle Valo 	case ATH12K_QMI_BDF_TYPE_REGDB:
264051120745SWen Gong 		ret = ath12k_core_fetch_regdb(ab, &bd);
2641d8899132SKalle Valo 		if (ret) {
2642d8899132SKalle Valo 			ath12k_warn(ab, "qmi failed to load regdb bin:\n");
2643d8899132SKalle Valo 			goto out;
2644d8899132SKalle Valo 		}
2645d8899132SKalle Valo 		break;
264642982259SDinesh Karthikeyan 	case ATH12K_QMI_BDF_TYPE_CALIBRATION:
2647d8899132SKalle Valo 
2648d8899132SKalle Valo 		if (ab->qmi.target.eeprom_caldata) {
2649801fc159SDinesh Karthikeyan 			file_type = ATH12K_QMI_FILE_TYPE_EEPROM;
2650d8899132SKalle Valo 			tmp = filename;
2651d8899132SKalle Valo 			fw_size = ATH12K_QMI_MAX_BDF_FILE_NAME_SIZE;
2652d8899132SKalle Valo 		} else {
2653d8899132SKalle Valo 			file_type = ATH12K_QMI_FILE_TYPE_CALDATA;
2654d8899132SKalle Valo 
2655d8899132SKalle Valo 			/* cal-<bus>-<id>.bin */
2656d8899132SKalle Valo 			snprintf(filename, sizeof(filename), "cal-%s-%s.bin",
2657d8899132SKalle Valo 				 ath12k_bus_str(ab->hif.bus), dev_name(dev));
2658d8899132SKalle Valo 			fw_entry = ath12k_core_firmware_request(ab, filename);
2659d8899132SKalle Valo 			if (!IS_ERR(fw_entry))
2660d8899132SKalle Valo 				goto success;
2661d8899132SKalle Valo 
266242982259SDinesh Karthikeyan 			fw_entry = ath12k_core_firmware_request(ab,
266342982259SDinesh Karthikeyan 								ATH12K_DEFAULT_CAL_FILE);
2664d8899132SKalle Valo 			if (IS_ERR(fw_entry)) {
2665d8899132SKalle Valo 				ret = PTR_ERR(fw_entry);
2666d8899132SKalle Valo 				ath12k_warn(ab,
2667d8899132SKalle Valo 					    "qmi failed to load CAL data file:%s\n",
2668d8899132SKalle Valo 					    filename);
2669d8899132SKalle Valo 				goto out;
2670d8899132SKalle Valo 			}
2671d8899132SKalle Valo 
2672d8899132SKalle Valo success:
267342982259SDinesh Karthikeyan 			fw_size = min_t(u32, ab->hw_params->fw.board_size,
267442982259SDinesh Karthikeyan 					fw_entry->size);
2675d8899132SKalle Valo 			tmp = fw_entry->data;
2676d8899132SKalle Valo 		}
2677d8899132SKalle Valo 		ret = ath12k_qmi_load_file_target_mem(ab, tmp, fw_size, file_type);
2678d8899132SKalle Valo 		if (ret < 0) {
2679d8899132SKalle Valo 			ath12k_warn(ab, "qmi failed to load caldata\n");
2680d8899132SKalle Valo 			goto out_qmi_cal;
2681d8899132SKalle Valo 		}
2682d8899132SKalle Valo 
2683d8899132SKalle Valo 		ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi caldata downloaded: type: %u\n",
2684d8899132SKalle Valo 			   file_type);
2685d8899132SKalle Valo 
2686d8899132SKalle Valo out_qmi_cal:
2687d8899132SKalle Valo 		if (!ab->qmi.target.eeprom_caldata)
2688d8899132SKalle Valo 			release_firmware(fw_entry);
268942982259SDinesh Karthikeyan 		return ret;
269042982259SDinesh Karthikeyan 	default:
269142982259SDinesh Karthikeyan 		ath12k_warn(ab, "unknown file type for load %d", type);
269242982259SDinesh Karthikeyan 		goto out;
269342982259SDinesh Karthikeyan 	}
269442982259SDinesh Karthikeyan 
269542982259SDinesh Karthikeyan 	ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi bdf_type %d\n", type);
269642982259SDinesh Karthikeyan 
269742982259SDinesh Karthikeyan 	fw_size = min_t(u32, ab->hw_params->fw.board_size, bd.len);
269842982259SDinesh Karthikeyan 
269942982259SDinesh Karthikeyan 	ret = ath12k_qmi_load_file_target_mem(ab, bd.data, fw_size, type);
270042982259SDinesh Karthikeyan 	if (ret < 0)
270142982259SDinesh Karthikeyan 		ath12k_warn(ab, "qmi failed to load bdf file\n");
270242982259SDinesh Karthikeyan 
2703d8899132SKalle Valo out:
2704d8899132SKalle Valo 	ath12k_core_free_bdf(ab, &bd);
2705d8899132SKalle Valo 	ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi BDF download sequence completed\n");
2706d8899132SKalle Valo 
2707d8899132SKalle Valo 	return ret;
2708d8899132SKalle Valo }
2709d8899132SKalle Valo 
2710d8899132SKalle Valo static int ath12k_qmi_m3_load(struct ath12k_base *ab)
2711d8899132SKalle Valo {
2712d8899132SKalle Valo 	struct m3_mem_region *m3_mem = &ab->qmi.m3_mem;
271312f491cdSRaj Kumar Bhagat 	const struct firmware *fw = NULL;
271412f491cdSRaj Kumar Bhagat 	const void *m3_data;
2715d8899132SKalle Valo 	char path[100];
271612f491cdSRaj Kumar Bhagat 	size_t m3_len;
2717d8899132SKalle Valo 	int ret;
2718d8899132SKalle Valo 
271912f491cdSRaj Kumar Bhagat 	if (ab->fw.m3_data && ab->fw.m3_len > 0) {
272012f491cdSRaj Kumar Bhagat 		/* firmware-N.bin had a m3 firmware file so use that */
272112f491cdSRaj Kumar Bhagat 		m3_data = ab->fw.m3_data;
272212f491cdSRaj Kumar Bhagat 		m3_len = ab->fw.m3_len;
272312f491cdSRaj Kumar Bhagat 	} else {
272412f491cdSRaj Kumar Bhagat 		/* No m3 file in firmware-N.bin so try to request old
272512f491cdSRaj Kumar Bhagat 		 * separate m3.bin.
272612f491cdSRaj Kumar Bhagat 		 */
2727d8899132SKalle Valo 		fw = ath12k_core_firmware_request(ab, ATH12K_M3_FILE);
2728d8899132SKalle Valo 		if (IS_ERR(fw)) {
2729d8899132SKalle Valo 			ret = PTR_ERR(fw);
2730d8899132SKalle Valo 			ath12k_core_create_firmware_path(ab, ATH12K_M3_FILE,
2731d8899132SKalle Valo 							 path, sizeof(path));
2732d8899132SKalle Valo 			ath12k_err(ab, "failed to load %s: %d\n", path, ret);
2733d8899132SKalle Valo 			return ret;
2734d8899132SKalle Valo 		}
2735d8899132SKalle Valo 
273612f491cdSRaj Kumar Bhagat 		m3_data = fw->data;
273712f491cdSRaj Kumar Bhagat 		m3_len = fw->size;
273812f491cdSRaj Kumar Bhagat 	}
273912f491cdSRaj Kumar Bhagat 
2740303c0178SBaochen Qiang 	if (m3_mem->vaddr)
2741303c0178SBaochen Qiang 		goto skip_m3_alloc;
2742303c0178SBaochen Qiang 
2743d8899132SKalle Valo 	m3_mem->vaddr = dma_alloc_coherent(ab->dev,
274412f491cdSRaj Kumar Bhagat 					   m3_len, &m3_mem->paddr,
2745d8899132SKalle Valo 					   GFP_KERNEL);
2746d8899132SKalle Valo 	if (!m3_mem->vaddr) {
2747d8899132SKalle Valo 		ath12k_err(ab, "failed to allocate memory for M3 with size %zu\n",
2748d8899132SKalle Valo 			   fw->size);
274912f491cdSRaj Kumar Bhagat 		ret = -ENOMEM;
275012f491cdSRaj Kumar Bhagat 		goto out;
2751d8899132SKalle Valo 	}
2752d8899132SKalle Valo 
2753303c0178SBaochen Qiang skip_m3_alloc:
275412f491cdSRaj Kumar Bhagat 	memcpy(m3_mem->vaddr, m3_data, m3_len);
275512f491cdSRaj Kumar Bhagat 	m3_mem->size = m3_len;
275612f491cdSRaj Kumar Bhagat 
275712f491cdSRaj Kumar Bhagat 	ret = 0;
275812f491cdSRaj Kumar Bhagat 
275912f491cdSRaj Kumar Bhagat out:
2760d8899132SKalle Valo 	release_firmware(fw);
2761d8899132SKalle Valo 
276212f491cdSRaj Kumar Bhagat 	return ret;
2763d8899132SKalle Valo }
2764d8899132SKalle Valo 
2765d8899132SKalle Valo static void ath12k_qmi_m3_free(struct ath12k_base *ab)
2766d8899132SKalle Valo {
2767d8899132SKalle Valo 	struct m3_mem_region *m3_mem = &ab->qmi.m3_mem;
2768d8899132SKalle Valo 
2769d8899132SKalle Valo 	if (!m3_mem->vaddr)
2770d8899132SKalle Valo 		return;
2771d8899132SKalle Valo 
2772d8899132SKalle Valo 	dma_free_coherent(ab->dev, m3_mem->size,
2773d8899132SKalle Valo 			  m3_mem->vaddr, m3_mem->paddr);
2774d8899132SKalle Valo 	m3_mem->vaddr = NULL;
2775c42c2b82SWen Gong 	m3_mem->size = 0;
2776d8899132SKalle Valo }
2777d8899132SKalle Valo 
2778d8899132SKalle Valo static int ath12k_qmi_wlanfw_m3_info_send(struct ath12k_base *ab)
2779d8899132SKalle Valo {
2780d8899132SKalle Valo 	struct m3_mem_region *m3_mem = &ab->qmi.m3_mem;
27816d2b0a06SJeff Johnson 	struct qmi_wlanfw_m3_info_req_msg_v01 req = {};
27826d2b0a06SJeff Johnson 	struct qmi_wlanfw_m3_info_resp_msg_v01 resp = {};
278359cf57abSJeff Johnson 	struct qmi_txn txn;
2784d8899132SKalle Valo 	int ret = 0;
2785d8899132SKalle Valo 
2786d8899132SKalle Valo 	ret = ath12k_qmi_m3_load(ab);
2787d8899132SKalle Valo 	if (ret) {
2788d8899132SKalle Valo 		ath12k_err(ab, "failed to load m3 firmware: %d", ret);
2789d8899132SKalle Valo 		return ret;
2790d8899132SKalle Valo 	}
2791d8899132SKalle Valo 
2792d8899132SKalle Valo 	req.addr = m3_mem->paddr;
2793d8899132SKalle Valo 	req.size = m3_mem->size;
2794d8899132SKalle Valo 
2795d8899132SKalle Valo 	ret = qmi_txn_init(&ab->qmi.handle, &txn,
2796d8899132SKalle Valo 			   qmi_wlanfw_m3_info_resp_msg_v01_ei, &resp);
2797d8899132SKalle Valo 	if (ret < 0)
2798d8899132SKalle Valo 		goto out;
2799d8899132SKalle Valo 
2800d8899132SKalle Valo 	ret = qmi_send_request(&ab->qmi.handle, NULL, &txn,
2801d8899132SKalle Valo 			       QMI_WLANFW_M3_INFO_REQ_V01,
2802d8899132SKalle Valo 			       QMI_WLANFW_M3_INFO_REQ_MSG_V01_MAX_MSG_LEN,
2803d8899132SKalle Valo 			       qmi_wlanfw_m3_info_req_msg_v01_ei, &req);
2804d8899132SKalle Valo 	if (ret < 0) {
28052e82b5f0SJeff Johnson 		qmi_txn_cancel(&txn);
2806d8899132SKalle Valo 		ath12k_warn(ab, "qmi failed to send M3 information request, err = %d\n",
2807d8899132SKalle Valo 			    ret);
2808d8899132SKalle Valo 		goto out;
2809d8899132SKalle Valo 	}
2810d8899132SKalle Valo 
2811d8899132SKalle Valo 	ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS));
2812d8899132SKalle Valo 	if (ret < 0) {
2813d8899132SKalle Valo 		ath12k_warn(ab, "qmi failed M3 information request %d\n", ret);
2814d8899132SKalle Valo 		goto out;
2815d8899132SKalle Valo 	}
2816d8899132SKalle Valo 
2817d8899132SKalle Valo 	if (resp.resp.result != QMI_RESULT_SUCCESS_V01) {
2818d8899132SKalle Valo 		ath12k_warn(ab, "qmi M3 info request failed, result: %d, err: %d\n",
2819d8899132SKalle Valo 			    resp.resp.result, resp.resp.error);
2820d8899132SKalle Valo 		ret = -EINVAL;
2821d8899132SKalle Valo 		goto out;
2822d8899132SKalle Valo 	}
2823d8899132SKalle Valo out:
2824d8899132SKalle Valo 	return ret;
2825d8899132SKalle Valo }
2826d8899132SKalle Valo 
2827d8899132SKalle Valo static int ath12k_qmi_wlanfw_mode_send(struct ath12k_base *ab,
2828d8899132SKalle Valo 				       u32 mode)
2829d8899132SKalle Valo {
28306d2b0a06SJeff Johnson 	struct qmi_wlanfw_wlan_mode_req_msg_v01 req = {};
28316d2b0a06SJeff Johnson 	struct qmi_wlanfw_wlan_mode_resp_msg_v01 resp = {};
283259cf57abSJeff Johnson 	struct qmi_txn txn;
2833d8899132SKalle Valo 	int ret = 0;
2834d8899132SKalle Valo 
2835d8899132SKalle Valo 	req.mode = mode;
2836d8899132SKalle Valo 	req.hw_debug_valid = 1;
2837d8899132SKalle Valo 	req.hw_debug = 0;
2838d8899132SKalle Valo 
2839d8899132SKalle Valo 	ret = qmi_txn_init(&ab->qmi.handle, &txn,
2840d8899132SKalle Valo 			   qmi_wlanfw_wlan_mode_resp_msg_v01_ei, &resp);
2841d8899132SKalle Valo 	if (ret < 0)
2842d8899132SKalle Valo 		goto out;
2843d8899132SKalle Valo 
2844d8899132SKalle Valo 	ret = qmi_send_request(&ab->qmi.handle, NULL, &txn,
2845d8899132SKalle Valo 			       QMI_WLANFW_WLAN_MODE_REQ_V01,
2846d8899132SKalle Valo 			       QMI_WLANFW_WLAN_MODE_REQ_MSG_V01_MAX_LEN,
2847d8899132SKalle Valo 			       qmi_wlanfw_wlan_mode_req_msg_v01_ei, &req);
2848d8899132SKalle Valo 	if (ret < 0) {
28492e82b5f0SJeff Johnson 		qmi_txn_cancel(&txn);
2850d8899132SKalle Valo 		ath12k_warn(ab, "qmi failed to send mode request, mode: %d, err = %d\n",
2851d8899132SKalle Valo 			    mode, ret);
2852d8899132SKalle Valo 		goto out;
2853d8899132SKalle Valo 	}
2854d8899132SKalle Valo 
2855d8899132SKalle Valo 	ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS));
2856d8899132SKalle Valo 	if (ret < 0) {
2857d8899132SKalle Valo 		if (mode == ATH12K_FIRMWARE_MODE_OFF && ret == -ENETRESET) {
2858d8899132SKalle Valo 			ath12k_warn(ab, "WLFW service is dis-connected\n");
2859d8899132SKalle Valo 			return 0;
2860d8899132SKalle Valo 		}
2861d8899132SKalle Valo 		ath12k_warn(ab, "qmi failed set mode request, mode: %d, err = %d\n",
2862d8899132SKalle Valo 			    mode, ret);
2863d8899132SKalle Valo 		goto out;
2864d8899132SKalle Valo 	}
2865d8899132SKalle Valo 
2866d8899132SKalle Valo 	if (resp.resp.result != QMI_RESULT_SUCCESS_V01) {
2867d8899132SKalle Valo 		ath12k_warn(ab, "Mode request failed, mode: %d, result: %d err: %d\n",
2868d8899132SKalle Valo 			    mode, resp.resp.result, resp.resp.error);
2869d8899132SKalle Valo 		ret = -EINVAL;
2870d8899132SKalle Valo 		goto out;
2871d8899132SKalle Valo 	}
2872d8899132SKalle Valo 
2873d8899132SKalle Valo out:
2874d8899132SKalle Valo 	return ret;
2875d8899132SKalle Valo }
2876d8899132SKalle Valo 
2877d8899132SKalle Valo static int ath12k_qmi_wlanfw_wlan_cfg_send(struct ath12k_base *ab)
2878d8899132SKalle Valo {
2879d8899132SKalle Valo 	struct qmi_wlanfw_wlan_cfg_req_msg_v01 *req;
28806d2b0a06SJeff Johnson 	struct qmi_wlanfw_wlan_cfg_resp_msg_v01 resp = {};
2881d8899132SKalle Valo 	struct ce_pipe_config *ce_cfg;
2882d8899132SKalle Valo 	struct service_to_pipe *svc_cfg;
288359cf57abSJeff Johnson 	struct qmi_txn txn;
2884d8899132SKalle Valo 	int ret = 0, pipe_num;
2885d8899132SKalle Valo 
2886d8899132SKalle Valo 	ce_cfg	= (struct ce_pipe_config *)ab->qmi.ce_cfg.tgt_ce;
2887d8899132SKalle Valo 	svc_cfg	= (struct service_to_pipe *)ab->qmi.ce_cfg.svc_to_ce_map;
2888d8899132SKalle Valo 
2889d8899132SKalle Valo 	req = kzalloc(sizeof(*req), GFP_KERNEL);
2890d8899132SKalle Valo 	if (!req)
2891d8899132SKalle Valo 		return -ENOMEM;
2892d8899132SKalle Valo 
2893d8899132SKalle Valo 	req->host_version_valid = 1;
2894d8899132SKalle Valo 	strscpy(req->host_version, ATH12K_HOST_VERSION_STRING,
2895d8899132SKalle Valo 		sizeof(req->host_version));
2896d8899132SKalle Valo 
2897d8899132SKalle Valo 	req->tgt_cfg_valid = 1;
2898d8899132SKalle Valo 	/* This is number of CE configs */
2899d8899132SKalle Valo 	req->tgt_cfg_len = ab->qmi.ce_cfg.tgt_ce_len;
2900d8899132SKalle Valo 	for (pipe_num = 0; pipe_num < req->tgt_cfg_len ; pipe_num++) {
2901d8899132SKalle Valo 		req->tgt_cfg[pipe_num].pipe_num = ce_cfg[pipe_num].pipenum;
2902d8899132SKalle Valo 		req->tgt_cfg[pipe_num].pipe_dir = ce_cfg[pipe_num].pipedir;
2903d8899132SKalle Valo 		req->tgt_cfg[pipe_num].nentries = ce_cfg[pipe_num].nentries;
2904d8899132SKalle Valo 		req->tgt_cfg[pipe_num].nbytes_max = ce_cfg[pipe_num].nbytes_max;
2905d8899132SKalle Valo 		req->tgt_cfg[pipe_num].flags = ce_cfg[pipe_num].flags;
2906d8899132SKalle Valo 	}
2907d8899132SKalle Valo 
2908d8899132SKalle Valo 	req->svc_cfg_valid = 1;
2909d8899132SKalle Valo 	/* This is number of Service/CE configs */
2910d8899132SKalle Valo 	req->svc_cfg_len = ab->qmi.ce_cfg.svc_to_ce_map_len;
2911d8899132SKalle Valo 	for (pipe_num = 0; pipe_num < req->svc_cfg_len; pipe_num++) {
2912d8899132SKalle Valo 		req->svc_cfg[pipe_num].service_id = svc_cfg[pipe_num].service_id;
2913d8899132SKalle Valo 		req->svc_cfg[pipe_num].pipe_dir = svc_cfg[pipe_num].pipedir;
2914d8899132SKalle Valo 		req->svc_cfg[pipe_num].pipe_num = svc_cfg[pipe_num].pipenum;
2915d8899132SKalle Valo 	}
2916d8899132SKalle Valo 
2917d8899132SKalle Valo 	/* set shadow v3 configuration */
2918d8899132SKalle Valo 	if (ab->hw_params->supports_shadow_regs) {
2919d8899132SKalle Valo 		req->shadow_reg_v3_valid = 1;
2920d8899132SKalle Valo 		req->shadow_reg_v3_len = min_t(u32,
2921d8899132SKalle Valo 					       ab->qmi.ce_cfg.shadow_reg_v3_len,
2922d8899132SKalle Valo 					       QMI_WLANFW_MAX_NUM_SHADOW_REG_V3_V01);
2923d8899132SKalle Valo 		memcpy(&req->shadow_reg_v3, ab->qmi.ce_cfg.shadow_reg_v3,
2924d8899132SKalle Valo 		       sizeof(u32) * req->shadow_reg_v3_len);
2925d8899132SKalle Valo 	} else {
2926d8899132SKalle Valo 		req->shadow_reg_v3_valid = 0;
2927d8899132SKalle Valo 	}
2928d8899132SKalle Valo 
2929d8899132SKalle Valo 	ret = qmi_txn_init(&ab->qmi.handle, &txn,
2930d8899132SKalle Valo 			   qmi_wlanfw_wlan_cfg_resp_msg_v01_ei, &resp);
2931d8899132SKalle Valo 	if (ret < 0)
2932d8899132SKalle Valo 		goto out;
2933d8899132SKalle Valo 
2934d8899132SKalle Valo 	ret = qmi_send_request(&ab->qmi.handle, NULL, &txn,
2935d8899132SKalle Valo 			       QMI_WLANFW_WLAN_CFG_REQ_V01,
2936d8899132SKalle Valo 			       QMI_WLANFW_WLAN_CFG_REQ_MSG_V01_MAX_LEN,
2937d8899132SKalle Valo 			       qmi_wlanfw_wlan_cfg_req_msg_v01_ei, req);
2938d8899132SKalle Valo 	if (ret < 0) {
29392e82b5f0SJeff Johnson 		qmi_txn_cancel(&txn);
2940d8899132SKalle Valo 		ath12k_warn(ab, "qmi failed to send wlan config request, err = %d\n",
2941d8899132SKalle Valo 			    ret);
2942d8899132SKalle Valo 		goto out;
2943d8899132SKalle Valo 	}
2944d8899132SKalle Valo 
2945d8899132SKalle Valo 	ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS));
2946d8899132SKalle Valo 	if (ret < 0) {
2947d8899132SKalle Valo 		ath12k_warn(ab, "qmi failed wlan config request, err = %d\n", ret);
2948d8899132SKalle Valo 		goto out;
2949d8899132SKalle Valo 	}
2950d8899132SKalle Valo 
2951d8899132SKalle Valo 	if (resp.resp.result != QMI_RESULT_SUCCESS_V01) {
2952d8899132SKalle Valo 		ath12k_warn(ab, "qmi wlan config request failed, result: %d, err: %d\n",
2953d8899132SKalle Valo 			    resp.resp.result, resp.resp.error);
2954d8899132SKalle Valo 		ret = -EINVAL;
2955d8899132SKalle Valo 		goto out;
2956d8899132SKalle Valo 	}
2957d8899132SKalle Valo 
2958d8899132SKalle Valo out:
2959d8899132SKalle Valo 	kfree(req);
2960d8899132SKalle Valo 	return ret;
2961d8899132SKalle Valo }
2962d8899132SKalle Valo 
29639f9df1a2SBaochen Qiang static int ath12k_qmi_wlanfw_wlan_ini_send(struct ath12k_base *ab)
29649f9df1a2SBaochen Qiang {
29659f9df1a2SBaochen Qiang 	struct qmi_wlanfw_wlan_ini_resp_msg_v01 resp = {};
29669f9df1a2SBaochen Qiang 	struct qmi_wlanfw_wlan_ini_req_msg_v01 req = {};
29679f9df1a2SBaochen Qiang 	struct qmi_txn txn;
29689f9df1a2SBaochen Qiang 	int ret;
29699f9df1a2SBaochen Qiang 
29709f9df1a2SBaochen Qiang 	req.enable_fwlog_valid = true;
29719f9df1a2SBaochen Qiang 	req.enable_fwlog = 1;
29729f9df1a2SBaochen Qiang 
29739f9df1a2SBaochen Qiang 	ret = qmi_txn_init(&ab->qmi.handle, &txn,
29749f9df1a2SBaochen Qiang 			   qmi_wlanfw_wlan_ini_resp_msg_v01_ei, &resp);
29759f9df1a2SBaochen Qiang 	if (ret < 0)
29769f9df1a2SBaochen Qiang 		goto out;
29779f9df1a2SBaochen Qiang 
29789f9df1a2SBaochen Qiang 	ret = qmi_send_request(&ab->qmi.handle, NULL, &txn,
29799f9df1a2SBaochen Qiang 			       ATH12K_QMI_WLANFW_WLAN_INI_REQ_V01,
29809f9df1a2SBaochen Qiang 			       QMI_WLANFW_WLAN_INI_REQ_MSG_V01_MAX_LEN,
29819f9df1a2SBaochen Qiang 			       qmi_wlanfw_wlan_ini_req_msg_v01_ei, &req);
29829f9df1a2SBaochen Qiang 	if (ret < 0) {
29839f9df1a2SBaochen Qiang 		qmi_txn_cancel(&txn);
29849f9df1a2SBaochen Qiang 		ath12k_warn(ab, "failed to send QMI wlan ini request: %d\n",
29859f9df1a2SBaochen Qiang 			    ret);
29869f9df1a2SBaochen Qiang 		goto out;
29879f9df1a2SBaochen Qiang 	}
29889f9df1a2SBaochen Qiang 
29899f9df1a2SBaochen Qiang 	ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS));
29909f9df1a2SBaochen Qiang 	if (ret < 0) {
29919f9df1a2SBaochen Qiang 		ath12k_warn(ab, "failed to receive QMI wlan ini request: %d\n", ret);
29929f9df1a2SBaochen Qiang 		goto out;
29939f9df1a2SBaochen Qiang 	}
29949f9df1a2SBaochen Qiang 
29959f9df1a2SBaochen Qiang 	if (resp.resp.result != QMI_RESULT_SUCCESS_V01) {
29969f9df1a2SBaochen Qiang 		ath12k_warn(ab, "QMI wlan ini response failure: %d %d\n",
29979f9df1a2SBaochen Qiang 			    resp.resp.result, resp.resp.error);
29989f9df1a2SBaochen Qiang 		ret = -EINVAL;
29999f9df1a2SBaochen Qiang 		goto out;
30009f9df1a2SBaochen Qiang 	}
30019f9df1a2SBaochen Qiang 
30029f9df1a2SBaochen Qiang out:
30039f9df1a2SBaochen Qiang 	return ret;
30049f9df1a2SBaochen Qiang }
30059f9df1a2SBaochen Qiang 
3006d8899132SKalle Valo void ath12k_qmi_firmware_stop(struct ath12k_base *ab)
3007d8899132SKalle Valo {
3008d8899132SKalle Valo 	int ret;
3009d8899132SKalle Valo 
3010d8899132SKalle Valo 	ret = ath12k_qmi_wlanfw_mode_send(ab, ATH12K_FIRMWARE_MODE_OFF);
3011d8899132SKalle Valo 	if (ret < 0) {
3012d8899132SKalle Valo 		ath12k_warn(ab, "qmi failed to send wlan mode off\n");
3013d8899132SKalle Valo 		return;
3014d8899132SKalle Valo 	}
3015d8899132SKalle Valo }
3016d8899132SKalle Valo 
3017d8899132SKalle Valo int ath12k_qmi_firmware_start(struct ath12k_base *ab,
3018d8899132SKalle Valo 			      u32 mode)
3019d8899132SKalle Valo {
3020d8899132SKalle Valo 	int ret;
3021d8899132SKalle Valo 
30229f9df1a2SBaochen Qiang 	ret = ath12k_qmi_wlanfw_wlan_ini_send(ab);
30239f9df1a2SBaochen Qiang 	if (ret < 0) {
30249f9df1a2SBaochen Qiang 		ath12k_warn(ab, "qmi failed to send wlan fw ini: %d\n", ret);
30259f9df1a2SBaochen Qiang 		return ret;
30269f9df1a2SBaochen Qiang 	}
30279f9df1a2SBaochen Qiang 
3028d8899132SKalle Valo 	ret = ath12k_qmi_wlanfw_wlan_cfg_send(ab);
3029d8899132SKalle Valo 	if (ret < 0) {
3030d8899132SKalle Valo 		ath12k_warn(ab, "qmi failed to send wlan cfg:%d\n", ret);
3031d8899132SKalle Valo 		return ret;
3032d8899132SKalle Valo 	}
3033d8899132SKalle Valo 
3034d8899132SKalle Valo 	ret = ath12k_qmi_wlanfw_mode_send(ab, mode);
3035d8899132SKalle Valo 	if (ret < 0) {
3036d8899132SKalle Valo 		ath12k_warn(ab, "qmi failed to send wlan fw mode:%d\n", ret);
3037d8899132SKalle Valo 		return ret;
3038d8899132SKalle Valo 	}
3039d8899132SKalle Valo 
3040d8899132SKalle Valo 	return 0;
3041d8899132SKalle Valo }
3042d8899132SKalle Valo 
3043d8899132SKalle Valo static int
3044d8899132SKalle Valo ath12k_qmi_driver_event_post(struct ath12k_qmi *qmi,
3045d8899132SKalle Valo 			     enum ath12k_qmi_event_type type,
3046d8899132SKalle Valo 			     void *data)
3047d8899132SKalle Valo {
3048d8899132SKalle Valo 	struct ath12k_qmi_driver_event *event;
3049d8899132SKalle Valo 
3050d8899132SKalle Valo 	event = kzalloc(sizeof(*event), GFP_ATOMIC);
3051d8899132SKalle Valo 	if (!event)
3052d8899132SKalle Valo 		return -ENOMEM;
3053d8899132SKalle Valo 
3054d8899132SKalle Valo 	event->type = type;
3055d8899132SKalle Valo 	event->data = data;
3056d8899132SKalle Valo 
3057d8899132SKalle Valo 	spin_lock(&qmi->event_lock);
3058d8899132SKalle Valo 	list_add_tail(&event->list, &qmi->event_list);
3059d8899132SKalle Valo 	spin_unlock(&qmi->event_lock);
3060d8899132SKalle Valo 
3061d8899132SKalle Valo 	queue_work(qmi->event_wq, &qmi->event_work);
3062d8899132SKalle Valo 
3063d8899132SKalle Valo 	return 0;
3064d8899132SKalle Valo }
3065d8899132SKalle Valo 
3066d8899132SKalle Valo static int ath12k_qmi_event_server_arrive(struct ath12k_qmi *qmi)
3067d8899132SKalle Valo {
3068d8899132SKalle Valo 	struct ath12k_base *ab = qmi->ab;
3069d8899132SKalle Valo 	int ret;
3070d8899132SKalle Valo 
307153a65445SKarthikeyan Periyasamy 	ath12k_qmi_phy_cap_send(ab);
307253a65445SKarthikeyan Periyasamy 
3073d8899132SKalle Valo 	ret = ath12k_qmi_fw_ind_register_send(ab);
3074d8899132SKalle Valo 	if (ret < 0) {
3075d8899132SKalle Valo 		ath12k_warn(ab, "qmi failed to send FW indication QMI:%d\n", ret);
3076d8899132SKalle Valo 		return ret;
3077d8899132SKalle Valo 	}
3078d8899132SKalle Valo 
3079d8899132SKalle Valo 	ret = ath12k_qmi_host_cap_send(ab);
3080d8899132SKalle Valo 	if (ret < 0) {
3081d8899132SKalle Valo 		ath12k_warn(ab, "qmi failed to send host cap QMI:%d\n", ret);
3082d8899132SKalle Valo 		return ret;
3083d8899132SKalle Valo 	}
3084d8899132SKalle Valo 
3085d8899132SKalle Valo 	return ret;
3086d8899132SKalle Valo }
3087d8899132SKalle Valo 
3088d8899132SKalle Valo static int ath12k_qmi_event_mem_request(struct ath12k_qmi *qmi)
3089d8899132SKalle Valo {
3090d8899132SKalle Valo 	struct ath12k_base *ab = qmi->ab;
3091d8899132SKalle Valo 	int ret;
3092d8899132SKalle Valo 
3093d8899132SKalle Valo 	ret = ath12k_qmi_respond_fw_mem_request(ab);
3094d8899132SKalle Valo 	if (ret < 0) {
3095d8899132SKalle Valo 		ath12k_warn(ab, "qmi failed to respond fw mem req:%d\n", ret);
3096d8899132SKalle Valo 		return ret;
3097d8899132SKalle Valo 	}
3098d8899132SKalle Valo 
3099d8899132SKalle Valo 	return ret;
3100d8899132SKalle Valo }
3101d8899132SKalle Valo 
3102d8899132SKalle Valo static int ath12k_qmi_event_load_bdf(struct ath12k_qmi *qmi)
3103d8899132SKalle Valo {
3104d8899132SKalle Valo 	struct ath12k_base *ab = qmi->ab;
3105d8899132SKalle Valo 	int ret;
3106d8899132SKalle Valo 
3107d8899132SKalle Valo 	ret = ath12k_qmi_request_target_cap(ab);
3108d8899132SKalle Valo 	if (ret < 0) {
3109d8899132SKalle Valo 		ath12k_warn(ab, "qmi failed to req target capabilities:%d\n", ret);
3110d8899132SKalle Valo 		return ret;
3111d8899132SKalle Valo 	}
3112d8899132SKalle Valo 
3113d8899132SKalle Valo 	ret = ath12k_qmi_load_bdf_qmi(ab, ATH12K_QMI_BDF_TYPE_REGDB);
3114d8899132SKalle Valo 	if (ret < 0) {
3115d8899132SKalle Valo 		ath12k_warn(ab, "qmi failed to load regdb file:%d\n", ret);
3116d8899132SKalle Valo 		return ret;
3117d8899132SKalle Valo 	}
3118d8899132SKalle Valo 
3119d8899132SKalle Valo 	ret = ath12k_qmi_load_bdf_qmi(ab, ATH12K_QMI_BDF_TYPE_ELF);
3120d8899132SKalle Valo 	if (ret < 0) {
3121d8899132SKalle Valo 		ath12k_warn(ab, "qmi failed to load board data file:%d\n", ret);
3122d8899132SKalle Valo 		return ret;
3123d8899132SKalle Valo 	}
3124d8899132SKalle Valo 
312542982259SDinesh Karthikeyan 	if (ab->hw_params->download_calib) {
312642982259SDinesh Karthikeyan 		ret = ath12k_qmi_load_bdf_qmi(ab, ATH12K_QMI_BDF_TYPE_CALIBRATION);
312742982259SDinesh Karthikeyan 		if (ret < 0)
312842982259SDinesh Karthikeyan 			ath12k_warn(ab, "qmi failed to load calibrated data :%d\n", ret);
312942982259SDinesh Karthikeyan 	}
313042982259SDinesh Karthikeyan 
3131d8899132SKalle Valo 	ret = ath12k_qmi_wlanfw_m3_info_send(ab);
3132d8899132SKalle Valo 	if (ret < 0) {
3133d8899132SKalle Valo 		ath12k_warn(ab, "qmi failed to send m3 info req:%d\n", ret);
3134d8899132SKalle Valo 		return ret;
3135d8899132SKalle Valo 	}
3136d8899132SKalle Valo 
3137d8899132SKalle Valo 	return ret;
3138d8899132SKalle Valo }
3139d8899132SKalle Valo 
3140d8899132SKalle Valo static void ath12k_qmi_msg_mem_request_cb(struct qmi_handle *qmi_hdl,
3141d8899132SKalle Valo 					  struct sockaddr_qrtr *sq,
3142d8899132SKalle Valo 					  struct qmi_txn *txn,
3143d8899132SKalle Valo 					  const void *data)
3144d8899132SKalle Valo {
3145d8899132SKalle Valo 	struct ath12k_qmi *qmi = container_of(qmi_hdl, struct ath12k_qmi, handle);
3146d8899132SKalle Valo 	struct ath12k_base *ab = qmi->ab;
3147d8899132SKalle Valo 	const struct qmi_wlanfw_request_mem_ind_msg_v01 *msg = data;
3148d8899132SKalle Valo 	int i, ret;
3149d8899132SKalle Valo 
3150d8899132SKalle Valo 	ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi firmware request memory request\n");
3151d8899132SKalle Valo 
3152d8899132SKalle Valo 	if (msg->mem_seg_len == 0 ||
3153d8899132SKalle Valo 	    msg->mem_seg_len > ATH12K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01)
3154d8899132SKalle Valo 		ath12k_warn(ab, "Invalid memory segment length: %u\n",
3155d8899132SKalle Valo 			    msg->mem_seg_len);
3156d8899132SKalle Valo 
3157d8899132SKalle Valo 	ab->qmi.mem_seg_count = msg->mem_seg_len;
3158d8899132SKalle Valo 
3159d8899132SKalle Valo 	for (i = 0; i < qmi->mem_seg_count ; i++) {
3160d8899132SKalle Valo 		ab->qmi.target_mem[i].type = msg->mem_seg[i].type;
3161d8899132SKalle Valo 		ab->qmi.target_mem[i].size = msg->mem_seg[i].size;
3162d8899132SKalle Valo 		ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi mem seg type %d size %d\n",
3163d8899132SKalle Valo 			   msg->mem_seg[i].type, msg->mem_seg[i].size);
3164d8899132SKalle Valo 	}
3165d8899132SKalle Valo 
3166d8899132SKalle Valo 	ret = ath12k_qmi_alloc_target_mem_chunk(ab);
3167d8899132SKalle Valo 	if (ret) {
3168d8899132SKalle Valo 		ath12k_warn(ab, "qmi failed to alloc target memory: %d\n",
3169d8899132SKalle Valo 			    ret);
3170d8899132SKalle Valo 		return;
3171d8899132SKalle Valo 	}
3172d8899132SKalle Valo 
3173d8899132SKalle Valo 	ath12k_qmi_driver_event_post(qmi, ATH12K_QMI_EVENT_REQUEST_MEM, NULL);
3174d8899132SKalle Valo }
3175d8899132SKalle Valo 
3176d8899132SKalle Valo static void ath12k_qmi_msg_mem_ready_cb(struct qmi_handle *qmi_hdl,
3177d8899132SKalle Valo 					struct sockaddr_qrtr *sq,
3178d8899132SKalle Valo 					struct qmi_txn *txn,
3179d8899132SKalle Valo 					const void *decoded)
3180d8899132SKalle Valo {
3181d8899132SKalle Valo 	struct ath12k_qmi *qmi = container_of(qmi_hdl, struct ath12k_qmi, handle);
3182d8899132SKalle Valo 	struct ath12k_base *ab = qmi->ab;
3183d8899132SKalle Valo 
3184d8899132SKalle Valo 	ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi firmware memory ready indication\n");
3185d8899132SKalle Valo 	ath12k_qmi_driver_event_post(qmi, ATH12K_QMI_EVENT_FW_MEM_READY, NULL);
3186d8899132SKalle Valo }
3187d8899132SKalle Valo 
3188d8899132SKalle Valo static void ath12k_qmi_msg_fw_ready_cb(struct qmi_handle *qmi_hdl,
3189d8899132SKalle Valo 				       struct sockaddr_qrtr *sq,
3190d8899132SKalle Valo 				       struct qmi_txn *txn,
3191d8899132SKalle Valo 				       const void *decoded)
3192d8899132SKalle Valo {
3193d8899132SKalle Valo 	struct ath12k_qmi *qmi = container_of(qmi_hdl, struct ath12k_qmi, handle);
3194d8899132SKalle Valo 	struct ath12k_base *ab = qmi->ab;
3195d8899132SKalle Valo 
3196d8899132SKalle Valo 	ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi firmware ready\n");
3197d8899132SKalle Valo 	ath12k_qmi_driver_event_post(qmi, ATH12K_QMI_EVENT_FW_READY, NULL);
3198d8899132SKalle Valo }
3199d8899132SKalle Valo 
3200d8899132SKalle Valo static const struct qmi_msg_handler ath12k_qmi_msg_handlers[] = {
3201d8899132SKalle Valo 	{
3202d8899132SKalle Valo 		.type = QMI_INDICATION,
3203d8899132SKalle Valo 		.msg_id = QMI_WLFW_REQUEST_MEM_IND_V01,
3204d8899132SKalle Valo 		.ei = qmi_wlanfw_request_mem_ind_msg_v01_ei,
3205d8899132SKalle Valo 		.decoded_size = sizeof(struct qmi_wlanfw_request_mem_ind_msg_v01),
3206d8899132SKalle Valo 		.fn = ath12k_qmi_msg_mem_request_cb,
3207d8899132SKalle Valo 	},
3208d8899132SKalle Valo 	{
3209d8899132SKalle Valo 		.type = QMI_INDICATION,
3210d8899132SKalle Valo 		.msg_id = QMI_WLFW_FW_MEM_READY_IND_V01,
3211d8899132SKalle Valo 		.ei = qmi_wlanfw_mem_ready_ind_msg_v01_ei,
3212d8899132SKalle Valo 		.decoded_size = sizeof(struct qmi_wlanfw_fw_mem_ready_ind_msg_v01),
3213d8899132SKalle Valo 		.fn = ath12k_qmi_msg_mem_ready_cb,
3214d8899132SKalle Valo 	},
3215d8899132SKalle Valo 	{
3216d8899132SKalle Valo 		.type = QMI_INDICATION,
3217d8899132SKalle Valo 		.msg_id = QMI_WLFW_FW_READY_IND_V01,
3218d8899132SKalle Valo 		.ei = qmi_wlanfw_fw_ready_ind_msg_v01_ei,
3219d8899132SKalle Valo 		.decoded_size = sizeof(struct qmi_wlanfw_fw_ready_ind_msg_v01),
3220d8899132SKalle Valo 		.fn = ath12k_qmi_msg_fw_ready_cb,
3221d8899132SKalle Valo 	},
3222e1bdff48SKarthikeyan Kathirvel 
3223e1bdff48SKarthikeyan Kathirvel 	/* end of list */
3224e1bdff48SKarthikeyan Kathirvel 	{},
3225d8899132SKalle Valo };
3226d8899132SKalle Valo 
3227d8899132SKalle Valo static int ath12k_qmi_ops_new_server(struct qmi_handle *qmi_hdl,
3228d8899132SKalle Valo 				     struct qmi_service *service)
3229d8899132SKalle Valo {
3230d8899132SKalle Valo 	struct ath12k_qmi *qmi = container_of(qmi_hdl, struct ath12k_qmi, handle);
3231d8899132SKalle Valo 	struct ath12k_base *ab = qmi->ab;
3232d8899132SKalle Valo 	struct sockaddr_qrtr *sq = &qmi->sq;
3233d8899132SKalle Valo 	int ret;
3234d8899132SKalle Valo 
3235d8899132SKalle Valo 	sq->sq_family = AF_QIPCRTR;
3236d8899132SKalle Valo 	sq->sq_node = service->node;
3237d8899132SKalle Valo 	sq->sq_port = service->port;
3238d8899132SKalle Valo 
3239d8899132SKalle Valo 	ret = kernel_connect(qmi_hdl->sock, (struct sockaddr *)sq,
3240d8899132SKalle Valo 			     sizeof(*sq), 0);
3241d8899132SKalle Valo 	if (ret) {
3242d8899132SKalle Valo 		ath12k_warn(ab, "qmi failed to connect to remote service %d\n", ret);
3243d8899132SKalle Valo 		return ret;
3244d8899132SKalle Valo 	}
3245d8899132SKalle Valo 
3246d8899132SKalle Valo 	ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi wifi fw qmi service connected\n");
3247d8899132SKalle Valo 	ath12k_qmi_driver_event_post(qmi, ATH12K_QMI_EVENT_SERVER_ARRIVE, NULL);
3248d8899132SKalle Valo 
3249d8899132SKalle Valo 	return ret;
3250d8899132SKalle Valo }
3251d8899132SKalle Valo 
3252d8899132SKalle Valo static void ath12k_qmi_ops_del_server(struct qmi_handle *qmi_hdl,
3253d8899132SKalle Valo 				      struct qmi_service *service)
3254d8899132SKalle Valo {
3255d8899132SKalle Valo 	struct ath12k_qmi *qmi = container_of(qmi_hdl, struct ath12k_qmi, handle);
3256d8899132SKalle Valo 	struct ath12k_base *ab = qmi->ab;
3257d8899132SKalle Valo 
3258d8899132SKalle Valo 	ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi wifi fw del server\n");
3259d8899132SKalle Valo 	ath12k_qmi_driver_event_post(qmi, ATH12K_QMI_EVENT_SERVER_EXIT, NULL);
3260d8899132SKalle Valo }
3261d8899132SKalle Valo 
3262d8899132SKalle Valo static const struct qmi_ops ath12k_qmi_ops = {
3263d8899132SKalle Valo 	.new_server = ath12k_qmi_ops_new_server,
3264d8899132SKalle Valo 	.del_server = ath12k_qmi_ops_del_server,
3265d8899132SKalle Valo };
3266d8899132SKalle Valo 
3267d8899132SKalle Valo static void ath12k_qmi_driver_event_work(struct work_struct *work)
3268d8899132SKalle Valo {
3269d8899132SKalle Valo 	struct ath12k_qmi *qmi = container_of(work, struct ath12k_qmi,
3270d8899132SKalle Valo 					      event_work);
3271d8899132SKalle Valo 	struct ath12k_qmi_driver_event *event;
3272d8899132SKalle Valo 	struct ath12k_base *ab = qmi->ab;
3273d8899132SKalle Valo 	int ret;
3274d8899132SKalle Valo 
3275d8899132SKalle Valo 	spin_lock(&qmi->event_lock);
3276d8899132SKalle Valo 	while (!list_empty(&qmi->event_list)) {
3277d8899132SKalle Valo 		event = list_first_entry(&qmi->event_list,
3278d8899132SKalle Valo 					 struct ath12k_qmi_driver_event, list);
3279d8899132SKalle Valo 		list_del(&event->list);
3280d8899132SKalle Valo 		spin_unlock(&qmi->event_lock);
3281d8899132SKalle Valo 
3282d8899132SKalle Valo 		if (test_bit(ATH12K_FLAG_UNREGISTERING, &ab->dev_flags))
3283960412beSRajat Soni 			goto skip;
3284d8899132SKalle Valo 
3285d8899132SKalle Valo 		switch (event->type) {
3286d8899132SKalle Valo 		case ATH12K_QMI_EVENT_SERVER_ARRIVE:
3287d8899132SKalle Valo 			ret = ath12k_qmi_event_server_arrive(qmi);
3288d8899132SKalle Valo 			if (ret < 0)
3289d8899132SKalle Valo 				set_bit(ATH12K_FLAG_QMI_FAIL, &ab->dev_flags);
3290d8899132SKalle Valo 			break;
3291d8899132SKalle Valo 		case ATH12K_QMI_EVENT_SERVER_EXIT:
3292d8899132SKalle Valo 			set_bit(ATH12K_FLAG_CRASH_FLUSH, &ab->dev_flags);
3293d8899132SKalle Valo 			set_bit(ATH12K_FLAG_RECOVERY, &ab->dev_flags);
3294d8899132SKalle Valo 			break;
3295d8899132SKalle Valo 		case ATH12K_QMI_EVENT_REQUEST_MEM:
3296d8899132SKalle Valo 			ret = ath12k_qmi_event_mem_request(qmi);
3297d8899132SKalle Valo 			if (ret < 0)
3298d8899132SKalle Valo 				set_bit(ATH12K_FLAG_QMI_FAIL, &ab->dev_flags);
3299d8899132SKalle Valo 			break;
3300d8899132SKalle Valo 		case ATH12K_QMI_EVENT_FW_MEM_READY:
3301d8899132SKalle Valo 			ret = ath12k_qmi_event_load_bdf(qmi);
3302d8899132SKalle Valo 			if (ret < 0)
3303d8899132SKalle Valo 				set_bit(ATH12K_FLAG_QMI_FAIL, &ab->dev_flags);
3304d8899132SKalle Valo 			break;
3305d8899132SKalle Valo 		case ATH12K_QMI_EVENT_FW_READY:
3306d8899132SKalle Valo 			clear_bit(ATH12K_FLAG_QMI_FAIL, &ab->dev_flags);
3307d8899132SKalle Valo 			if (test_bit(ATH12K_FLAG_REGISTERED, &ab->dev_flags)) {
33088591b2baSBaochen Qiang 				if (ab->is_reset)
3309d8899132SKalle Valo 					ath12k_hal_dump_srng_stats(ab);
3310d8899132SKalle Valo 				queue_work(ab->workqueue, &ab->restart_work);
3311d8899132SKalle Valo 				break;
3312d8899132SKalle Valo 			}
3313d8899132SKalle Valo 
3314d8899132SKalle Valo 			clear_bit(ATH12K_FLAG_CRASH_FLUSH,
3315d8899132SKalle Valo 				  &ab->dev_flags);
3316d8899132SKalle Valo 			clear_bit(ATH12K_FLAG_RECOVERY, &ab->dev_flags);
3317d8899132SKalle Valo 			ath12k_core_qmi_firmware_ready(ab);
3318d8899132SKalle Valo 			set_bit(ATH12K_FLAG_REGISTERED, &ab->dev_flags);
3319d8899132SKalle Valo 
3320d8899132SKalle Valo 			break;
3321d8899132SKalle Valo 		default:
3322d8899132SKalle Valo 			ath12k_warn(ab, "invalid event type: %d", event->type);
3323d8899132SKalle Valo 			break;
3324d8899132SKalle Valo 		}
3325960412beSRajat Soni 
3326960412beSRajat Soni skip:
3327d8899132SKalle Valo 		kfree(event);
3328d8899132SKalle Valo 		spin_lock(&qmi->event_lock);
3329d8899132SKalle Valo 	}
3330d8899132SKalle Valo 	spin_unlock(&qmi->event_lock);
3331d8899132SKalle Valo }
3332d8899132SKalle Valo 
3333d8899132SKalle Valo int ath12k_qmi_init_service(struct ath12k_base *ab)
3334d8899132SKalle Valo {
3335d8899132SKalle Valo 	int ret;
3336d8899132SKalle Valo 
3337d8899132SKalle Valo 	memset(&ab->qmi.target, 0, sizeof(struct target_info));
3338d8899132SKalle Valo 	memset(&ab->qmi.target_mem, 0, sizeof(struct target_mem_chunk));
3339d8899132SKalle Valo 	ab->qmi.ab = ab;
3340d8899132SKalle Valo 
3341d8899132SKalle Valo 	ab->qmi.target_mem_mode = ATH12K_QMI_TARGET_MEM_MODE_DEFAULT;
3342d8899132SKalle Valo 	ret = qmi_handle_init(&ab->qmi.handle, ATH12K_QMI_RESP_LEN_MAX,
3343d8899132SKalle Valo 			      &ath12k_qmi_ops, ath12k_qmi_msg_handlers);
3344d8899132SKalle Valo 	if (ret < 0) {
3345d8899132SKalle Valo 		ath12k_warn(ab, "failed to initialize qmi handle\n");
3346d8899132SKalle Valo 		return ret;
3347d8899132SKalle Valo 	}
3348d8899132SKalle Valo 
33491e80449eSTejun Heo 	ab->qmi.event_wq = alloc_ordered_workqueue("ath12k_qmi_driver_event", 0);
3350d8899132SKalle Valo 	if (!ab->qmi.event_wq) {
3351d8899132SKalle Valo 		ath12k_err(ab, "failed to allocate workqueue\n");
3352d8899132SKalle Valo 		return -EFAULT;
3353d8899132SKalle Valo 	}
3354d8899132SKalle Valo 
3355d8899132SKalle Valo 	INIT_LIST_HEAD(&ab->qmi.event_list);
3356d8899132SKalle Valo 	spin_lock_init(&ab->qmi.event_lock);
3357d8899132SKalle Valo 	INIT_WORK(&ab->qmi.event_work, ath12k_qmi_driver_event_work);
3358d8899132SKalle Valo 
3359d8899132SKalle Valo 	ret = qmi_add_lookup(&ab->qmi.handle, ATH12K_QMI_WLFW_SERVICE_ID_V01,
3360d8899132SKalle Valo 			     ATH12K_QMI_WLFW_SERVICE_VERS_V01,
3361d8899132SKalle Valo 			     ab->qmi.service_ins_id);
3362d8899132SKalle Valo 	if (ret < 0) {
3363d8899132SKalle Valo 		ath12k_warn(ab, "failed to add qmi lookup\n");
3364d8899132SKalle Valo 		destroy_workqueue(ab->qmi.event_wq);
3365d8899132SKalle Valo 		return ret;
3366d8899132SKalle Valo 	}
3367d8899132SKalle Valo 
3368d8899132SKalle Valo 	return ret;
3369d8899132SKalle Valo }
3370d8899132SKalle Valo 
3371d8899132SKalle Valo void ath12k_qmi_deinit_service(struct ath12k_base *ab)
3372d8899132SKalle Valo {
3373d8899132SKalle Valo 	qmi_handle_release(&ab->qmi.handle);
3374d8899132SKalle Valo 	cancel_work_sync(&ab->qmi.event_work);
3375d8899132SKalle Valo 	destroy_workqueue(ab->qmi.event_wq);
3376d8899132SKalle Valo 	ath12k_qmi_m3_free(ab);
3377d8899132SKalle Valo 	ath12k_qmi_free_target_mem_chunk(ab);
3378d8899132SKalle Valo }
337992448f87SWen Gong 
338092448f87SWen Gong void ath12k_qmi_free_resource(struct ath12k_base *ab)
338192448f87SWen Gong {
338292448f87SWen Gong 	ath12k_qmi_free_target_mem_chunk(ab);
338392448f87SWen Gong 	ath12k_qmi_m3_free(ab);
338492448f87SWen Gong }
3385