Lines Matching defs:hdev
200 static struct sk_buff *btrtl_read_local_version(struct hci_dev *hdev)
204 skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_VERSION, 0, NULL,
207 rtl_dev_err(hdev, "HCI_OP_READ_LOCAL_VERSION failed (%ld)",
213 rtl_dev_err(hdev, "HCI_OP_READ_LOCAL_VERSION event length mismatch");
221 static int rtl_read_rom_version(struct hci_dev *hdev, u8 *version)
227 skb = __hci_cmd_sync(hdev, 0xfc6d, 0, NULL, HCI_INIT_TIMEOUT);
229 rtl_dev_err(hdev, "Read ROM version failed (%ld)",
235 rtl_dev_err(hdev, "version event length mismatch");
241 rtl_dev_info(hdev, "rom_version status=%x version=%x",
250 static int rtlbt_parse_firmware(struct hci_dev *hdev,
286 rtl_dev_err(hdev, "extension section signature mismatch");
307 rtl_dev_err(hdev, "found instruction with length 0");
320 rtl_dev_err(hdev, "failed to find version instruction");
331 rtl_dev_err(hdev, "unknown project id %d", project_id);
337 rtl_dev_err(hdev, "firmware is for %x but this is a %x",
345 rtl_dev_err(hdev, "bad EPATCH signature");
379 rtl_dev_err(hdev, "didn't find patch for chip id %d",
404 static int rtl_download_firmware(struct hci_dev *hdev,
436 skb = __hci_cmd_sync(hdev, 0xfc20, frag_len + 1, dl_cmd,
439 rtl_dev_err(hdev, "download fw command failed (%ld)",
446 rtl_dev_err(hdev, "download fw event length mismatch");
456 skb = btrtl_read_local_version(hdev);
459 rtl_dev_err(hdev, "read local version failed");
464 rtl_dev_info(hdev, "fw version 0x%04x%04x",
473 static int rtl_load_file(struct hci_dev *hdev, const char *name, u8 **buff)
478 rtl_dev_info(hdev, "loading %s", name);
479 ret = request_firmware(&fw, name, &hdev->dev);
494 static int btrtl_setup_rtl8723a(struct hci_dev *hdev,
504 rtl_dev_err(hdev, "unexpected EPATCH signature!");
508 return rtl_download_firmware(hdev, btrtl_dev->fw_data,
512 static int btrtl_setup_rtl8723b(struct hci_dev *hdev,
519 ret = rtlbt_parse_firmware(hdev, btrtl_dev, &fw_data);
539 rtl_dev_info(hdev, "cfg_sz %d, total sz %d", btrtl_dev->cfg_len, ret);
541 ret = rtl_download_firmware(hdev, fw_data, ret);
556 struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
573 skb = btrtl_read_local_version(hdev);
580 rtl_dev_info(hdev, "examining hci_ver=%02x hci_rev=%04x lmp_ver=%02x lmp_subver=%04x",
590 hdev->bus);
593 rtl_dev_info(hdev, "unknown IC info, lmp subver %04x, hci rev %04x, hci ver %04x",
599 ret = rtl_read_rom_version(hdev, &btrtl_dev->rom_version);
604 btrtl_dev->fw_len = rtl_load_file(hdev, btrtl_dev->ic_info->fw_name,
607 rtl_dev_err(hdev, "firmware file %s not found",
621 btrtl_dev->cfg_len = rtl_load_file(hdev, cfg_name,
625 rtl_dev_err(hdev, "mandatory config file %s not found",
641 int btrtl_download_firmware(struct hci_dev *hdev,
651 rtl_dev_info(hdev, "assuming no firmware upload needed");
658 return btrtl_setup_rtl8723a(hdev, btrtl_dev);
663 return btrtl_setup_rtl8723b(hdev, btrtl_dev);
665 rtl_dev_info(hdev, "assuming no firmware upload needed");
671 int btrtl_setup_realtek(struct hci_dev *hdev)
676 btrtl_dev = btrtl_initialize(hdev, NULL);
680 ret = btrtl_download_firmware(hdev, btrtl_dev);
687 set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
693 int btrtl_shutdown_realtek(struct hci_dev *hdev)
701 skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
704 bt_dev_err(hdev, "HCI reset during shutdown failed");
750 int btrtl_get_uart_settings(struct hci_dev *hdev,
762 rtl_dev_warn(hdev, "no config loaded");
768 rtl_dev_err(hdev, "invalid config magic");
773 rtl_dev_err(hdev, "config is too short");
783 rtl_dev_err(hdev, "invalid UART config entry");
800 rtl_dev_dbg(hdev, "skipping config entry 0x%x (len %u)",
809 rtl_dev_err(hdev, "no UART config entry found");
813 rtl_dev_dbg(hdev, "device baudrate = 0x%08x", *device_baudrate);
814 rtl_dev_dbg(hdev, "controller baudrate = %u", *controller_baudrate);
815 rtl_dev_dbg(hdev, "flow control %d", *flow_control);