All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hui Wang <hui.wang@canonical.com>
To: linux-bluetooth@vger.kernel.org, marcel@holtmann.org
Subject: [PATCH] Bluetooth: btusb: Add a parameter to load fw forcibly for Intel BT
Date: Mon, 30 Nov 2020 13:27:53 +0800	[thread overview]
Message-ID: <20201130052753.111742-1-hui.wang@canonical.com> (raw)

On the machines with Intel new BT module, if users run reboot, the BT
driver will not load the firmware from rootfs during boot since it is
already in operational mode. This will confuse the users if users
update the BT firmware and expect the updated firmware to fix some
problems.

Let the driver print a message to tell users the firmware is not
loaded and add a module parameter to let driver forcibly load the
firmware from rootfs. After users read this message, they could set
this parameter to load the firmware forcibly.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
---
 drivers/bluetooth/btusb.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 1005b6e8ff74..d4fceedd354b 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -32,6 +32,7 @@ static bool force_scofix;
 static bool enable_autosuspend = IS_ENABLED(CONFIG_BT_HCIBTUSB_AUTOSUSPEND);
 
 static bool reset = true;
+static bool force_load_fw;
 
 static struct usb_driver btusb_driver;
 
@@ -2589,8 +2590,15 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
 		return err;
 
 	/* controller is already having an operational firmware */
-	if (ver.fw_variant == 0x23)
+	if (ver.fw_variant == 0x23) {
+		if (force_load_fw) {
+			btintel_reset_to_bootloader(hdev);
+			force_load_fw = false;
+			return -EAGAIN;
+		}
+		bt_dev_info(hdev, "already in operational mode, not load fw. Set force_load_fw=1 to load fw forcibly");
 		goto finish;
+	}
 
 	rettime = ktime_get();
 	delta = ktime_sub(rettime, calltime);
@@ -4451,6 +4459,9 @@ MODULE_PARM_DESC(enable_autosuspend, "Enable USB autosuspend by default");
 module_param(reset, bool, 0644);
 MODULE_PARM_DESC(reset, "Send HCI reset command on initialization");
 
+module_param(force_load_fw, bool, 0644);
+MODULE_PARM_DESC(force_load_fw, "Let Intel BT module load the fw unconditionally during boot");
+
 MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
 MODULE_DESCRIPTION("Generic Bluetooth USB driver ver " VERSION);
 MODULE_VERSION(VERSION);
-- 
2.25.1


             reply	other threads:[~2020-11-30  5:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-30  5:27 Hui Wang [this message]
2020-11-30  6:01 ` Bluetooth: btusb: Add a parameter to load fw forcibly for Intel BT bluez.test.bot
2020-11-30 17:05 ` [PATCH] " Marcel Holtmann
2020-12-01  5:46   ` Hui Wang
2021-02-05 13:26     ` Hui Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201130052753.111742-1-hui.wang@canonical.com \
    --to=hui.wang@canonical.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.