Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1804411pxb; Tue, 26 Oct 2021 16:35:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSgePMf2Lz6MXLMQXKX5Fda052cNqVhSPi3ieOUYurW94kM8zHcfbRcEplSpxEQrfJ+0c2 X-Received: by 2002:a17:906:f1c6:: with SMTP id gx6mr33270875ejb.358.1635291355481; Tue, 26 Oct 2021 16:35:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635291355; cv=none; d=google.com; s=arc-20160816; b=aJ75Bv4DHqAZgrAev2FDe4KXy/FVWmHmGzS3GZzyPrkCFj9Nj1Ao1RbWqy5wloDQ/x XXsABlkeAZKxH1yeU1Izv15261XHnFxJxBe6XgAzIGNr93C4dhFFtypo18xRtPJVnGgz gL/ZeG7Li+7yk7nlsaANv+Sf0P9fS8CX0gbsRJnxn06ryQsJwMhdZZ37CUQZ4D693Rgk DZTHkxfuXvU/EvLFUJFAP8ZF7Zl5ZW4jZHHTnK8EV+dPT+i9M115O2V7xqNUdp9HF+ZG V/Aabv41AhJqG4YcfWqjBU9/TPC/OGStoMAW4TJ0mKDl/n6OgtyC0eMAlIomiYyQ7wzk mOcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=q7Maw+sMF3Q6N+ptoNDxzqCK96vnCGLnGzCFF2robfg=; b=W4uGWM/DnTKB9IX0V6DVdsaKkxUglZgxfBBuGIRD95B7iKzv9BmricCbJFTBhkhWYG UE17W9fgotXkIzREWlSb/ZcU0vdJQ/I9SashIT8f778AisvtO6hah8WzbKbM12+P2g7A kZCq2huFP83CZ7aa4QSWYAnzGhcJCSWsttZTjYpb+Q9fANBHOR5yFg5AAr2KlK2cm522 XuIj/wzFtvpTYYI1oFb02uxqvzCgFFgaF/82QsJqgDuPFASK8exy0qgmpfrZVHsUGRRb I5IGDAB4dHI0xGzBp2PsxrvQBT/1BwkUje1IhPHxV5ZSTZc2h+2Pio4fW2TMFomx6x9Y SXTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=GrlvUUDs; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e10si18907068eja.731.2021.10.26.16.35.08; Tue, 26 Oct 2021 16:35:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=GrlvUUDs; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237440AbhJZQ10 (ORCPT + 99 others); Tue, 26 Oct 2021 12:27:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237483AbhJZQ1B (ORCPT ); Tue, 26 Oct 2021 12:27:01 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E56CC061237 for ; Tue, 26 Oct 2021 09:24:35 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id 127so16779pfu.1 for ; Tue, 26 Oct 2021 09:24:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=q7Maw+sMF3Q6N+ptoNDxzqCK96vnCGLnGzCFF2robfg=; b=GrlvUUDsDZCc4Noh/EpeKHDMxftQ31Xq7/gSooGwllD3Sl0nKzM5Otw5mVQyM3dqDR 6h2SAjkMi0yojVE0Z9F0/IpE5nu5RnWJt33MQ1XpOj/Y8KkCLObUYsJjnJjX/SCSnvEb j0OBM7vNTetfxokbGlBbCwLr//JdztO7pwWMc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=q7Maw+sMF3Q6N+ptoNDxzqCK96vnCGLnGzCFF2robfg=; b=67+myvxujJfruozhV6banU96aT3jxS3jZ70tfN4js335vJHbQC8qqDycUWZIx5ZZzD DlQwDPnm+0fW0d/7NbOlses8arJ4e5BUgtRgH2uBqoS1dNESpD6vUsTJ+0w5vk/nvSOl p7fp6aCuFjMQUOGZvB2gqx9sW/ARbxogK6I5FVEDayrMlgmghKA3OtGAO/ZRO7lEKxI2 lEEqMI3wyZFq7dT6I45fvWCbmwaoOo0tX6Xnsnk8UXfzLQpKRypucWL8ZZAm2tFD/eA0 AVa6gLhZRauf0osrzbF0krELNXwxAxQ+yVATxVmlGmuAzD6cbVYZmOxr4xjJPmbT2ha3 yz2Q== X-Gm-Message-State: AOAM530sCzSrBcp9zbswBQS1gikv4XKd/f+T6mCunOT3XApozFMdiQk6 uwOIU8Xduw6+JyYqd22UfcVYLQ== X-Received: by 2002:a63:8c4f:: with SMTP id q15mr15040959pgn.225.1635265473926; Tue, 26 Oct 2021 09:24:33 -0700 (PDT) Received: from localhost ([2620:15c:202:201:8854:dee7:f36d:b5da]) by smtp.gmail.com with UTF8SMTPSA id q6sm19344307pgc.1.2021.10.26.09.24.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 26 Oct 2021 09:24:33 -0700 (PDT) Date: Tue, 26 Oct 2021 09:24:32 -0700 From: Matthias Kaehlcke To: tjiang@codeaurora.org Cc: marcel@holtmann.org, johan.hedberg@gmail.com, luiz.dentz@gmail.com, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-arm-msm@vger.kernel.org, bgodavar@codeaurora.org, c-hbandi@codeaurora.org, hemantg@codeaurora.org, rjliao@codeaurora.org, zijuhu@codeaurora.org Subject: Re: [PATCH v3] Bluetooth: btusb: Add support for variant WCN6855 by using different nvm Message-ID: References: <1d19afff955cdc8d47582297a26246d9@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1d19afff955cdc8d47582297a26246d9@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org On Fri, Oct 22, 2021 at 01:35:38PM +0800, tjiang@codeaurora.org wrote: > the RF performance 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 | 55 > +++++++++++++++++++++++++++++++++++------------ > 1 file changed, 41 insertions(+), 14 deletions(-) > > diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c > index 87b71740fad8..a5fe57e7cd7e 100644 > --- a/drivers/bluetooth/btusb.c > +++ b/drivers/bluetooth/btusb.c > @@ -3195,6 +3195,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; > @@ -3226,6 +3229,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, > @@ -3380,6 +3384,42 @@ 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, > + const struct qca_version *ver) > +{ > + u32 rom_version = le32_to_cpu(ver->rom_version); > + u16 flag = le16_to_cpu(ver->flag); > + > + if (((flag >> 8) & 0xff) == QCA_FLAG_MULTI_NVM) { > + u16 board_id = le16_to_cpu(ver->board_id); > + u32 ram_version = le32_to_cpu(ver->ram_version); > + const char *variant = NULL; This assignement was introduced in v3, it isn't really useful since the variable is always assigned to a value in the switch statement below. btw, why did you reset the patch version numbers, earlier they went up to v11? This is confusing, e.g. when someone mentions v3 of this patch, are they referring to this version or to https://patchwork.kernel.org/project/bluetooth/patch/1628758216-3201-1-git-send-email-zijuhu@codeaurora.org/? > + > + switch (ram_version) { > + case WCN6855_2_0_RAM_VERSION_GF: > + case WCN6855_2_1_RAM_VERSION_GF: > + variant = "_gf"; > + break; > + default: > + variant = ""; > + break; > + } > + > + if (board_id == 0) { > + snprintf(fwname, max_size, "qca/nvm_usb_%08x%s.bin", > + rom_version, variant); > + } else { > + snprintf(fwname, max_size, "qca/nvm_usb_%08x%s_%04x.bin", > + rom_version, 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) > @@ -3388,20 +3428,7 @@ 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)); > - } > + btusb_generate_qca_nvm_name(fwname, sizeof(fwname), ver); > > err = request_firmware(&fw, fwname, &hdev->dev); > if (err) { > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a > Linux Foundation Collaborative Project