diff mbox series

[v5,1/5] Bluetooth: btmtk: add the function to get the fw name

Message ID ce0337178bf617d52ff320a36837d75bf537df2d.1715813148.git.sean.wang@kernel.org (mailing list archive)
State New, archived
Headers show
Series [v5,1/5] Bluetooth: btmtk: add the function to get the fw name | expand

Commit Message

Sean Wang May 15, 2024, 11:15 p.m. UTC
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
v4: rebase onto the latest code and add an additional parameter
    fw_flavor into the function btmtk_fw_get_filename.
v5: fix an issue about the directive output truncated writing caught by
    the linux test robot
---
 drivers/bluetooth/btmtk.c | 18 ++++++++++++++++++
 drivers/bluetooth/btmtk.h |  8 ++++++++
 2 files changed, 26 insertions(+)

Comments

patchwork-bot+bluetooth@kernel.org May 20, 2024, 7:40 p.m. UTC | #1
Hello:

This series was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Wed, 15 May 2024 16:15:17 -0700 you wrote:
> 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>
> 
> [...]

Here is the summary with links:
  - [v5,1/5] Bluetooth: btmtk: add the function to get the fw name
    https://git.kernel.org/bluetooth/bluetooth-next/c/1a9f00aa23b8
  - [v5,2/5] Bluetooth: btmtk: apply the common btmtk_fw_get_filename
    https://git.kernel.org/bluetooth/bluetooth-next/c/8a5b9ee69fe6
  - [v5,3/5] Bluetooth: btusb: mediatek: refactor the function btusb_mtk_reset
    https://git.kernel.org/bluetooth/bluetooth-next/c/9d5a3b40987d
  - [v5,4/5] Bluetooth: btusb: mediatek: reset the controller before downloading the fw
    https://git.kernel.org/bluetooth/bluetooth-next/c/8f9fa6c70d35
  - [v5,5/5] Bluetooth: btusb: mediatek: add MT7922 subsystem reset
    https://git.kernel.org/bluetooth/bluetooth-next/c/2a6bc5724952

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/bluetooth/btmtk.c b/drivers/bluetooth/btmtk.c
index 812fd2a8f853..a27c251bf56e 100644
--- a/drivers/bluetooth/btmtk.c
+++ b/drivers/bluetooth/btmtk.c
@@ -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)
 {
diff --git a/drivers/bluetooth/btmtk.h b/drivers/bluetooth/btmtk.h
index cbcdb99a22e6..e76b8a358be8 100644
--- a/drivers/bluetooth/btmtk.h
+++ b/drivers/bluetooth/btmtk.h
@@ -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