All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] Bluetooth: btrtl: try config w/o postfix if postfixed one failed to load
       [not found] <20220422160231.1072810-1-icenowy@outlook.com>
@ 2022-04-22 16:02 ` icenowy
  2022-04-22 17:22   ` btrtl: try to use OF machine compatible as config postfix bluez.test.bot
  2022-04-22 16:02 ` [PATCH 2/3] Bluetooth: btrtl: use board DT compatible string " icenowy
  2022-04-22 16:02 ` [PATCH 3/3] Bluetooth: btrtl: allow longer config file name icenowy
  2 siblings, 1 reply; 4+ messages in thread
From: icenowy @ 2022-04-22 16:02 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz
  Cc: linux-bluetooth, linux-kernel, linux-sunxi, Icenowy Zheng

From: Icenowy Zheng <icenowy@sipeed.com>

We should try the non-prefixed config file name if the prefixed one
failed to load (possibly because of it does not exist).

Add this behavior to firmware-loading routine.

Signed-off-by: Icenowy Zheng <icenowy@sipeed.com>
---
 drivers/bluetooth/btrtl.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
index 481d488bca0f..1f834513762b 100644
--- a/drivers/bluetooth/btrtl.c
+++ b/drivers/bluetooth/btrtl.c
@@ -699,6 +699,12 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
 		}
 		btrtl_dev->cfg_len = rtl_load_file(hdev, cfg_name,
 						   &btrtl_dev->cfg_data);
+		if (postfix && btrtl_dev->cfg_len <= 0) {
+			snprintf(cfg_name, sizeof(cfg_name), "%s.bin",
+				 btrtl_dev->ic_info->cfg_name);
+			btrtl_dev->cfg_len = rtl_load_file(hdev, cfg_name,
+							&btrtl_dev->cfg_data);
+		}
 		if (btrtl_dev->ic_info->config_needed &&
 		    btrtl_dev->cfg_len <= 0) {
 			rtl_dev_err(hdev, "mandatory config file %s not found",
-- 
2.35.1


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

* [PATCH 2/3] Bluetooth: btrtl: use board DT compatible string as config postfix
       [not found] <20220422160231.1072810-1-icenowy@outlook.com>
  2022-04-22 16:02 ` [PATCH 1/3] Bluetooth: btrtl: try config w/o postfix if postfixed one failed to load icenowy
@ 2022-04-22 16:02 ` icenowy
  2022-04-22 16:02 ` [PATCH 3/3] Bluetooth: btrtl: allow longer config file name icenowy
  2 siblings, 0 replies; 4+ messages in thread
From: icenowy @ 2022-04-22 16:02 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz
  Cc: linux-bluetooth, linux-kernel, linux-sunxi, Icenowy Zheng

From: Icenowy Zheng <icenowy@sipeed.com>

Mimic the behavior of brcmfmac driver, which uses the DT compatible
string of the board as the NVRAM postfix.

Signed-off-by: Icenowy Zheng <icenowy@sipeed.com>
---
 drivers/bluetooth/hci_h5.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
index c5a0409ef84f..d1f90b23a5e0 100644
--- a/drivers/bluetooth/hci_h5.c
+++ b/drivers/bluetooth/hci_h5.c
@@ -817,6 +817,7 @@ static int h5_serdev_probe(struct serdev_device *serdev)
 {
 	struct device *dev = &serdev->dev;
 	struct h5 *h5;
+	struct device_node *root;
 	const struct h5_device_data *data;
 
 	h5 = devm_kzalloc(dev, sizeof(*h5), GFP_KERNEL);
@@ -847,6 +848,32 @@ static int h5_serdev_probe(struct serdev_device *serdev)
 			return -ENODEV;
 
 		h5->vnd = data->vnd;
+
+		/* Set id to the first string of the machine compatible prop */
+		root = of_find_node_by_path("/");
+		if (root) {
+			int i, len;
+			char *id;
+			const char *tmp;
+
+			of_property_read_string_index(root, "compatible", 0,
+						      &tmp);
+
+			/*
+			 * get rid of '/' in the compatible string to be able
+			 * to find the FW
+			 */
+			len = strlen(tmp) + 1;
+			id = devm_kzalloc(dev, len, GFP_KERNEL);
+			strscpy(id, tmp, len);
+			for (i = 0; i < id[i]; i++) {
+				if (id[i] == '/')
+					id[i] = '-';
+			}
+			h5->id = id;
+
+			of_node_put(root);
+		}
 	}
 
 	if (data->driver_info & H5_INFO_WAKEUP_DISABLE)
-- 
2.35.1


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

* [PATCH 3/3] Bluetooth: btrtl: allow longer config file name
       [not found] <20220422160231.1072810-1-icenowy@outlook.com>
  2022-04-22 16:02 ` [PATCH 1/3] Bluetooth: btrtl: try config w/o postfix if postfixed one failed to load icenowy
  2022-04-22 16:02 ` [PATCH 2/3] Bluetooth: btrtl: use board DT compatible string " icenowy
@ 2022-04-22 16:02 ` icenowy
  2 siblings, 0 replies; 4+ messages in thread
From: icenowy @ 2022-04-22 16:02 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz
  Cc: linux-bluetooth, linux-kernel, linux-sunxi, Icenowy Zheng

From: Icenowy Zheng <icenowy@sipeed.com>

As we now use board compatible as postfix on DT platform, we're going to
have long postfix strings.

Allow a longer config file name then. The value 320 is taken from
brcmfmac driver, which has a similar behavior.

Signed-off-by: Icenowy Zheng <icenowy@sipeed.com>
---
 drivers/bluetooth/btrtl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
index 1f834513762b..383428977a7a 100644
--- a/drivers/bluetooth/btrtl.c
+++ b/drivers/bluetooth/btrtl.c
@@ -591,7 +591,7 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
 	struct btrtl_device_info *btrtl_dev;
 	struct sk_buff *skb;
 	struct hci_rp_read_local_version *resp;
-	char cfg_name[40];
+	char cfg_name[320];
 	u16 hci_rev, lmp_subver;
 	u8 hci_ver;
 	int ret;
-- 
2.35.1


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

* RE: btrtl: try to use OF machine compatible as config postfix
  2022-04-22 16:02 ` [PATCH 1/3] Bluetooth: btrtl: try config w/o postfix if postfixed one failed to load icenowy
@ 2022-04-22 17:22   ` bluez.test.bot
  0 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2022-04-22 17:22 UTC (permalink / raw)
  To: linux-bluetooth, icenowy

[-- Attachment #1: Type: text/plain, Size: 1097 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=634720

---Test result---

Test Summary:
CheckPatch                    PASS      2.36 seconds
GitLint                       PASS      1.29 seconds
SubjectPrefix                 PASS      0.93 seconds
BuildKernel                   PASS      31.82 seconds
BuildKernel32                 PASS      28.41 seconds
Incremental Build with patchesPASS      50.57 seconds
TestRunner: Setup             PASS      487.24 seconds
TestRunner: l2cap-tester      PASS      17.97 seconds
TestRunner: bnep-tester       PASS      6.12 seconds
TestRunner: mgmt-tester       PASS      106.62 seconds
TestRunner: rfcomm-tester     PASS      9.91 seconds
TestRunner: sco-tester        PASS      9.59 seconds
TestRunner: smp-tester        PASS      9.65 seconds
TestRunner: userchan-tester   PASS      6.46 seconds



---
Regards,
Linux Bluetooth


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

end of thread, other threads:[~2022-04-22 17:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20220422160231.1072810-1-icenowy@outlook.com>
2022-04-22 16:02 ` [PATCH 1/3] Bluetooth: btrtl: try config w/o postfix if postfixed one failed to load icenowy
2022-04-22 17:22   ` btrtl: try to use OF machine compatible as config postfix bluez.test.bot
2022-04-22 16:02 ` [PATCH 2/3] Bluetooth: btrtl: use board DT compatible string " icenowy
2022-04-22 16:02 ` [PATCH 3/3] Bluetooth: btrtl: allow longer config file name icenowy

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.