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 { 58653a65445SKarthikeyan Periyasamy .data_type = QMI_EOTI, 58753a65445SKarthikeyan Periyasamy .array_type = NO_ARRAY, 58853a65445SKarthikeyan Periyasamy .tlv_type = QMI_COMMON_TLV_TYPE, 58953a65445SKarthikeyan Periyasamy }, 59053a65445SKarthikeyan Periyasamy }; 59153a65445SKarthikeyan Periyasamy 592e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_ind_register_req_msg_v01_ei[] = { 593d8899132SKalle Valo { 594d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 595d8899132SKalle Valo .elem_len = 1, 596d8899132SKalle Valo .elem_size = sizeof(u8), 597d8899132SKalle Valo .array_type = NO_ARRAY, 598d8899132SKalle Valo .tlv_type = 0x10, 599d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 600d8899132SKalle Valo fw_ready_enable_valid), 601d8899132SKalle Valo }, 602d8899132SKalle Valo { 603d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 604d8899132SKalle Valo .elem_len = 1, 605d8899132SKalle Valo .elem_size = sizeof(u8), 606d8899132SKalle Valo .array_type = NO_ARRAY, 607d8899132SKalle Valo .tlv_type = 0x10, 608d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 609d8899132SKalle Valo fw_ready_enable), 610d8899132SKalle Valo }, 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 = 0x11, 617d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 618d8899132SKalle Valo initiate_cal_download_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 = 0x11, 626d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 627d8899132SKalle Valo initiate_cal_download_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 = 0x12, 635d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 636d8899132SKalle Valo initiate_cal_update_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 = 0x12, 644d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 645d8899132SKalle Valo initiate_cal_update_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 = 0x13, 653d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 654d8899132SKalle Valo msa_ready_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 = 0x13, 662d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 663d8899132SKalle Valo msa_ready_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 = 0x14, 671d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 672d8899132SKalle Valo pin_connect_result_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 = 0x14, 680d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 681d8899132SKalle Valo pin_connect_result_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 = 0x15, 689d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 690d8899132SKalle Valo client_id_valid), 691d8899132SKalle Valo }, 692d8899132SKalle Valo { 693d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 694d8899132SKalle Valo .elem_len = 1, 695d8899132SKalle Valo .elem_size = sizeof(u32), 696d8899132SKalle Valo .array_type = NO_ARRAY, 697d8899132SKalle Valo .tlv_type = 0x15, 698d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 699d8899132SKalle Valo client_id), 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 = 0x16, 707d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 708d8899132SKalle Valo request_mem_enable_valid), 709d8899132SKalle Valo }, 710d8899132SKalle Valo { 711d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 712d8899132SKalle Valo .elem_len = 1, 713d8899132SKalle Valo .elem_size = sizeof(u8), 714d8899132SKalle Valo .array_type = NO_ARRAY, 715d8899132SKalle Valo .tlv_type = 0x16, 716d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 717d8899132SKalle Valo request_mem_enable), 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 = 0x17, 725d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 726d8899132SKalle Valo fw_mem_ready_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 = 0x17, 734d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 735d8899132SKalle Valo fw_mem_ready_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 = 0x18, 743d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 744d8899132SKalle Valo fw_init_done_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 = 0x18, 752d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 753d8899132SKalle Valo fw_init_done_enable), 754d8899132SKalle Valo }, 755d8899132SKalle Valo 756d8899132SKalle Valo { 757d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 758d8899132SKalle Valo .elem_len = 1, 759d8899132SKalle Valo .elem_size = sizeof(u8), 760d8899132SKalle Valo .array_type = NO_ARRAY, 761d8899132SKalle Valo .tlv_type = 0x19, 762d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 763d8899132SKalle Valo rejuvenate_enable_valid), 764d8899132SKalle Valo }, 765d8899132SKalle Valo { 766d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 767d8899132SKalle Valo .elem_len = 1, 768d8899132SKalle Valo .elem_size = sizeof(u8), 769d8899132SKalle Valo .array_type = NO_ARRAY, 770d8899132SKalle Valo .tlv_type = 0x19, 771d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 772d8899132SKalle Valo rejuvenate_enable), 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 = 0x1A, 780d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 781d8899132SKalle Valo xo_cal_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 = 0x1A, 789d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 790d8899132SKalle Valo xo_cal_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 = 0x1B, 798d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 799d8899132SKalle Valo cal_done_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 = 0x1B, 807d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 808d8899132SKalle Valo cal_done_enable), 809d8899132SKalle Valo }, 810d8899132SKalle Valo { 811d8899132SKalle Valo .data_type = QMI_EOTI, 812d8899132SKalle Valo .array_type = NO_ARRAY, 813d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 814d8899132SKalle Valo }, 815d8899132SKalle Valo }; 816d8899132SKalle Valo 817e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_ind_register_resp_msg_v01_ei[] = { 818d8899132SKalle Valo { 819d8899132SKalle Valo .data_type = QMI_STRUCT, 820d8899132SKalle Valo .elem_len = 1, 821d8899132SKalle Valo .elem_size = sizeof(struct qmi_response_type_v01), 822d8899132SKalle Valo .array_type = NO_ARRAY, 823d8899132SKalle Valo .tlv_type = 0x02, 824d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_resp_msg_v01, 825d8899132SKalle Valo resp), 826d8899132SKalle Valo .ei_array = qmi_response_type_v01_ei, 827d8899132SKalle Valo }, 828d8899132SKalle Valo { 829d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 830d8899132SKalle Valo .elem_len = 1, 831d8899132SKalle Valo .elem_size = sizeof(u8), 832d8899132SKalle Valo .array_type = NO_ARRAY, 833d8899132SKalle Valo .tlv_type = 0x10, 834d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_resp_msg_v01, 835d8899132SKalle Valo fw_status_valid), 836d8899132SKalle Valo }, 837d8899132SKalle Valo { 838d8899132SKalle Valo .data_type = QMI_UNSIGNED_8_BYTE, 839d8899132SKalle Valo .elem_len = 1, 840d8899132SKalle Valo .elem_size = sizeof(u64), 841d8899132SKalle Valo .array_type = NO_ARRAY, 842d8899132SKalle Valo .tlv_type = 0x10, 843d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_resp_msg_v01, 844d8899132SKalle Valo fw_status), 845d8899132SKalle Valo }, 846d8899132SKalle Valo { 847d8899132SKalle Valo .data_type = QMI_EOTI, 848d8899132SKalle Valo .array_type = NO_ARRAY, 849d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 850d8899132SKalle Valo }, 851d8899132SKalle Valo }; 852d8899132SKalle Valo 853e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_mem_cfg_s_v01_ei[] = { 854d8899132SKalle Valo { 855d8899132SKalle Valo .data_type = QMI_UNSIGNED_8_BYTE, 856d8899132SKalle Valo .elem_len = 1, 857d8899132SKalle Valo .elem_size = sizeof(u64), 858d8899132SKalle Valo .array_type = NO_ARRAY, 859d8899132SKalle Valo .tlv_type = 0, 860d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_mem_cfg_s_v01, offset), 861d8899132SKalle Valo }, 862d8899132SKalle Valo { 863d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 864d8899132SKalle Valo .elem_len = 1, 865d8899132SKalle Valo .elem_size = sizeof(u32), 866d8899132SKalle Valo .array_type = NO_ARRAY, 867d8899132SKalle Valo .tlv_type = 0, 868d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_mem_cfg_s_v01, size), 869d8899132SKalle Valo }, 870d8899132SKalle Valo { 871d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 872d8899132SKalle Valo .elem_len = 1, 873d8899132SKalle Valo .elem_size = sizeof(u8), 874d8899132SKalle Valo .array_type = NO_ARRAY, 875d8899132SKalle Valo .tlv_type = 0, 876d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_mem_cfg_s_v01, secure_flag), 877d8899132SKalle Valo }, 878d8899132SKalle Valo { 879d8899132SKalle Valo .data_type = QMI_EOTI, 880d8899132SKalle Valo .array_type = NO_ARRAY, 881d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 882d8899132SKalle Valo }, 883d8899132SKalle Valo }; 884d8899132SKalle Valo 885e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_mem_seg_s_v01_ei[] = { 886d8899132SKalle Valo { 887d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 888d8899132SKalle Valo .elem_len = 1, 889d8899132SKalle Valo .elem_size = sizeof(u32), 890d8899132SKalle Valo .array_type = NO_ARRAY, 891d8899132SKalle Valo .tlv_type = 0, 892d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_mem_seg_s_v01, 893d8899132SKalle Valo size), 894d8899132SKalle Valo }, 895d8899132SKalle Valo { 896d8899132SKalle Valo .data_type = QMI_SIGNED_4_BYTE_ENUM, 897d8899132SKalle Valo .elem_len = 1, 898d8899132SKalle Valo .elem_size = sizeof(enum qmi_wlanfw_mem_type_enum_v01), 899d8899132SKalle Valo .array_type = NO_ARRAY, 900d8899132SKalle Valo .tlv_type = 0, 901d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_mem_seg_s_v01, type), 902d8899132SKalle Valo }, 903d8899132SKalle Valo { 904d8899132SKalle Valo .data_type = QMI_DATA_LEN, 905d8899132SKalle Valo .elem_len = 1, 906d8899132SKalle Valo .elem_size = sizeof(u8), 907d8899132SKalle Valo .array_type = NO_ARRAY, 908d8899132SKalle Valo .tlv_type = 0, 909d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_mem_seg_s_v01, mem_cfg_len), 910d8899132SKalle Valo }, 911d8899132SKalle Valo { 912d8899132SKalle Valo .data_type = QMI_STRUCT, 913d8899132SKalle Valo .elem_len = QMI_WLANFW_MAX_NUM_MEM_CFG_V01, 914d8899132SKalle Valo .elem_size = sizeof(struct qmi_wlanfw_mem_cfg_s_v01), 915d8899132SKalle Valo .array_type = VAR_LEN_ARRAY, 916d8899132SKalle Valo .tlv_type = 0, 917d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_mem_seg_s_v01, mem_cfg), 918d8899132SKalle Valo .ei_array = qmi_wlanfw_mem_cfg_s_v01_ei, 919d8899132SKalle Valo }, 920d8899132SKalle Valo { 921d8899132SKalle Valo .data_type = QMI_EOTI, 922d8899132SKalle Valo .array_type = NO_ARRAY, 923d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 924d8899132SKalle Valo }, 925d8899132SKalle Valo }; 926d8899132SKalle Valo 927e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_request_mem_ind_msg_v01_ei[] = { 928d8899132SKalle Valo { 929d8899132SKalle Valo .data_type = QMI_DATA_LEN, 930d8899132SKalle Valo .elem_len = 1, 931d8899132SKalle Valo .elem_size = sizeof(u8), 932d8899132SKalle Valo .array_type = NO_ARRAY, 933d8899132SKalle Valo .tlv_type = 0x01, 934d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_request_mem_ind_msg_v01, 935d8899132SKalle Valo mem_seg_len), 936d8899132SKalle Valo }, 937d8899132SKalle Valo { 938d8899132SKalle Valo .data_type = QMI_STRUCT, 939d8899132SKalle Valo .elem_len = ATH12K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01, 940d8899132SKalle Valo .elem_size = sizeof(struct qmi_wlanfw_mem_seg_s_v01), 941d8899132SKalle Valo .array_type = VAR_LEN_ARRAY, 942d8899132SKalle Valo .tlv_type = 0x01, 943d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_request_mem_ind_msg_v01, 944d8899132SKalle Valo mem_seg), 945d8899132SKalle Valo .ei_array = qmi_wlanfw_mem_seg_s_v01_ei, 946d8899132SKalle Valo }, 947d8899132SKalle Valo { 948d8899132SKalle Valo .data_type = QMI_EOTI, 949d8899132SKalle Valo .array_type = NO_ARRAY, 950d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 951d8899132SKalle Valo }, 952d8899132SKalle Valo }; 953d8899132SKalle Valo 954e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_mem_seg_resp_s_v01_ei[] = { 955d8899132SKalle Valo { 956d8899132SKalle Valo .data_type = QMI_UNSIGNED_8_BYTE, 957d8899132SKalle Valo .elem_len = 1, 958d8899132SKalle Valo .elem_size = sizeof(u64), 959d8899132SKalle Valo .array_type = NO_ARRAY, 960d8899132SKalle Valo .tlv_type = 0, 961d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_mem_seg_resp_s_v01, addr), 962d8899132SKalle Valo }, 963d8899132SKalle Valo { 964d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 965d8899132SKalle Valo .elem_len = 1, 966d8899132SKalle Valo .elem_size = sizeof(u32), 967d8899132SKalle Valo .array_type = NO_ARRAY, 968d8899132SKalle Valo .tlv_type = 0, 969d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_mem_seg_resp_s_v01, size), 970d8899132SKalle Valo }, 971d8899132SKalle Valo { 972d8899132SKalle Valo .data_type = QMI_SIGNED_4_BYTE_ENUM, 973d8899132SKalle Valo .elem_len = 1, 974d8899132SKalle Valo .elem_size = sizeof(enum qmi_wlanfw_mem_type_enum_v01), 975d8899132SKalle Valo .array_type = NO_ARRAY, 976d8899132SKalle Valo .tlv_type = 0, 977d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_mem_seg_resp_s_v01, type), 978d8899132SKalle Valo }, 979d8899132SKalle Valo { 980d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 981d8899132SKalle Valo .elem_len = 1, 982d8899132SKalle Valo .elem_size = sizeof(u8), 983d8899132SKalle Valo .array_type = NO_ARRAY, 984d8899132SKalle Valo .tlv_type = 0, 985d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_mem_seg_resp_s_v01, restore), 986d8899132SKalle Valo }, 987d8899132SKalle Valo { 988d8899132SKalle Valo .data_type = QMI_EOTI, 989d8899132SKalle Valo .array_type = NO_ARRAY, 990d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 991d8899132SKalle Valo }, 992d8899132SKalle Valo }; 993d8899132SKalle Valo 994e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_respond_mem_req_msg_v01_ei[] = { 995d8899132SKalle Valo { 996d8899132SKalle Valo .data_type = QMI_DATA_LEN, 997d8899132SKalle Valo .elem_len = 1, 998d8899132SKalle Valo .elem_size = sizeof(u8), 999d8899132SKalle Valo .array_type = NO_ARRAY, 1000d8899132SKalle Valo .tlv_type = 0x01, 1001d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_respond_mem_req_msg_v01, 1002d8899132SKalle Valo mem_seg_len), 1003d8899132SKalle Valo }, 1004d8899132SKalle Valo { 1005d8899132SKalle Valo .data_type = QMI_STRUCT, 1006d8899132SKalle Valo .elem_len = ATH12K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01, 1007d8899132SKalle Valo .elem_size = sizeof(struct qmi_wlanfw_mem_seg_resp_s_v01), 1008d8899132SKalle Valo .array_type = VAR_LEN_ARRAY, 1009d8899132SKalle Valo .tlv_type = 0x01, 1010d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_respond_mem_req_msg_v01, 1011d8899132SKalle Valo mem_seg), 1012d8899132SKalle Valo .ei_array = qmi_wlanfw_mem_seg_resp_s_v01_ei, 1013d8899132SKalle Valo }, 1014d8899132SKalle Valo { 1015d8899132SKalle Valo .data_type = QMI_EOTI, 1016d8899132SKalle Valo .array_type = NO_ARRAY, 1017d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1018d8899132SKalle Valo }, 1019d8899132SKalle Valo }; 1020d8899132SKalle Valo 1021e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_respond_mem_resp_msg_v01_ei[] = { 1022d8899132SKalle Valo { 1023d8899132SKalle Valo .data_type = QMI_STRUCT, 1024d8899132SKalle Valo .elem_len = 1, 1025d8899132SKalle Valo .elem_size = sizeof(struct qmi_response_type_v01), 1026d8899132SKalle Valo .array_type = NO_ARRAY, 1027d8899132SKalle Valo .tlv_type = 0x02, 1028d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_respond_mem_resp_msg_v01, 1029d8899132SKalle Valo resp), 1030d8899132SKalle Valo .ei_array = qmi_response_type_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_cap_req_msg_v01_ei[] = { 1040d8899132SKalle Valo { 1041d8899132SKalle Valo .data_type = QMI_EOTI, 1042d8899132SKalle Valo .array_type = NO_ARRAY, 1043d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1044d8899132SKalle Valo }, 1045d8899132SKalle Valo }; 1046d8899132SKalle Valo 1047e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_rf_chip_info_s_v01_ei[] = { 1048d8899132SKalle Valo { 1049d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1050d8899132SKalle Valo .elem_len = 1, 1051d8899132SKalle Valo .elem_size = sizeof(u32), 1052d8899132SKalle Valo .array_type = NO_ARRAY, 1053d8899132SKalle Valo .tlv_type = 0, 1054d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_rf_chip_info_s_v01, 1055d8899132SKalle Valo chip_id), 1056d8899132SKalle Valo }, 1057d8899132SKalle Valo { 1058d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1059d8899132SKalle Valo .elem_len = 1, 1060d8899132SKalle Valo .elem_size = sizeof(u32), 1061d8899132SKalle Valo .array_type = NO_ARRAY, 1062d8899132SKalle Valo .tlv_type = 0, 1063d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_rf_chip_info_s_v01, 1064d8899132SKalle Valo chip_family), 1065d8899132SKalle Valo }, 1066d8899132SKalle Valo { 1067d8899132SKalle Valo .data_type = QMI_EOTI, 1068d8899132SKalle Valo .array_type = NO_ARRAY, 1069d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1070d8899132SKalle Valo }, 1071d8899132SKalle Valo }; 1072d8899132SKalle Valo 1073e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_rf_board_info_s_v01_ei[] = { 1074d8899132SKalle Valo { 1075d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1076d8899132SKalle Valo .elem_len = 1, 1077d8899132SKalle Valo .elem_size = sizeof(u32), 1078d8899132SKalle Valo .array_type = NO_ARRAY, 1079d8899132SKalle Valo .tlv_type = 0, 1080d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_rf_board_info_s_v01, 1081d8899132SKalle Valo board_id), 1082d8899132SKalle Valo }, 1083d8899132SKalle Valo { 1084d8899132SKalle Valo .data_type = QMI_EOTI, 1085d8899132SKalle Valo .array_type = NO_ARRAY, 1086d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1087d8899132SKalle Valo }, 1088d8899132SKalle Valo }; 1089d8899132SKalle Valo 1090e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_soc_info_s_v01_ei[] = { 1091d8899132SKalle Valo { 1092d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1093d8899132SKalle Valo .elem_len = 1, 1094d8899132SKalle Valo .elem_size = sizeof(u32), 1095d8899132SKalle Valo .array_type = NO_ARRAY, 1096d8899132SKalle Valo .tlv_type = 0, 1097d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_soc_info_s_v01, soc_id), 1098d8899132SKalle Valo }, 1099d8899132SKalle Valo { 1100d8899132SKalle Valo .data_type = QMI_EOTI, 1101d8899132SKalle Valo .array_type = NO_ARRAY, 1102d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1103d8899132SKalle Valo }, 1104d8899132SKalle Valo }; 1105d8899132SKalle Valo 1106e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_dev_mem_info_s_v01_ei[] = { 1107d8899132SKalle Valo { 1108d8899132SKalle Valo .data_type = QMI_UNSIGNED_8_BYTE, 1109d8899132SKalle Valo .elem_len = 1, 1110d8899132SKalle Valo .elem_size = sizeof(u64), 1111d8899132SKalle Valo .array_type = NO_ARRAY, 1112d8899132SKalle Valo .tlv_type = 0, 1113d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_dev_mem_info_s_v01, 1114d8899132SKalle Valo start), 1115d8899132SKalle Valo }, 1116d8899132SKalle Valo { 1117d8899132SKalle Valo .data_type = QMI_UNSIGNED_8_BYTE, 1118d8899132SKalle Valo .elem_len = 1, 1119d8899132SKalle Valo .elem_size = sizeof(u64), 1120d8899132SKalle Valo .array_type = NO_ARRAY, 1121d8899132SKalle Valo .tlv_type = 0, 1122d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_dev_mem_info_s_v01, 1123d8899132SKalle Valo size), 1124d8899132SKalle Valo }, 1125d8899132SKalle Valo { 1126d8899132SKalle Valo .data_type = QMI_EOTI, 1127d8899132SKalle Valo .array_type = NO_ARRAY, 1128d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1129d8899132SKalle Valo }, 1130d8899132SKalle Valo }; 1131d8899132SKalle Valo 1132e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_fw_version_info_s_v01_ei[] = { 1133d8899132SKalle Valo { 1134d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1135d8899132SKalle Valo .elem_len = 1, 1136d8899132SKalle Valo .elem_size = sizeof(u32), 1137d8899132SKalle Valo .array_type = NO_ARRAY, 1138d8899132SKalle Valo .tlv_type = 0, 1139d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_fw_version_info_s_v01, 1140d8899132SKalle Valo fw_version), 1141d8899132SKalle Valo }, 1142d8899132SKalle Valo { 1143d8899132SKalle Valo .data_type = QMI_STRING, 1144d8899132SKalle Valo .elem_len = ATH12K_QMI_WLANFW_MAX_TIMESTAMP_LEN_V01 + 1, 1145d8899132SKalle Valo .elem_size = sizeof(char), 1146d8899132SKalle Valo .array_type = NO_ARRAY, 1147d8899132SKalle Valo .tlv_type = 0, 1148d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_fw_version_info_s_v01, 1149d8899132SKalle Valo fw_build_timestamp), 1150d8899132SKalle Valo }, 1151d8899132SKalle Valo { 1152d8899132SKalle Valo .data_type = QMI_EOTI, 1153d8899132SKalle Valo .array_type = NO_ARRAY, 1154d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1155d8899132SKalle Valo }, 1156d8899132SKalle Valo }; 1157d8899132SKalle Valo 1158e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_cap_resp_msg_v01_ei[] = { 1159d8899132SKalle Valo { 1160d8899132SKalle Valo .data_type = QMI_STRUCT, 1161d8899132SKalle Valo .elem_len = 1, 1162d8899132SKalle Valo .elem_size = sizeof(struct qmi_response_type_v01), 1163d8899132SKalle Valo .array_type = NO_ARRAY, 1164d8899132SKalle Valo .tlv_type = 0x02, 1165d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, resp), 1166d8899132SKalle Valo .ei_array = qmi_response_type_v01_ei, 1167d8899132SKalle Valo }, 1168d8899132SKalle Valo { 1169d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1170d8899132SKalle Valo .elem_len = 1, 1171d8899132SKalle Valo .elem_size = sizeof(u8), 1172d8899132SKalle Valo .array_type = NO_ARRAY, 1173d8899132SKalle Valo .tlv_type = 0x10, 1174d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1175d8899132SKalle Valo chip_info_valid), 1176d8899132SKalle Valo }, 1177d8899132SKalle Valo { 1178d8899132SKalle Valo .data_type = QMI_STRUCT, 1179d8899132SKalle Valo .elem_len = 1, 1180d8899132SKalle Valo .elem_size = sizeof(struct qmi_wlanfw_rf_chip_info_s_v01), 1181d8899132SKalle Valo .array_type = NO_ARRAY, 1182d8899132SKalle Valo .tlv_type = 0x10, 1183d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1184d8899132SKalle Valo chip_info), 1185d8899132SKalle Valo .ei_array = qmi_wlanfw_rf_chip_info_s_v01_ei, 1186d8899132SKalle Valo }, 1187d8899132SKalle Valo { 1188d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1189d8899132SKalle Valo .elem_len = 1, 1190d8899132SKalle Valo .elem_size = sizeof(u8), 1191d8899132SKalle Valo .array_type = NO_ARRAY, 1192d8899132SKalle Valo .tlv_type = 0x11, 1193d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1194d8899132SKalle Valo board_info_valid), 1195d8899132SKalle Valo }, 1196d8899132SKalle Valo { 1197d8899132SKalle Valo .data_type = QMI_STRUCT, 1198d8899132SKalle Valo .elem_len = 1, 1199d8899132SKalle Valo .elem_size = sizeof(struct qmi_wlanfw_rf_board_info_s_v01), 1200d8899132SKalle Valo .array_type = NO_ARRAY, 1201d8899132SKalle Valo .tlv_type = 0x11, 1202d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1203d8899132SKalle Valo board_info), 1204d8899132SKalle Valo .ei_array = qmi_wlanfw_rf_board_info_s_v01_ei, 1205d8899132SKalle Valo }, 1206d8899132SKalle Valo { 1207d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1208d8899132SKalle Valo .elem_len = 1, 1209d8899132SKalle Valo .elem_size = sizeof(u8), 1210d8899132SKalle Valo .array_type = NO_ARRAY, 1211d8899132SKalle Valo .tlv_type = 0x12, 1212d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1213d8899132SKalle Valo soc_info_valid), 1214d8899132SKalle Valo }, 1215d8899132SKalle Valo { 1216d8899132SKalle Valo .data_type = QMI_STRUCT, 1217d8899132SKalle Valo .elem_len = 1, 1218d8899132SKalle Valo .elem_size = sizeof(struct qmi_wlanfw_soc_info_s_v01), 1219d8899132SKalle Valo .array_type = NO_ARRAY, 1220d8899132SKalle Valo .tlv_type = 0x12, 1221d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1222d8899132SKalle Valo soc_info), 1223d8899132SKalle Valo .ei_array = qmi_wlanfw_soc_info_s_v01_ei, 1224d8899132SKalle Valo }, 1225d8899132SKalle Valo { 1226d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1227d8899132SKalle Valo .elem_len = 1, 1228d8899132SKalle Valo .elem_size = sizeof(u8), 1229d8899132SKalle Valo .array_type = NO_ARRAY, 1230d8899132SKalle Valo .tlv_type = 0x13, 1231d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1232d8899132SKalle Valo fw_version_info_valid), 1233d8899132SKalle Valo }, 1234d8899132SKalle Valo { 1235d8899132SKalle Valo .data_type = QMI_STRUCT, 1236d8899132SKalle Valo .elem_len = 1, 1237d8899132SKalle Valo .elem_size = sizeof(struct qmi_wlanfw_fw_version_info_s_v01), 1238d8899132SKalle Valo .array_type = NO_ARRAY, 1239d8899132SKalle Valo .tlv_type = 0x13, 1240d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1241d8899132SKalle Valo fw_version_info), 1242d8899132SKalle Valo .ei_array = qmi_wlanfw_fw_version_info_s_v01_ei, 1243d8899132SKalle Valo }, 1244d8899132SKalle Valo { 1245d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1246d8899132SKalle Valo .elem_len = 1, 1247d8899132SKalle Valo .elem_size = sizeof(u8), 1248d8899132SKalle Valo .array_type = NO_ARRAY, 1249d8899132SKalle Valo .tlv_type = 0x14, 1250d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1251d8899132SKalle Valo fw_build_id_valid), 1252d8899132SKalle Valo }, 1253d8899132SKalle Valo { 1254d8899132SKalle Valo .data_type = QMI_STRING, 1255d8899132SKalle Valo .elem_len = ATH12K_QMI_WLANFW_MAX_BUILD_ID_LEN_V01 + 1, 1256d8899132SKalle Valo .elem_size = sizeof(char), 1257d8899132SKalle Valo .array_type = NO_ARRAY, 1258d8899132SKalle Valo .tlv_type = 0x14, 1259d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1260d8899132SKalle Valo fw_build_id), 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 = 0x15, 1268d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1269d8899132SKalle Valo num_macs_valid), 1270d8899132SKalle Valo }, 1271d8899132SKalle Valo { 1272d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 1273d8899132SKalle Valo .elem_len = 1, 1274d8899132SKalle Valo .elem_size = sizeof(u8), 1275d8899132SKalle Valo .array_type = NO_ARRAY, 1276d8899132SKalle Valo .tlv_type = 0x15, 1277d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1278d8899132SKalle Valo num_macs), 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 = 0x16, 1286d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1287d8899132SKalle Valo voltage_mv_valid), 1288d8899132SKalle Valo }, 1289d8899132SKalle Valo { 1290d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1291d8899132SKalle Valo .elem_len = 1, 1292d8899132SKalle Valo .elem_size = sizeof(u32), 1293d8899132SKalle Valo .array_type = NO_ARRAY, 1294d8899132SKalle Valo .tlv_type = 0x16, 1295d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1296d8899132SKalle Valo voltage_mv), 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 = 0x17, 1304d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1305d8899132SKalle Valo time_freq_hz_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 = 0x17, 1313d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1314d8899132SKalle Valo time_freq_hz), 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 = 0x18, 1322d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1323d8899132SKalle Valo otp_version_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 = 0x18, 1331d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1332d8899132SKalle Valo otp_version), 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 = 0x19, 1340d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1341d8899132SKalle Valo eeprom_caldata_read_timeout_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 = 0x19, 1349d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1350d8899132SKalle Valo eeprom_caldata_read_timeout), 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 = 0x1A, 1358d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1359d8899132SKalle Valo fw_caps_valid), 1360d8899132SKalle Valo }, 1361d8899132SKalle Valo { 1362d8899132SKalle Valo .data_type = QMI_UNSIGNED_8_BYTE, 1363d8899132SKalle Valo .elem_len = 1, 1364d8899132SKalle Valo .elem_size = sizeof(u64), 1365d8899132SKalle Valo .array_type = NO_ARRAY, 1366d8899132SKalle Valo .tlv_type = 0x1A, 1367d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, fw_caps), 1368d8899132SKalle Valo }, 1369d8899132SKalle Valo { 1370d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1371d8899132SKalle Valo .elem_len = 1, 1372d8899132SKalle Valo .elem_size = sizeof(u8), 1373d8899132SKalle Valo .array_type = NO_ARRAY, 1374d8899132SKalle Valo .tlv_type = 0x1B, 1375d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1376d8899132SKalle Valo rd_card_chain_cap_valid), 1377d8899132SKalle Valo }, 1378d8899132SKalle Valo { 1379d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1380d8899132SKalle Valo .elem_len = 1, 1381d8899132SKalle Valo .elem_size = sizeof(u32), 1382d8899132SKalle Valo .array_type = NO_ARRAY, 1383d8899132SKalle Valo .tlv_type = 0x1B, 1384d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1385d8899132SKalle Valo rd_card_chain_cap), 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 = 0x1C, 1393d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1394d8899132SKalle Valo dev_mem_info_valid), 1395d8899132SKalle Valo }, 1396d8899132SKalle Valo { 1397d8899132SKalle Valo .data_type = QMI_STRUCT, 1398d8899132SKalle Valo .elem_len = ATH12K_QMI_WLFW_MAX_DEV_MEM_NUM_V01, 1399d8899132SKalle Valo .elem_size = sizeof(struct qmi_wlanfw_dev_mem_info_s_v01), 1400d8899132SKalle Valo .array_type = STATIC_ARRAY, 1401d8899132SKalle Valo .tlv_type = 0x1C, 1402d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, dev_mem), 1403d8899132SKalle Valo .ei_array = qmi_wlanfw_dev_mem_info_s_v01_ei, 1404d8899132SKalle Valo }, 1405d8899132SKalle Valo { 1406d8899132SKalle Valo .data_type = QMI_EOTI, 1407d8899132SKalle Valo .array_type = NO_ARRAY, 1408d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1409d8899132SKalle Valo }, 1410d8899132SKalle Valo }; 1411d8899132SKalle Valo 1412e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_bdf_download_req_msg_v01_ei[] = { 1413d8899132SKalle Valo { 1414d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 1415d8899132SKalle Valo .elem_len = 1, 1416d8899132SKalle Valo .elem_size = sizeof(u8), 1417d8899132SKalle Valo .array_type = NO_ARRAY, 1418d8899132SKalle Valo .tlv_type = 0x01, 1419d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01, 1420d8899132SKalle Valo valid), 1421d8899132SKalle Valo }, 1422d8899132SKalle Valo { 1423d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1424d8899132SKalle Valo .elem_len = 1, 1425d8899132SKalle Valo .elem_size = sizeof(u8), 1426d8899132SKalle Valo .array_type = NO_ARRAY, 1427d8899132SKalle Valo .tlv_type = 0x10, 1428d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01, 1429d8899132SKalle Valo file_id_valid), 1430d8899132SKalle Valo }, 1431d8899132SKalle Valo { 1432d8899132SKalle Valo .data_type = QMI_SIGNED_4_BYTE_ENUM, 1433d8899132SKalle Valo .elem_len = 1, 1434d8899132SKalle Valo .elem_size = sizeof(enum qmi_wlanfw_cal_temp_id_enum_v01), 1435d8899132SKalle Valo .array_type = NO_ARRAY, 1436d8899132SKalle Valo .tlv_type = 0x10, 1437d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01, 1438d8899132SKalle Valo file_id), 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 = 0x11, 1446d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01, 1447d8899132SKalle Valo total_size_valid), 1448d8899132SKalle Valo }, 1449d8899132SKalle Valo { 1450d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1451d8899132SKalle Valo .elem_len = 1, 1452d8899132SKalle Valo .elem_size = sizeof(u32), 1453d8899132SKalle Valo .array_type = NO_ARRAY, 1454d8899132SKalle Valo .tlv_type = 0x11, 1455d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01, 1456d8899132SKalle Valo total_size), 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 = 0x12, 1464d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01, 1465d8899132SKalle Valo seg_id_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 = 0x12, 1473d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01, 1474d8899132SKalle Valo seg_id), 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 = 0x13, 1482d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01, 1483d8899132SKalle Valo data_valid), 1484d8899132SKalle Valo }, 1485d8899132SKalle Valo { 1486d8899132SKalle Valo .data_type = QMI_DATA_LEN, 1487d8899132SKalle Valo .elem_len = 1, 1488d8899132SKalle Valo .elem_size = sizeof(u16), 1489d8899132SKalle Valo .array_type = NO_ARRAY, 1490d8899132SKalle Valo .tlv_type = 0x13, 1491d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01, 1492d8899132SKalle Valo data_len), 1493d8899132SKalle Valo }, 1494d8899132SKalle Valo { 1495d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 1496d8899132SKalle Valo .elem_len = QMI_WLANFW_MAX_DATA_SIZE_V01, 1497d8899132SKalle Valo .elem_size = sizeof(u8), 1498d8899132SKalle Valo .array_type = VAR_LEN_ARRAY, 1499d8899132SKalle Valo .tlv_type = 0x13, 1500d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01, 1501d8899132SKalle Valo data), 1502d8899132SKalle Valo }, 1503d8899132SKalle Valo { 1504d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1505d8899132SKalle Valo .elem_len = 1, 1506d8899132SKalle Valo .elem_size = sizeof(u8), 1507d8899132SKalle Valo .array_type = NO_ARRAY, 1508d8899132SKalle Valo .tlv_type = 0x14, 1509d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01, 1510d8899132SKalle Valo end_valid), 1511d8899132SKalle Valo }, 1512d8899132SKalle Valo { 1513d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 1514d8899132SKalle Valo .elem_len = 1, 1515d8899132SKalle Valo .elem_size = sizeof(u8), 1516d8899132SKalle Valo .array_type = NO_ARRAY, 1517d8899132SKalle Valo .tlv_type = 0x14, 1518d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01, 1519d8899132SKalle Valo end), 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 = 0x15, 1527d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01, 1528d8899132SKalle Valo bdf_type_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 = 0x15, 1536d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01, 1537d8899132SKalle Valo bdf_type), 1538d8899132SKalle Valo }, 1539d8899132SKalle Valo 1540d8899132SKalle Valo { 1541d8899132SKalle Valo .data_type = QMI_EOTI, 1542d8899132SKalle Valo .array_type = NO_ARRAY, 1543d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1544d8899132SKalle Valo }, 1545d8899132SKalle Valo }; 1546d8899132SKalle Valo 1547e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_bdf_download_resp_msg_v01_ei[] = { 1548d8899132SKalle Valo { 1549d8899132SKalle Valo .data_type = QMI_STRUCT, 1550d8899132SKalle Valo .elem_len = 1, 1551d8899132SKalle Valo .elem_size = sizeof(struct qmi_response_type_v01), 1552d8899132SKalle Valo .array_type = NO_ARRAY, 1553d8899132SKalle Valo .tlv_type = 0x02, 1554d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_resp_msg_v01, 1555d8899132SKalle Valo resp), 1556d8899132SKalle Valo .ei_array = qmi_response_type_v01_ei, 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_m3_info_req_msg_v01_ei[] = { 1566d8899132SKalle Valo { 1567d8899132SKalle Valo .data_type = QMI_UNSIGNED_8_BYTE, 1568d8899132SKalle Valo .elem_len = 1, 1569d8899132SKalle Valo .elem_size = sizeof(u64), 1570d8899132SKalle Valo .array_type = NO_ARRAY, 1571d8899132SKalle Valo .tlv_type = 0x01, 1572d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_m3_info_req_msg_v01, addr), 1573d8899132SKalle Valo }, 1574d8899132SKalle Valo { 1575d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1576d8899132SKalle Valo .elem_len = 1, 1577d8899132SKalle Valo .elem_size = sizeof(u32), 1578d8899132SKalle Valo .array_type = NO_ARRAY, 1579d8899132SKalle Valo .tlv_type = 0x02, 1580d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_m3_info_req_msg_v01, size), 1581d8899132SKalle Valo }, 1582d8899132SKalle Valo { 1583d8899132SKalle Valo .data_type = QMI_EOTI, 1584d8899132SKalle Valo .array_type = NO_ARRAY, 1585d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1586d8899132SKalle Valo }, 1587d8899132SKalle Valo }; 1588d8899132SKalle Valo 1589e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_m3_info_resp_msg_v01_ei[] = { 1590d8899132SKalle Valo { 1591d8899132SKalle Valo .data_type = QMI_STRUCT, 1592d8899132SKalle Valo .elem_len = 1, 1593d8899132SKalle Valo .elem_size = sizeof(struct qmi_response_type_v01), 1594d8899132SKalle Valo .array_type = NO_ARRAY, 1595d8899132SKalle Valo .tlv_type = 0x02, 1596d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_m3_info_resp_msg_v01, resp), 1597d8899132SKalle Valo .ei_array = qmi_response_type_v01_ei, 1598d8899132SKalle Valo }, 1599d8899132SKalle Valo { 1600d8899132SKalle Valo .data_type = QMI_EOTI, 1601d8899132SKalle Valo .array_type = NO_ARRAY, 1602d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1603d8899132SKalle Valo }, 1604d8899132SKalle Valo }; 1605d8899132SKalle Valo 1606e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_ce_tgt_pipe_cfg_s_v01_ei[] = { 1607d8899132SKalle Valo { 1608d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1609d8899132SKalle Valo .elem_len = 1, 1610d8899132SKalle Valo .elem_size = sizeof(u32), 1611d8899132SKalle Valo .array_type = NO_ARRAY, 1612d8899132SKalle Valo .tlv_type = 0, 1613d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01, 1614d8899132SKalle Valo pipe_num), 1615d8899132SKalle Valo }, 1616d8899132SKalle Valo { 1617d8899132SKalle Valo .data_type = QMI_SIGNED_4_BYTE_ENUM, 1618d8899132SKalle Valo .elem_len = 1, 1619d8899132SKalle Valo .elem_size = sizeof(enum qmi_wlanfw_pipedir_enum_v01), 1620d8899132SKalle Valo .array_type = NO_ARRAY, 1621d8899132SKalle Valo .tlv_type = 0, 1622d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01, 1623d8899132SKalle Valo pipe_dir), 1624d8899132SKalle Valo }, 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 nentries), 1633d8899132SKalle Valo }, 1634d8899132SKalle Valo { 1635d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1636d8899132SKalle Valo .elem_len = 1, 1637d8899132SKalle Valo .elem_size = sizeof(u32), 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 nbytes_max), 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 flags), 1651d8899132SKalle Valo }, 1652d8899132SKalle Valo { 1653d8899132SKalle Valo .data_type = QMI_EOTI, 1654d8899132SKalle Valo .array_type = NO_ARRAY, 1655d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1656d8899132SKalle Valo }, 1657d8899132SKalle Valo }; 1658d8899132SKalle Valo 1659e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_ce_svc_pipe_cfg_s_v01_ei[] = { 1660d8899132SKalle Valo { 1661d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1662d8899132SKalle Valo .elem_len = 1, 1663d8899132SKalle Valo .elem_size = sizeof(u32), 1664d8899132SKalle Valo .array_type = NO_ARRAY, 1665d8899132SKalle Valo .tlv_type = 0, 1666d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ce_svc_pipe_cfg_s_v01, 1667d8899132SKalle Valo service_id), 1668d8899132SKalle Valo }, 1669d8899132SKalle Valo { 1670d8899132SKalle Valo .data_type = QMI_SIGNED_4_BYTE_ENUM, 1671d8899132SKalle Valo .elem_len = 1, 1672d8899132SKalle Valo .elem_size = sizeof(enum qmi_wlanfw_pipedir_enum_v01), 1673d8899132SKalle Valo .array_type = NO_ARRAY, 1674d8899132SKalle Valo .tlv_type = 0, 1675d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ce_svc_pipe_cfg_s_v01, 1676d8899132SKalle Valo pipe_dir), 1677d8899132SKalle Valo }, 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 pipe_num), 1686d8899132SKalle Valo }, 1687d8899132SKalle Valo { 1688d8899132SKalle Valo .data_type = QMI_EOTI, 1689d8899132SKalle Valo .array_type = NO_ARRAY, 1690d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1691d8899132SKalle Valo }, 1692d8899132SKalle Valo }; 1693d8899132SKalle Valo 1694e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_shadow_reg_cfg_s_v01_ei[] = { 1695d8899132SKalle Valo { 1696d8899132SKalle Valo .data_type = QMI_UNSIGNED_2_BYTE, 1697d8899132SKalle Valo .elem_len = 1, 1698d8899132SKalle Valo .elem_size = sizeof(u16), 1699d8899132SKalle Valo .array_type = NO_ARRAY, 1700d8899132SKalle Valo .tlv_type = 0, 1701d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_shadow_reg_cfg_s_v01, id), 1702d8899132SKalle Valo }, 1703d8899132SKalle Valo { 1704d8899132SKalle Valo .data_type = QMI_UNSIGNED_2_BYTE, 1705d8899132SKalle Valo .elem_len = 1, 1706d8899132SKalle Valo .elem_size = sizeof(u16), 1707d8899132SKalle Valo .array_type = NO_ARRAY, 1708d8899132SKalle Valo .tlv_type = 0, 1709d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_shadow_reg_cfg_s_v01, 1710d8899132SKalle Valo offset), 1711d8899132SKalle Valo }, 1712d8899132SKalle Valo { 1713d8899132SKalle Valo .data_type = QMI_EOTI, 1714d8899132SKalle Valo .array_type = QMI_COMMON_TLV_TYPE, 1715d8899132SKalle Valo }, 1716d8899132SKalle Valo }; 1717d8899132SKalle Valo 1718e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_shadow_reg_v3_cfg_s_v01_ei[] = { 1719d8899132SKalle Valo { 1720d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1721d8899132SKalle Valo .elem_len = 1, 1722d8899132SKalle Valo .elem_size = sizeof(u32), 1723d8899132SKalle Valo .array_type = NO_ARRAY, 1724d8899132SKalle Valo .tlv_type = 0, 1725d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_shadow_reg_v3_cfg_s_v01, 1726d8899132SKalle Valo addr), 1727d8899132SKalle Valo }, 1728d8899132SKalle Valo { 1729d8899132SKalle Valo .data_type = QMI_EOTI, 1730d8899132SKalle Valo .array_type = NO_ARRAY, 1731d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1732d8899132SKalle Valo }, 1733d8899132SKalle Valo }; 1734d8899132SKalle Valo 1735e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_wlan_mode_req_msg_v01_ei[] = { 1736d8899132SKalle Valo { 1737d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1738d8899132SKalle Valo .elem_len = 1, 1739d8899132SKalle Valo .elem_size = sizeof(u32), 1740d8899132SKalle Valo .array_type = NO_ARRAY, 1741d8899132SKalle Valo .tlv_type = 0x01, 1742d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_mode_req_msg_v01, 1743d8899132SKalle Valo mode), 1744d8899132SKalle Valo }, 1745d8899132SKalle Valo { 1746d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1747d8899132SKalle Valo .elem_len = 1, 1748d8899132SKalle Valo .elem_size = sizeof(u8), 1749d8899132SKalle Valo .array_type = NO_ARRAY, 1750d8899132SKalle Valo .tlv_type = 0x10, 1751d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_mode_req_msg_v01, 1752d8899132SKalle Valo hw_debug_valid), 1753d8899132SKalle Valo }, 1754d8899132SKalle Valo { 1755d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 1756d8899132SKalle Valo .elem_len = 1, 1757d8899132SKalle Valo .elem_size = sizeof(u8), 1758d8899132SKalle Valo .array_type = NO_ARRAY, 1759d8899132SKalle Valo .tlv_type = 0x10, 1760d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_mode_req_msg_v01, 1761d8899132SKalle Valo hw_debug), 1762d8899132SKalle Valo }, 1763d8899132SKalle Valo { 1764d8899132SKalle Valo .data_type = QMI_EOTI, 1765d8899132SKalle Valo .array_type = NO_ARRAY, 1766d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1767d8899132SKalle Valo }, 1768d8899132SKalle Valo }; 1769d8899132SKalle Valo 1770e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_wlan_mode_resp_msg_v01_ei[] = { 1771d8899132SKalle Valo { 1772d8899132SKalle Valo .data_type = QMI_STRUCT, 1773d8899132SKalle Valo .elem_len = 1, 1774d8899132SKalle Valo .elem_size = sizeof(struct qmi_response_type_v01), 1775d8899132SKalle Valo .array_type = NO_ARRAY, 1776d8899132SKalle Valo .tlv_type = 0x02, 1777d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_mode_resp_msg_v01, 1778d8899132SKalle Valo resp), 1779d8899132SKalle Valo .ei_array = qmi_response_type_v01_ei, 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_cfg_req_msg_v01_ei[] = { 1789d8899132SKalle Valo { 1790d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1791d8899132SKalle Valo .elem_len = 1, 1792d8899132SKalle Valo .elem_size = sizeof(u8), 1793d8899132SKalle Valo .array_type = NO_ARRAY, 1794d8899132SKalle Valo .tlv_type = 0x10, 1795d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01, 1796d8899132SKalle Valo host_version_valid), 1797d8899132SKalle Valo }, 1798d8899132SKalle Valo { 1799d8899132SKalle Valo .data_type = QMI_STRING, 1800d8899132SKalle Valo .elem_len = QMI_WLANFW_MAX_STR_LEN_V01 + 1, 1801d8899132SKalle Valo .elem_size = sizeof(char), 1802d8899132SKalle Valo .array_type = NO_ARRAY, 1803d8899132SKalle Valo .tlv_type = 0x10, 1804d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01, 1805d8899132SKalle Valo host_version), 1806d8899132SKalle Valo }, 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 = 0x11, 1813d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01, 1814d8899132SKalle Valo tgt_cfg_valid), 1815d8899132SKalle Valo }, 1816d8899132SKalle Valo { 1817d8899132SKalle Valo .data_type = QMI_DATA_LEN, 1818d8899132SKalle Valo .elem_len = 1, 1819d8899132SKalle Valo .elem_size = sizeof(u8), 1820d8899132SKalle Valo .array_type = NO_ARRAY, 1821d8899132SKalle Valo .tlv_type = 0x11, 1822d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01, 1823d8899132SKalle Valo tgt_cfg_len), 1824d8899132SKalle Valo }, 1825d8899132SKalle Valo { 1826d8899132SKalle Valo .data_type = QMI_STRUCT, 1827d8899132SKalle Valo .elem_len = QMI_WLANFW_MAX_NUM_CE_V01, 1828d8899132SKalle Valo .elem_size = sizeof(struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01), 1829d8899132SKalle Valo .array_type = VAR_LEN_ARRAY, 1830d8899132SKalle Valo .tlv_type = 0x11, 1831d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01, 1832d8899132SKalle Valo tgt_cfg), 1833d8899132SKalle Valo .ei_array = qmi_wlanfw_ce_tgt_pipe_cfg_s_v01_ei, 1834d8899132SKalle Valo }, 1835d8899132SKalle Valo { 1836d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1837d8899132SKalle Valo .elem_len = 1, 1838d8899132SKalle Valo .elem_size = sizeof(u8), 1839d8899132SKalle Valo .array_type = NO_ARRAY, 1840d8899132SKalle Valo .tlv_type = 0x12, 1841d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01, 1842d8899132SKalle Valo svc_cfg_valid), 1843d8899132SKalle Valo }, 1844d8899132SKalle Valo { 1845d8899132SKalle Valo .data_type = QMI_DATA_LEN, 1846d8899132SKalle Valo .elem_len = 1, 1847d8899132SKalle Valo .elem_size = sizeof(u8), 1848d8899132SKalle Valo .array_type = NO_ARRAY, 1849d8899132SKalle Valo .tlv_type = 0x12, 1850d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01, 1851d8899132SKalle Valo svc_cfg_len), 1852d8899132SKalle Valo }, 1853d8899132SKalle Valo { 1854d8899132SKalle Valo .data_type = QMI_STRUCT, 1855d8899132SKalle Valo .elem_len = QMI_WLANFW_MAX_NUM_SVC_V01, 1856d8899132SKalle Valo .elem_size = sizeof(struct qmi_wlanfw_ce_svc_pipe_cfg_s_v01), 1857d8899132SKalle Valo .array_type = VAR_LEN_ARRAY, 1858d8899132SKalle Valo .tlv_type = 0x12, 1859d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01, 1860d8899132SKalle Valo svc_cfg), 1861d8899132SKalle Valo .ei_array = qmi_wlanfw_ce_svc_pipe_cfg_s_v01_ei, 1862d8899132SKalle Valo }, 1863d8899132SKalle Valo { 1864d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1865d8899132SKalle Valo .elem_len = 1, 1866d8899132SKalle Valo .elem_size = sizeof(u8), 1867d8899132SKalle Valo .array_type = NO_ARRAY, 1868d8899132SKalle Valo .tlv_type = 0x13, 1869d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01, 1870d8899132SKalle Valo shadow_reg_valid), 1871d8899132SKalle Valo }, 1872d8899132SKalle Valo { 1873d8899132SKalle Valo .data_type = QMI_DATA_LEN, 1874d8899132SKalle Valo .elem_len = 1, 1875d8899132SKalle Valo .elem_size = sizeof(u8), 1876d8899132SKalle Valo .array_type = NO_ARRAY, 1877d8899132SKalle Valo .tlv_type = 0x13, 1878d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01, 1879d8899132SKalle Valo shadow_reg_len), 1880d8899132SKalle Valo }, 1881d8899132SKalle Valo { 1882d8899132SKalle Valo .data_type = QMI_STRUCT, 1883d8899132SKalle Valo .elem_len = QMI_WLANFW_MAX_NUM_SHADOW_REG_V01, 1884d8899132SKalle Valo .elem_size = sizeof(struct qmi_wlanfw_shadow_reg_cfg_s_v01), 1885d8899132SKalle Valo .array_type = VAR_LEN_ARRAY, 1886d8899132SKalle Valo .tlv_type = 0x13, 1887d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01, 1888d8899132SKalle Valo shadow_reg), 1889d8899132SKalle Valo .ei_array = qmi_wlanfw_shadow_reg_cfg_s_v01_ei, 1890d8899132SKalle Valo }, 1891d8899132SKalle Valo { 1892d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1893d8899132SKalle Valo .elem_len = 1, 1894d8899132SKalle Valo .elem_size = sizeof(u8), 1895d8899132SKalle Valo .array_type = NO_ARRAY, 1896d8899132SKalle Valo .tlv_type = 0x17, 1897d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01, 1898d8899132SKalle Valo shadow_reg_v3_valid), 1899d8899132SKalle Valo }, 1900d8899132SKalle Valo { 1901d8899132SKalle Valo .data_type = QMI_DATA_LEN, 1902d8899132SKalle Valo .elem_len = 1, 1903d8899132SKalle Valo .elem_size = sizeof(u8), 1904d8899132SKalle Valo .array_type = NO_ARRAY, 1905d8899132SKalle Valo .tlv_type = 0x17, 1906d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01, 1907d8899132SKalle Valo shadow_reg_v3_len), 1908d8899132SKalle Valo }, 1909d8899132SKalle Valo { 1910d8899132SKalle Valo .data_type = QMI_STRUCT, 1911d8899132SKalle Valo .elem_len = QMI_WLANFW_MAX_NUM_SHADOW_REG_V3_V01, 1912d8899132SKalle Valo .elem_size = sizeof(struct qmi_wlanfw_shadow_reg_v3_cfg_s_v01), 1913d8899132SKalle Valo .array_type = VAR_LEN_ARRAY, 1914d8899132SKalle Valo .tlv_type = 0x17, 1915d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01, 1916d8899132SKalle Valo shadow_reg_v3), 1917d8899132SKalle Valo .ei_array = qmi_wlanfw_shadow_reg_v3_cfg_s_v01_ei, 1918d8899132SKalle Valo }, 1919d8899132SKalle Valo { 1920d8899132SKalle Valo .data_type = QMI_EOTI, 1921d8899132SKalle Valo .array_type = NO_ARRAY, 1922d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1923d8899132SKalle Valo }, 1924d8899132SKalle Valo }; 1925d8899132SKalle Valo 1926e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_wlan_cfg_resp_msg_v01_ei[] = { 1927d8899132SKalle Valo { 1928d8899132SKalle Valo .data_type = QMI_STRUCT, 1929d8899132SKalle Valo .elem_len = 1, 1930d8899132SKalle Valo .elem_size = sizeof(struct qmi_response_type_v01), 1931d8899132SKalle Valo .array_type = NO_ARRAY, 1932d8899132SKalle Valo .tlv_type = 0x02, 1933d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_resp_msg_v01, resp), 1934d8899132SKalle Valo .ei_array = qmi_response_type_v01_ei, 1935d8899132SKalle Valo }, 1936d8899132SKalle Valo { 1937d8899132SKalle Valo .data_type = QMI_EOTI, 1938d8899132SKalle Valo .array_type = NO_ARRAY, 1939d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1940d8899132SKalle Valo }, 1941d8899132SKalle Valo }; 1942d8899132SKalle Valo 1943e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_mem_ready_ind_msg_v01_ei[] = { 1944d8899132SKalle Valo { 1945d8899132SKalle Valo .data_type = QMI_EOTI, 1946d8899132SKalle Valo .array_type = NO_ARRAY, 1947d8899132SKalle Valo }, 1948d8899132SKalle Valo }; 1949d8899132SKalle Valo 1950e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_fw_ready_ind_msg_v01_ei[] = { 1951d8899132SKalle Valo { 1952d8899132SKalle Valo .data_type = QMI_EOTI, 1953d8899132SKalle Valo .array_type = NO_ARRAY, 1954d8899132SKalle Valo }, 1955d8899132SKalle Valo }; 1956d8899132SKalle Valo 19579f9df1a2SBaochen Qiang static const struct qmi_elem_info qmi_wlanfw_wlan_ini_req_msg_v01_ei[] = { 19589f9df1a2SBaochen Qiang { 19599f9df1a2SBaochen Qiang .data_type = QMI_OPT_FLAG, 19609f9df1a2SBaochen Qiang .elem_len = 1, 19619f9df1a2SBaochen Qiang .elem_size = sizeof(u8), 19629f9df1a2SBaochen Qiang .array_type = NO_ARRAY, 19639f9df1a2SBaochen Qiang .tlv_type = 0x10, 19649f9df1a2SBaochen Qiang .offset = offsetof(struct qmi_wlanfw_wlan_ini_req_msg_v01, 19659f9df1a2SBaochen Qiang enable_fwlog_valid), 19669f9df1a2SBaochen Qiang }, 19679f9df1a2SBaochen Qiang { 19689f9df1a2SBaochen Qiang .data_type = QMI_UNSIGNED_1_BYTE, 19699f9df1a2SBaochen Qiang .elem_len = 1, 19709f9df1a2SBaochen Qiang .elem_size = sizeof(u8), 19719f9df1a2SBaochen Qiang .array_type = NO_ARRAY, 19729f9df1a2SBaochen Qiang .tlv_type = 0x10, 19739f9df1a2SBaochen Qiang .offset = offsetof(struct qmi_wlanfw_wlan_ini_req_msg_v01, 19749f9df1a2SBaochen Qiang enable_fwlog), 19759f9df1a2SBaochen Qiang }, 19769f9df1a2SBaochen Qiang { 19779f9df1a2SBaochen Qiang .data_type = QMI_EOTI, 19789f9df1a2SBaochen Qiang .array_type = NO_ARRAY, 19799f9df1a2SBaochen Qiang .tlv_type = QMI_COMMON_TLV_TYPE, 19809f9df1a2SBaochen Qiang }, 19819f9df1a2SBaochen Qiang }; 19829f9df1a2SBaochen Qiang 19839f9df1a2SBaochen Qiang static const struct qmi_elem_info qmi_wlanfw_wlan_ini_resp_msg_v01_ei[] = { 19849f9df1a2SBaochen Qiang { 19859f9df1a2SBaochen Qiang .data_type = QMI_STRUCT, 19869f9df1a2SBaochen Qiang .elem_len = 1, 19879f9df1a2SBaochen Qiang .elem_size = sizeof(struct qmi_response_type_v01), 19889f9df1a2SBaochen Qiang .array_type = NO_ARRAY, 19899f9df1a2SBaochen Qiang .tlv_type = 0x02, 19909f9df1a2SBaochen Qiang .offset = offsetof(struct qmi_wlanfw_wlan_ini_resp_msg_v01, 19919f9df1a2SBaochen Qiang resp), 19929f9df1a2SBaochen Qiang .ei_array = qmi_response_type_v01_ei, 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 200176fece36SKarthikeyan Periyasamy static void ath12k_host_cap_parse_mlo(struct ath12k_base *ab, 200276fece36SKarthikeyan Periyasamy struct qmi_wlanfw_host_cap_req_msg_v01 *req) 2003d8899132SKalle Valo { 200476fece36SKarthikeyan Periyasamy struct wlfw_host_mlo_chip_info_s_v01 *info; 200576fece36SKarthikeyan Periyasamy u8 hw_link_id = 0; 200676fece36SKarthikeyan Periyasamy int i; 200776fece36SKarthikeyan Periyasamy 200853a65445SKarthikeyan Periyasamy if (!ab->qmi.num_radios || ab->qmi.num_radios == U8_MAX) { 200953a65445SKarthikeyan Periyasamy ath12k_dbg(ab, ATH12K_DBG_QMI, 201053a65445SKarthikeyan Periyasamy "skip QMI MLO cap due to invalid num_radio %d\n", 201153a65445SKarthikeyan Periyasamy ab->qmi.num_radios); 201276fece36SKarthikeyan Periyasamy return; 201353a65445SKarthikeyan Periyasamy } 201476fece36SKarthikeyan Periyasamy 2015d8899132SKalle Valo req->mlo_capable_valid = 1; 2016d8899132SKalle Valo req->mlo_capable = 1; 2017d8899132SKalle Valo req->mlo_chip_id_valid = 1; 2018d8899132SKalle Valo req->mlo_chip_id = 0; 2019d8899132SKalle Valo req->mlo_group_id_valid = 1; 2020d8899132SKalle Valo req->mlo_group_id = 0; 2021d8899132SKalle Valo req->max_mlo_peer_valid = 1; 2022d8899132SKalle Valo /* Max peer number generally won't change for the same device 2023d8899132SKalle Valo * but needs to be synced with host driver. 2024d8899132SKalle Valo */ 202576fece36SKarthikeyan Periyasamy req->max_mlo_peer = ab->hw_params->max_mlo_peer; 2026d8899132SKalle Valo req->mlo_num_chips_valid = 1; 2027d8899132SKalle Valo req->mlo_num_chips = 1; 202876fece36SKarthikeyan Periyasamy 202976fece36SKarthikeyan Periyasamy info = &req->mlo_chip_info[0]; 203076fece36SKarthikeyan Periyasamy info->chip_id = 0; 203153a65445SKarthikeyan Periyasamy info->num_local_links = ab->qmi.num_radios; 203276fece36SKarthikeyan Periyasamy 203376fece36SKarthikeyan Periyasamy for (i = 0; i < info->num_local_links; i++) { 203476fece36SKarthikeyan Periyasamy info->hw_link_id[i] = hw_link_id; 203576fece36SKarthikeyan Periyasamy info->valid_mlo_link_id[i] = 1; 203676fece36SKarthikeyan Periyasamy 203776fece36SKarthikeyan Periyasamy hw_link_id++; 203876fece36SKarthikeyan Periyasamy } 203976fece36SKarthikeyan Periyasamy 2040d8899132SKalle Valo req->mlo_chip_info_valid = 1; 2041d8899132SKalle Valo } 2042d8899132SKalle Valo 2043d8899132SKalle Valo static int ath12k_qmi_host_cap_send(struct ath12k_base *ab) 2044d8899132SKalle Valo { 20456d2b0a06SJeff Johnson struct qmi_wlanfw_host_cap_req_msg_v01 req = {}; 20466d2b0a06SJeff Johnson struct qmi_wlanfw_host_cap_resp_msg_v01 resp = {}; 204759cf57abSJeff Johnson struct qmi_txn txn; 2048d8899132SKalle Valo int ret = 0; 2049d8899132SKalle Valo 2050d8899132SKalle Valo req.num_clients_valid = 1; 2051d8899132SKalle Valo req.num_clients = 1; 2052d8899132SKalle Valo req.mem_cfg_mode = ab->qmi.target_mem_mode; 2053d8899132SKalle Valo req.mem_cfg_mode_valid = 1; 2054d8899132SKalle Valo req.bdf_support_valid = 1; 2055d8899132SKalle Valo req.bdf_support = 1; 2056d8899132SKalle Valo 2057d8899132SKalle Valo req.m3_support_valid = 1; 2058d8899132SKalle Valo req.m3_support = 1; 2059d8899132SKalle Valo req.m3_cache_support_valid = 1; 2060d8899132SKalle Valo req.m3_cache_support = 1; 2061d8899132SKalle Valo 2062d8899132SKalle Valo req.cal_done_valid = 1; 2063d8899132SKalle Valo req.cal_done = ab->qmi.cal_done; 2064d8899132SKalle Valo 20659981a3acSCarl Huang if (ab->hw_params->qmi_cnss_feature_bitmap) { 2066d8899132SKalle Valo req.feature_list_valid = 1; 20679981a3acSCarl Huang req.feature_list = ab->hw_params->qmi_cnss_feature_bitmap; 20689981a3acSCarl Huang } 2069d8899132SKalle Valo 2070d8899132SKalle Valo /* BRINGUP: here we are piggybacking a lot of stuff using 2071d8899132SKalle Valo * internal_sleep_clock, should it be split? 2072d8899132SKalle Valo */ 2073d8899132SKalle Valo if (ab->hw_params->internal_sleep_clock) { 2074d8899132SKalle Valo req.nm_modem_valid = 1; 2075d8899132SKalle Valo 2076d8899132SKalle Valo /* Notify firmware that this is non-qualcomm platform. */ 2077d8899132SKalle Valo req.nm_modem |= HOST_CSTATE_BIT; 2078d8899132SKalle Valo 2079d8899132SKalle Valo /* Notify firmware about the sleep clock selection, 2080d8899132SKalle Valo * nm_modem_bit[1] is used for this purpose. Host driver on 2081d8899132SKalle Valo * non-qualcomm platforms should select internal sleep 2082d8899132SKalle Valo * clock. 2083d8899132SKalle Valo */ 2084d8899132SKalle Valo req.nm_modem |= SLEEP_CLOCK_SELECT_INTERNAL_BIT; 2085d8899132SKalle Valo req.nm_modem |= PLATFORM_CAP_PCIE_GLOBAL_RESET; 2086d8899132SKalle Valo } 2087d8899132SKalle Valo 208876fece36SKarthikeyan Periyasamy ath12k_host_cap_parse_mlo(ab, &req); 208976fece36SKarthikeyan Periyasamy 2090d8899132SKalle Valo ret = qmi_txn_init(&ab->qmi.handle, &txn, 2091d8899132SKalle Valo qmi_wlanfw_host_cap_resp_msg_v01_ei, &resp); 2092d8899132SKalle Valo if (ret < 0) 2093d8899132SKalle Valo goto out; 2094d8899132SKalle Valo 2095d8899132SKalle Valo ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, 2096d8899132SKalle Valo QMI_WLANFW_HOST_CAP_REQ_V01, 2097d8899132SKalle Valo QMI_WLANFW_HOST_CAP_REQ_MSG_V01_MAX_LEN, 2098d8899132SKalle Valo qmi_wlanfw_host_cap_req_msg_v01_ei, &req); 2099d8899132SKalle Valo if (ret < 0) { 21002e82b5f0SJeff Johnson qmi_txn_cancel(&txn); 2101d8899132SKalle Valo ath12k_warn(ab, "Failed to send host capability request,err = %d\n", ret); 2102d8899132SKalle Valo goto out; 2103d8899132SKalle Valo } 2104d8899132SKalle Valo 2105d8899132SKalle Valo ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS)); 2106d8899132SKalle Valo if (ret < 0) 2107d8899132SKalle Valo goto out; 2108d8899132SKalle Valo 2109d8899132SKalle Valo if (resp.resp.result != QMI_RESULT_SUCCESS_V01) { 2110d8899132SKalle Valo ath12k_warn(ab, "Host capability request failed, result: %d, err: %d\n", 2111d8899132SKalle Valo resp.resp.result, resp.resp.error); 2112d8899132SKalle Valo ret = -EINVAL; 2113d8899132SKalle Valo goto out; 2114d8899132SKalle Valo } 2115d8899132SKalle Valo 2116d8899132SKalle Valo out: 2117d8899132SKalle Valo return ret; 2118d8899132SKalle Valo } 2119d8899132SKalle Valo 212053a65445SKarthikeyan Periyasamy static void ath12k_qmi_phy_cap_send(struct ath12k_base *ab) 212153a65445SKarthikeyan Periyasamy { 212253a65445SKarthikeyan Periyasamy struct qmi_wlanfw_phy_cap_req_msg_v01 req = {}; 212353a65445SKarthikeyan Periyasamy struct qmi_wlanfw_phy_cap_resp_msg_v01 resp = {}; 212453a65445SKarthikeyan Periyasamy struct qmi_txn txn; 212553a65445SKarthikeyan Periyasamy int ret; 212653a65445SKarthikeyan Periyasamy 2127*2d3a7384SRaj Kumar Bhagat if (!ab->slo_capable) 2128*2d3a7384SRaj Kumar Bhagat goto out; 2129*2d3a7384SRaj Kumar Bhagat 213053a65445SKarthikeyan Periyasamy ret = qmi_txn_init(&ab->qmi.handle, &txn, 213153a65445SKarthikeyan Periyasamy qmi_wlanfw_phy_cap_resp_msg_v01_ei, &resp); 213253a65445SKarthikeyan Periyasamy if (ret < 0) 213353a65445SKarthikeyan Periyasamy goto out; 213453a65445SKarthikeyan Periyasamy 213553a65445SKarthikeyan Periyasamy ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, 213653a65445SKarthikeyan Periyasamy QMI_WLANFW_PHY_CAP_REQ_V01, 213753a65445SKarthikeyan Periyasamy QMI_WLANFW_PHY_CAP_REQ_MSG_V01_MAX_LEN, 213853a65445SKarthikeyan Periyasamy qmi_wlanfw_phy_cap_req_msg_v01_ei, &req); 213953a65445SKarthikeyan Periyasamy if (ret < 0) { 214053a65445SKarthikeyan Periyasamy qmi_txn_cancel(&txn); 214153a65445SKarthikeyan Periyasamy ath12k_warn(ab, "failed to send phy capability request: %d\n", ret); 214253a65445SKarthikeyan Periyasamy goto out; 214353a65445SKarthikeyan Periyasamy } 214453a65445SKarthikeyan Periyasamy 214553a65445SKarthikeyan Periyasamy ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS)); 214653a65445SKarthikeyan Periyasamy if (ret < 0) 214753a65445SKarthikeyan Periyasamy goto out; 214853a65445SKarthikeyan Periyasamy 214953a65445SKarthikeyan Periyasamy if (resp.resp.result != QMI_RESULT_SUCCESS_V01) { 215053a65445SKarthikeyan Periyasamy ret = -EOPNOTSUPP; 215153a65445SKarthikeyan Periyasamy goto out; 215253a65445SKarthikeyan Periyasamy } 215353a65445SKarthikeyan Periyasamy 215453a65445SKarthikeyan Periyasamy if (!resp.num_phy_valid) { 215553a65445SKarthikeyan Periyasamy ret = -ENODATA; 215653a65445SKarthikeyan Periyasamy goto out; 215753a65445SKarthikeyan Periyasamy } 215853a65445SKarthikeyan Periyasamy 215953a65445SKarthikeyan Periyasamy ab->qmi.num_radios = resp.num_phy; 216053a65445SKarthikeyan Periyasamy 216153a65445SKarthikeyan Periyasamy ath12k_dbg(ab, ATH12K_DBG_QMI, "phy capability resp valid %d num_phy %d valid %d board_id %d\n", 216253a65445SKarthikeyan Periyasamy resp.num_phy_valid, resp.num_phy, 216353a65445SKarthikeyan Periyasamy resp.board_id_valid, resp.board_id); 216453a65445SKarthikeyan Periyasamy 216553a65445SKarthikeyan Periyasamy return; 216653a65445SKarthikeyan Periyasamy 216753a65445SKarthikeyan Periyasamy out: 216853a65445SKarthikeyan Periyasamy /* If PHY capability not advertised then rely on default num link */ 216953a65445SKarthikeyan Periyasamy ab->qmi.num_radios = ab->hw_params->def_num_link; 217053a65445SKarthikeyan Periyasamy 217153a65445SKarthikeyan Periyasamy ath12k_dbg(ab, ATH12K_DBG_QMI, 217253a65445SKarthikeyan Periyasamy "no valid response from PHY capability, choose default num_phy %d\n", 217353a65445SKarthikeyan Periyasamy ab->qmi.num_radios); 217453a65445SKarthikeyan Periyasamy } 217553a65445SKarthikeyan Periyasamy 2176d8899132SKalle Valo static int ath12k_qmi_fw_ind_register_send(struct ath12k_base *ab) 2177d8899132SKalle Valo { 2178d8899132SKalle Valo struct qmi_wlanfw_ind_register_req_msg_v01 *req; 2179d8899132SKalle Valo struct qmi_wlanfw_ind_register_resp_msg_v01 *resp; 2180d8899132SKalle Valo struct qmi_handle *handle = &ab->qmi.handle; 2181d8899132SKalle Valo struct qmi_txn txn; 2182d8899132SKalle Valo int ret; 2183d8899132SKalle Valo 2184d8899132SKalle Valo req = kzalloc(sizeof(*req), GFP_KERNEL); 2185d8899132SKalle Valo if (!req) 2186d8899132SKalle Valo return -ENOMEM; 2187d8899132SKalle Valo 2188d8899132SKalle Valo resp = kzalloc(sizeof(*resp), GFP_KERNEL); 2189d8899132SKalle Valo if (!resp) { 2190d8899132SKalle Valo ret = -ENOMEM; 2191d8899132SKalle Valo goto resp_out; 2192d8899132SKalle Valo } 2193d8899132SKalle Valo 2194d8899132SKalle Valo req->client_id_valid = 1; 2195d8899132SKalle Valo req->client_id = QMI_WLANFW_CLIENT_ID; 2196d8899132SKalle Valo req->fw_ready_enable_valid = 1; 2197d8899132SKalle Valo req->fw_ready_enable = 1; 2198d8899132SKalle Valo req->request_mem_enable_valid = 1; 2199d8899132SKalle Valo req->request_mem_enable = 1; 2200d8899132SKalle Valo req->fw_mem_ready_enable_valid = 1; 2201d8899132SKalle Valo req->fw_mem_ready_enable = 1; 2202d8899132SKalle Valo req->cal_done_enable_valid = 1; 2203d8899132SKalle Valo req->cal_done_enable = 1; 2204d8899132SKalle Valo req->fw_init_done_enable_valid = 1; 2205d8899132SKalle Valo req->fw_init_done_enable = 1; 2206d8899132SKalle Valo 2207d8899132SKalle Valo req->pin_connect_result_enable_valid = 0; 2208d8899132SKalle Valo req->pin_connect_result_enable = 0; 2209d8899132SKalle Valo 2210d8899132SKalle Valo ret = qmi_txn_init(handle, &txn, 2211d8899132SKalle Valo qmi_wlanfw_ind_register_resp_msg_v01_ei, resp); 2212d8899132SKalle Valo if (ret < 0) 2213d8899132SKalle Valo goto out; 2214d8899132SKalle Valo 2215d8899132SKalle Valo ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, 2216d8899132SKalle Valo QMI_WLANFW_IND_REGISTER_REQ_V01, 2217d8899132SKalle Valo QMI_WLANFW_IND_REGISTER_REQ_MSG_V01_MAX_LEN, 2218d8899132SKalle Valo qmi_wlanfw_ind_register_req_msg_v01_ei, req); 2219d8899132SKalle Valo if (ret < 0) { 22202e82b5f0SJeff Johnson qmi_txn_cancel(&txn); 2221d8899132SKalle Valo ath12k_warn(ab, "Failed to send indication register request, err = %d\n", 2222d8899132SKalle Valo ret); 2223d8899132SKalle Valo goto out; 2224d8899132SKalle Valo } 2225d8899132SKalle Valo 2226d8899132SKalle Valo ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS)); 2227d8899132SKalle Valo if (ret < 0) { 2228d8899132SKalle Valo ath12k_warn(ab, "failed to register fw indication %d\n", ret); 2229d8899132SKalle Valo goto out; 2230d8899132SKalle Valo } 2231d8899132SKalle Valo 2232d8899132SKalle Valo if (resp->resp.result != QMI_RESULT_SUCCESS_V01) { 2233d8899132SKalle Valo ath12k_warn(ab, "FW Ind register request failed, result: %d, err: %d\n", 2234d8899132SKalle Valo resp->resp.result, resp->resp.error); 2235d8899132SKalle Valo ret = -EINVAL; 2236d8899132SKalle Valo goto out; 2237d8899132SKalle Valo } 2238d8899132SKalle Valo 2239d8899132SKalle Valo out: 2240d8899132SKalle Valo kfree(resp); 2241d8899132SKalle Valo resp_out: 2242d8899132SKalle Valo kfree(req); 2243d8899132SKalle Valo return ret; 2244d8899132SKalle Valo } 2245d8899132SKalle Valo 2246d8899132SKalle Valo static int ath12k_qmi_respond_fw_mem_request(struct ath12k_base *ab) 2247d8899132SKalle Valo { 2248d8899132SKalle Valo struct qmi_wlanfw_respond_mem_req_msg_v01 *req; 22496d2b0a06SJeff Johnson struct qmi_wlanfw_respond_mem_resp_msg_v01 resp = {}; 225059cf57abSJeff Johnson struct qmi_txn txn; 2251d8899132SKalle Valo int ret = 0, i; 2252d8899132SKalle Valo bool delayed; 2253d8899132SKalle Valo 2254d8899132SKalle Valo req = kzalloc(sizeof(*req), GFP_KERNEL); 2255d8899132SKalle Valo if (!req) 2256d8899132SKalle Valo return -ENOMEM; 2257d8899132SKalle Valo 2258d8899132SKalle Valo /* Some targets by default request a block of big contiguous 2259d8899132SKalle Valo * DMA memory, it's hard to allocate from kernel. So host returns 2260d8899132SKalle Valo * failure to firmware and firmware then request multiple blocks of 2261d8899132SKalle Valo * small chunk size memory. 2262d8899132SKalle Valo */ 2263d8899132SKalle Valo if (ab->qmi.target_mem_delayed) { 2264d8899132SKalle Valo delayed = true; 2265d8899132SKalle Valo ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi delays mem_request %d\n", 2266d8899132SKalle Valo ab->qmi.mem_seg_count); 2267d8899132SKalle Valo } else { 2268d8899132SKalle Valo delayed = false; 2269d8899132SKalle Valo req->mem_seg_len = ab->qmi.mem_seg_count; 2270d8899132SKalle Valo for (i = 0; i < req->mem_seg_len ; i++) { 2271d8899132SKalle Valo req->mem_seg[i].addr = ab->qmi.target_mem[i].paddr; 2272d8899132SKalle Valo req->mem_seg[i].size = ab->qmi.target_mem[i].size; 2273d8899132SKalle Valo req->mem_seg[i].type = ab->qmi.target_mem[i].type; 2274d8899132SKalle Valo ath12k_dbg(ab, ATH12K_DBG_QMI, 2275d8899132SKalle Valo "qmi req mem_seg[%d] %pad %u %u\n", i, 2276d8899132SKalle Valo &ab->qmi.target_mem[i].paddr, 2277d8899132SKalle Valo ab->qmi.target_mem[i].size, 2278d8899132SKalle Valo ab->qmi.target_mem[i].type); 2279d8899132SKalle Valo } 2280d8899132SKalle Valo } 2281d8899132SKalle Valo 2282d8899132SKalle Valo ret = qmi_txn_init(&ab->qmi.handle, &txn, 2283d8899132SKalle Valo qmi_wlanfw_respond_mem_resp_msg_v01_ei, &resp); 2284d8899132SKalle Valo if (ret < 0) 2285d8899132SKalle Valo goto out; 2286d8899132SKalle Valo 2287d8899132SKalle Valo ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, 2288d8899132SKalle Valo QMI_WLANFW_RESPOND_MEM_REQ_V01, 2289d8899132SKalle Valo QMI_WLANFW_RESPOND_MEM_REQ_MSG_V01_MAX_LEN, 2290d8899132SKalle Valo qmi_wlanfw_respond_mem_req_msg_v01_ei, req); 2291d8899132SKalle Valo if (ret < 0) { 22922e82b5f0SJeff Johnson qmi_txn_cancel(&txn); 2293d8899132SKalle Valo ath12k_warn(ab, "qmi failed to respond memory request, err = %d\n", 2294d8899132SKalle Valo ret); 2295d8899132SKalle Valo goto out; 2296d8899132SKalle Valo } 2297d8899132SKalle Valo 2298d8899132SKalle Valo ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS)); 2299d8899132SKalle Valo if (ret < 0) { 2300d8899132SKalle Valo ath12k_warn(ab, "qmi failed memory request, err = %d\n", ret); 2301d8899132SKalle Valo goto out; 2302d8899132SKalle Valo } 2303d8899132SKalle Valo 2304d8899132SKalle Valo if (resp.resp.result != QMI_RESULT_SUCCESS_V01) { 2305d8899132SKalle Valo /* the error response is expected when 2306d8899132SKalle Valo * target_mem_delayed is true. 2307d8899132SKalle Valo */ 2308d8899132SKalle Valo if (delayed && resp.resp.error == 0) 2309d8899132SKalle Valo goto out; 2310d8899132SKalle Valo 2311d8899132SKalle Valo ath12k_warn(ab, "Respond mem req failed, result: %d, err: %d\n", 2312d8899132SKalle Valo resp.resp.result, resp.resp.error); 2313d8899132SKalle Valo ret = -EINVAL; 2314d8899132SKalle Valo goto out; 2315d8899132SKalle Valo } 2316d8899132SKalle Valo out: 2317d8899132SKalle Valo kfree(req); 2318d8899132SKalle Valo return ret; 2319d8899132SKalle Valo } 2320d8899132SKalle Valo 2321d8899132SKalle Valo static void ath12k_qmi_free_target_mem_chunk(struct ath12k_base *ab) 2322d8899132SKalle Valo { 2323d8899132SKalle Valo int i; 2324d8899132SKalle Valo 2325d8899132SKalle Valo for (i = 0; i < ab->qmi.mem_seg_count; i++) { 2326d8899132SKalle Valo if (!ab->qmi.target_mem[i].v.addr) 2327d8899132SKalle Valo continue; 2328d8899132SKalle Valo dma_free_coherent(ab->dev, 2329d8899132SKalle Valo ab->qmi.target_mem[i].size, 2330d8899132SKalle Valo ab->qmi.target_mem[i].v.addr, 2331d8899132SKalle Valo ab->qmi.target_mem[i].paddr); 2332d8899132SKalle Valo ab->qmi.target_mem[i].v.addr = NULL; 2333d8899132SKalle Valo } 2334d8899132SKalle Valo } 2335d8899132SKalle Valo 2336d8899132SKalle Valo static int ath12k_qmi_alloc_target_mem_chunk(struct ath12k_base *ab) 2337d8899132SKalle Valo { 2338d8899132SKalle Valo int i; 2339d8899132SKalle Valo struct target_mem_chunk *chunk; 2340d8899132SKalle Valo 2341d8899132SKalle Valo ab->qmi.target_mem_delayed = false; 2342d8899132SKalle Valo 2343d8899132SKalle Valo for (i = 0; i < ab->qmi.mem_seg_count; i++) { 2344d8899132SKalle Valo chunk = &ab->qmi.target_mem[i]; 2345d8899132SKalle Valo 2346d8899132SKalle Valo /* Allocate memory for the region and the functionality supported 2347d8899132SKalle Valo * on the host. For the non-supported memory region, host does not 2348d8899132SKalle Valo * allocate memory, assigns NULL and FW will handle this without crashing. 2349d8899132SKalle Valo */ 2350d8899132SKalle Valo switch (chunk->type) { 2351d8899132SKalle Valo case HOST_DDR_REGION_TYPE: 2352d8899132SKalle Valo case M3_DUMP_REGION_TYPE: 2353d8899132SKalle Valo case PAGEABLE_MEM_REGION_TYPE: 2354d8899132SKalle Valo case CALDB_MEM_REGION_TYPE: 2355d8899132SKalle Valo chunk->v.addr = dma_alloc_coherent(ab->dev, 2356d8899132SKalle Valo chunk->size, 2357d8899132SKalle Valo &chunk->paddr, 2358d8899132SKalle Valo GFP_KERNEL | __GFP_NOWARN); 2359d8899132SKalle Valo if (!chunk->v.addr) { 2360d8899132SKalle Valo if (chunk->size > ATH12K_QMI_MAX_CHUNK_SIZE) { 2361d8899132SKalle Valo ab->qmi.target_mem_delayed = true; 2362d8899132SKalle Valo ath12k_warn(ab, 2363d8899132SKalle Valo "qmi dma allocation failed (%d B type %u), will try later with small size\n", 2364d8899132SKalle Valo chunk->size, 2365d8899132SKalle Valo chunk->type); 2366d8899132SKalle Valo ath12k_qmi_free_target_mem_chunk(ab); 2367d8899132SKalle Valo return 0; 2368d8899132SKalle Valo } 2369d8899132SKalle Valo ath12k_warn(ab, "memory allocation failure for %u size: %d\n", 2370d8899132SKalle Valo chunk->type, chunk->size); 2371d8899132SKalle Valo return -ENOMEM; 2372d8899132SKalle Valo } 2373d8899132SKalle Valo break; 2374d8899132SKalle Valo default: 2375d8899132SKalle Valo ath12k_warn(ab, "memory type %u not supported\n", 2376d8899132SKalle Valo chunk->type); 2377d8899132SKalle Valo chunk->paddr = 0; 2378d8899132SKalle Valo chunk->v.addr = NULL; 2379d8899132SKalle Valo break; 2380d8899132SKalle Valo } 2381d8899132SKalle Valo } 2382d8899132SKalle Valo return 0; 2383d8899132SKalle Valo } 2384d8899132SKalle Valo 2385d8899132SKalle Valo static int ath12k_qmi_request_target_cap(struct ath12k_base *ab) 2386d8899132SKalle Valo { 23876d2b0a06SJeff Johnson struct qmi_wlanfw_cap_req_msg_v01 req = {}; 23886d2b0a06SJeff Johnson struct qmi_wlanfw_cap_resp_msg_v01 resp = {}; 238959cf57abSJeff Johnson struct qmi_txn txn; 2390d8899132SKalle Valo unsigned int board_id = ATH12K_BOARD_ID_DEFAULT; 2391d8899132SKalle Valo int ret = 0; 23927d9832e3SWen Gong int r; 2393d8899132SKalle Valo int i; 2394d8899132SKalle Valo 2395d8899132SKalle Valo ret = qmi_txn_init(&ab->qmi.handle, &txn, 2396d8899132SKalle Valo qmi_wlanfw_cap_resp_msg_v01_ei, &resp); 2397d8899132SKalle Valo if (ret < 0) 2398d8899132SKalle Valo goto out; 2399d8899132SKalle Valo 2400d8899132SKalle Valo ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, 2401d8899132SKalle Valo QMI_WLANFW_CAP_REQ_V01, 2402d8899132SKalle Valo QMI_WLANFW_CAP_REQ_MSG_V01_MAX_LEN, 2403d8899132SKalle Valo qmi_wlanfw_cap_req_msg_v01_ei, &req); 2404d8899132SKalle Valo if (ret < 0) { 24052e82b5f0SJeff Johnson qmi_txn_cancel(&txn); 2406d8899132SKalle Valo ath12k_warn(ab, "qmi failed to send target cap request, err = %d\n", 2407d8899132SKalle Valo ret); 2408d8899132SKalle Valo goto out; 2409d8899132SKalle Valo } 2410d8899132SKalle Valo 2411d8899132SKalle Valo ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS)); 2412d8899132SKalle Valo if (ret < 0) { 2413d8899132SKalle Valo ath12k_warn(ab, "qmi failed target cap request %d\n", ret); 2414d8899132SKalle Valo goto out; 2415d8899132SKalle Valo } 2416d8899132SKalle Valo 2417d8899132SKalle Valo if (resp.resp.result != QMI_RESULT_SUCCESS_V01) { 2418d8899132SKalle Valo ath12k_warn(ab, "qmi targetcap req failed, result: %d, err: %d\n", 2419d8899132SKalle Valo resp.resp.result, resp.resp.error); 2420d8899132SKalle Valo ret = -EINVAL; 2421d8899132SKalle Valo goto out; 2422d8899132SKalle Valo } 2423d8899132SKalle Valo 2424d8899132SKalle Valo if (resp.chip_info_valid) { 2425d8899132SKalle Valo ab->qmi.target.chip_id = resp.chip_info.chip_id; 2426d8899132SKalle Valo ab->qmi.target.chip_family = resp.chip_info.chip_family; 2427d8899132SKalle Valo } 2428d8899132SKalle Valo 2429d8899132SKalle Valo if (resp.board_info_valid) 2430d8899132SKalle Valo ab->qmi.target.board_id = resp.board_info.board_id; 2431d8899132SKalle Valo else 2432d8899132SKalle Valo ab->qmi.target.board_id = board_id; 2433d8899132SKalle Valo 2434d8899132SKalle Valo if (resp.soc_info_valid) 2435d8899132SKalle Valo ab->qmi.target.soc_id = resp.soc_info.soc_id; 2436d8899132SKalle Valo 2437d8899132SKalle Valo if (resp.fw_version_info_valid) { 2438d8899132SKalle Valo ab->qmi.target.fw_version = resp.fw_version_info.fw_version; 2439d8899132SKalle Valo strscpy(ab->qmi.target.fw_build_timestamp, 2440d8899132SKalle Valo resp.fw_version_info.fw_build_timestamp, 2441d8899132SKalle Valo sizeof(ab->qmi.target.fw_build_timestamp)); 2442d8899132SKalle Valo } 2443d8899132SKalle Valo 2444d8899132SKalle Valo if (resp.fw_build_id_valid) 2445d8899132SKalle Valo strscpy(ab->qmi.target.fw_build_id, resp.fw_build_id, 2446d8899132SKalle Valo sizeof(ab->qmi.target.fw_build_id)); 2447d8899132SKalle Valo 2448d8899132SKalle Valo if (resp.dev_mem_info_valid) { 2449d8899132SKalle Valo for (i = 0; i < ATH12K_QMI_WLFW_MAX_DEV_MEM_NUM_V01; i++) { 2450d8899132SKalle Valo ab->qmi.dev_mem[i].start = 2451d8899132SKalle Valo resp.dev_mem[i].start; 2452d8899132SKalle Valo ab->qmi.dev_mem[i].size = 2453d8899132SKalle Valo resp.dev_mem[i].size; 2454d8899132SKalle Valo ath12k_dbg(ab, ATH12K_DBG_QMI, 2455d8899132SKalle Valo "devmem [%d] start ox%llx size %llu\n", i, 2456d8899132SKalle Valo ab->qmi.dev_mem[i].start, 2457d8899132SKalle Valo ab->qmi.dev_mem[i].size); 2458d8899132SKalle Valo } 2459d8899132SKalle Valo } 2460d8899132SKalle Valo 2461d8899132SKalle Valo if (resp.eeprom_caldata_read_timeout_valid) { 2462d8899132SKalle Valo ab->qmi.target.eeprom_caldata = resp.eeprom_caldata_read_timeout; 2463d8899132SKalle Valo ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi cal data supported from eeprom\n"); 2464d8899132SKalle Valo } 2465d8899132SKalle Valo 2466d8899132SKalle Valo ath12k_info(ab, "chip_id 0x%x chip_family 0x%x board_id 0x%x soc_id 0x%x\n", 2467d8899132SKalle Valo ab->qmi.target.chip_id, ab->qmi.target.chip_family, 2468d8899132SKalle Valo ab->qmi.target.board_id, ab->qmi.target.soc_id); 2469d8899132SKalle Valo 2470d8899132SKalle Valo ath12k_info(ab, "fw_version 0x%x fw_build_timestamp %s fw_build_id %s", 2471d8899132SKalle Valo ab->qmi.target.fw_version, 2472d8899132SKalle Valo ab->qmi.target.fw_build_timestamp, 2473d8899132SKalle Valo ab->qmi.target.fw_build_id); 2474d8899132SKalle Valo 24757d9832e3SWen Gong r = ath12k_core_check_smbios(ab); 24767d9832e3SWen Gong if (r) 24777d9832e3SWen Gong ath12k_dbg(ab, ATH12K_DBG_QMI, "SMBIOS bdf variant name not set.\n"); 24787d9832e3SWen Gong 2479d8899132SKalle Valo out: 2480d8899132SKalle Valo return ret; 2481d8899132SKalle Valo } 2482d8899132SKalle Valo 2483d8899132SKalle Valo static int ath12k_qmi_load_file_target_mem(struct ath12k_base *ab, 2484d8899132SKalle Valo const u8 *data, u32 len, u8 type) 2485d8899132SKalle Valo { 2486d8899132SKalle Valo struct qmi_wlanfw_bdf_download_req_msg_v01 *req; 24876d2b0a06SJeff Johnson struct qmi_wlanfw_bdf_download_resp_msg_v01 resp = {}; 248859cf57abSJeff Johnson struct qmi_txn txn; 2489d8899132SKalle Valo const u8 *temp = data; 2490d8899132SKalle Valo int ret; 2491d8899132SKalle Valo u32 remaining = len; 2492d8899132SKalle Valo 2493d8899132SKalle Valo req = kzalloc(sizeof(*req), GFP_KERNEL); 2494d8899132SKalle Valo if (!req) 2495d8899132SKalle Valo return -ENOMEM; 2496d8899132SKalle Valo 2497d8899132SKalle Valo while (remaining) { 2498d8899132SKalle Valo req->valid = 1; 2499d8899132SKalle Valo req->file_id_valid = 1; 2500d8899132SKalle Valo req->file_id = ab->qmi.target.board_id; 2501d8899132SKalle Valo req->total_size_valid = 1; 2502d8899132SKalle Valo req->total_size = remaining; 2503d8899132SKalle Valo req->seg_id_valid = 1; 2504d8899132SKalle Valo req->data_valid = 1; 2505d8899132SKalle Valo req->bdf_type = type; 2506d8899132SKalle Valo req->bdf_type_valid = 1; 2507d8899132SKalle Valo req->end_valid = 1; 2508d8899132SKalle Valo req->end = 0; 2509d8899132SKalle Valo 2510d8899132SKalle Valo if (remaining > QMI_WLANFW_MAX_DATA_SIZE_V01) { 2511d8899132SKalle Valo req->data_len = QMI_WLANFW_MAX_DATA_SIZE_V01; 2512d8899132SKalle Valo } else { 2513d8899132SKalle Valo req->data_len = remaining; 2514d8899132SKalle Valo req->end = 1; 2515d8899132SKalle Valo } 2516d8899132SKalle Valo 2517d8899132SKalle Valo if (type == ATH12K_QMI_FILE_TYPE_EEPROM) { 2518d8899132SKalle Valo req->data_valid = 0; 2519d8899132SKalle Valo req->end = 1; 2520d8899132SKalle Valo req->data_len = ATH12K_QMI_MAX_BDF_FILE_NAME_SIZE; 2521d8899132SKalle Valo } else { 2522d8899132SKalle Valo memcpy(req->data, temp, req->data_len); 2523d8899132SKalle Valo } 2524d8899132SKalle Valo 2525d8899132SKalle Valo ret = qmi_txn_init(&ab->qmi.handle, &txn, 2526d8899132SKalle Valo qmi_wlanfw_bdf_download_resp_msg_v01_ei, 2527d8899132SKalle Valo &resp); 2528d8899132SKalle Valo if (ret < 0) 2529d8899132SKalle Valo goto out; 2530d8899132SKalle Valo 2531d8899132SKalle Valo ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi bdf download req fixed addr type %d\n", 2532d8899132SKalle Valo type); 2533d8899132SKalle Valo 2534d8899132SKalle Valo ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, 2535d8899132SKalle Valo QMI_WLANFW_BDF_DOWNLOAD_REQ_V01, 2536d8899132SKalle Valo QMI_WLANFW_BDF_DOWNLOAD_REQ_MSG_V01_MAX_LEN, 2537d8899132SKalle Valo qmi_wlanfw_bdf_download_req_msg_v01_ei, req); 2538d8899132SKalle Valo if (ret < 0) { 2539d8899132SKalle Valo qmi_txn_cancel(&txn); 2540d8899132SKalle Valo goto out; 2541d8899132SKalle Valo } 2542d8899132SKalle Valo 2543d8899132SKalle Valo ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS)); 2544d8899132SKalle Valo if (ret < 0) 2545d8899132SKalle Valo goto out; 2546d8899132SKalle Valo 2547d8899132SKalle Valo if (resp.resp.result != QMI_RESULT_SUCCESS_V01) { 2548d8899132SKalle Valo ath12k_warn(ab, "qmi BDF download failed, result: %d, err: %d\n", 2549d8899132SKalle Valo resp.resp.result, resp.resp.error); 2550d8899132SKalle Valo ret = -EINVAL; 2551d8899132SKalle Valo goto out; 2552d8899132SKalle Valo } 2553d8899132SKalle Valo 2554801fc159SDinesh Karthikeyan if (type == ATH12K_QMI_FILE_TYPE_EEPROM) { 2555801fc159SDinesh Karthikeyan remaining = 0; 2556801fc159SDinesh Karthikeyan } else { 2557d8899132SKalle Valo remaining -= req->data_len; 2558d8899132SKalle Valo temp += req->data_len; 2559d8899132SKalle Valo req->seg_id++; 2560d8899132SKalle Valo ath12k_dbg(ab, ATH12K_DBG_QMI, 2561d8899132SKalle Valo "qmi bdf download request remaining %i\n", 2562d8899132SKalle Valo remaining); 2563d8899132SKalle Valo } 2564801fc159SDinesh Karthikeyan } 2565d8899132SKalle Valo 2566d8899132SKalle Valo out: 2567d8899132SKalle Valo kfree(req); 2568d8899132SKalle Valo return ret; 2569d8899132SKalle Valo } 2570d8899132SKalle Valo 2571d8899132SKalle Valo static int ath12k_qmi_load_bdf_qmi(struct ath12k_base *ab, 2572d8899132SKalle Valo enum ath12k_qmi_bdf_type type) 2573d8899132SKalle Valo { 2574d8899132SKalle Valo struct device *dev = ab->dev; 2575d8899132SKalle Valo char filename[ATH12K_QMI_MAX_BDF_FILE_NAME_SIZE]; 2576d8899132SKalle Valo const struct firmware *fw_entry; 2577d8899132SKalle Valo struct ath12k_board_data bd; 2578d8899132SKalle Valo u32 fw_size, file_type; 2579d8899132SKalle Valo int ret = 0; 2580d8899132SKalle Valo const u8 *tmp; 2581d8899132SKalle Valo 2582d8899132SKalle Valo memset(&bd, 0, sizeof(bd)); 2583d8899132SKalle Valo 2584d8899132SKalle Valo switch (type) { 2585d8899132SKalle Valo case ATH12K_QMI_BDF_TYPE_ELF: 2586d8899132SKalle Valo ret = ath12k_core_fetch_bdf(ab, &bd); 2587d8899132SKalle Valo if (ret) { 2588d8899132SKalle Valo ath12k_warn(ab, "qmi failed to load bdf:\n"); 2589d8899132SKalle Valo goto out; 2590d8899132SKalle Valo } 2591d8899132SKalle Valo 2592d8899132SKalle Valo if (bd.len >= SELFMAG && memcmp(bd.data, ELFMAG, SELFMAG) == 0) 2593d8899132SKalle Valo type = ATH12K_QMI_BDF_TYPE_ELF; 2594d8899132SKalle Valo else 2595d8899132SKalle Valo type = ATH12K_QMI_BDF_TYPE_BIN; 2596d8899132SKalle Valo 2597d8899132SKalle Valo break; 2598d8899132SKalle Valo case ATH12K_QMI_BDF_TYPE_REGDB: 259951120745SWen Gong ret = ath12k_core_fetch_regdb(ab, &bd); 2600d8899132SKalle Valo if (ret) { 2601d8899132SKalle Valo ath12k_warn(ab, "qmi failed to load regdb bin:\n"); 2602d8899132SKalle Valo goto out; 2603d8899132SKalle Valo } 2604d8899132SKalle Valo break; 260542982259SDinesh Karthikeyan case ATH12K_QMI_BDF_TYPE_CALIBRATION: 2606d8899132SKalle Valo 2607d8899132SKalle Valo if (ab->qmi.target.eeprom_caldata) { 2608801fc159SDinesh Karthikeyan file_type = ATH12K_QMI_FILE_TYPE_EEPROM; 2609d8899132SKalle Valo tmp = filename; 2610d8899132SKalle Valo fw_size = ATH12K_QMI_MAX_BDF_FILE_NAME_SIZE; 2611d8899132SKalle Valo } else { 2612d8899132SKalle Valo file_type = ATH12K_QMI_FILE_TYPE_CALDATA; 2613d8899132SKalle Valo 2614d8899132SKalle Valo /* cal-<bus>-<id>.bin */ 2615d8899132SKalle Valo snprintf(filename, sizeof(filename), "cal-%s-%s.bin", 2616d8899132SKalle Valo ath12k_bus_str(ab->hif.bus), dev_name(dev)); 2617d8899132SKalle Valo fw_entry = ath12k_core_firmware_request(ab, filename); 2618d8899132SKalle Valo if (!IS_ERR(fw_entry)) 2619d8899132SKalle Valo goto success; 2620d8899132SKalle Valo 262142982259SDinesh Karthikeyan fw_entry = ath12k_core_firmware_request(ab, 262242982259SDinesh Karthikeyan ATH12K_DEFAULT_CAL_FILE); 2623d8899132SKalle Valo if (IS_ERR(fw_entry)) { 2624d8899132SKalle Valo ret = PTR_ERR(fw_entry); 2625d8899132SKalle Valo ath12k_warn(ab, 2626d8899132SKalle Valo "qmi failed to load CAL data file:%s\n", 2627d8899132SKalle Valo filename); 2628d8899132SKalle Valo goto out; 2629d8899132SKalle Valo } 2630d8899132SKalle Valo 2631d8899132SKalle Valo success: 263242982259SDinesh Karthikeyan fw_size = min_t(u32, ab->hw_params->fw.board_size, 263342982259SDinesh Karthikeyan fw_entry->size); 2634d8899132SKalle Valo tmp = fw_entry->data; 2635d8899132SKalle Valo } 2636d8899132SKalle Valo ret = ath12k_qmi_load_file_target_mem(ab, tmp, fw_size, file_type); 2637d8899132SKalle Valo if (ret < 0) { 2638d8899132SKalle Valo ath12k_warn(ab, "qmi failed to load caldata\n"); 2639d8899132SKalle Valo goto out_qmi_cal; 2640d8899132SKalle Valo } 2641d8899132SKalle Valo 2642d8899132SKalle Valo ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi caldata downloaded: type: %u\n", 2643d8899132SKalle Valo file_type); 2644d8899132SKalle Valo 2645d8899132SKalle Valo out_qmi_cal: 2646d8899132SKalle Valo if (!ab->qmi.target.eeprom_caldata) 2647d8899132SKalle Valo release_firmware(fw_entry); 264842982259SDinesh Karthikeyan return ret; 264942982259SDinesh Karthikeyan default: 265042982259SDinesh Karthikeyan ath12k_warn(ab, "unknown file type for load %d", type); 265142982259SDinesh Karthikeyan goto out; 265242982259SDinesh Karthikeyan } 265342982259SDinesh Karthikeyan 265442982259SDinesh Karthikeyan ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi bdf_type %d\n", type); 265542982259SDinesh Karthikeyan 265642982259SDinesh Karthikeyan fw_size = min_t(u32, ab->hw_params->fw.board_size, bd.len); 265742982259SDinesh Karthikeyan 265842982259SDinesh Karthikeyan ret = ath12k_qmi_load_file_target_mem(ab, bd.data, fw_size, type); 265942982259SDinesh Karthikeyan if (ret < 0) 266042982259SDinesh Karthikeyan ath12k_warn(ab, "qmi failed to load bdf file\n"); 266142982259SDinesh Karthikeyan 2662d8899132SKalle Valo out: 2663d8899132SKalle Valo ath12k_core_free_bdf(ab, &bd); 2664d8899132SKalle Valo ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi BDF download sequence completed\n"); 2665d8899132SKalle Valo 2666d8899132SKalle Valo return ret; 2667d8899132SKalle Valo } 2668d8899132SKalle Valo 2669d8899132SKalle Valo static int ath12k_qmi_m3_load(struct ath12k_base *ab) 2670d8899132SKalle Valo { 2671d8899132SKalle Valo struct m3_mem_region *m3_mem = &ab->qmi.m3_mem; 267212f491cdSRaj Kumar Bhagat const struct firmware *fw = NULL; 267312f491cdSRaj Kumar Bhagat const void *m3_data; 2674d8899132SKalle Valo char path[100]; 267512f491cdSRaj Kumar Bhagat size_t m3_len; 2676d8899132SKalle Valo int ret; 2677d8899132SKalle Valo 267812f491cdSRaj Kumar Bhagat if (m3_mem->vaddr) 267912f491cdSRaj Kumar Bhagat /* m3 firmware buffer is already available in the DMA buffer */ 2680d8899132SKalle Valo return 0; 2681d8899132SKalle Valo 268212f491cdSRaj Kumar Bhagat if (ab->fw.m3_data && ab->fw.m3_len > 0) { 268312f491cdSRaj Kumar Bhagat /* firmware-N.bin had a m3 firmware file so use that */ 268412f491cdSRaj Kumar Bhagat m3_data = ab->fw.m3_data; 268512f491cdSRaj Kumar Bhagat m3_len = ab->fw.m3_len; 268612f491cdSRaj Kumar Bhagat } else { 268712f491cdSRaj Kumar Bhagat /* No m3 file in firmware-N.bin so try to request old 268812f491cdSRaj Kumar Bhagat * separate m3.bin. 268912f491cdSRaj Kumar Bhagat */ 2690d8899132SKalle Valo fw = ath12k_core_firmware_request(ab, ATH12K_M3_FILE); 2691d8899132SKalle Valo if (IS_ERR(fw)) { 2692d8899132SKalle Valo ret = PTR_ERR(fw); 2693d8899132SKalle Valo ath12k_core_create_firmware_path(ab, ATH12K_M3_FILE, 2694d8899132SKalle Valo path, sizeof(path)); 2695d8899132SKalle Valo ath12k_err(ab, "failed to load %s: %d\n", path, ret); 2696d8899132SKalle Valo return ret; 2697d8899132SKalle Valo } 2698d8899132SKalle Valo 269912f491cdSRaj Kumar Bhagat m3_data = fw->data; 270012f491cdSRaj Kumar Bhagat m3_len = fw->size; 270112f491cdSRaj Kumar Bhagat } 270212f491cdSRaj Kumar Bhagat 2703d8899132SKalle Valo m3_mem->vaddr = dma_alloc_coherent(ab->dev, 270412f491cdSRaj Kumar Bhagat m3_len, &m3_mem->paddr, 2705d8899132SKalle Valo GFP_KERNEL); 2706d8899132SKalle Valo if (!m3_mem->vaddr) { 2707d8899132SKalle Valo ath12k_err(ab, "failed to allocate memory for M3 with size %zu\n", 2708d8899132SKalle Valo fw->size); 270912f491cdSRaj Kumar Bhagat ret = -ENOMEM; 271012f491cdSRaj Kumar Bhagat goto out; 2711d8899132SKalle Valo } 2712d8899132SKalle Valo 271312f491cdSRaj Kumar Bhagat memcpy(m3_mem->vaddr, m3_data, m3_len); 271412f491cdSRaj Kumar Bhagat m3_mem->size = m3_len; 271512f491cdSRaj Kumar Bhagat 271612f491cdSRaj Kumar Bhagat ret = 0; 271712f491cdSRaj Kumar Bhagat 271812f491cdSRaj Kumar Bhagat out: 2719d8899132SKalle Valo release_firmware(fw); 2720d8899132SKalle Valo 272112f491cdSRaj Kumar Bhagat return ret; 2722d8899132SKalle Valo } 2723d8899132SKalle Valo 2724d8899132SKalle Valo static void ath12k_qmi_m3_free(struct ath12k_base *ab) 2725d8899132SKalle Valo { 2726d8899132SKalle Valo struct m3_mem_region *m3_mem = &ab->qmi.m3_mem; 2727d8899132SKalle Valo 2728d8899132SKalle Valo if (!m3_mem->vaddr) 2729d8899132SKalle Valo return; 2730d8899132SKalle Valo 2731d8899132SKalle Valo dma_free_coherent(ab->dev, m3_mem->size, 2732d8899132SKalle Valo m3_mem->vaddr, m3_mem->paddr); 2733d8899132SKalle Valo m3_mem->vaddr = NULL; 2734c42c2b82SWen Gong m3_mem->size = 0; 2735d8899132SKalle Valo } 2736d8899132SKalle Valo 2737d8899132SKalle Valo static int ath12k_qmi_wlanfw_m3_info_send(struct ath12k_base *ab) 2738d8899132SKalle Valo { 2739d8899132SKalle Valo struct m3_mem_region *m3_mem = &ab->qmi.m3_mem; 27406d2b0a06SJeff Johnson struct qmi_wlanfw_m3_info_req_msg_v01 req = {}; 27416d2b0a06SJeff Johnson struct qmi_wlanfw_m3_info_resp_msg_v01 resp = {}; 274259cf57abSJeff Johnson struct qmi_txn txn; 2743d8899132SKalle Valo int ret = 0; 2744d8899132SKalle Valo 2745d8899132SKalle Valo ret = ath12k_qmi_m3_load(ab); 2746d8899132SKalle Valo if (ret) { 2747d8899132SKalle Valo ath12k_err(ab, "failed to load m3 firmware: %d", ret); 2748d8899132SKalle Valo return ret; 2749d8899132SKalle Valo } 2750d8899132SKalle Valo 2751d8899132SKalle Valo req.addr = m3_mem->paddr; 2752d8899132SKalle Valo req.size = m3_mem->size; 2753d8899132SKalle Valo 2754d8899132SKalle Valo ret = qmi_txn_init(&ab->qmi.handle, &txn, 2755d8899132SKalle Valo qmi_wlanfw_m3_info_resp_msg_v01_ei, &resp); 2756d8899132SKalle Valo if (ret < 0) 2757d8899132SKalle Valo goto out; 2758d8899132SKalle Valo 2759d8899132SKalle Valo ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, 2760d8899132SKalle Valo QMI_WLANFW_M3_INFO_REQ_V01, 2761d8899132SKalle Valo QMI_WLANFW_M3_INFO_REQ_MSG_V01_MAX_MSG_LEN, 2762d8899132SKalle Valo qmi_wlanfw_m3_info_req_msg_v01_ei, &req); 2763d8899132SKalle Valo if (ret < 0) { 27642e82b5f0SJeff Johnson qmi_txn_cancel(&txn); 2765d8899132SKalle Valo ath12k_warn(ab, "qmi failed to send M3 information request, err = %d\n", 2766d8899132SKalle Valo ret); 2767d8899132SKalle Valo goto out; 2768d8899132SKalle Valo } 2769d8899132SKalle Valo 2770d8899132SKalle Valo ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS)); 2771d8899132SKalle Valo if (ret < 0) { 2772d8899132SKalle Valo ath12k_warn(ab, "qmi failed M3 information request %d\n", ret); 2773d8899132SKalle Valo goto out; 2774d8899132SKalle Valo } 2775d8899132SKalle Valo 2776d8899132SKalle Valo if (resp.resp.result != QMI_RESULT_SUCCESS_V01) { 2777d8899132SKalle Valo ath12k_warn(ab, "qmi M3 info request failed, result: %d, err: %d\n", 2778d8899132SKalle Valo resp.resp.result, resp.resp.error); 2779d8899132SKalle Valo ret = -EINVAL; 2780d8899132SKalle Valo goto out; 2781d8899132SKalle Valo } 2782d8899132SKalle Valo out: 2783d8899132SKalle Valo return ret; 2784d8899132SKalle Valo } 2785d8899132SKalle Valo 2786d8899132SKalle Valo static int ath12k_qmi_wlanfw_mode_send(struct ath12k_base *ab, 2787d8899132SKalle Valo u32 mode) 2788d8899132SKalle Valo { 27896d2b0a06SJeff Johnson struct qmi_wlanfw_wlan_mode_req_msg_v01 req = {}; 27906d2b0a06SJeff Johnson struct qmi_wlanfw_wlan_mode_resp_msg_v01 resp = {}; 279159cf57abSJeff Johnson struct qmi_txn txn; 2792d8899132SKalle Valo int ret = 0; 2793d8899132SKalle Valo 2794d8899132SKalle Valo req.mode = mode; 2795d8899132SKalle Valo req.hw_debug_valid = 1; 2796d8899132SKalle Valo req.hw_debug = 0; 2797d8899132SKalle Valo 2798d8899132SKalle Valo ret = qmi_txn_init(&ab->qmi.handle, &txn, 2799d8899132SKalle Valo qmi_wlanfw_wlan_mode_resp_msg_v01_ei, &resp); 2800d8899132SKalle Valo if (ret < 0) 2801d8899132SKalle Valo goto out; 2802d8899132SKalle Valo 2803d8899132SKalle Valo ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, 2804d8899132SKalle Valo QMI_WLANFW_WLAN_MODE_REQ_V01, 2805d8899132SKalle Valo QMI_WLANFW_WLAN_MODE_REQ_MSG_V01_MAX_LEN, 2806d8899132SKalle Valo qmi_wlanfw_wlan_mode_req_msg_v01_ei, &req); 2807d8899132SKalle Valo if (ret < 0) { 28082e82b5f0SJeff Johnson qmi_txn_cancel(&txn); 2809d8899132SKalle Valo ath12k_warn(ab, "qmi failed to send mode request, mode: %d, err = %d\n", 2810d8899132SKalle Valo mode, ret); 2811d8899132SKalle Valo goto out; 2812d8899132SKalle Valo } 2813d8899132SKalle Valo 2814d8899132SKalle Valo ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS)); 2815d8899132SKalle Valo if (ret < 0) { 2816d8899132SKalle Valo if (mode == ATH12K_FIRMWARE_MODE_OFF && ret == -ENETRESET) { 2817d8899132SKalle Valo ath12k_warn(ab, "WLFW service is dis-connected\n"); 2818d8899132SKalle Valo return 0; 2819d8899132SKalle Valo } 2820d8899132SKalle Valo ath12k_warn(ab, "qmi failed set mode request, mode: %d, err = %d\n", 2821d8899132SKalle Valo mode, ret); 2822d8899132SKalle Valo goto out; 2823d8899132SKalle Valo } 2824d8899132SKalle Valo 2825d8899132SKalle Valo if (resp.resp.result != QMI_RESULT_SUCCESS_V01) { 2826d8899132SKalle Valo ath12k_warn(ab, "Mode request failed, mode: %d, result: %d err: %d\n", 2827d8899132SKalle Valo mode, resp.resp.result, resp.resp.error); 2828d8899132SKalle Valo ret = -EINVAL; 2829d8899132SKalle Valo goto out; 2830d8899132SKalle Valo } 2831d8899132SKalle Valo 2832d8899132SKalle Valo out: 2833d8899132SKalle Valo return ret; 2834d8899132SKalle Valo } 2835d8899132SKalle Valo 2836d8899132SKalle Valo static int ath12k_qmi_wlanfw_wlan_cfg_send(struct ath12k_base *ab) 2837d8899132SKalle Valo { 2838d8899132SKalle Valo struct qmi_wlanfw_wlan_cfg_req_msg_v01 *req; 28396d2b0a06SJeff Johnson struct qmi_wlanfw_wlan_cfg_resp_msg_v01 resp = {}; 2840d8899132SKalle Valo struct ce_pipe_config *ce_cfg; 2841d8899132SKalle Valo struct service_to_pipe *svc_cfg; 284259cf57abSJeff Johnson struct qmi_txn txn; 2843d8899132SKalle Valo int ret = 0, pipe_num; 2844d8899132SKalle Valo 2845d8899132SKalle Valo ce_cfg = (struct ce_pipe_config *)ab->qmi.ce_cfg.tgt_ce; 2846d8899132SKalle Valo svc_cfg = (struct service_to_pipe *)ab->qmi.ce_cfg.svc_to_ce_map; 2847d8899132SKalle Valo 2848d8899132SKalle Valo req = kzalloc(sizeof(*req), GFP_KERNEL); 2849d8899132SKalle Valo if (!req) 2850d8899132SKalle Valo return -ENOMEM; 2851d8899132SKalle Valo 2852d8899132SKalle Valo req->host_version_valid = 1; 2853d8899132SKalle Valo strscpy(req->host_version, ATH12K_HOST_VERSION_STRING, 2854d8899132SKalle Valo sizeof(req->host_version)); 2855d8899132SKalle Valo 2856d8899132SKalle Valo req->tgt_cfg_valid = 1; 2857d8899132SKalle Valo /* This is number of CE configs */ 2858d8899132SKalle Valo req->tgt_cfg_len = ab->qmi.ce_cfg.tgt_ce_len; 2859d8899132SKalle Valo for (pipe_num = 0; pipe_num < req->tgt_cfg_len ; pipe_num++) { 2860d8899132SKalle Valo req->tgt_cfg[pipe_num].pipe_num = ce_cfg[pipe_num].pipenum; 2861d8899132SKalle Valo req->tgt_cfg[pipe_num].pipe_dir = ce_cfg[pipe_num].pipedir; 2862d8899132SKalle Valo req->tgt_cfg[pipe_num].nentries = ce_cfg[pipe_num].nentries; 2863d8899132SKalle Valo req->tgt_cfg[pipe_num].nbytes_max = ce_cfg[pipe_num].nbytes_max; 2864d8899132SKalle Valo req->tgt_cfg[pipe_num].flags = ce_cfg[pipe_num].flags; 2865d8899132SKalle Valo } 2866d8899132SKalle Valo 2867d8899132SKalle Valo req->svc_cfg_valid = 1; 2868d8899132SKalle Valo /* This is number of Service/CE configs */ 2869d8899132SKalle Valo req->svc_cfg_len = ab->qmi.ce_cfg.svc_to_ce_map_len; 2870d8899132SKalle Valo for (pipe_num = 0; pipe_num < req->svc_cfg_len; pipe_num++) { 2871d8899132SKalle Valo req->svc_cfg[pipe_num].service_id = svc_cfg[pipe_num].service_id; 2872d8899132SKalle Valo req->svc_cfg[pipe_num].pipe_dir = svc_cfg[pipe_num].pipedir; 2873d8899132SKalle Valo req->svc_cfg[pipe_num].pipe_num = svc_cfg[pipe_num].pipenum; 2874d8899132SKalle Valo } 2875d8899132SKalle Valo 2876d8899132SKalle Valo /* set shadow v3 configuration */ 2877d8899132SKalle Valo if (ab->hw_params->supports_shadow_regs) { 2878d8899132SKalle Valo req->shadow_reg_v3_valid = 1; 2879d8899132SKalle Valo req->shadow_reg_v3_len = min_t(u32, 2880d8899132SKalle Valo ab->qmi.ce_cfg.shadow_reg_v3_len, 2881d8899132SKalle Valo QMI_WLANFW_MAX_NUM_SHADOW_REG_V3_V01); 2882d8899132SKalle Valo memcpy(&req->shadow_reg_v3, ab->qmi.ce_cfg.shadow_reg_v3, 2883d8899132SKalle Valo sizeof(u32) * req->shadow_reg_v3_len); 2884d8899132SKalle Valo } else { 2885d8899132SKalle Valo req->shadow_reg_v3_valid = 0; 2886d8899132SKalle Valo } 2887d8899132SKalle Valo 2888d8899132SKalle Valo ret = qmi_txn_init(&ab->qmi.handle, &txn, 2889d8899132SKalle Valo qmi_wlanfw_wlan_cfg_resp_msg_v01_ei, &resp); 2890d8899132SKalle Valo if (ret < 0) 2891d8899132SKalle Valo goto out; 2892d8899132SKalle Valo 2893d8899132SKalle Valo ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, 2894d8899132SKalle Valo QMI_WLANFW_WLAN_CFG_REQ_V01, 2895d8899132SKalle Valo QMI_WLANFW_WLAN_CFG_REQ_MSG_V01_MAX_LEN, 2896d8899132SKalle Valo qmi_wlanfw_wlan_cfg_req_msg_v01_ei, req); 2897d8899132SKalle Valo if (ret < 0) { 28982e82b5f0SJeff Johnson qmi_txn_cancel(&txn); 2899d8899132SKalle Valo ath12k_warn(ab, "qmi failed to send wlan config request, err = %d\n", 2900d8899132SKalle Valo ret); 2901d8899132SKalle Valo goto out; 2902d8899132SKalle Valo } 2903d8899132SKalle Valo 2904d8899132SKalle Valo ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS)); 2905d8899132SKalle Valo if (ret < 0) { 2906d8899132SKalle Valo ath12k_warn(ab, "qmi failed wlan config request, err = %d\n", ret); 2907d8899132SKalle Valo goto out; 2908d8899132SKalle Valo } 2909d8899132SKalle Valo 2910d8899132SKalle Valo if (resp.resp.result != QMI_RESULT_SUCCESS_V01) { 2911d8899132SKalle Valo ath12k_warn(ab, "qmi wlan config request failed, result: %d, err: %d\n", 2912d8899132SKalle Valo resp.resp.result, resp.resp.error); 2913d8899132SKalle Valo ret = -EINVAL; 2914d8899132SKalle Valo goto out; 2915d8899132SKalle Valo } 2916d8899132SKalle Valo 2917d8899132SKalle Valo out: 2918d8899132SKalle Valo kfree(req); 2919d8899132SKalle Valo return ret; 2920d8899132SKalle Valo } 2921d8899132SKalle Valo 29229f9df1a2SBaochen Qiang static int ath12k_qmi_wlanfw_wlan_ini_send(struct ath12k_base *ab) 29239f9df1a2SBaochen Qiang { 29249f9df1a2SBaochen Qiang struct qmi_wlanfw_wlan_ini_resp_msg_v01 resp = {}; 29259f9df1a2SBaochen Qiang struct qmi_wlanfw_wlan_ini_req_msg_v01 req = {}; 29269f9df1a2SBaochen Qiang struct qmi_txn txn; 29279f9df1a2SBaochen Qiang int ret; 29289f9df1a2SBaochen Qiang 29299f9df1a2SBaochen Qiang req.enable_fwlog_valid = true; 29309f9df1a2SBaochen Qiang req.enable_fwlog = 1; 29319f9df1a2SBaochen Qiang 29329f9df1a2SBaochen Qiang ret = qmi_txn_init(&ab->qmi.handle, &txn, 29339f9df1a2SBaochen Qiang qmi_wlanfw_wlan_ini_resp_msg_v01_ei, &resp); 29349f9df1a2SBaochen Qiang if (ret < 0) 29359f9df1a2SBaochen Qiang goto out; 29369f9df1a2SBaochen Qiang 29379f9df1a2SBaochen Qiang ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, 29389f9df1a2SBaochen Qiang ATH12K_QMI_WLANFW_WLAN_INI_REQ_V01, 29399f9df1a2SBaochen Qiang QMI_WLANFW_WLAN_INI_REQ_MSG_V01_MAX_LEN, 29409f9df1a2SBaochen Qiang qmi_wlanfw_wlan_ini_req_msg_v01_ei, &req); 29419f9df1a2SBaochen Qiang if (ret < 0) { 29429f9df1a2SBaochen Qiang qmi_txn_cancel(&txn); 29439f9df1a2SBaochen Qiang ath12k_warn(ab, "failed to send QMI wlan ini request: %d\n", 29449f9df1a2SBaochen Qiang ret); 29459f9df1a2SBaochen Qiang goto out; 29469f9df1a2SBaochen Qiang } 29479f9df1a2SBaochen Qiang 29489f9df1a2SBaochen Qiang ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS)); 29499f9df1a2SBaochen Qiang if (ret < 0) { 29509f9df1a2SBaochen Qiang ath12k_warn(ab, "failed to receive QMI wlan ini request: %d\n", ret); 29519f9df1a2SBaochen Qiang goto out; 29529f9df1a2SBaochen Qiang } 29539f9df1a2SBaochen Qiang 29549f9df1a2SBaochen Qiang if (resp.resp.result != QMI_RESULT_SUCCESS_V01) { 29559f9df1a2SBaochen Qiang ath12k_warn(ab, "QMI wlan ini response failure: %d %d\n", 29569f9df1a2SBaochen Qiang resp.resp.result, resp.resp.error); 29579f9df1a2SBaochen Qiang ret = -EINVAL; 29589f9df1a2SBaochen Qiang goto out; 29599f9df1a2SBaochen Qiang } 29609f9df1a2SBaochen Qiang 29619f9df1a2SBaochen Qiang out: 29629f9df1a2SBaochen Qiang return ret; 29639f9df1a2SBaochen Qiang } 29649f9df1a2SBaochen Qiang 2965d8899132SKalle Valo void ath12k_qmi_firmware_stop(struct ath12k_base *ab) 2966d8899132SKalle Valo { 2967d8899132SKalle Valo int ret; 2968d8899132SKalle Valo 2969d8899132SKalle Valo ret = ath12k_qmi_wlanfw_mode_send(ab, ATH12K_FIRMWARE_MODE_OFF); 2970d8899132SKalle Valo if (ret < 0) { 2971d8899132SKalle Valo ath12k_warn(ab, "qmi failed to send wlan mode off\n"); 2972d8899132SKalle Valo return; 2973d8899132SKalle Valo } 2974d8899132SKalle Valo } 2975d8899132SKalle Valo 2976d8899132SKalle Valo int ath12k_qmi_firmware_start(struct ath12k_base *ab, 2977d8899132SKalle Valo u32 mode) 2978d8899132SKalle Valo { 2979d8899132SKalle Valo int ret; 2980d8899132SKalle Valo 29819f9df1a2SBaochen Qiang ret = ath12k_qmi_wlanfw_wlan_ini_send(ab); 29829f9df1a2SBaochen Qiang if (ret < 0) { 29839f9df1a2SBaochen Qiang ath12k_warn(ab, "qmi failed to send wlan fw ini: %d\n", ret); 29849f9df1a2SBaochen Qiang return ret; 29859f9df1a2SBaochen Qiang } 29869f9df1a2SBaochen Qiang 2987d8899132SKalle Valo ret = ath12k_qmi_wlanfw_wlan_cfg_send(ab); 2988d8899132SKalle Valo if (ret < 0) { 2989d8899132SKalle Valo ath12k_warn(ab, "qmi failed to send wlan cfg:%d\n", ret); 2990d8899132SKalle Valo return ret; 2991d8899132SKalle Valo } 2992d8899132SKalle Valo 2993d8899132SKalle Valo ret = ath12k_qmi_wlanfw_mode_send(ab, mode); 2994d8899132SKalle Valo if (ret < 0) { 2995d8899132SKalle Valo ath12k_warn(ab, "qmi failed to send wlan fw mode:%d\n", ret); 2996d8899132SKalle Valo return ret; 2997d8899132SKalle Valo } 2998d8899132SKalle Valo 2999d8899132SKalle Valo return 0; 3000d8899132SKalle Valo } 3001d8899132SKalle Valo 3002d8899132SKalle Valo static int 3003d8899132SKalle Valo ath12k_qmi_driver_event_post(struct ath12k_qmi *qmi, 3004d8899132SKalle Valo enum ath12k_qmi_event_type type, 3005d8899132SKalle Valo void *data) 3006d8899132SKalle Valo { 3007d8899132SKalle Valo struct ath12k_qmi_driver_event *event; 3008d8899132SKalle Valo 3009d8899132SKalle Valo event = kzalloc(sizeof(*event), GFP_ATOMIC); 3010d8899132SKalle Valo if (!event) 3011d8899132SKalle Valo return -ENOMEM; 3012d8899132SKalle Valo 3013d8899132SKalle Valo event->type = type; 3014d8899132SKalle Valo event->data = data; 3015d8899132SKalle Valo 3016d8899132SKalle Valo spin_lock(&qmi->event_lock); 3017d8899132SKalle Valo list_add_tail(&event->list, &qmi->event_list); 3018d8899132SKalle Valo spin_unlock(&qmi->event_lock); 3019d8899132SKalle Valo 3020d8899132SKalle Valo queue_work(qmi->event_wq, &qmi->event_work); 3021d8899132SKalle Valo 3022d8899132SKalle Valo return 0; 3023d8899132SKalle Valo } 3024d8899132SKalle Valo 3025d8899132SKalle Valo static int ath12k_qmi_event_server_arrive(struct ath12k_qmi *qmi) 3026d8899132SKalle Valo { 3027d8899132SKalle Valo struct ath12k_base *ab = qmi->ab; 3028d8899132SKalle Valo int ret; 3029d8899132SKalle Valo 303053a65445SKarthikeyan Periyasamy ath12k_qmi_phy_cap_send(ab); 303153a65445SKarthikeyan Periyasamy 3032d8899132SKalle Valo ret = ath12k_qmi_fw_ind_register_send(ab); 3033d8899132SKalle Valo if (ret < 0) { 3034d8899132SKalle Valo ath12k_warn(ab, "qmi failed to send FW indication QMI:%d\n", ret); 3035d8899132SKalle Valo return ret; 3036d8899132SKalle Valo } 3037d8899132SKalle Valo 3038d8899132SKalle Valo ret = ath12k_qmi_host_cap_send(ab); 3039d8899132SKalle Valo if (ret < 0) { 3040d8899132SKalle Valo ath12k_warn(ab, "qmi failed to send host cap QMI:%d\n", ret); 3041d8899132SKalle Valo return ret; 3042d8899132SKalle Valo } 3043d8899132SKalle Valo 3044d8899132SKalle Valo return ret; 3045d8899132SKalle Valo } 3046d8899132SKalle Valo 3047d8899132SKalle Valo static int ath12k_qmi_event_mem_request(struct ath12k_qmi *qmi) 3048d8899132SKalle Valo { 3049d8899132SKalle Valo struct ath12k_base *ab = qmi->ab; 3050d8899132SKalle Valo int ret; 3051d8899132SKalle Valo 3052d8899132SKalle Valo ret = ath12k_qmi_respond_fw_mem_request(ab); 3053d8899132SKalle Valo if (ret < 0) { 3054d8899132SKalle Valo ath12k_warn(ab, "qmi failed to respond fw mem req:%d\n", ret); 3055d8899132SKalle Valo return ret; 3056d8899132SKalle Valo } 3057d8899132SKalle Valo 3058d8899132SKalle Valo return ret; 3059d8899132SKalle Valo } 3060d8899132SKalle Valo 3061d8899132SKalle Valo static int ath12k_qmi_event_load_bdf(struct ath12k_qmi *qmi) 3062d8899132SKalle Valo { 3063d8899132SKalle Valo struct ath12k_base *ab = qmi->ab; 3064d8899132SKalle Valo int ret; 3065d8899132SKalle Valo 3066d8899132SKalle Valo ret = ath12k_qmi_request_target_cap(ab); 3067d8899132SKalle Valo if (ret < 0) { 3068d8899132SKalle Valo ath12k_warn(ab, "qmi failed to req target capabilities:%d\n", ret); 3069d8899132SKalle Valo return ret; 3070d8899132SKalle Valo } 3071d8899132SKalle Valo 3072d8899132SKalle Valo ret = ath12k_qmi_load_bdf_qmi(ab, ATH12K_QMI_BDF_TYPE_REGDB); 3073d8899132SKalle Valo if (ret < 0) { 3074d8899132SKalle Valo ath12k_warn(ab, "qmi failed to load regdb file:%d\n", ret); 3075d8899132SKalle Valo return ret; 3076d8899132SKalle Valo } 3077d8899132SKalle Valo 3078d8899132SKalle Valo ret = ath12k_qmi_load_bdf_qmi(ab, ATH12K_QMI_BDF_TYPE_ELF); 3079d8899132SKalle Valo if (ret < 0) { 3080d8899132SKalle Valo ath12k_warn(ab, "qmi failed to load board data file:%d\n", ret); 3081d8899132SKalle Valo return ret; 3082d8899132SKalle Valo } 3083d8899132SKalle Valo 308442982259SDinesh Karthikeyan if (ab->hw_params->download_calib) { 308542982259SDinesh Karthikeyan ret = ath12k_qmi_load_bdf_qmi(ab, ATH12K_QMI_BDF_TYPE_CALIBRATION); 308642982259SDinesh Karthikeyan if (ret < 0) 308742982259SDinesh Karthikeyan ath12k_warn(ab, "qmi failed to load calibrated data :%d\n", ret); 308842982259SDinesh Karthikeyan } 308942982259SDinesh Karthikeyan 3090d8899132SKalle Valo ret = ath12k_qmi_wlanfw_m3_info_send(ab); 3091d8899132SKalle Valo if (ret < 0) { 3092d8899132SKalle Valo ath12k_warn(ab, "qmi failed to send m3 info req:%d\n", ret); 3093d8899132SKalle Valo return ret; 3094d8899132SKalle Valo } 3095d8899132SKalle Valo 3096d8899132SKalle Valo return ret; 3097d8899132SKalle Valo } 3098d8899132SKalle Valo 3099d8899132SKalle Valo static void ath12k_qmi_msg_mem_request_cb(struct qmi_handle *qmi_hdl, 3100d8899132SKalle Valo struct sockaddr_qrtr *sq, 3101d8899132SKalle Valo struct qmi_txn *txn, 3102d8899132SKalle Valo const void *data) 3103d8899132SKalle Valo { 3104d8899132SKalle Valo struct ath12k_qmi *qmi = container_of(qmi_hdl, struct ath12k_qmi, handle); 3105d8899132SKalle Valo struct ath12k_base *ab = qmi->ab; 3106d8899132SKalle Valo const struct qmi_wlanfw_request_mem_ind_msg_v01 *msg = data; 3107d8899132SKalle Valo int i, ret; 3108d8899132SKalle Valo 3109d8899132SKalle Valo ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi firmware request memory request\n"); 3110d8899132SKalle Valo 3111d8899132SKalle Valo if (msg->mem_seg_len == 0 || 3112d8899132SKalle Valo msg->mem_seg_len > ATH12K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01) 3113d8899132SKalle Valo ath12k_warn(ab, "Invalid memory segment length: %u\n", 3114d8899132SKalle Valo msg->mem_seg_len); 3115d8899132SKalle Valo 3116d8899132SKalle Valo ab->qmi.mem_seg_count = msg->mem_seg_len; 3117d8899132SKalle Valo 3118d8899132SKalle Valo for (i = 0; i < qmi->mem_seg_count ; i++) { 3119d8899132SKalle Valo ab->qmi.target_mem[i].type = msg->mem_seg[i].type; 3120d8899132SKalle Valo ab->qmi.target_mem[i].size = msg->mem_seg[i].size; 3121d8899132SKalle Valo ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi mem seg type %d size %d\n", 3122d8899132SKalle Valo msg->mem_seg[i].type, msg->mem_seg[i].size); 3123d8899132SKalle Valo } 3124d8899132SKalle Valo 3125d8899132SKalle Valo ret = ath12k_qmi_alloc_target_mem_chunk(ab); 3126d8899132SKalle Valo if (ret) { 3127d8899132SKalle Valo ath12k_warn(ab, "qmi failed to alloc target memory: %d\n", 3128d8899132SKalle Valo ret); 3129d8899132SKalle Valo return; 3130d8899132SKalle Valo } 3131d8899132SKalle Valo 3132d8899132SKalle Valo ath12k_qmi_driver_event_post(qmi, ATH12K_QMI_EVENT_REQUEST_MEM, NULL); 3133d8899132SKalle Valo } 3134d8899132SKalle Valo 3135d8899132SKalle Valo static void ath12k_qmi_msg_mem_ready_cb(struct qmi_handle *qmi_hdl, 3136d8899132SKalle Valo struct sockaddr_qrtr *sq, 3137d8899132SKalle Valo struct qmi_txn *txn, 3138d8899132SKalle Valo const void *decoded) 3139d8899132SKalle Valo { 3140d8899132SKalle Valo struct ath12k_qmi *qmi = container_of(qmi_hdl, struct ath12k_qmi, handle); 3141d8899132SKalle Valo struct ath12k_base *ab = qmi->ab; 3142d8899132SKalle Valo 3143d8899132SKalle Valo ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi firmware memory ready indication\n"); 3144d8899132SKalle Valo ath12k_qmi_driver_event_post(qmi, ATH12K_QMI_EVENT_FW_MEM_READY, NULL); 3145d8899132SKalle Valo } 3146d8899132SKalle Valo 3147d8899132SKalle Valo static void ath12k_qmi_msg_fw_ready_cb(struct qmi_handle *qmi_hdl, 3148d8899132SKalle Valo struct sockaddr_qrtr *sq, 3149d8899132SKalle Valo struct qmi_txn *txn, 3150d8899132SKalle Valo const void *decoded) 3151d8899132SKalle Valo { 3152d8899132SKalle Valo struct ath12k_qmi *qmi = container_of(qmi_hdl, struct ath12k_qmi, handle); 3153d8899132SKalle Valo struct ath12k_base *ab = qmi->ab; 3154d8899132SKalle Valo 3155d8899132SKalle Valo ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi firmware ready\n"); 3156d8899132SKalle Valo ath12k_qmi_driver_event_post(qmi, ATH12K_QMI_EVENT_FW_READY, NULL); 3157d8899132SKalle Valo } 3158d8899132SKalle Valo 3159d8899132SKalle Valo static const struct qmi_msg_handler ath12k_qmi_msg_handlers[] = { 3160d8899132SKalle Valo { 3161d8899132SKalle Valo .type = QMI_INDICATION, 3162d8899132SKalle Valo .msg_id = QMI_WLFW_REQUEST_MEM_IND_V01, 3163d8899132SKalle Valo .ei = qmi_wlanfw_request_mem_ind_msg_v01_ei, 3164d8899132SKalle Valo .decoded_size = sizeof(struct qmi_wlanfw_request_mem_ind_msg_v01), 3165d8899132SKalle Valo .fn = ath12k_qmi_msg_mem_request_cb, 3166d8899132SKalle Valo }, 3167d8899132SKalle Valo { 3168d8899132SKalle Valo .type = QMI_INDICATION, 3169d8899132SKalle Valo .msg_id = QMI_WLFW_FW_MEM_READY_IND_V01, 3170d8899132SKalle Valo .ei = qmi_wlanfw_mem_ready_ind_msg_v01_ei, 3171d8899132SKalle Valo .decoded_size = sizeof(struct qmi_wlanfw_fw_mem_ready_ind_msg_v01), 3172d8899132SKalle Valo .fn = ath12k_qmi_msg_mem_ready_cb, 3173d8899132SKalle Valo }, 3174d8899132SKalle Valo { 3175d8899132SKalle Valo .type = QMI_INDICATION, 3176d8899132SKalle Valo .msg_id = QMI_WLFW_FW_READY_IND_V01, 3177d8899132SKalle Valo .ei = qmi_wlanfw_fw_ready_ind_msg_v01_ei, 3178d8899132SKalle Valo .decoded_size = sizeof(struct qmi_wlanfw_fw_ready_ind_msg_v01), 3179d8899132SKalle Valo .fn = ath12k_qmi_msg_fw_ready_cb, 3180d8899132SKalle Valo }, 3181d8899132SKalle Valo }; 3182d8899132SKalle Valo 3183d8899132SKalle Valo static int ath12k_qmi_ops_new_server(struct qmi_handle *qmi_hdl, 3184d8899132SKalle Valo struct qmi_service *service) 3185d8899132SKalle Valo { 3186d8899132SKalle Valo struct ath12k_qmi *qmi = container_of(qmi_hdl, struct ath12k_qmi, handle); 3187d8899132SKalle Valo struct ath12k_base *ab = qmi->ab; 3188d8899132SKalle Valo struct sockaddr_qrtr *sq = &qmi->sq; 3189d8899132SKalle Valo int ret; 3190d8899132SKalle Valo 3191d8899132SKalle Valo sq->sq_family = AF_QIPCRTR; 3192d8899132SKalle Valo sq->sq_node = service->node; 3193d8899132SKalle Valo sq->sq_port = service->port; 3194d8899132SKalle Valo 3195d8899132SKalle Valo ret = kernel_connect(qmi_hdl->sock, (struct sockaddr *)sq, 3196d8899132SKalle Valo sizeof(*sq), 0); 3197d8899132SKalle Valo if (ret) { 3198d8899132SKalle Valo ath12k_warn(ab, "qmi failed to connect to remote service %d\n", ret); 3199d8899132SKalle Valo return ret; 3200d8899132SKalle Valo } 3201d8899132SKalle Valo 3202d8899132SKalle Valo ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi wifi fw qmi service connected\n"); 3203d8899132SKalle Valo ath12k_qmi_driver_event_post(qmi, ATH12K_QMI_EVENT_SERVER_ARRIVE, NULL); 3204d8899132SKalle Valo 3205d8899132SKalle Valo return ret; 3206d8899132SKalle Valo } 3207d8899132SKalle Valo 3208d8899132SKalle Valo static void ath12k_qmi_ops_del_server(struct qmi_handle *qmi_hdl, 3209d8899132SKalle Valo struct qmi_service *service) 3210d8899132SKalle Valo { 3211d8899132SKalle Valo struct ath12k_qmi *qmi = container_of(qmi_hdl, struct ath12k_qmi, handle); 3212d8899132SKalle Valo struct ath12k_base *ab = qmi->ab; 3213d8899132SKalle Valo 3214d8899132SKalle Valo ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi wifi fw del server\n"); 3215d8899132SKalle Valo ath12k_qmi_driver_event_post(qmi, ATH12K_QMI_EVENT_SERVER_EXIT, NULL); 3216d8899132SKalle Valo } 3217d8899132SKalle Valo 3218d8899132SKalle Valo static const struct qmi_ops ath12k_qmi_ops = { 3219d8899132SKalle Valo .new_server = ath12k_qmi_ops_new_server, 3220d8899132SKalle Valo .del_server = ath12k_qmi_ops_del_server, 3221d8899132SKalle Valo }; 3222d8899132SKalle Valo 3223d8899132SKalle Valo static void ath12k_qmi_driver_event_work(struct work_struct *work) 3224d8899132SKalle Valo { 3225d8899132SKalle Valo struct ath12k_qmi *qmi = container_of(work, struct ath12k_qmi, 3226d8899132SKalle Valo event_work); 3227d8899132SKalle Valo struct ath12k_qmi_driver_event *event; 3228d8899132SKalle Valo struct ath12k_base *ab = qmi->ab; 3229d8899132SKalle Valo int ret; 3230d8899132SKalle Valo 3231d8899132SKalle Valo spin_lock(&qmi->event_lock); 3232d8899132SKalle Valo while (!list_empty(&qmi->event_list)) { 3233d8899132SKalle Valo event = list_first_entry(&qmi->event_list, 3234d8899132SKalle Valo struct ath12k_qmi_driver_event, list); 3235d8899132SKalle Valo list_del(&event->list); 3236d8899132SKalle Valo spin_unlock(&qmi->event_lock); 3237d8899132SKalle Valo 3238d8899132SKalle Valo if (test_bit(ATH12K_FLAG_UNREGISTERING, &ab->dev_flags)) 3239960412beSRajat Soni goto skip; 3240d8899132SKalle Valo 3241d8899132SKalle Valo switch (event->type) { 3242d8899132SKalle Valo case ATH12K_QMI_EVENT_SERVER_ARRIVE: 3243d8899132SKalle Valo ret = ath12k_qmi_event_server_arrive(qmi); 3244d8899132SKalle Valo if (ret < 0) 3245d8899132SKalle Valo set_bit(ATH12K_FLAG_QMI_FAIL, &ab->dev_flags); 3246d8899132SKalle Valo break; 3247d8899132SKalle Valo case ATH12K_QMI_EVENT_SERVER_EXIT: 3248d8899132SKalle Valo set_bit(ATH12K_FLAG_CRASH_FLUSH, &ab->dev_flags); 3249d8899132SKalle Valo set_bit(ATH12K_FLAG_RECOVERY, &ab->dev_flags); 3250d8899132SKalle Valo break; 3251d8899132SKalle Valo case ATH12K_QMI_EVENT_REQUEST_MEM: 3252d8899132SKalle Valo ret = ath12k_qmi_event_mem_request(qmi); 3253d8899132SKalle Valo if (ret < 0) 3254d8899132SKalle Valo set_bit(ATH12K_FLAG_QMI_FAIL, &ab->dev_flags); 3255d8899132SKalle Valo break; 3256d8899132SKalle Valo case ATH12K_QMI_EVENT_FW_MEM_READY: 3257d8899132SKalle Valo ret = ath12k_qmi_event_load_bdf(qmi); 3258d8899132SKalle Valo if (ret < 0) 3259d8899132SKalle Valo set_bit(ATH12K_FLAG_QMI_FAIL, &ab->dev_flags); 3260d8899132SKalle Valo break; 3261d8899132SKalle Valo case ATH12K_QMI_EVENT_FW_READY: 3262d8899132SKalle Valo clear_bit(ATH12K_FLAG_QMI_FAIL, &ab->dev_flags); 3263d8899132SKalle Valo if (test_bit(ATH12K_FLAG_REGISTERED, &ab->dev_flags)) { 3264d8899132SKalle Valo ath12k_hal_dump_srng_stats(ab); 3265d8899132SKalle Valo queue_work(ab->workqueue, &ab->restart_work); 3266d8899132SKalle Valo break; 3267d8899132SKalle Valo } 3268d8899132SKalle Valo 3269d8899132SKalle Valo clear_bit(ATH12K_FLAG_CRASH_FLUSH, 3270d8899132SKalle Valo &ab->dev_flags); 3271d8899132SKalle Valo clear_bit(ATH12K_FLAG_RECOVERY, &ab->dev_flags); 3272d8899132SKalle Valo ath12k_core_qmi_firmware_ready(ab); 3273d8899132SKalle Valo set_bit(ATH12K_FLAG_REGISTERED, &ab->dev_flags); 3274d8899132SKalle Valo 3275d8899132SKalle Valo break; 3276d8899132SKalle Valo default: 3277d8899132SKalle Valo ath12k_warn(ab, "invalid event type: %d", event->type); 3278d8899132SKalle Valo break; 3279d8899132SKalle Valo } 3280960412beSRajat Soni 3281960412beSRajat Soni skip: 3282d8899132SKalle Valo kfree(event); 3283d8899132SKalle Valo spin_lock(&qmi->event_lock); 3284d8899132SKalle Valo } 3285d8899132SKalle Valo spin_unlock(&qmi->event_lock); 3286d8899132SKalle Valo } 3287d8899132SKalle Valo 3288d8899132SKalle Valo int ath12k_qmi_init_service(struct ath12k_base *ab) 3289d8899132SKalle Valo { 3290d8899132SKalle Valo int ret; 3291d8899132SKalle Valo 3292d8899132SKalle Valo memset(&ab->qmi.target, 0, sizeof(struct target_info)); 3293d8899132SKalle Valo memset(&ab->qmi.target_mem, 0, sizeof(struct target_mem_chunk)); 3294d8899132SKalle Valo ab->qmi.ab = ab; 3295d8899132SKalle Valo 3296d8899132SKalle Valo ab->qmi.target_mem_mode = ATH12K_QMI_TARGET_MEM_MODE_DEFAULT; 3297d8899132SKalle Valo ret = qmi_handle_init(&ab->qmi.handle, ATH12K_QMI_RESP_LEN_MAX, 3298d8899132SKalle Valo &ath12k_qmi_ops, ath12k_qmi_msg_handlers); 3299d8899132SKalle Valo if (ret < 0) { 3300d8899132SKalle Valo ath12k_warn(ab, "failed to initialize qmi handle\n"); 3301d8899132SKalle Valo return ret; 3302d8899132SKalle Valo } 3303d8899132SKalle Valo 33041e80449eSTejun Heo ab->qmi.event_wq = alloc_ordered_workqueue("ath12k_qmi_driver_event", 0); 3305d8899132SKalle Valo if (!ab->qmi.event_wq) { 3306d8899132SKalle Valo ath12k_err(ab, "failed to allocate workqueue\n"); 3307d8899132SKalle Valo return -EFAULT; 3308d8899132SKalle Valo } 3309d8899132SKalle Valo 3310d8899132SKalle Valo INIT_LIST_HEAD(&ab->qmi.event_list); 3311d8899132SKalle Valo spin_lock_init(&ab->qmi.event_lock); 3312d8899132SKalle Valo INIT_WORK(&ab->qmi.event_work, ath12k_qmi_driver_event_work); 3313d8899132SKalle Valo 3314d8899132SKalle Valo ret = qmi_add_lookup(&ab->qmi.handle, ATH12K_QMI_WLFW_SERVICE_ID_V01, 3315d8899132SKalle Valo ATH12K_QMI_WLFW_SERVICE_VERS_V01, 3316d8899132SKalle Valo ab->qmi.service_ins_id); 3317d8899132SKalle Valo if (ret < 0) { 3318d8899132SKalle Valo ath12k_warn(ab, "failed to add qmi lookup\n"); 3319d8899132SKalle Valo destroy_workqueue(ab->qmi.event_wq); 3320d8899132SKalle Valo return ret; 3321d8899132SKalle Valo } 3322d8899132SKalle Valo 3323d8899132SKalle Valo return ret; 3324d8899132SKalle Valo } 3325d8899132SKalle Valo 3326d8899132SKalle Valo void ath12k_qmi_deinit_service(struct ath12k_base *ab) 3327d8899132SKalle Valo { 3328d8899132SKalle Valo qmi_handle_release(&ab->qmi.handle); 3329d8899132SKalle Valo cancel_work_sync(&ab->qmi.event_work); 3330d8899132SKalle Valo destroy_workqueue(ab->qmi.event_wq); 3331d8899132SKalle Valo ath12k_qmi_m3_free(ab); 3332d8899132SKalle Valo ath12k_qmi_free_target_mem_chunk(ab); 3333d8899132SKalle Valo } 333492448f87SWen Gong 333592448f87SWen Gong void ath12k_qmi_free_resource(struct ath12k_base *ab) 333692448f87SWen Gong { 333792448f87SWen Gong ath12k_qmi_free_target_mem_chunk(ab); 333892448f87SWen Gong ath12k_qmi_m3_free(ab); 333992448f87SWen Gong } 3340