[PATCH 3/5][SRU][U/OEM-5.10] UBUNTU: SAUCE: Bluetooth: btusb: Define a function to construct firmware filename
You-Sheng Yang
vicamo.yang at canonical.com
Fri Dec 4 09:57:58 UTC 2020
From: Kiran K <kiran.k at intel.com>
BugLink: https://bugs.launchpad.net/bugs/1890130
Define a new function to construct firmware/ddc filename for new
generation Intel controllers
Signed-off-by: Kiran K <kiran.k at intel.com>
(cherry picked from commit 7dd7abdd9d858d716c6d46341e805cf15789bc99
https://lore.kernel.org/linux-bluetooth/20201119113943.13839-3-kiran.k@intel.com/)
Signed-off-by: You-Sheng Yang <vicamo.yang at canonical.com>
---
drivers/bluetooth/btintel.h | 6 ++++++
drivers/bluetooth/btusb.c | 17 +++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/drivers/bluetooth/btintel.h b/drivers/bluetooth/btintel.h
index 78cc64b42b30..6511b091caf5 100644
--- a/drivers/bluetooth/btintel.h
+++ b/drivers/bluetooth/btintel.h
@@ -132,6 +132,12 @@ struct intel_debug_features {
__u8 page1[16];
} __packed;
+#define INTEL_HW_PLATFORM(cnvx_bt) ((u8)(((cnvx_bt) & 0x0000ff00) >> 8))
+#define INTEL_HW_VARIANT(cnvx_bt) ((u8)(((cnvx_bt) & 0x003f0000) >> 16))
+#define INTEL_CNVX_TOP_TYPE(cnvx_top) ((cnvx_top) & 0x00000fff)
+#define INTEL_CNVX_TOP_STEP(cnvx_top) (((cnvx_top) & 0x0f000000) >> 24)
+#define INTEL_CNVX_TOP_PACK_SWAB(t, s) __swab16(((__u16)(((t) << 4) | (s))))
+
#if IS_ENABLED(CONFIG_BT_INTEL)
int btintel_check_bdaddr(struct hci_dev *hdev);
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 015b43b932ea..c0deef9fa011 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2361,6 +2361,21 @@ static bool btusb_setup_intel_new_get_fw_name(struct intel_version *ver,
return true;
}
+static void btusb_setup_intel_newgen_get_fw_name(const struct intel_version_tlv *ver_tlv,
+ char *fw_name, size_t len,
+ const char *suffix)
+{
+ /* The firmware file name for new generation controllers will be
+ * ibt-<cnvi_top type+cnvi_top step>-<cnvr_top type+cnvr_top step>
+ */
+ snprintf(fw_name, len, "intel/ibt-%04x-%04x.%s",
+ INTEL_CNVX_TOP_PACK_SWAB(INTEL_CNVX_TOP_TYPE(ver_tlv->cnvi_top),
+ INTEL_CNVX_TOP_STEP(ver_tlv->cnvi_top)),
+ INTEL_CNVX_TOP_PACK_SWAB(INTEL_CNVX_TOP_TYPE(ver_tlv->cnvr_top),
+ INTEL_CNVX_TOP_STEP(ver_tlv->cnvr_top)),
+ suffix);
+}
+
static int btusb_intel_download_firmware(struct hci_dev *hdev,
struct intel_version *ver,
struct intel_boot_params *params,
@@ -2782,6 +2797,8 @@ static int btusb_setup_intel_newgen(struct hci_dev *hdev)
clear_bit(BTUSB_BOOTLOADER, &data->flags);
+ btusb_setup_intel_newgen_get_fw_name(&version, ddcname, sizeof(ddcname),
+ "ddc");
/* Once the device is running in operational mode, it needs to
* apply the device configuration (DDC) parameters.
*
--
2.29.2
More information about the kernel-team
mailing list