Lines Matching defs:hdev

343 static struct sk_buff *btrtl_read_local_version(struct hci_dev *hdev)
347 skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_VERSION, 0, NULL,
350 rtl_dev_err(hdev, "HCI_OP_READ_LOCAL_VERSION failed (%ld)",
356 rtl_dev_err(hdev, "HCI_OP_READ_LOCAL_VERSION event length mismatch");
364 static int rtl_read_rom_version(struct hci_dev *hdev, u8 *version)
370 skb = __hci_cmd_sync(hdev, 0xfc6d, 0, NULL, HCI_INIT_TIMEOUT);
372 rtl_dev_err(hdev, "Read ROM version failed (%ld)",
378 rtl_dev_err(hdev, "version event length mismatch");
384 rtl_dev_info(hdev, "rom_version status=%x version=%x",
393 static int btrtl_vendor_read_reg16(struct hci_dev *hdev,
399 skb = __hci_cmd_sync(hdev, 0xfc61, sizeof(*cmd), cmd,
403 rtl_dev_err(hdev, "RTL: Read reg16 failed (%d)", err);
408 bt_dev_err(hdev, "RTL: Read reg16 length mismatch");
449 static int btrtl_parse_section(struct hci_dev *hdev,
478 rtl_dev_dbg(hdev, "subsec, eco 0x%02x, len %08x",
510 static int rtlbt_parse_firmware_v2(struct hci_dev *hdev,
531 rc = btrtl_vendor_read_reg16(hdev, RTL_SEC_PROJ, reg_val);
536 rtl_dev_dbg(hdev, "%s: key id %u", __func__, key_id);
545 rtl_dev_dbg(hdev, "FW version %08x-%08x", *((u32 *)hdr->fw_version),
555 rtl_dev_dbg(hdev, "opcode 0x%04x", section->opcode);
563 rc = btrtl_parse_section(hdev, btrtl_dev, opcode,
572 rc = btrtl_parse_section(hdev, btrtl_dev, opcode,
576 rc = btrtl_parse_section(hdev, btrtl_dev, opcode,
584 rtl_dev_err(hdev, "RTL: Parse section (%u) err %d",
601 rtl_dev_dbg(hdev, "RTL: opcode %08x, addr %p, len 0x%x",
614 static int rtlbt_parse_firmware(struct hci_dev *hdev,
619 struct btrealtek_data *coredump_info = hci_get_priv(hdev);
667 rtl_dev_err(hdev, "extension section signature mismatch");
688 rtl_dev_err(hdev, "found instruction with length 0");
701 rtl_dev_err(hdev, "failed to find version instruction");
714 rtl_dev_err(hdev, "unknown project id %d", project_id);
720 rtl_dev_err(hdev, "firmware is for %x but this is a %x",
728 return rtlbt_parse_firmware_v2(hdev, btrtl_dev, _buf);
729 rtl_dev_err(hdev, "bad EPATCH signature");
766 rtl_dev_err(hdev, "didn't find patch for chip id %d",
791 static int rtl_download_firmware(struct hci_dev *hdev,
818 rtl_dev_dbg(hdev, "download fw (%d/%d). index = %d", i,
823 skb = __hci_cmd_sync(hdev, 0xfc20, frag_len + 1, dl_cmd,
826 rtl_dev_err(hdev, "download fw command failed (%ld)",
833 rtl_dev_err(hdev, "download fw event length mismatch");
843 skb = btrtl_read_local_version(hdev);
846 rtl_dev_err(hdev, "read local version failed");
851 rtl_dev_info(hdev, "fw version 0x%04x%04x",
860 static int rtl_load_file(struct hci_dev *hdev, const char *name, u8 **buff)
865 rtl_dev_info(hdev, "loading %s", name);
866 ret = request_firmware(&fw, name, &hdev->dev);
881 static int btrtl_setup_rtl8723a(struct hci_dev *hdev,
891 rtl_dev_err(hdev, "unexpected EPATCH signature!");
895 return rtl_download_firmware(hdev, btrtl_dev->fw_data,
899 static int btrtl_setup_rtl8723b(struct hci_dev *hdev,
906 ret = rtlbt_parse_firmware(hdev, btrtl_dev, &fw_data);
926 rtl_dev_info(hdev, "cfg_sz %d, total sz %d", btrtl_dev->cfg_len, ret);
928 ret = rtl_download_firmware(hdev, fw_data, ret);
935 static void btrtl_coredump(struct hci_dev *hdev)
939 __hci_cmd_send(hdev, RTL_VSC_OP_COREDUMP, sizeof(param), param);
942 static void btrtl_dmp_hdr(struct hci_dev *hdev, struct sk_buff *skb)
944 struct btrealtek_data *coredump_info = hci_get_priv(hdev);
965 static void btrtl_register_devcoredump_support(struct hci_dev *hdev)
967 hci_devcd_register(hdev, btrtl_coredump, btrtl_dmp_hdr, NULL);
971 void btrtl_set_driver_name(struct hci_dev *hdev, const char *driver_name)
973 struct btrealtek_data *coredump_info = hci_get_priv(hdev);
991 static int rtl_read_chip_type(struct hci_dev *hdev, u8 *type)
998 skb = __hci_cmd_sync(hdev, 0xfc61, 5, cmd_buf, HCI_INIT_TIMEOUT);
1000 rtl_dev_err(hdev, "Read chip type failed (%ld)",
1007 rtl_dev_err(hdev, "RTL chip type event length mismatch");
1012 rtl_dev_info(hdev, "chip_type status=%x type=%x",
1037 struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
1040 struct btrealtek_data *coredump_info = hci_get_priv(hdev);
1061 ret = btrtl_vendor_read_reg16(hdev, RTL_CHIP_SUBVER, reg_val);
1067 ret = btrtl_vendor_read_reg16(hdev, RTL_CHIP_REV, reg_val);
1077 hci_ver, hdev->bus,
1083 skb = btrtl_read_local_version(hdev);
1099 ret = rtl_read_chip_type(hdev, &chip_type);
1105 hdev->bus, chip_type);
1108 rtl_dev_info(hdev, "examining hci_ver=%02x hci_rev=%04x lmp_ver=%02x lmp_subver=%04x",
1128 ret = hdev->send(hdev, skb);
1130 bt_dev_err(hdev, "sending frame failed (%d)", ret);
1144 rtl_dev_info(hdev, "unknown IC info, lmp subver %04x, hci rev %04x, hci ver %04x",
1150 ret = rtl_read_rom_version(hdev, &btrtl_dev->rom_version);
1164 btrtl_dev->fw_len = rtl_load_file(hdev, fw_name,
1171 btrtl_dev->fw_len = rtl_load_file(hdev, fw_name,
1176 rtl_dev_err(hdev, "firmware file %s not found",
1190 btrtl_dev->cfg_len = rtl_load_file(hdev, cfg_name,
1194 rtl_dev_err(hdev, "mandatory config file %s not found",
1205 hci_set_msft_opcode(hdev, 0xFCF0);
1219 int btrtl_download_firmware(struct hci_dev *hdev,
1231 rtl_dev_info(hdev, "assuming no firmware upload needed");
1238 err = btrtl_setup_rtl8723a(hdev, btrtl_dev);
1247 err = btrtl_setup_rtl8723b(hdev, btrtl_dev);
1250 rtl_dev_info(hdev, "assuming no firmware upload needed");
1255 btrtl_register_devcoredump_support(hdev);
1261 void btrtl_set_quirks(struct hci_dev *hdev, struct btrtl_device_info *btrtl_dev)
1266 set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
1278 set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks);
1279 set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks);
1285 btrealtek_set_flag(hdev, REALTEK_ALT6_CONTINUOUS_TX_CHIP);
1289 set_bit(HCI_QUIRK_USE_MSFT_EXT_ADDRESS_FILTER, &hdev->quirks);
1291 hci_set_aosp_capable(hdev);
1294 rtl_dev_dbg(hdev, "Central-peripheral role not enabled.");
1295 rtl_dev_dbg(hdev, "WBS supported not enabled.");
1309 &hdev->quirks);
1317 int btrtl_setup_realtek(struct hci_dev *hdev)
1322 btrtl_dev = btrtl_initialize(hdev, NULL);
1326 ret = btrtl_download_firmware(hdev, btrtl_dev);
1328 btrtl_set_quirks(hdev, btrtl_dev);
1335 int btrtl_shutdown_realtek(struct hci_dev *hdev)
1343 skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
1346 bt_dev_err(hdev, "HCI reset during shutdown failed");
1392 int btrtl_get_uart_settings(struct hci_dev *hdev,
1404 rtl_dev_warn(hdev, "no config loaded");
1410 rtl_dev_err(hdev, "invalid config magic");
1415 rtl_dev_err(hdev, "config is too short");
1425 rtl_dev_err(hdev, "invalid UART config entry");
1442 rtl_dev_dbg(hdev, "skipping config entry 0x%x (len %u)",
1451 rtl_dev_err(hdev, "no UART config entry found");
1455 rtl_dev_dbg(hdev, "device baudrate = 0x%08x", *device_baudrate);
1456 rtl_dev_dbg(hdev, "controller baudrate = %u", *controller_baudrate);
1457 rtl_dev_dbg(hdev, "flow control %d", *flow_control);