All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/5] Bluetooth: btmtk: add the function to get the fw name
@ 2024-04-25 22:06 sean.wang
  2024-04-25 22:06 ` [PATCH v3 2/5] Bluetooth: btmtk: apply the common btmtk_fw_get_filename sean.wang
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: sean.wang @ 2024-04-25 22:06 UTC (permalink / raw)
  To: marcel, johan.hedberg, luiz.dentz
  Cc: linux-bluetooth, linux-mediatek, linux-kernel, Sean Wang

From: Sean Wang <sean.wang@mediatek.com>

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>
---
v3: first added to the series
---
 drivers/bluetooth/btmtk.c | 13 +++++++++++++
 drivers/bluetooth/btmtk.h |  6 ++++++
 2 files changed, 19 insertions(+)

diff --git a/drivers/bluetooth/btmtk.c b/drivers/bluetooth/btmtk.c
index e882613036a0..7ead7f967019 100644
--- a/drivers/bluetooth/btmtk.c
+++ b/drivers/bluetooth/btmtk.c
@@ -103,6 +103,19 @@ 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)
+{
+	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
+		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)
 {
diff --git a/drivers/bluetooth/btmtk.h b/drivers/bluetooth/btmtk.h
index 56f5502baadf..ef225980f110 100644
--- a/drivers/bluetooth/btmtk.h
+++ b/drivers/bluetooth/btmtk.h
@@ -159,6 +159,8 @@ 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);
 #else
 
 static inline int btmtk_set_bdaddr(struct hci_dev *hdev,
@@ -193,4 +195,8 @@ 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)
+{
+}
 #endif
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-04-25 22:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-25 22:06 [PATCH v3 1/5] Bluetooth: btmtk: add the function to get the fw name sean.wang
2024-04-25 22:06 ` [PATCH v3 2/5] Bluetooth: btmtk: apply the common btmtk_fw_get_filename sean.wang
2024-04-25 22:06 ` [PATCH v3 3/5] Bluetooth: btusb: mediatek: refactor the function btusb_mtk_reset sean.wang
2024-04-25 22:06 ` [PATCH v3 4/5] Bluetooth: btusb: mediatek: reset the controller before downloading the fw sean.wang
2024-04-25 22:06 ` [PATCH v3 5/5] Bluetooth: btusb: mediatek: add MT7922 subsystem reset sean.wang
2024-04-25 22:12 ` [v3,1/5] Bluetooth: btmtk: add the function to get the fw name bluez.test.bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.