]> www.infradead.org Git - nvme.git/commitdiff
Bluetooth: btmtk: add the function to get the fw name
authorSean Wang <sean.wang@mediatek.com>
Wed, 15 May 2024 23:15:17 +0000 (16:15 -0700)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Mon, 15 Jul 2024 01:33:26 +0000 (21:33 -0400)
Include a shared function to get the firmware name, to prevent repeating
code for similar chipsets.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
drivers/bluetooth/btmtk.c
drivers/bluetooth/btmtk.h

index 812fd2a8f853e1dc305fa6aab04db8098ea28872..a27c251bf56e4925031740202435637c5946913c 100644 (file)
@@ -103,6 +103,24 @@ static void btmtk_coredump_notify(struct hci_dev *hdev, int state)
        }
 }
 
+void btmtk_fw_get_filename(char *buf, size_t size, u32 dev_id, u32 fw_ver,
+                          u32 fw_flavor)
+{
+       if (dev_id == 0x7925)
+               snprintf(buf, size,
+                        "mediatek/mt%04x/BT_RAM_CODE_MT%04x_1_%x_hdr.bin",
+                        dev_id & 0xffff, dev_id & 0xffff, (fw_ver & 0xff) + 1);
+       else if (dev_id == 0x7961 && fw_flavor)
+               snprintf(buf, size,
+                        "mediatek/BT_RAM_CODE_MT%04x_1a_%x_hdr.bin",
+                        dev_id & 0xffff, (fw_ver & 0xff) + 1);
+       else
+               snprintf(buf, size,
+                        "mediatek/BT_RAM_CODE_MT%04x_1_%x_hdr.bin",
+                        dev_id & 0xffff, (fw_ver & 0xff) + 1);
+}
+EXPORT_SYMBOL_GPL(btmtk_fw_get_filename);
+
 int btmtk_setup_firmware_79xx(struct hci_dev *hdev, const char *fwname,
                              wmt_cmd_sync_func_t wmt_cmd_sync)
 {
index cbcdb99a22e6ddb8ea407ce2a36a06674d61fa53..e76b8a358be880f7b2635ad4bf4ce57f51c63f05 100644 (file)
@@ -160,6 +160,9 @@ int btmtk_register_coredump(struct hci_dev *hdev, const char *name,
                            u32 fw_version);
 
 int btmtk_process_coredump(struct hci_dev *hdev, struct sk_buff *skb);
+
+void btmtk_fw_get_filename(char *buf, size_t size, u32 dev_id, u32 fw_ver,
+                          u32 fw_flavor);
 #else
 
 static inline int btmtk_set_bdaddr(struct hci_dev *hdev,
@@ -194,4 +197,9 @@ static int btmtk_process_coredump(struct hci_dev *hdev, struct sk_buff *skb)
 {
        return -EOPNOTSUPP;
 }
+
+static void btmtk_fw_get_filename(char *buf, size_t size, u32 dev_id,
+                                 u32 fw_ver, u32 fw_flavor)
+{
+}
 #endif