diff mbox series

[v1] Bluetooth: btqca: Add support to read FW build version for WCN3991 BTSoC

Message ID 1605634182-7926-1-git-send-email-gubbaven@codeaurora.org
State Superseded
Headers show
Series [v1] Bluetooth: btqca: Add support to read FW build version for WCN3991 BTSoC | expand

Commit Message

Venkata Lakshmi Narayana Gubba Nov. 17, 2020, 5:29 p.m. UTC
Add support to read FW build version for WCN3991 BTSoC

Signed-off-by: Venkata Lakshmi Narayana Gubba <gubbaven@codeaurora.org>
---
 drivers/bluetooth/btqca.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++
 drivers/bluetooth/btqca.h |  3 +++
 2 files changed, 60 insertions(+)

Comments

kernel test robot Nov. 17, 2020, 9:08 p.m. UTC | #1
Hi Venkata,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on bluetooth-next/master]
[also build test WARNING on linux/master linus/master v5.10-rc4 next-20201117]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Venkata-Lakshmi-Narayana-Gubba/Bluetooth-btqca-Add-support-to-read-FW-build-version-for-WCN3991-BTSoC/20201118-013220
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
config: i386-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/773b13ede05cd62b2e429541685f7be9a9ec1e7b
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Venkata-Lakshmi-Narayana-Gubba/Bluetooth-btqca-Add-support-to-read-FW-build-version-for-WCN3991-BTSoC/20201118-013220
        git checkout 773b13ede05cd62b2e429541685f7be9a9ec1e7b
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/bluetooth/btqca.c:104:5: warning: no previous prototype for 'qca_read_fw_build_info' [-Wmissing-prototypes]
     104 | int qca_read_fw_build_info(struct hci_dev *hdev)
         |     ^~~~~~~~~~~~~~~~~~~~~~

vim +/qca_read_fw_build_info +104 drivers/bluetooth/btqca.c

   103	
 > 104	int qca_read_fw_build_info(struct hci_dev *hdev)
   105	{
   106		struct sk_buff *skb;
   107		struct edl_event_hdr *edl;
   108		char cmd;
   109		int err = 0;
   110		char build_label[QCA_FW_BUILD_VER_LEN];
   111		int build_lbl_len;
   112	
   113		bt_dev_dbg(hdev, "QCA read fw build info");
   114	
   115		cmd = EDL_GET_BUILD_INFO_CMD;
   116		skb = __hci_cmd_sync_ev(hdev, EDL_PATCH_CMD_OPCODE, EDL_PATCH_CMD_LEN,
   117					&cmd, HCI_EV_VENDOR, HCI_INIT_TIMEOUT);
   118		if (IS_ERR(skb)) {
   119			err = PTR_ERR(skb);
   120			bt_dev_err(hdev, "Reading QCA fw build info failed (%d)",
   121				   err);
   122			return err;
   123		}
   124	
   125		edl = (struct edl_event_hdr *)(skb->data);
   126		if (!edl) {
   127			bt_dev_err(hdev, "QCA read fw build info with no header");
   128			err = -EILSEQ;
   129			goto out;
   130		}
   131	
   132		if (edl->cresp != EDL_CMD_REQ_RES_EVT ||
   133		    edl->rtype != EDL_GET_BUILD_INFO_CMD) {
   134			bt_dev_err(hdev, "QCA Wrong packet received %d %d", edl->cresp,
   135				   edl->rtype);
   136			err = -EIO;
   137			goto out;
   138		}
   139	
   140		build_lbl_len = edl->data[0];
   141		memcpy(build_label, &edl->data[1], build_lbl_len);
   142		*(build_label + build_lbl_len) = '\0';
   143	
   144		bt_dev_info(hdev, "BT SoC FW Build info: %s", build_label);
   145	
   146	out:
   147		kfree_skb(skb);
   148		if (err)
   149			bt_dev_err(hdev, "QCA read fw build info failed (%d)", err);
   150	
   151		return err;
   152	}
   153	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
kernel test robot Nov. 17, 2020, 10:21 p.m. UTC | #2
Hi Venkata,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on bluetooth-next/master]
[also build test WARNING on linux/master linus/master bluetooth/master v5.10-rc4 next-20201117]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Venkata-Lakshmi-Narayana-Gubba/Bluetooth-btqca-Add-support-to-read-FW-build-version-for-WCN3991-BTSoC/20201118-013220
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
config: x86_64-randconfig-a012-20201116 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project ace9653c11c6308401dcda2e8b26bf97e6e66e30)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/773b13ede05cd62b2e429541685f7be9a9ec1e7b
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Venkata-Lakshmi-Narayana-Gubba/Bluetooth-btqca-Add-support-to-read-FW-build-version-for-WCN3991-BTSoC/20201118-013220
        git checkout 773b13ede05cd62b2e429541685f7be9a9ec1e7b
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/bluetooth/btqca.c:104:5: warning: no previous prototype for function 'qca_read_fw_build_info' [-Wmissing-prototypes]
   int qca_read_fw_build_info(struct hci_dev *hdev)
       ^
   drivers/bluetooth/btqca.c:104:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int qca_read_fw_build_info(struct hci_dev *hdev)
   ^
   static 
   1 warning generated.

vim +/qca_read_fw_build_info +104 drivers/bluetooth/btqca.c

   103	
 > 104	int qca_read_fw_build_info(struct hci_dev *hdev)
   105	{
   106		struct sk_buff *skb;
   107		struct edl_event_hdr *edl;
   108		char cmd;
   109		int err = 0;
   110		char build_label[QCA_FW_BUILD_VER_LEN];
   111		int build_lbl_len;
   112	
   113		bt_dev_dbg(hdev, "QCA read fw build info");
   114	
   115		cmd = EDL_GET_BUILD_INFO_CMD;
   116		skb = __hci_cmd_sync_ev(hdev, EDL_PATCH_CMD_OPCODE, EDL_PATCH_CMD_LEN,
   117					&cmd, HCI_EV_VENDOR, HCI_INIT_TIMEOUT);
   118		if (IS_ERR(skb)) {
   119			err = PTR_ERR(skb);
   120			bt_dev_err(hdev, "Reading QCA fw build info failed (%d)",
   121				   err);
   122			return err;
   123		}
   124	
   125		edl = (struct edl_event_hdr *)(skb->data);
   126		if (!edl) {
   127			bt_dev_err(hdev, "QCA read fw build info with no header");
   128			err = -EILSEQ;
   129			goto out;
   130		}
   131	
   132		if (edl->cresp != EDL_CMD_REQ_RES_EVT ||
   133		    edl->rtype != EDL_GET_BUILD_INFO_CMD) {
   134			bt_dev_err(hdev, "QCA Wrong packet received %d %d", edl->cresp,
   135				   edl->rtype);
   136			err = -EIO;
   137			goto out;
   138		}
   139	
   140		build_lbl_len = edl->data[0];
   141		memcpy(build_label, &edl->data[1], build_lbl_len);
   142		*(build_label + build_lbl_len) = '\0';
   143	
   144		bt_dev_info(hdev, "BT SoC FW Build info: %s", build_label);
   145	
   146	out:
   147		kfree_skb(skb);
   148		if (err)
   149			bt_dev_err(hdev, "QCA read fw build info failed (%d)", err);
   150	
   151		return err;
   152	}
   153	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
bluez.test.bot@gmail.com Nov. 17, 2020, 11:18 p.m. UTC | #3
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=386201

---Test result---

##############################
Test: CheckPatch - FAIL
Output:
Bluetooth: btqca: Add support to read FW build version for WCN3991 BTSoC
WARNING: Duplicate signature
#11: 
Reported-by: kernel test robot <lkp@intel.com>

total: 0 errors, 1 warnings, 84 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

"[PATCH] Bluetooth: btqca: Add support to read FW build version for" has style problems, please review.

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.


##############################
Test: CheckGitLint - PASS

##############################
Test: CheckBuildK - PASS



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
index ce9dcff..70f6cc5 100644
--- a/drivers/bluetooth/btqca.c
+++ b/drivers/bluetooth/btqca.c
@@ -101,6 +101,56 @@  int qca_read_soc_version(struct hci_dev *hdev, u32 *soc_version,
 }
 EXPORT_SYMBOL_GPL(qca_read_soc_version);
 
+int qca_read_fw_build_info(struct hci_dev *hdev)
+{
+	struct sk_buff *skb;
+	struct edl_event_hdr *edl;
+	char cmd;
+	int err = 0;
+	char build_label[QCA_FW_BUILD_VER_LEN];
+	int build_lbl_len;
+
+	bt_dev_dbg(hdev, "QCA read fw build info");
+
+	cmd = EDL_GET_BUILD_INFO_CMD;
+	skb = __hci_cmd_sync_ev(hdev, EDL_PATCH_CMD_OPCODE, EDL_PATCH_CMD_LEN,
+				&cmd, HCI_EV_VENDOR, HCI_INIT_TIMEOUT);
+	if (IS_ERR(skb)) {
+		err = PTR_ERR(skb);
+		bt_dev_err(hdev, "Reading QCA fw build info failed (%d)",
+			   err);
+		return err;
+	}
+
+	edl = (struct edl_event_hdr *)(skb->data);
+	if (!edl) {
+		bt_dev_err(hdev, "QCA read fw build info with no header");
+		err = -EILSEQ;
+		goto out;
+	}
+
+	if (edl->cresp != EDL_CMD_REQ_RES_EVT ||
+	    edl->rtype != EDL_GET_BUILD_INFO_CMD) {
+		bt_dev_err(hdev, "QCA Wrong packet received %d %d", edl->cresp,
+			   edl->rtype);
+		err = -EIO;
+		goto out;
+	}
+
+	build_lbl_len = edl->data[0];
+	memcpy(build_label, &edl->data[1], build_lbl_len);
+	*(build_label + build_lbl_len) = '\0';
+
+	bt_dev_info(hdev, "BT SoC FW Build info: %s", build_label);
+
+out:
+	kfree_skb(skb);
+	if (err)
+		bt_dev_err(hdev, "QCA read fw build info failed (%d)", err);
+
+	return err;
+}
+
 static int qca_send_reset(struct hci_dev *hdev)
 {
 	struct sk_buff *skb;
@@ -520,6 +570,13 @@  int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
 		return err;
 	}
 
+	if (soc_type == QCA_WCN3991) {
+		/* get fw build info */
+		qca_read_fw_build_info(hdev);
+		if (err < 0)
+			return err;
+	}
+
 	bt_dev_info(hdev, "QCA setup on UART is completed");
 
 	return 0;
diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h
index d81b74c..375c7fc 100644
--- a/drivers/bluetooth/btqca.h
+++ b/drivers/bluetooth/btqca.h
@@ -11,6 +11,7 @@ 
 #define EDL_PATCH_CMD_LEN		(1)
 #define EDL_PATCH_VER_REQ_CMD		(0x19)
 #define EDL_PATCH_TLV_REQ_CMD		(0x1E)
+#define EDL_GET_BUILD_INFO_CMD		(0x20)
 #define EDL_NVM_ACCESS_SET_REQ_CMD	(0x01)
 #define MAX_SIZE_PER_TLV_SEGMENT	(243)
 #define QCA_PRE_SHUTDOWN_CMD		(0xFC08)
@@ -34,6 +35,8 @@ 
 #define QCA_HCI_CC_OPCODE		0xFC00
 #define QCA_HCI_CC_SUCCESS		0x00
 
+#define QCA_FW_BUILD_VER_LEN		255
+
 enum qca_baudrate {
 	QCA_BAUDRATE_115200 	= 0,
 	QCA_BAUDRATE_57600,