Lines Matching refs:btrtl_dev
206 struct btrtl_device_info *btrtl_dev, in rtlbt_parse_firmware() argument
234 if (btrtl_dev->fw_len < min_size) in rtlbt_parse_firmware()
237 fwptr = btrtl_dev->fw_data + btrtl_dev->fw_len - sizeof(extension_sig); in rtlbt_parse_firmware()
249 while (fwptr >= btrtl_dev->fw_data + (sizeof(*epatch_info) + 3)) { in rtlbt_parse_firmware()
288 if (btrtl_dev->ic_info->lmp_subver != in rtlbt_parse_firmware()
292 btrtl_dev->ic_info->lmp_subver); in rtlbt_parse_firmware()
296 epatch_info = (struct rtl_epatch_header *)btrtl_dev->fw_data; in rtlbt_parse_firmware()
313 if (btrtl_dev->fw_len < min_size) in rtlbt_parse_firmware()
316 chip_id_base = btrtl_dev->fw_data + sizeof(struct rtl_epatch_header); in rtlbt_parse_firmware()
322 if (chip_id == btrtl_dev->rom_version + 1) { in rtlbt_parse_firmware()
333 btrtl_dev->rom_version); in rtlbt_parse_firmware()
339 if (btrtl_dev->fw_len < min_size) in rtlbt_parse_firmware()
346 buf = kmemdup(btrtl_dev->fw_data + patch_offset, patch_length, in rtlbt_parse_firmware()
428 struct btrtl_device_info *btrtl_dev) in btrtl_setup_rtl8723a() argument
430 if (btrtl_dev->fw_len < 8) in btrtl_setup_rtl8723a()
436 if (!memcmp(btrtl_dev->fw_data, RTL_EPATCH_SIGNATURE, 8)) { in btrtl_setup_rtl8723a()
441 return rtl_download_firmware(hdev, btrtl_dev->fw_data, in btrtl_setup_rtl8723a()
442 btrtl_dev->fw_len); in btrtl_setup_rtl8723a()
446 struct btrtl_device_info *btrtl_dev) in btrtl_setup_rtl8723b() argument
452 ret = rtlbt_parse_firmware(hdev, btrtl_dev, &fw_data); in btrtl_setup_rtl8723b()
456 if (btrtl_dev->cfg_len > 0) { in btrtl_setup_rtl8723b()
457 tbuff = kzalloc(ret + btrtl_dev->cfg_len, GFP_KERNEL); in btrtl_setup_rtl8723b()
466 memcpy(tbuff + ret, btrtl_dev->cfg_data, btrtl_dev->cfg_len); in btrtl_setup_rtl8723b()
467 ret += btrtl_dev->cfg_len; in btrtl_setup_rtl8723b()
472 rtl_dev_info(hdev, "cfg_sz %d, total sz %d\n", btrtl_dev->cfg_len, ret); in btrtl_setup_rtl8723b()
502 void btrtl_free(struct btrtl_device_info *btrtl_dev) in btrtl_free() argument
504 kfree(btrtl_dev->fw_data); in btrtl_free()
505 kfree(btrtl_dev->cfg_data); in btrtl_free()
506 kfree(btrtl_dev); in btrtl_free()
513 struct btrtl_device_info *btrtl_dev; in btrtl_initialize() local
521 btrtl_dev = kzalloc(sizeof(*btrtl_dev), GFP_KERNEL); in btrtl_initialize()
522 if (!btrtl_dev) { in btrtl_initialize()
543 btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver, in btrtl_initialize()
546 if (!btrtl_dev->ic_info) { in btrtl_initialize()
553 if (btrtl_dev->ic_info->has_rom_version) { in btrtl_initialize()
554 ret = rtl_read_rom_version(hdev, &btrtl_dev->rom_version); in btrtl_initialize()
559 btrtl_dev->fw_len = rtl_load_file(hdev, btrtl_dev->ic_info->fw_name, in btrtl_initialize()
560 &btrtl_dev->fw_data); in btrtl_initialize()
561 if (btrtl_dev->fw_len < 0) { in btrtl_initialize()
563 btrtl_dev->ic_info->fw_name); in btrtl_initialize()
564 ret = btrtl_dev->fw_len; in btrtl_initialize()
568 if (btrtl_dev->ic_info->cfg_name) { in btrtl_initialize()
571 btrtl_dev->ic_info->cfg_name, postfix); in btrtl_initialize()
574 btrtl_dev->ic_info->cfg_name); in btrtl_initialize()
576 btrtl_dev->cfg_len = rtl_load_file(hdev, cfg_name, in btrtl_initialize()
577 &btrtl_dev->cfg_data); in btrtl_initialize()
578 if (btrtl_dev->ic_info->config_needed && in btrtl_initialize()
579 btrtl_dev->cfg_len <= 0) { in btrtl_initialize()
581 btrtl_dev->ic_info->cfg_name); in btrtl_initialize()
582 ret = btrtl_dev->cfg_len; in btrtl_initialize()
587 return btrtl_dev; in btrtl_initialize()
590 btrtl_free(btrtl_dev); in btrtl_initialize()
597 struct btrtl_device_info *btrtl_dev) in btrtl_download_firmware() argument
605 switch (btrtl_dev->ic_info->lmp_subver) { in btrtl_download_firmware()
608 return btrtl_setup_rtl8723a(hdev, btrtl_dev); in btrtl_download_firmware()
613 return btrtl_setup_rtl8723b(hdev, btrtl_dev); in btrtl_download_firmware()
623 struct btrtl_device_info *btrtl_dev; in btrtl_setup_realtek() local
626 btrtl_dev = btrtl_initialize(hdev, NULL); in btrtl_setup_realtek()
627 if (IS_ERR(btrtl_dev)) in btrtl_setup_realtek()
628 return PTR_ERR(btrtl_dev); in btrtl_setup_realtek()
630 ret = btrtl_download_firmware(hdev, btrtl_dev); in btrtl_setup_realtek()
632 btrtl_free(btrtl_dev); in btrtl_setup_realtek()
676 struct btrtl_device_info *btrtl_dev, in btrtl_get_uart_settings() argument
685 total_data_len = btrtl_dev->cfg_len - sizeof(*config); in btrtl_get_uart_settings()
691 config = (struct rtl_vendor_config *)btrtl_dev->cfg_data; in btrtl_get_uart_settings()