Lines Matching defs:hdev

353 static struct sk_buff *btrtl_read_local_version(struct hci_dev *hdev)
357 skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_VERSION, 0, NULL,
360 rtl_dev_err(hdev, "HCI_OP_READ_LOCAL_VERSION failed (%ld)",
366 rtl_dev_err(hdev, "HCI_OP_READ_LOCAL_VERSION event length mismatch");
374 static int rtl_read_rom_version(struct hci_dev *hdev, u8 *version)
380 skb = __hci_cmd_sync(hdev, 0xfc6d, 0, NULL, HCI_INIT_TIMEOUT);
382 rtl_dev_err(hdev, "Read ROM version failed (%ld)",
388 rtl_dev_err(hdev, "version event length mismatch");
394 rtl_dev_info(hdev, "rom_version status=%x version=%x",
403 static int btrtl_vendor_read_reg16(struct hci_dev *hdev,
409 skb = __hci_cmd_sync(hdev, 0xfc61, sizeof(*cmd), cmd,
413 rtl_dev_err(hdev, "RTL: Read reg16 failed (%d)", err);
418 bt_dev_err(hdev, "RTL: Read reg16 length mismatch");
459 static int btrtl_parse_section(struct hci_dev *hdev,
488 rtl_dev_dbg(hdev, "subsec, eco 0x%02x, len %08x",
520 static int rtlbt_parse_firmware_v2(struct hci_dev *hdev,
541 rc = btrtl_vendor_read_reg16(hdev, RTL_SEC_PROJ, reg_val);
546 rtl_dev_dbg(hdev, "%s: key id %u", __func__, key_id);
555 rtl_dev_dbg(hdev, "FW version %08x-%08x", *((u32 *)hdr->fw_version),
565 rtl_dev_dbg(hdev, "opcode 0x%04x", section->opcode);
573 rc = btrtl_parse_section(hdev, btrtl_dev, opcode,
582 rc = btrtl_parse_section(hdev, btrtl_dev, opcode,
586 rc = btrtl_parse_section(hdev, btrtl_dev, opcode,
594 rtl_dev_err(hdev, "RTL: Parse section (%u) err %d",
611 rtl_dev_dbg(hdev, "RTL: opcode %08x, addr %p, len 0x%x",
624 static int rtlbt_parse_firmware(struct hci_dev *hdev,
629 struct btrealtek_data *coredump_info = hci_get_priv(hdev);
678 rtl_dev_err(hdev, "extension section signature mismatch");
699 rtl_dev_err(hdev, "found instruction with length 0");
712 rtl_dev_err(hdev, "failed to find version instruction");
725 rtl_dev_err(hdev, "unknown project id %d", project_id);
731 rtl_dev_err(hdev, "firmware is for %x but this is a %x",
739 return rtlbt_parse_firmware_v2(hdev, btrtl_dev, _buf);
740 rtl_dev_err(hdev, "bad EPATCH signature");
777 rtl_dev_err(hdev, "didn't find patch for chip id %d",
802 static int rtl_download_firmware(struct hci_dev *hdev,
829 rtl_dev_dbg(hdev, "download fw (%d/%d). index = %d", i,
834 skb = __hci_cmd_sync(hdev, 0xfc20, frag_len + 1, dl_cmd,
837 rtl_dev_err(hdev, "download fw command failed (%ld)",
844 rtl_dev_err(hdev, "download fw event length mismatch");
854 skb = btrtl_read_local_version(hdev);
857 rtl_dev_err(hdev, "read local version failed");
862 rtl_dev_info(hdev, "fw version 0x%04x%04x",
871 static int rtl_load_file(struct hci_dev *hdev, const char *name, u8 **buff)
876 rtl_dev_info(hdev, "loading %s", name);
877 ret = request_firmware(&fw, name, &hdev->dev);
892 static int btrtl_setup_rtl8723a(struct hci_dev *hdev,
902 rtl_dev_err(hdev, "unexpected EPATCH signature!");
906 return rtl_download_firmware(hdev, btrtl_dev->fw_data,
910 static int btrtl_setup_rtl8723b(struct hci_dev *hdev,
917 ret = rtlbt_parse_firmware(hdev, btrtl_dev, &fw_data);
937 rtl_dev_info(hdev, "cfg_sz %d, total sz %d", btrtl_dev->cfg_len, ret);
939 ret = rtl_download_firmware(hdev, fw_data, ret);
946 static void btrtl_coredump(struct hci_dev *hdev)
950 __hci_cmd_send(hdev, RTL_VSC_OP_COREDUMP, sizeof(param), param);
953 static void btrtl_dmp_hdr(struct hci_dev *hdev, struct sk_buff *skb)
955 struct btrealtek_data *coredump_info = hci_get_priv(hdev);
976 static void btrtl_register_devcoredump_support(struct hci_dev *hdev)
978 hci_devcd_register(hdev, btrtl_coredump, btrtl_dmp_hdr, NULL);
982 void btrtl_set_driver_name(struct hci_dev *hdev, const char *driver_name)
984 struct btrealtek_data *coredump_info = hci_get_priv(hdev);
1002 static int rtl_read_chip_type(struct hci_dev *hdev, u8 *type)
1009 skb = __hci_cmd_sync(hdev, 0xfc61, 5, cmd_buf, HCI_INIT_TIMEOUT);
1011 rtl_dev_err(hdev, "Read chip type failed (%ld)",
1018 rtl_dev_err(hdev, "RTL chip type event length mismatch");
1023 rtl_dev_info(hdev, "chip_type status=%x type=%x",
1048 struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
1051 struct btrealtek_data *coredump_info = hci_get_priv(hdev);
1072 ret = btrtl_vendor_read_reg16(hdev, RTL_CHIP_SUBVER, reg_val);
1078 ret = btrtl_vendor_read_reg16(hdev, RTL_CHIP_REV, reg_val);
1088 hci_ver, hdev->bus,
1094 skb = btrtl_read_local_version(hdev);
1110 ret = rtl_read_chip_type(hdev, &chip_type);
1116 hdev->bus, chip_type);
1119 rtl_dev_info(hdev, "examining hci_ver=%02x hci_rev=%04x lmp_ver=%02x lmp_subver=%04x",
1139 ret = hdev->send(hdev, skb);
1141 bt_dev_err(hdev, "sending frame failed (%d)", ret);
1155 rtl_dev_info(hdev, "unknown IC info, lmp subver %04x, hci rev %04x, hci ver %04x",
1161 ret = rtl_read_rom_version(hdev, &btrtl_dev->rom_version);
1175 btrtl_dev->fw_len = rtl_load_file(hdev, fw_name,
1182 btrtl_dev->fw_len = rtl_load_file(hdev, fw_name,
1187 rtl_dev_err(hdev, "firmware file %s not found",
1201 btrtl_dev->cfg_len = rtl_load_file(hdev, cfg_name,
1205 rtl_dev_err(hdev, "mandatory config file %s not found",
1216 hci_set_msft_opcode(hdev, 0xFCF0);
1230 int btrtl_download_firmware(struct hci_dev *hdev,
1242 rtl_dev_info(hdev, "assuming no firmware upload needed");
1249 err = btrtl_setup_rtl8723a(hdev, btrtl_dev);
1258 err = btrtl_setup_rtl8723b(hdev, btrtl_dev);
1261 rtl_dev_info(hdev, "assuming no firmware upload needed");
1266 btrtl_register_devcoredump_support(hdev);
1272 void btrtl_set_quirks(struct hci_dev *hdev, struct btrtl_device_info *btrtl_dev)
1277 set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
1290 set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks);
1291 set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks);
1297 btrealtek_set_flag(hdev, REALTEK_ALT6_CONTINUOUS_TX_CHIP);
1301 set_bit(HCI_QUIRK_USE_MSFT_EXT_ADDRESS_FILTER, &hdev->quirks);
1303 hci_set_aosp_capable(hdev);
1306 rtl_dev_dbg(hdev, "Central-peripheral role not enabled.");
1307 rtl_dev_dbg(hdev, "WBS supported not enabled.");
1321 &hdev->quirks);
1329 int btrtl_setup_realtek(struct hci_dev *hdev)
1334 btrtl_dev = btrtl_initialize(hdev, NULL);
1338 ret = btrtl_download_firmware(hdev, btrtl_dev);
1340 btrtl_set_quirks(hdev, btrtl_dev);
1342 hci_set_hw_info(hdev,
1354 int btrtl_shutdown_realtek(struct hci_dev *hdev)
1362 skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
1365 bt_dev_err(hdev, "HCI reset during shutdown failed");
1411 int btrtl_get_uart_settings(struct hci_dev *hdev,
1423 rtl_dev_warn(hdev, "no config loaded");
1429 rtl_dev_err(hdev, "invalid config magic");
1434 rtl_dev_err(hdev, "config is too short");
1444 rtl_dev_err(hdev, "invalid UART config entry");
1461 rtl_dev_dbg(hdev, "skipping config entry 0x%x (len %u)",
1470 rtl_dev_err(hdev, "no UART config entry found");
1474 rtl_dev_dbg(hdev, "device baudrate = 0x%08x", *device_baudrate);
1475 rtl_dev_dbg(hdev, "controller baudrate = %u", *controller_baudrate);
1476 rtl_dev_dbg(hdev, "flow control %d", *flow_control);