Message ID | 1630572986-30786-1-git-send-email-zijuhu@codeaurora.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [v7] Bluetooth: btusb: Add support using different nvm for variant WCN6855 controller | expand |
Hi Zijun, > the RF perfermence of wcn6855 soc chip from different foundries will be spelling check please. > difference, so we should use different nvm to configure them. > > Signed-off-by: Tim Jiang <tjiang@codeaurora.org> > --- > drivers/bluetooth/btusb.c | 50 +++++++++++++++++++++++++++++++++++------------ > 1 file changed, 37 insertions(+), 13 deletions(-) > > diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c > index 928cbfa4c42d..218547f6097e 100644 > --- a/drivers/bluetooth/btusb.c > +++ b/drivers/bluetooth/btusb.c > @@ -3161,6 +3161,9 @@ static int btusb_set_bdaddr_wcn6855(struct hci_dev *hdev, > #define QCA_DFU_TIMEOUT 3000 > #define QCA_FLAG_MULTI_NVM 0x80 > > +#define WCN6855_2_0_RAM_VERSION_GF 0x400c1200 > +#define WCN6855_2_1_RAM_VERSION_GF 0x400c1211 > + > struct qca_version { > __le32 rom_version; > __le32 patch_version; > @@ -3192,6 +3195,7 @@ static const struct qca_device_info qca_devices_table[] = { > { 0x00000302, 28, 4, 16 }, /* Rome 3.2 */ > { 0x00130100, 40, 4, 16 }, /* WCN6855 1.0 */ > { 0x00130200, 40, 4, 16 }, /* WCN6855 2.0 */ > + { 0x00130201, 40, 4, 16 }, /* WCN6855 2.1 */ > }; > > static int btusb_qca_send_vendor_req(struct usb_device *udev, u8 request, > @@ -3346,6 +3350,31 @@ static int btusb_setup_qca_load_rampatch(struct hci_dev *hdev, > return err; > } > > +static void btusb_generate_qca_nvm_name(char *fwname, > + size_t max_size, > + struct qca_version *ver, > + char *variant) > +{ > + char *separator = (strlen(variant) == 0) ? "" : "_"; Shortcut this variable name to sep. > + u16 board_id = le16_to_cpu(ver->board_id); > + u32 rom_version = le32_to_cpu(ver->rom_version); > + > + if (((ver->flag >> 8) & 0xff) == QCA_FLAG_MULTI_NVM) { > + /* if boardid equal 0, use default nvm without suffix */ > + if (board_id == 0x0) { > + snprintf(fwname, max_size, "qca/nvm_usb_%08x%s%s.bin", > + rom_version, separator, variant); > + } else { > + snprintf(fwname, max_size, "qca/nvm_usb_%08x%s%s_%04x.bin", > + rom_version, separator, variant, board_id); > + } > + } else { > + snprintf(fwname, max_size, "qca/nvm_usb_%08x.bin", > + rom_version); > + } > + > +} > + > static int btusb_setup_qca_load_nvm(struct hci_dev *hdev, > struct qca_version *ver, > const struct qca_device_info *info) > @@ -3354,19 +3383,14 @@ static int btusb_setup_qca_load_nvm(struct hci_dev *hdev, > char fwname[64]; > int err; > > - if (((ver->flag >> 8) & 0xff) == QCA_FLAG_MULTI_NVM) { > - /* if boardid equal 0, use default nvm without surfix */ > - if (le16_to_cpu(ver->board_id) == 0x0) { > - snprintf(fwname, sizeof(fwname), "qca/nvm_usb_%08x.bin", > - le32_to_cpu(ver->rom_version)); > - } else { > - snprintf(fwname, sizeof(fwname), "qca/nvm_usb_%08x_%04x.bin", > - le32_to_cpu(ver->rom_version), > - le16_to_cpu(ver->board_id)); > - } > - } else { > - snprintf(fwname, sizeof(fwname), "qca/nvm_usb_%08x.bin", > - le32_to_cpu(ver->rom_version)); > + switch (ver->ram_version) { > + case WCN6855_2_0_RAM_VERSION_GF: > + case WCN6855_2_1_RAM_VERSION_GF: > + btusb_generate_qca_nvm_name(fwname, sizeof(fwname), ver, "gf"); > + break; > + default: > + btusb_generate_qca_nvm_name(fwname, sizeof(fwname), ver, ""); > + break; Indentation mistake. > } > > err = request_firmware(&fw, fwname, &hdev->dev); Regards Marcel
Hi Zijun, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on bluetooth-next/master] [also build test WARNING on linus/master v5.14 next-20210902] [cannot apply to linux/master bluetooth/master] [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/Zijun-Hu/Bluetooth-btusb-Add-support-using-different-nvm-for-variant-WCN6855-controller/20210902-165857 base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master config: i386-randconfig-s002-20210831 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.3-348-gf0e6938b-dirty # https://github.com/0day-ci/linux/commit/971383be35e3681a6e8b1e85ad3c01f21f4e0076 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Zijun-Hu/Bluetooth-btusb-Add-support-using-different-nvm-for-variant-WCN6855-controller/20210902-165857 git checkout 971383be35e3681a6e8b1e85ad3c01f21f4e0076 # save the attached .config to linux build tree make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash drivers/bluetooth/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> sparse warnings: (new ones prefixed by >>) drivers/bluetooth/btusb.c:1871:18: sparse: sparse: cast to restricted __le16 drivers/bluetooth/btusb.c:1875:18: sparse: sparse: cast to restricted __le16 drivers/bluetooth/btusb.c:1879:18: sparse: sparse: cast to restricted __le16 drivers/bluetooth/btusb.c:1883:18: sparse: sparse: cast to restricted __le16 drivers/bluetooth/btusb.c:1887:18: sparse: sparse: cast to restricted __le16 drivers/bluetooth/btusb.c:1893:18: sparse: sparse: cast to restricted __le16 drivers/bluetooth/btusb.c:3330:28: sparse: sparse: cast to restricted __le32 drivers/bluetooth/btusb.c:3362:18: sparse: sparse: restricted __le16 degrades to integer >> drivers/bluetooth/btusb.c:3386:20: sparse: sparse: restricted __le32 degrades to integer >> drivers/bluetooth/btusb.c:3386:20: sparse: sparse: restricted __le32 degrades to integer vim +3386 drivers/bluetooth/btusb.c 3377 3378 static int btusb_setup_qca_load_nvm(struct hci_dev *hdev, 3379 struct qca_version *ver, 3380 const struct qca_device_info *info) 3381 { 3382 const struct firmware *fw; 3383 char fwname[64]; 3384 int err; 3385 > 3386 switch (ver->ram_version) { 3387 case WCN6855_2_0_RAM_VERSION_GF: 3388 case WCN6855_2_1_RAM_VERSION_GF: 3389 btusb_generate_qca_nvm_name(fwname, sizeof(fwname), ver, "gf"); 3390 break; 3391 default: 3392 btusb_generate_qca_nvm_name(fwname, sizeof(fwname), ver, ""); 3393 break; 3394 } 3395 3396 err = request_firmware(&fw, fwname, &hdev->dev); 3397 if (err) { 3398 bt_dev_err(hdev, "failed to request NVM file: %s (%d)", 3399 fwname, err); 3400 return err; 3401 } 3402 3403 bt_dev_info(hdev, "using NVM file: %s", fwname); 3404 3405 err = btusb_setup_qca_download_fw(hdev, fw, info->nvm_hdr); 3406 3407 release_firmware(fw); 3408 3409 return err; 3410 } 3411 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
On Thu, Sep 02, 2021 at 04:56:26PM +0800, Zijun Hu wrote: > From: Tim Jiang <tjiang@codeaurora.org> > > the RF perfermence of wcn6855 soc chip from different foundries will be > difference, so we should use different nvm to configure them. > > Signed-off-by: Tim Jiang <tjiang@codeaurora.org> as I commented before on v4: > Please also add your own Signed-off-by tag, even when sending unmodified > patches on behalf of others. In this case you are making changes to the > original patch and are effectively a co-author, which is another important > reason for adding the tag.
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 928cbfa4c42d..218547f6097e 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -3161,6 +3161,9 @@ static int btusb_set_bdaddr_wcn6855(struct hci_dev *hdev, #define QCA_DFU_TIMEOUT 3000 #define QCA_FLAG_MULTI_NVM 0x80 +#define WCN6855_2_0_RAM_VERSION_GF 0x400c1200 +#define WCN6855_2_1_RAM_VERSION_GF 0x400c1211 + struct qca_version { __le32 rom_version; __le32 patch_version; @@ -3192,6 +3195,7 @@ static const struct qca_device_info qca_devices_table[] = { { 0x00000302, 28, 4, 16 }, /* Rome 3.2 */ { 0x00130100, 40, 4, 16 }, /* WCN6855 1.0 */ { 0x00130200, 40, 4, 16 }, /* WCN6855 2.0 */ + { 0x00130201, 40, 4, 16 }, /* WCN6855 2.1 */ }; static int btusb_qca_send_vendor_req(struct usb_device *udev, u8 request, @@ -3346,6 +3350,31 @@ static int btusb_setup_qca_load_rampatch(struct hci_dev *hdev, return err; } +static void btusb_generate_qca_nvm_name(char *fwname, + size_t max_size, + struct qca_version *ver, + char *variant) +{ + char *separator = (strlen(variant) == 0) ? "" : "_"; + u16 board_id = le16_to_cpu(ver->board_id); + u32 rom_version = le32_to_cpu(ver->rom_version); + + if (((ver->flag >> 8) & 0xff) == QCA_FLAG_MULTI_NVM) { + /* if boardid equal 0, use default nvm without suffix */ + if (board_id == 0x0) { + snprintf(fwname, max_size, "qca/nvm_usb_%08x%s%s.bin", + rom_version, separator, variant); + } else { + snprintf(fwname, max_size, "qca/nvm_usb_%08x%s%s_%04x.bin", + rom_version, separator, variant, board_id); + } + } else { + snprintf(fwname, max_size, "qca/nvm_usb_%08x.bin", + rom_version); + } + +} + static int btusb_setup_qca_load_nvm(struct hci_dev *hdev, struct qca_version *ver, const struct qca_device_info *info) @@ -3354,19 +3383,14 @@ static int btusb_setup_qca_load_nvm(struct hci_dev *hdev, char fwname[64]; int err; - if (((ver->flag >> 8) & 0xff) == QCA_FLAG_MULTI_NVM) { - /* if boardid equal 0, use default nvm without surfix */ - if (le16_to_cpu(ver->board_id) == 0x0) { - snprintf(fwname, sizeof(fwname), "qca/nvm_usb_%08x.bin", - le32_to_cpu(ver->rom_version)); - } else { - snprintf(fwname, sizeof(fwname), "qca/nvm_usb_%08x_%04x.bin", - le32_to_cpu(ver->rom_version), - le16_to_cpu(ver->board_id)); - } - } else { - snprintf(fwname, sizeof(fwname), "qca/nvm_usb_%08x.bin", - le32_to_cpu(ver->rom_version)); + switch (ver->ram_version) { + case WCN6855_2_0_RAM_VERSION_GF: + case WCN6855_2_1_RAM_VERSION_GF: + btusb_generate_qca_nvm_name(fwname, sizeof(fwname), ver, "gf"); + break; + default: + btusb_generate_qca_nvm_name(fwname, sizeof(fwname), ver, ""); + break; } err = request_firmware(&fw, fwname, &hdev->dev);