LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v7] Bluetooth: btusb: Add support using different nvm for variant WCN6855 controller
@ 2021-09-02 8:56 Zijun Hu
2021-09-02 9:41 ` Marcel Holtmann
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Zijun Hu @ 2021-09-02 8:56 UTC (permalink / raw)
To: marcel, johan.hedberg, luiz.dentz
Cc: linux-kernel, linux-bluetooth, linux-arm-msm, bgodavar, c-hbandi,
hemantg, mka, rjliao, zijuhu, tjiang
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>
---
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) ? "" : "_";
+ 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);
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v7] Bluetooth: btusb: Add support using different nvm for variant WCN6855 controller
2021-09-02 8:56 [PATCH v7] Bluetooth: btusb: Add support using different nvm for variant WCN6855 controller Zijun Hu
@ 2021-09-02 9:41 ` Marcel Holtmann
2021-09-02 14:36 ` kernel test robot
2021-09-02 17:46 ` Matthias Kaehlcke
2 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2021-09-02 9:41 UTC (permalink / raw)
To: Zijun Hu
Cc: Johan Hedberg, Luiz Augusto von Dentz, open list,
linux-bluetooth, MSM, Balakrishna Godavarthi, c-hbandi, Hemantg,
Matthias Kaehlcke, Rocky Liao, tjiang
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v7] Bluetooth: btusb: Add support using different nvm for variant WCN6855 controller
2021-09-02 8:56 [PATCH v7] Bluetooth: btusb: Add support using different nvm for variant WCN6855 controller Zijun Hu
2021-09-02 9:41 ` Marcel Holtmann
@ 2021-09-02 14:36 ` kernel test robot
2021-09-02 17:46 ` Matthias Kaehlcke
2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2021-09-02 14:36 UTC (permalink / raw)
To: Zijun Hu, marcel, johan.hedberg, luiz.dentz
Cc: kbuild-all, linux-kernel, linux-bluetooth, linux-arm-msm,
bgodavar, c-hbandi, hemantg, mka
[-- Attachment #1: Type: text/plain, Size: 3557 bytes --]
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
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 36231 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v7] Bluetooth: btusb: Add support using different nvm for variant WCN6855 controller
2021-09-02 8:56 [PATCH v7] Bluetooth: btusb: Add support using different nvm for variant WCN6855 controller Zijun Hu
2021-09-02 9:41 ` Marcel Holtmann
2021-09-02 14:36 ` kernel test robot
@ 2021-09-02 17:46 ` Matthias Kaehlcke
2 siblings, 0 replies; 4+ messages in thread
From: Matthias Kaehlcke @ 2021-09-02 17:46 UTC (permalink / raw)
To: Zijun Hu
Cc: marcel, johan.hedberg, luiz.dentz, linux-kernel, linux-bluetooth,
linux-arm-msm, bgodavar, c-hbandi, hemantg, rjliao, tjiang
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-09-02 17:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-02 8:56 [PATCH v7] Bluetooth: btusb: Add support using different nvm for variant WCN6855 controller Zijun Hu
2021-09-02 9:41 ` Marcel Holtmann
2021-09-02 14:36 ` kernel test robot
2021-09-02 17:46 ` Matthias Kaehlcke
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).