Lines Matching +full:driver +full:- +full:strength +full:- +full:ohm

1 // SPDX-License-Identifier: GPL-2.0-or-later
69 if (skb->len != sizeof(*bda)) { in btintel_check_bdaddr()
72 return -EIO; in btintel_check_bdaddr()
75 bda = (struct hci_rp_read_bd_addr *)skb->data; in btintel_check_bdaddr()
82 if (!bacmp(&bda->bdaddr, BDADDR_INTEL)) { in btintel_check_bdaddr()
84 &bda->bdaddr); in btintel_check_bdaddr()
85 set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks); in btintel_check_bdaddr()
193 if (err == -ENODATA) in btintel_set_diag()
263 if (skb->len != 13) { in btintel_hw_error()
269 bt_dev_err(hdev, "Exception info %s", (char *)(skb->data + 1)); in btintel_hw_error()
282 if (ver->hw_platform != 0x37) { in btintel_version_info()
284 ver->hw_platform); in btintel_version_info()
285 return -EINVAL; in btintel_version_info()
294 switch (ver->hw_variant) { in btintel_version_info()
295 case 0x07: /* WP - Legacy ROM */ in btintel_version_info()
296 case 0x08: /* StP - Legacy ROM */ in btintel_version_info()
306 ver->hw_variant); in btintel_version_info()
307 return -EINVAL; in btintel_version_info()
310 switch (ver->fw_variant) { in btintel_version_info()
324 bt_dev_err(hdev, "Unsupported firmware variant(%02x)", ver->fw_variant); in btintel_version_info()
325 return -EINVAL; in btintel_version_info()
328 coredump_info.hw_variant = ver->hw_variant; in btintel_version_info()
329 coredump_info.fw_build_num = ver->fw_build_num; in btintel_version_info()
332 variant, ver->fw_revision >> 4, ver->fw_revision & 0x0f, in btintel_version_info()
333 ver->fw_build_num, ver->fw_build_ww, in btintel_version_info()
334 2000 + ver->fw_build_yy); in btintel_version_info()
357 plen -= fragment_len; in btintel_secure_send()
371 err = request_firmware_direct(&fw, ddc_name, &hdev->dev); in btintel_load_ddc_config()
380 fw_ptr = fw->data; in btintel_load_ddc_config()
383 * Length (1 byte), DDC ID (2 bytes), and DDC value (Length - 2). in btintel_load_ddc_config()
385 while (fw->size > fw_ptr - fw->data) { in btintel_load_ddc_config()
438 if (!skb || skb->len != sizeof(*ver)) { in btintel_read_version()
441 return -EILSEQ; in btintel_read_version()
444 memcpy(ver, skb->data, sizeof(*ver)); in btintel_read_version()
460 if (INTEL_HW_PLATFORM(version->cnvi_bt) != 0x37) { in btintel_version_info_tlv()
462 INTEL_HW_PLATFORM(version->cnvi_bt)); in btintel_version_info_tlv()
463 return -EINVAL; in btintel_version_info_tlv()
472 switch (INTEL_HW_VARIANT(version->cnvi_bt)) { in btintel_version_info_tlv()
475 case 0x19: /* Slr-F */ in btintel_version_info_tlv()
483 INTEL_HW_VARIANT(version->cnvi_bt)); in btintel_version_info_tlv()
484 return -EINVAL; in btintel_version_info_tlv()
487 switch (version->img_type) { in btintel_version_info_tlv()
494 if (version->limited_cce != 0x00) { in btintel_version_info_tlv()
496 version->limited_cce); in btintel_version_info_tlv()
497 return -EINVAL; in btintel_version_info_tlv()
501 if (version->sbe_type > 0x01) { in btintel_version_info_tlv()
503 version->sbe_type); in btintel_version_info_tlv()
504 return -EINVAL; in btintel_version_info_tlv()
507 bt_dev_info(hdev, "Device revision is %u", version->dev_rev_id); in btintel_version_info_tlv()
509 version->secure_boot ? "enabled" : "disabled"); in btintel_version_info_tlv()
511 version->otp_lock ? "enabled" : "disabled"); in btintel_version_info_tlv()
513 version->api_lock ? "enabled" : "disabled"); in btintel_version_info_tlv()
515 version->debug_lock ? "enabled" : "disabled"); in btintel_version_info_tlv()
517 version->min_fw_build_nn, version->min_fw_build_cw, in btintel_version_info_tlv()
518 2000 + version->min_fw_build_yy); in btintel_version_info_tlv()
527 bt_dev_err(hdev, "Unsupported image type(%02x)", version->img_type); in btintel_version_info_tlv()
528 return -EINVAL; in btintel_version_info_tlv()
531 coredump_info.hw_variant = INTEL_HW_VARIANT(version->cnvi_bt); in btintel_version_info_tlv()
532 coredump_info.fw_build_num = version->build_num; in btintel_version_info_tlv()
535 2000 + (version->timestamp >> 8), version->timestamp & 0xff, in btintel_version_info_tlv()
536 version->build_type, version->build_num); in btintel_version_info_tlv()
537 if (version->img_type == BTINTEL_IMG_OP) in btintel_version_info_tlv()
538 bt_dev_info(hdev, "Firmware SHA1: 0x%8.8x", version->git_sha1); in btintel_version_info_tlv()
556 while (skb->len) { in btintel_parse_version_tlv()
560 if (skb->len < sizeof(*tlv)) in btintel_parse_version_tlv()
561 return -EINVAL; in btintel_parse_version_tlv()
563 tlv = (struct intel_tlv *)skb->data; in btintel_parse_version_tlv()
566 if (skb->len < tlv->len + sizeof(*tlv)) in btintel_parse_version_tlv()
567 return -EINVAL; in btintel_parse_version_tlv()
569 switch (tlv->type) { in btintel_parse_version_tlv()
571 version->cnvi_top = get_unaligned_le32(tlv->val); in btintel_parse_version_tlv()
574 version->cnvr_top = get_unaligned_le32(tlv->val); in btintel_parse_version_tlv()
577 version->cnvi_bt = get_unaligned_le32(tlv->val); in btintel_parse_version_tlv()
580 version->cnvr_bt = get_unaligned_le32(tlv->val); in btintel_parse_version_tlv()
583 version->dev_rev_id = get_unaligned_le16(tlv->val); in btintel_parse_version_tlv()
586 version->img_type = tlv->val[0]; in btintel_parse_version_tlv()
593 version->min_fw_build_cw = tlv->val[0]; in btintel_parse_version_tlv()
594 version->min_fw_build_yy = tlv->val[1]; in btintel_parse_version_tlv()
595 version->timestamp = get_unaligned_le16(tlv->val); in btintel_parse_version_tlv()
598 version->build_type = tlv->val[0]; in btintel_parse_version_tlv()
605 version->min_fw_build_nn = tlv->val[0]; in btintel_parse_version_tlv()
606 version->build_num = get_unaligned_le32(tlv->val); in btintel_parse_version_tlv()
609 version->secure_boot = tlv->val[0]; in btintel_parse_version_tlv()
612 version->otp_lock = tlv->val[0]; in btintel_parse_version_tlv()
615 version->api_lock = tlv->val[0]; in btintel_parse_version_tlv()
618 version->debug_lock = tlv->val[0]; in btintel_parse_version_tlv()
621 version->min_fw_build_nn = tlv->val[0]; in btintel_parse_version_tlv()
622 version->min_fw_build_cw = tlv->val[1]; in btintel_parse_version_tlv()
623 version->min_fw_build_yy = tlv->val[2]; in btintel_parse_version_tlv()
626 version->limited_cce = tlv->val[0]; in btintel_parse_version_tlv()
629 version->sbe_type = tlv->val[0]; in btintel_parse_version_tlv()
632 memcpy(&version->otp_bd_addr, tlv->val, in btintel_parse_version_tlv()
636 version->git_sha1 = get_unaligned_le32(tlv->val); in btintel_parse_version_tlv()
639 snprintf(version->fw_id, sizeof(version->fw_id), in btintel_parse_version_tlv()
640 "%s", tlv->val); in btintel_parse_version_tlv()
647 skb_pull(skb, tlv->len + sizeof(*tlv)); in btintel_parse_version_tlv()
661 return -EINVAL; in btintel_read_version_tlv()
670 if (skb->data[0]) { in btintel_read_version_tlv()
672 skb->data[0]); in btintel_read_version_tlv()
674 return -EIO; in btintel_read_version_tlv()
683 /* ------- REGMAP IBT SUPPORT ------- */
718 return -EINVAL; in regmap_ibt_read()
731 return -EINVAL; in regmap_ibt_read()
734 /* regmap provides a little-endian formatted addr */ in regmap_ibt_read()
738 bt_dev_dbg(ctx->hdev, "Register (0x%x) read", le32_to_cpu(cp.addr)); in regmap_ibt_read()
740 skb = hci_cmd_sync(ctx->hdev, ctx->op_read, sizeof(cp), &cp, in regmap_ibt_read()
744 bt_dev_err(ctx->hdev, "regmap: Register (0x%x) read error (%d)", in regmap_ibt_read()
749 if (skb->len != sizeof(*rp) + val_size) { in regmap_ibt_read()
750 bt_dev_err(ctx->hdev, "regmap: Register (0x%x) read error, bad len", in regmap_ibt_read()
752 err = -EINVAL; in regmap_ibt_read()
756 rp = (struct ibt_rp_reg_access *)skb->data; in regmap_ibt_read()
758 if (rp->addr != cp.addr) { in regmap_ibt_read()
759 bt_dev_err(ctx->hdev, "regmap: Register (0x%x) read error, bad addr", in regmap_ibt_read()
760 le32_to_cpu(rp->addr)); in regmap_ibt_read()
761 err = -EINVAL; in regmap_ibt_read()
765 memcpy(val, rp->data, val_size); in regmap_ibt_read()
784 return -EINVAL; in regmap_ibt_gather_write()
797 return -EINVAL; in regmap_ibt_gather_write()
802 return -ENOMEM; in regmap_ibt_gather_write()
804 /* regmap provides a little-endian formatted addr/value */ in regmap_ibt_gather_write()
805 cp->addr = *(__le32 *)addr; in regmap_ibt_gather_write()
806 cp->mode = mode; in regmap_ibt_gather_write()
807 cp->len = val_size; in regmap_ibt_gather_write()
808 memcpy(&cp->data, val, val_size); in regmap_ibt_gather_write()
810 bt_dev_dbg(ctx->hdev, "Register (0x%x) write", le32_to_cpu(cp->addr)); in regmap_ibt_gather_write()
812 skb = hci_cmd_sync(ctx->hdev, ctx->op_write, plen, cp, HCI_CMD_TIMEOUT); in regmap_ibt_gather_write()
815 bt_dev_err(ctx->hdev, "regmap: Register (0x%x) write error (%d)", in regmap_ibt_gather_write()
816 le32_to_cpu(cp->addr), err); in regmap_ibt_gather_write()
832 return -EINVAL; in regmap_ibt_write()
834 return regmap_ibt_gather_write(context, data, 4, data + 4, count - 4); in regmap_ibt_write()
863 bt_dev_info(hdev, "regmap: Init R%x-W%x region", opcode_read, in btintel_regmap_init()
868 return ERR_PTR(-ENOMEM); in btintel_regmap_init()
870 ctx->op_read = opcode_read; in btintel_regmap_init()
871 ctx->op_write = opcode_write; in btintel_regmap_init()
872 ctx->hdev = hdev; in btintel_regmap_init()
874 return regmap_init(&hdev->dev, &regmap_ibt, ctx, &regmap_ibt_cfg); in btintel_regmap_init()
910 if (skb->len != sizeof(*params)) { in btintel_read_boot_params()
913 return -EILSEQ; in btintel_read_boot_params()
916 memcpy(params, skb->data, sizeof(*params)); in btintel_read_boot_params()
920 if (params->status) { in btintel_read_boot_params()
922 params->status); in btintel_read_boot_params()
923 return -bt_to_errno(params->status); in btintel_read_boot_params()
927 le16_to_cpu(params->dev_revid)); in btintel_read_boot_params()
930 params->secure_boot ? "enabled" : "disabled"); in btintel_read_boot_params()
933 params->otp_lock ? "enabled" : "disabled"); in btintel_read_boot_params()
936 params->api_lock ? "enabled" : "disabled"); in btintel_read_boot_params()
939 params->debug_lock ? "enabled" : "disabled"); in btintel_read_boot_params()
942 params->min_fw_build_nn, params->min_fw_build_cw, in btintel_read_boot_params()
943 2000 + params->min_fw_build_yy); in btintel_read_boot_params()
957 err = btintel_secure_send(hdev, 0x00, 128, fw->data); in btintel_sfi_rsa_header_secure_send()
966 err = btintel_secure_send(hdev, 0x03, 256, fw->data + 128); in btintel_sfi_rsa_header_secure_send()
975 err = btintel_secure_send(hdev, 0x02, 256, fw->data + 388); in btintel_sfi_rsa_header_secure_send()
993 err = btintel_secure_send(hdev, 0x00, 128, fw->data + 644); in btintel_sfi_ecdsa_header_secure_send()
1002 err = btintel_secure_send(hdev, 0x03, 96, fw->data + 644 + 128); in btintel_sfi_ecdsa_header_secure_send()
1011 err = btintel_secure_send(hdev, 0x02, 96, fw->data + 644 + 224); in btintel_sfi_ecdsa_header_secure_send()
1028 fw_ptr = fw->data + offset; in btintel_download_firmware_payload()
1030 err = -EINVAL; in btintel_download_firmware_payload()
1032 while (fw_ptr - fw->data < fw->size) { in btintel_download_firmware_payload()
1035 frag_len += sizeof(*cmd) + cmd->plen; in btintel_download_firmware_payload()
1070 fw_ptr = fw->data; in btintel_firmware_version()
1072 while (fw_ptr - fw->data < fw->size) { in btintel_firmware_version()
1080 if (le16_to_cpu(cmd->opcode) == CMD_WRITE_BOOT_PARAMS) { in btintel_firmware_version()
1085 *boot_addr = le32_to_cpu(params->boot_addr); in btintel_firmware_version()
1089 bt_dev_info(hdev, "Firmware Version: %u-%u.%u", in btintel_firmware_version()
1090 params->fw_build_num, params->fw_build_ww, in btintel_firmware_version()
1091 params->fw_build_yy); in btintel_firmware_version()
1093 return (num == params->fw_build_num && in btintel_firmware_version()
1094 ww == params->fw_build_ww && in btintel_firmware_version()
1095 yy == params->fw_build_yy); in btintel_firmware_version()
1098 fw_ptr += sizeof(*cmd) + cmd->plen; in btintel_firmware_version()
1114 switch (ver->hw_variant) { in btintel_download_firmware()
1122 if (btintel_firmware_version(hdev, ver->fw_build_num, in btintel_download_firmware()
1123 ver->fw_build_ww, ver->fw_build_yy, in btintel_download_firmware()
1126 /* Return -EALREADY to indicate that the firmware has in btintel_download_firmware()
1129 return -EALREADY; in btintel_download_firmware()
1141 if (ver->fw_variant == 0x23) in btintel_download_firmware()
1142 return -EINVAL; in btintel_download_firmware()
1161 if (btintel_firmware_version(hdev, ver->min_fw_build_nn, in btintel_download_fw_tlv()
1162 ver->min_fw_build_cw, in btintel_download_fw_tlv()
1163 ver->min_fw_build_yy, in btintel_download_fw_tlv()
1166 /* Return -EALREADY to indicate that firmware has in btintel_download_fw_tlv()
1169 return -EALREADY; in btintel_download_fw_tlv()
1180 if (ver->img_type == BTINTEL_IMG_OP) in btintel_download_fw_tlv()
1181 return -EINVAL; in btintel_download_fw_tlv()
1195 css_header_ver = get_unaligned_le32(fw->data + CSS_HEADER_OFFSET); in btintel_download_fw_tlv()
1198 return -EINVAL; in btintel_download_fw_tlv()
1205 return -EINVAL; in btintel_download_fw_tlv()
1217 if (fw->data[ECDSA_OFFSET] != 0x06) in btintel_download_fw_tlv()
1218 return -EINVAL; in btintel_download_fw_tlv()
1221 css_header_ver = get_unaligned_le32(fw->data + ECDSA_OFFSET + CSS_HEADER_OFFSET); in btintel_download_fw_tlv()
1224 return -EINVAL; in btintel_download_fw_tlv()
1258 if (hdev->bus == HCI_PCI) in btintel_reset_to_bootloader()
1262 * re-enumeration of BT controller. in btintel_reset_to_bootloader()
1307 /* Intel controller supports two pages, each page is of 128-bit in btintel_read_debug_features()
1318 if (skb->len != (sizeof(features->page1) + 3)) { in btintel_read_debug_features()
1321 return -EILSEQ; in btintel_read_debug_features()
1324 memcpy(features->page1, skb->data + 3, sizeof(features->page1)); in btintel_read_debug_features()
1343 return -EINVAL; in btintel_set_debug_features()
1346 if (!(features->page1[0] & 0x3f)) { in btintel_set_debug_features()
1391 return -EINVAL; in btintel_reset_debug_features()
1394 if (!(features->page1[0] & 0x3f)) { in btintel_reset_debug_features()
1471 snprintf(buf, sizeof(buf), "Driver: %s\n", coredump_info.driver_name); in btintel_dmp_hdr()
1491 return -EOPNOTSUPP; in btintel_register_devcoredump_support()
1507 "intel/ibt-hw-%x.%x.%x-fw-%x.%x.%x.%x.%x.bseq", in btintel_legacy_rom_get_fw()
1508 ver->hw_platform, ver->hw_variant, ver->hw_revision, in btintel_legacy_rom_get_fw()
1509 ver->fw_variant, ver->fw_revision, ver->fw_build_num, in btintel_legacy_rom_get_fw()
1510 ver->fw_build_ww, ver->fw_build_yy); in btintel_legacy_rom_get_fw()
1512 ret = request_firmware(&fw, fwname, &hdev->dev); in btintel_legacy_rom_get_fw()
1514 if (ret == -EINVAL) { in btintel_legacy_rom_get_fw()
1526 snprintf(fwname, sizeof(fwname), "intel/ibt-hw-%x.%x.bseq", in btintel_legacy_rom_get_fw()
1527 ver->hw_platform, ver->hw_variant); in btintel_legacy_rom_get_fw()
1528 if (request_firmware(&fw, fwname, &hdev->dev) < 0) { in btintel_legacy_rom_get_fw()
1549 int remain = fw->size - (*fw_ptr - fw->data); in btintel_legacy_rom_patching()
1560 return -EINVAL; in btintel_legacy_rom_patching()
1563 remain--; in btintel_legacy_rom_patching()
1567 remain -= sizeof(*cmd); in btintel_legacy_rom_patching()
1572 if (remain < cmd->plen) { in btintel_legacy_rom_patching()
1574 return -EFAULT; in btintel_legacy_rom_patching()
1583 if (*disable_patch && le16_to_cpu(cmd->opcode) == 0xfc8e) in btintel_legacy_rom_patching()
1587 *fw_ptr += cmd->plen; in btintel_legacy_rom_patching()
1588 remain -= cmd->plen; in btintel_legacy_rom_patching()
1599 remain--; in btintel_legacy_rom_patching()
1603 remain -= sizeof(*evt); in btintel_legacy_rom_patching()
1605 if (remain < evt->plen) { in btintel_legacy_rom_patching()
1607 return -EFAULT; in btintel_legacy_rom_patching()
1611 *fw_ptr += evt->plen; in btintel_legacy_rom_patching()
1612 remain -= evt->plen; in btintel_legacy_rom_patching()
1621 return -EFAULT; in btintel_legacy_rom_patching()
1624 skb = __hci_cmd_sync_ev(hdev, le16_to_cpu(cmd->opcode), cmd->plen, in btintel_legacy_rom_patching()
1625 cmd_param, evt->evt, HCI_INIT_TIMEOUT); in btintel_legacy_rom_patching()
1628 cmd->opcode, PTR_ERR(skb)); in btintel_legacy_rom_patching()
1636 if (skb->len != evt->plen) { in btintel_legacy_rom_patching()
1638 le16_to_cpu(cmd->opcode)); in btintel_legacy_rom_patching()
1640 return -EFAULT; in btintel_legacy_rom_patching()
1643 if (memcmp(skb->data, evt_param, evt->plen)) { in btintel_legacy_rom_patching()
1645 le16_to_cpu(cmd->opcode)); in btintel_legacy_rom_patching()
1647 return -EFAULT; in btintel_legacy_rom_patching()
1662 BT_DBG("%s", hdev->name); in btintel_legacy_rom_setup()
1668 if (ver->fw_patch_num) { in btintel_legacy_rom_setup()
1671 ver->fw_patch_num); in btintel_legacy_rom_setup()
1684 fw_ptr = fw->data; in btintel_legacy_rom_setup()
1687 * Only while this mode is enabled, the driver can download the in btintel_legacy_rom_setup()
1718 while (fw->size > fw_ptr - fw->data) { in btintel_legacy_rom_setup()
1740 * every power-on boot in btintel_legacy_rom_setup()
1797 if (err == -EINTR) { in btintel_download_wait()
1804 return -ETIMEDOUT; in btintel_download_wait()
1809 return -ENOEXEC; in btintel_download_wait()
1832 if (err == -EINTR) { in btintel_boot_wait()
1834 return -EINTR; in btintel_boot_wait()
1839 return -ETIMEDOUT; in btintel_boot_wait()
1863 if (err == -EINTR) { in btintel_boot_wait_d0()
1865 return -EINTR; in btintel_boot_wait_d0()
1870 return -ETIMEDOUT; in btintel_boot_wait_d0()
1907 if (err == -ETIMEDOUT) { in btintel_boot()
1912 if (hdev->bus == HCI_PCI) { in btintel_boot()
1913 /* In case of PCIe, after receiving bootup event, driver performs in btintel_boot()
1933 switch (ver->hw_variant) { in btintel_get_fw_name()
1936 snprintf(fw_name, len, "intel/ibt-%u-%u.%s", in btintel_get_fw_name()
1937 ver->hw_variant, in btintel_get_fw_name()
1938 le16_to_cpu(params->dev_revid), in btintel_get_fw_name()
1945 snprintf(fw_name, len, "intel/ibt-%u-%u-%u.%s", in btintel_get_fw_name()
1946 ver->hw_variant, in btintel_get_fw_name()
1947 ver->hw_revision, in btintel_get_fw_name()
1948 ver->fw_revision, in btintel_get_fw_name()
1952 return -EINVAL; in btintel_get_fw_name()
1969 return -EINVAL; in btintel_download_fw()
1984 if (ver->fw_variant == 0x23) { in btintel_download_fw()
1991 switch (ver->hw_variant) { in btintel_download_fw()
2012 if (params->limited_cce != 0x00) { in btintel_download_fw()
2014 params->limited_cce); in btintel_download_fw()
2015 return -EINVAL; in btintel_download_fw()
2021 if (!bacmp(&params->otp_bdaddr, BDADDR_ANY)) { in btintel_download_fw()
2023 set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks); in btintel_download_fw()
2031 * The firmware filename is ibt-<hw_variant>-<dev_revid>.sfi. in btintel_download_fw()
2045 * ibt-<hw_variant>-<hw_revision>-<fw_revision>.sfi. in btintel_download_fw()
2057 return -EINVAL; in btintel_download_fw()
2060 err = firmware_request_nowarn(&fw, fwname, &hdev->dev); in btintel_download_fw()
2075 if (fw->size < 644) { in btintel_download_fw()
2077 fw->size); in btintel_download_fw()
2078 err = -EBADF; in btintel_download_fw()
2089 if (err == -EALREADY) { in btintel_download_fw()
2115 if (err == -ETIMEDOUT) in btintel_download_fw()
2132 BT_DBG("%s", hdev->name); in btintel_bootloader_setup()
2147 if (ver->fw_variant == 0x23) in btintel_bootloader_setup()
2200 cnvi = INTEL_CNVX_TOP_PACK_SWAB(INTEL_CNVX_TOP_TYPE(ver->cnvi_top), in btintel_get_fw_name_tlv()
2201 INTEL_CNVX_TOP_STEP(ver->cnvi_top)); in btintel_get_fw_name_tlv()
2203 cnvr = INTEL_CNVX_TOP_PACK_SWAB(INTEL_CNVX_TOP_TYPE(ver->cnvr_top), in btintel_get_fw_name_tlv()
2204 INTEL_CNVX_TOP_STEP(ver->cnvr_top)); in btintel_get_fw_name_tlv()
2209 if (INTEL_HW_VARIANT(ver->cnvi_bt) >= 0x1e) { in btintel_get_fw_name_tlv()
2212 if (ver->img_type == BTINTEL_IMG_BOOTLOADER) { in btintel_get_fw_name_tlv()
2213 format = "intel/ibt-%04x-%04x-iml.%s"; in btintel_get_fw_name_tlv()
2220 /* ibt-<cnvi_top type+cnvi_top step>-<cnvr_top type+cnvr_top step-fw_id> */ in btintel_get_fw_name_tlv()
2221 if (memcmp(ver->fw_id, zero, sizeof(zero))) { in btintel_get_fw_name_tlv()
2222 format = "intel/ibt-%04x-%04x-%s.%s"; in btintel_get_fw_name_tlv()
2224 ver->fw_id, suffix); in btintel_get_fw_name_tlv()
2232 * ibt-<cnvi_top type+cnvi_top step>-<cnvr_top type+cnvr_top step> in btintel_get_fw_name_tlv()
2234 format = "intel/ibt-%04x-%04x.%s"; in btintel_get_fw_name_tlv()
2245 cnvi = INTEL_CNVX_TOP_PACK_SWAB(INTEL_CNVX_TOP_TYPE(ver->cnvi_top), in btintel_get_iml_tlv()
2246 INTEL_CNVX_TOP_STEP(ver->cnvi_top)); in btintel_get_iml_tlv()
2248 cnvr = INTEL_CNVX_TOP_PACK_SWAB(INTEL_CNVX_TOP_TYPE(ver->cnvr_top), in btintel_get_iml_tlv()
2249 INTEL_CNVX_TOP_STEP(ver->cnvr_top)); in btintel_get_iml_tlv()
2251 format = "intel/ibt-%04x-%04x-iml.%s"; in btintel_get_iml_tlv()
2265 return -EINVAL; in btintel_prepare_fw_download_tlv()
2280 if (ver->img_type == BTINTEL_IMG_OP) { in btintel_prepare_fw_download_tlv()
2289 if (!bacmp(&ver->otp_bd_addr, BDADDR_ANY)) { in btintel_prepare_fw_download_tlv()
2291 set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks); in btintel_prepare_fw_download_tlv()
2295 if (ver->img_type == BTINTEL_IMG_OP) { in btintel_prepare_fw_download_tlv()
2297 * FWID TLV may not be present and driver may attempt to load in btintel_prepare_fw_download_tlv()
2301 if (INTEL_HW_VARIANT(ver->cnvi_bt) >= 0x1e) in btintel_prepare_fw_download_tlv()
2309 err = firmware_request_nowarn(&fw, fwname, &hdev->dev); in btintel_prepare_fw_download_tlv()
2325 if (fw->size < 644) { in btintel_prepare_fw_download_tlv()
2327 fw->size); in btintel_prepare_fw_download_tlv()
2328 err = -EBADF; in btintel_prepare_fw_download_tlv()
2338 INTEL_HW_VARIANT(ver->cnvi_bt), in btintel_prepare_fw_download_tlv()
2339 ver->sbe_type); in btintel_prepare_fw_download_tlv()
2341 if (err == -EALREADY) { in btintel_prepare_fw_download_tlv()
2367 if (err == -ETIMEDOUT) in btintel_prepare_fw_download_tlv()
2382 return -EINVAL; in btintel_get_codec_config_data()
2389 return -EINVAL; in btintel_get_codec_config_data()
2394 err = -ENOMEM; in btintel_get_codec_config_data()
2399 switch (codec->id) { in btintel_get_codec_config_data()
2407 err = -EINVAL; in btintel_get_codec_config_data()
2408 bt_dev_err(hdev, "Invalid codec id(%u)", codec->id); in btintel_get_codec_config_data()
2411 /* codec and its capabilities are pre-defined to ids in btintel_get_codec_config_data()
2444 if (skb->len < sizeof(*use_cases)) { in btintel_configure_offload()
2445 err = -EIO; in btintel_configure_offload()
2449 use_cases = (void *)skb->data; in btintel_configure_offload()
2451 if (use_cases->status) { in btintel_configure_offload()
2452 err = -bt_to_errno(skb->data[0]); in btintel_configure_offload()
2456 if (use_cases->preset[0] & 0x03) { in btintel_configure_offload()
2457 hdev->get_data_path_id = btintel_get_data_path_id; in btintel_configure_offload()
2458 hdev->get_codec_config_data = btintel_get_codec_config_data; in btintel_configure_offload()
2476 switch (ver->cnvr_top & 0xFFF) { in btintel_set_ppag()
2481 ver->cnvr_top & 0xFFF); in btintel_set_ppag()
2494 bt_dev_dbg(hdev, "PPAG-BT: ACPI entry not found"); in btintel_set_ppag()
2497 bt_dev_warn(hdev, "PPAG-BT: ACPI Failure: %s", acpi_format_exception(status)); in btintel_set_ppag()
2502 if (p->type != ACPI_TYPE_PACKAGE || p->package.count != 2) { in btintel_set_ppag()
2503 bt_dev_warn(hdev, "PPAG-BT: Invalid object type: %d or package count: %d", in btintel_set_ppag()
2504 p->type, p->package.count); in btintel_set_ppag()
2509 elements = p->package.elements; in btintel_set_ppag()
2514 domain = (u32)p->package.elements[0].integer.value; in btintel_set_ppag()
2515 mode = (u32)p->package.elements[1].integer.value; in btintel_set_ppag()
2519 bt_dev_dbg(hdev, "PPAG-BT: Bluetooth domain is disabled in ACPI firmware"); in btintel_set_ppag()
2532 bt_dev_dbg(hdev, "PPAG-BT: EU, China mode are disabled in BIOS"); in btintel_set_ppag()
2544 bt_dev_info(hdev, "PPAG-BT: Enabled (Mode %d)", mode); in btintel_set_ppag()
2558 ret = -ENODEV; in btintel_acpi_reset_method()
2563 if (p->package.count != 1 || p->type != ACPI_TYPE_PACKAGE) { in btintel_acpi_reset_method()
2565 ret = -EINVAL; in btintel_acpi_reset_method()
2569 ref = &p->package.elements[0]; in btintel_acpi_reset_method()
2570 if (ref->type != ACPI_TYPE_LOCAL_REFERENCE) { in btintel_acpi_reset_method()
2571 bt_dev_err(hdev, "Invalid object type: 0x%x", ref->type); in btintel_acpi_reset_method()
2572 ret = -EINVAL; in btintel_acpi_reset_method()
2576 status = acpi_evaluate_object(ref->reference.handle, "_RST", NULL, NULL); in btintel_acpi_reset_method()
2579 ret = -ENODEV; in btintel_acpi_reset_method()
2612 switch (ver_tlv->cnvi_top & 0xfff) { in btintel_set_dsm_reset_method()
2655 data->acpi_reset_method = btintel_acpi_reset_method; in btintel_set_dsm_reset_method()
2667 __u16 handle = __le16_to_cpu(hci_acl_hdr(skb)->handle); in btintel_classify_pkt_type()
2681 * strength. The below structure represents DSBR data.
2687 * header - defines revision number of the structure
2688 * dsbr - defines drive strength BRI response
2690 * 0 - instructs bluetooth firmware to use default values
2691 * 1 - instructs bluetooth firmware to override default values
2699 * 1. 0xF1 - indicates that the resistor on board is 33 Ohm
2700 * 2. 0x00 or 0xB1 - indicates that the resistor on board is 10 Ohm
2701 * 3. Non existing UEFI variable or invalid (none of the above) - indicates
2702 * that the resistor on board is 10 Ohm
2703 * Even if uefi variable is not present, driver shall send 0xfc0a command to
2720 return -EOPNOTSUPP; in btintel_uefi_get_dsbr()
2723 return -EOPNOTSUPP; in btintel_uefi_get_dsbr()
2729 return -EIO; in btintel_uefi_get_dsbr()
2735 return -ENXIO; in btintel_uefi_get_dsbr()
2754 cnvi = ver->cnvi_top & 0xfff; in btintel_set_dsbr()
2763 if (ver->img_type == BTINTEL_IMG_IML && in btintel_set_dsbr()
2764 INTEL_CNVX_TOP_STEP(ver->cnvi_top) == 0x01) in btintel_set_dsbr()
2769 if (ver->img_type == BTINTEL_IMG_OP && in btintel_set_dsbr()
2770 hdev->bus == HCI_USB) in btintel_set_dsbr()
2791 return -bt_to_errno(PTR_ERR(skb)); in btintel_set_dsbr()
2793 status = skb->data[0]; in btintel_set_dsbr()
2797 return -bt_to_errno(status); in btintel_set_dsbr()
2832 if (ver->img_type == BTINTEL_IMG_OP) in btintel_bootloader_setup_tlv()
2843 /* set drive strength of BRI response */ in btintel_bootloader_setup_tlv()
2853 if (ver->img_type == BTINTEL_IMG_IML) { in btintel_bootloader_setup_tlv()
2944 if (skb->len < (sizeof(u32) * 16 + 2)) { in btintel_print_fseq_info()
2946 skb->len); in btintel_print_fseq_info()
2991 p = skb->data; in btintel_print_fseq_info()
2996 p = skb->data; in btintel_print_fseq_info()
3052 BT_DBG("%s", hdev->name); in btintel_setup_combined()
3095 if (skb->data[0]) { in btintel_setup_combined()
3097 skb->data[0]); in btintel_setup_combined()
3098 err = -EIO; in btintel_setup_combined()
3103 set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks); in btintel_setup_combined()
3104 set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks); in btintel_setup_combined()
3105 set_bit(HCI_QUIRK_NON_PERSISTENT_DIAG, &hdev->quirks); in btintel_setup_combined()
3108 hdev->set_quality_report = btintel_set_quality_report; in btintel_setup_combined()
3111 if (skb->len == sizeof(ver) && skb->data[1] == 0x37) { in btintel_setup_combined()
3114 memcpy(&ver, skb->data, sizeof(ver)); in btintel_setup_combined()
3134 * WBS for SdP - For the Legacy ROM products, only SdP in btintel_setup_combined()
3138 * the transport driver (btusb) based on the HW info in btintel_setup_combined()
3144 &hdev->quirks); in btintel_setup_combined()
3160 &hdev->quirks); in btintel_setup_combined()
3163 set_bit(HCI_QUIRK_BROKEN_LE_CODED, &hdev->quirks); in btintel_setup_combined()
3174 err = -EINVAL; in btintel_setup_combined()
3199 err = -EINVAL; in btintel_setup_combined()
3239 set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks); in btintel_setup_combined()
3242 set_bit(HCI_QUIRK_BROKEN_LE_CODED, &hdev->quirks); in btintel_setup_combined()
3252 /* Re-classify packet type for controllers with LE audio */ in btintel_setup_combined()
3253 hdev->classify_pkt_type = btintel_classify_pkt_type; in btintel_setup_combined()
3267 set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks); in btintel_setup_combined()
3284 err = -EINVAL; in btintel_setup_combined()
3336 hdev->manufacturer = 2; in btintel_configure_setup()
3337 hdev->setup = btintel_setup_combined; in btintel_configure_setup()
3338 hdev->shutdown = btintel_shutdown_combined; in btintel_configure_setup()
3339 hdev->hw_error = btintel_hw_error; in btintel_configure_setup()
3340 hdev->set_diag = btintel_set_diag_combined; in btintel_configure_setup()
3341 hdev->set_bdaddr = btintel_set_bdaddr; in btintel_configure_setup()
3351 struct intel_tlv *tlv = (void *)&skb->data[5]; in btintel_diagnostics()
3354 if (tlv->type != INTEL_TLV_TYPE_ID) in btintel_diagnostics()
3357 switch (tlv->val[0]) { in btintel_diagnostics()
3363 if (!hci_devcd_init(hdev, skb->len)) { in btintel_diagnostics()
3371 bt_dev_err(hdev, "Invalid exception type %02X", tlv->val[0]); in btintel_diagnostics()
3381 struct hci_event_hdr *hdr = (void *)skb->data; in btintel_recv_event()
3384 if (skb->len > HCI_EVENT_HDR_SIZE && hdr->evt == 0xff && in btintel_recv_event()
3385 hdr->plen > 0) { in btintel_recv_event()
3386 const void *ptr = skb->data + HCI_EVENT_HDR_SIZE + 1; in btintel_recv_event()
3387 unsigned int len = skb->len - HCI_EVENT_HDR_SIZE - 1; in btintel_recv_event()
3390 switch (skb->data[2]) { in btintel_recv_event()
3415 memcmp(&skb->data[2], diagnostics_hdr, in btintel_recv_event()
3445 if (evt->result) in btintel_secure_send_result()
3458 MODULE_FIRMWARE("intel/ibt-11-5.sfi");
3459 MODULE_FIRMWARE("intel/ibt-11-5.ddc");
3460 MODULE_FIRMWARE("intel/ibt-12-16.sfi");
3461 MODULE_FIRMWARE("intel/ibt-12-16.ddc");