Lines Matching refs:btrtl_dev

435 					struct btrtl_device_info *btrtl_dev)  in btrtl_insert_ordered_subsec()  argument
441 list_for_each_safe(pos, next, &btrtl_dev->patch_subsecs) { in btrtl_insert_ordered_subsec()
450 struct btrtl_device_info *btrtl_dev, u32 opcode, in btrtl_parse_section() argument
485 if (common_subsec->eco != btrtl_dev->rom_version + 1) in btrtl_parse_section()
491 if (sec_hdr->key_id != btrtl_dev->key_id) in btrtl_parse_section()
503 btrtl_insert_ordered_subsec(subsec, btrtl_dev); in btrtl_parse_section()
511 struct btrtl_device_info *btrtl_dev, in rtlbt_parse_firmware_v2() argument
527 .data = btrtl_dev->fw_data, in rtlbt_parse_firmware_v2()
528 .len = btrtl_dev->fw_len - 7, /* Cut the tail */ in rtlbt_parse_firmware_v2()
538 btrtl_dev->key_id = key_id; in rtlbt_parse_firmware_v2()
563 rc = btrtl_parse_section(hdev, btrtl_dev, opcode, in rtlbt_parse_firmware_v2()
572 rc = btrtl_parse_section(hdev, btrtl_dev, opcode, in rtlbt_parse_firmware_v2()
576 rc = btrtl_parse_section(hdev, btrtl_dev, opcode, in rtlbt_parse_firmware_v2()
600 list_for_each_entry_safe(entry, tmp, &btrtl_dev->patch_subsecs, list) { in rtlbt_parse_firmware_v2()
615 struct btrtl_device_info *btrtl_dev, in rtlbt_parse_firmware() argument
650 if (btrtl_dev->fw_len <= 8) in rtlbt_parse_firmware()
653 if (!memcmp(btrtl_dev->fw_data, RTL_EPATCH_SIGNATURE, 8)) in rtlbt_parse_firmware()
656 else if (!memcmp(btrtl_dev->fw_data, RTL_EPATCH_SIGNATURE_V2, 8)) in rtlbt_parse_firmware()
662 if (btrtl_dev->fw_len < min_size) in rtlbt_parse_firmware()
665 fwptr = btrtl_dev->fw_data + btrtl_dev->fw_len - sizeof(extension_sig); in rtlbt_parse_firmware()
677 while (fwptr >= btrtl_dev->fw_data + (sizeof(*epatch_info) + 3)) { in rtlbt_parse_firmware()
708 btrtl_dev->project_id = project_id; in rtlbt_parse_firmware()
718 if (btrtl_dev->ic_info->lmp_subver != in rtlbt_parse_firmware()
722 btrtl_dev->ic_info->lmp_subver); in rtlbt_parse_firmware()
726 if (memcmp(btrtl_dev->fw_data, RTL_EPATCH_SIGNATURE, 8) != 0) { in rtlbt_parse_firmware()
727 if (!memcmp(btrtl_dev->fw_data, RTL_EPATCH_SIGNATURE_V2, 8)) in rtlbt_parse_firmware()
728 return rtlbt_parse_firmware_v2(hdev, btrtl_dev, _buf); in rtlbt_parse_firmware()
733 epatch_info = (struct rtl_epatch_header *)btrtl_dev->fw_data; in rtlbt_parse_firmware()
747 if (btrtl_dev->fw_len < min_size) in rtlbt_parse_firmware()
750 chip_id_base = btrtl_dev->fw_data + sizeof(struct rtl_epatch_header); in rtlbt_parse_firmware()
756 if (chip_id == btrtl_dev->rom_version + 1) { in rtlbt_parse_firmware()
767 btrtl_dev->rom_version); in rtlbt_parse_firmware()
773 if (btrtl_dev->fw_len < min_size) in rtlbt_parse_firmware()
784 memcpy(buf, btrtl_dev->fw_data + patch_offset, patch_length - 4); in rtlbt_parse_firmware()
882 struct btrtl_device_info *btrtl_dev) in btrtl_setup_rtl8723a() argument
884 if (btrtl_dev->fw_len < 8) in btrtl_setup_rtl8723a()
890 if (!memcmp(btrtl_dev->fw_data, RTL_EPATCH_SIGNATURE, 8)) { in btrtl_setup_rtl8723a()
895 return rtl_download_firmware(hdev, btrtl_dev->fw_data, in btrtl_setup_rtl8723a()
896 btrtl_dev->fw_len); in btrtl_setup_rtl8723a()
900 struct btrtl_device_info *btrtl_dev) in btrtl_setup_rtl8723b() argument
906 ret = rtlbt_parse_firmware(hdev, btrtl_dev, &fw_data); in btrtl_setup_rtl8723b()
910 if (btrtl_dev->cfg_len > 0) { in btrtl_setup_rtl8723b()
911 tbuff = kvzalloc(ret + btrtl_dev->cfg_len, GFP_KERNEL); in btrtl_setup_rtl8723b()
920 memcpy(tbuff + ret, btrtl_dev->cfg_data, btrtl_dev->cfg_len); in btrtl_setup_rtl8723b()
921 ret += btrtl_dev->cfg_len; in btrtl_setup_rtl8723b()
926 rtl_dev_info(hdev, "cfg_sz %d, total sz %d", btrtl_dev->cfg_len, ret); in btrtl_setup_rtl8723b()
1021 void btrtl_free(struct btrtl_device_info *btrtl_dev) in btrtl_free() argument
1025 kvfree(btrtl_dev->fw_data); in btrtl_free()
1026 kvfree(btrtl_dev->cfg_data); in btrtl_free()
1028 list_for_each_entry_safe(entry, tmp, &btrtl_dev->patch_subsecs, list) { in btrtl_free()
1033 kfree(btrtl_dev); in btrtl_free()
1041 struct btrtl_device_info *btrtl_dev; in btrtl_initialize() local
1052 btrtl_dev = kzalloc(sizeof(*btrtl_dev), GFP_KERNEL); in btrtl_initialize()
1053 if (!btrtl_dev) { in btrtl_initialize()
1058 INIT_LIST_HEAD(&btrtl_dev->patch_subsecs); in btrtl_initialize()
1076 btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, in btrtl_initialize()
1104 btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver, in btrtl_initialize()
1112 if (!btrtl_dev->ic_info && !btrtl_dev->drop_fw) in btrtl_initialize()
1113 btrtl_dev->drop_fw = true; in btrtl_initialize()
1115 btrtl_dev->drop_fw = false; in btrtl_initialize()
1117 if (btrtl_dev->drop_fw) { in btrtl_initialize()
1143 if (!btrtl_dev->ic_info) { in btrtl_initialize()
1146 return btrtl_dev; in btrtl_initialize()
1149 if (btrtl_dev->ic_info->has_rom_version) { in btrtl_initialize()
1150 ret = rtl_read_rom_version(hdev, &btrtl_dev->rom_version); in btrtl_initialize()
1155 if (!btrtl_dev->ic_info->fw_name) { in btrtl_initialize()
1160 btrtl_dev->fw_len = -EIO; in btrtl_initialize()
1163 btrtl_dev->ic_info->fw_name); in btrtl_initialize()
1164 btrtl_dev->fw_len = rtl_load_file(hdev, fw_name, in btrtl_initialize()
1165 &btrtl_dev->fw_data); in btrtl_initialize()
1168 if (btrtl_dev->fw_len < 0) { in btrtl_initialize()
1170 btrtl_dev->ic_info->fw_name); in btrtl_initialize()
1171 btrtl_dev->fw_len = rtl_load_file(hdev, fw_name, in btrtl_initialize()
1172 &btrtl_dev->fw_data); in btrtl_initialize()
1175 if (btrtl_dev->fw_len < 0) { in btrtl_initialize()
1177 btrtl_dev->ic_info->fw_name); in btrtl_initialize()
1178 ret = btrtl_dev->fw_len; in btrtl_initialize()
1182 if (btrtl_dev->ic_info->cfg_name) { in btrtl_initialize()
1185 btrtl_dev->ic_info->cfg_name, postfix); in btrtl_initialize()
1188 btrtl_dev->ic_info->cfg_name); in btrtl_initialize()
1190 btrtl_dev->cfg_len = rtl_load_file(hdev, cfg_name, in btrtl_initialize()
1191 &btrtl_dev->cfg_data); in btrtl_initialize()
1192 if (btrtl_dev->ic_info->config_needed && in btrtl_initialize()
1193 btrtl_dev->cfg_len <= 0) { in btrtl_initialize()
1195 btrtl_dev->ic_info->cfg_name); in btrtl_initialize()
1196 ret = btrtl_dev->cfg_len; in btrtl_initialize()
1204 if (btrtl_dev->ic_info->has_msft_ext) in btrtl_initialize()
1207 if (btrtl_dev->ic_info) in btrtl_initialize()
1208 coredump_info->rtl_dump.controller = btrtl_dev->ic_info->hw_info; in btrtl_initialize()
1210 return btrtl_dev; in btrtl_initialize()
1213 btrtl_free(btrtl_dev); in btrtl_initialize()
1220 struct btrtl_device_info *btrtl_dev) in btrtl_download_firmware() argument
1230 if (!btrtl_dev->ic_info) { in btrtl_download_firmware()
1236 switch (btrtl_dev->ic_info->lmp_subver) { in btrtl_download_firmware()
1238 err = btrtl_setup_rtl8723a(hdev, btrtl_dev); in btrtl_download_firmware()
1247 err = btrtl_setup_rtl8723b(hdev, btrtl_dev); in btrtl_download_firmware()
1261 void btrtl_set_quirks(struct hci_dev *hdev, struct btrtl_device_info *btrtl_dev) in btrtl_set_quirks() argument
1272 switch (btrtl_dev->project_id) { in btrtl_set_quirks()
1284 if (btrtl_dev->project_id == CHIP_ID_8852C) in btrtl_set_quirks()
1287 if (btrtl_dev->project_id == CHIP_ID_8852A || in btrtl_set_quirks()
1288 btrtl_dev->project_id == CHIP_ID_8852B || in btrtl_set_quirks()
1289 btrtl_dev->project_id == CHIP_ID_8852C) in btrtl_set_quirks()
1300 if (!btrtl_dev->ic_info) in btrtl_set_quirks()
1303 switch (btrtl_dev->ic_info->lmp_subver) { in btrtl_set_quirks()
1320 struct btrtl_device_info *btrtl_dev; in btrtl_setup_realtek() local
1323 btrtl_dev = btrtl_initialize(hdev, NULL); in btrtl_setup_realtek()
1324 if (IS_ERR(btrtl_dev)) in btrtl_setup_realtek()
1325 return PTR_ERR(btrtl_dev); in btrtl_setup_realtek()
1327 ret = btrtl_download_firmware(hdev, btrtl_dev); in btrtl_setup_realtek()
1329 btrtl_set_quirks(hdev, btrtl_dev); in btrtl_setup_realtek()
1331 btrtl_free(btrtl_dev); in btrtl_setup_realtek()
1394 struct btrtl_device_info *btrtl_dev, in btrtl_get_uart_settings() argument
1403 total_data_len = btrtl_dev->cfg_len - sizeof(*config); in btrtl_get_uart_settings()
1409 config = (struct rtl_vendor_config *)btrtl_dev->cfg_data; in btrtl_get_uart_settings()