Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1222419pxb; Fri, 10 Sep 2021 00:32:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwf3AQVdab2y4JYo0OhAcr9PUq01zw11oBmZRzQw6/NouubkXfWXk0ghArMprOQd9WxWKyZ X-Received: by 2002:a05:6402:10cc:: with SMTP id p12mr7400033edu.328.1631259141317; Fri, 10 Sep 2021 00:32:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631259141; cv=none; d=google.com; s=arc-20160816; b=RYb2bMkXhFIM3XLBD8+1rL3n9b783RI9wbHEF6FQzoQhzDcUMYXk68UH9d7zhlWwCf j9tJjskEeRl+ip0vvk348fqH4nNm8mRu4qv7NWEs2IKiJn9BfNrgSgVqrGc1a60VPdoy iqOInPHlBPV+gK2DjxE9NAsSuaALTQCGzkjszKy7M9LsrVzVHatATdGnSiIzNh5pPaUc Mfruv1aOrNxScqMQceU3wDCzrLKfPP2481vK3EhesI8KLcheU3TATBNXQtvxxGCqryhM rTJe80ZuFnYBNX8zcVANed84x6kAIXiItPd3gGsiUQoUFpond2wo2r2x9ohQ5NkmjUuE I2Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=Subo7dbHMcgPAczdyshopvzJlCEtf7jut6lShggrBgc=; b=dUB9q6jot+j8SVcAnc34oNGemRmc1kLOEg3n/sPIAtxFeGAiHAGyIPDOCXjer18TvD 73Qok4ZjMpk/wJzGp2AxHxle0kCvp5emAtPTnQiCBDyMAcm1AYn9VwWakMgqS6e4j3o9 bl8z3x+HKrRpWqNjf6Ohzsqb6kJNH6bI3VFtZM8HGighNjAAIZoUW7MrGQY08Id6nu70 hD/Q9MYHbqHpJIQxyLijaPPbhXL4wC2Jx6zHUuEDEeG8PQ07Th/DT2O3wxVjBFfPhbO2 ptleZYUyn0Rm7SwLcqMa2ucrFSkVuOMKJ9Iunk8Jrt74W/t3mS2V0Zvwny5kMCrYz4cd jo3w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id eb13si3653840edb.271.2021.09.10.00.31.34; Fri, 10 Sep 2021 00:32:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231514AbhIJHbR convert rfc822-to-8bit (ORCPT + 99 others); Fri, 10 Sep 2021 03:31:17 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:58657 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231364AbhIJHbQ (ORCPT ); Fri, 10 Sep 2021 03:31:16 -0400 Received: from smtpclient.apple (p5b3d2185.dip0.t-ipconnect.de [91.61.33.133]) by mail.holtmann.org (Postfix) with ESMTPSA id EAB79CED3D; Fri, 10 Sep 2021 09:30:03 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: [PATCH v8] Bluetooth: btusb: Add support using different nvm for variant WCN6855 controller From: Marcel Holtmann In-Reply-To: <1630641758-22281-1-git-send-email-zijuhu@codeaurora.org> Date: Fri, 10 Sep 2021 09:30:03 +0200 Cc: Johan Hedberg , Luiz Augusto von Dentz , open list , linux-bluetooth , MSM , Balakrishna Godavarthi , c-hbandi@codeaurora.org, Hemantg , Matthias Kaehlcke , Rocky Liao , tjiang@codeaurora.org Content-Transfer-Encoding: 8BIT Message-Id: <1A6C7105-5BA3-44C4-9F94-BB71FBDBE8F5@holtmann.org> References: <1630641758-22281-1-git-send-email-zijuhu@codeaurora.org> To: Zijun Hu X-Mailer: Apple Mail (2.3654.120.0.1.13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Zijun, > the RF perfermance of wcn6855 soc chip from different foundries will be > difference, so we should use different nvm to configure them. > > Signed-off-by: Tim Jiang > --- > 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..0f5d2222d624 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 *sep = (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, sep, variant); > + } else { > + snprintf(fwname, max_size, "qca/nvm_usb_%08x%s%s_%04x.bin", > + rom_version, sep, 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; I mentioned this multiple times now, the indentation is wrong here. Regards Marcel