Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp528644yba; Mon, 1 Apr 2019 11:07:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqyVOfvDZK1OEb+7BUzwydfTZHQLQsH6/cdstoPZcNZjQqJy2A7Vn3StwXfUGcP4GuQ1vke2 X-Received: by 2002:a17:902:7441:: with SMTP id e1mr31887969plt.13.1554142065924; Mon, 01 Apr 2019 11:07:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554142065; cv=none; d=google.com; s=arc-20160816; b=HgJKiol9lweEW/O79QMyVF1A7Lb5yW/ZskvIEkaPMaV2lZNQ1Pjs0gfTZM/zF9e8BK ueb2wKvMs11cGSlhAlRg3MUCAZ7qqXR2u1EBKLU74L2zjnM2H/D+67gTptaA3WYQo1L7 OV6dygkqqUo1TmTS8Q7GdSJDZwl3jl3PFKkncbwK1y3LDdQA1IwkcTu7HqHIly8wyYMY qPuML1W8Hv7rLUK2F+Lqv8EAFg4D1NPiGvo79UR1gYKU7M65qpWLoQyofS8ClUgX7yvj 4WppqGxPOf9/HZCdOw1bVFsamhD3WpRYygxsARHZ3z8ZuK5phoIaEMIrAAH3dZNKRUHn opmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=HFIbZQ25f4RzvK0/BsFZbfNQa0GXntCHY2z9L/SWgJU=; b=HnbSYnqaknVVqxynrELqeQ/NeDnBqCC89ViotndHxsoHNWsJ6VCAS42oFjAZzFriyT PgKOU9fW7COYnODN0Y1egFGHYwYl0CP8KOWOVJ1AmxwO7U/EctAsNLpcZKZGLeUVzX7a 8YRlWuiTSWPsOnfsfC4WrWENMyB7vi9PxCytoZC93iaCQzKPy83Sf4ZJ0u1zUWtXbvhY ZEB/F0Soz0N08c2sQV065aEw/+A61+vXPUTyWiq2qjhnfuIuUDuO5immw5rZxG8YWgmR YTaBYs74P/IMiSkxH62xRG2uRoNADZQy8OhMhv0hNzCfQDA3iVNb+MosdyEE58+Co23L a9DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=QsbdQ7AD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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. [209.132.180.67]) by mx.google.com with ESMTP id v41si9414764plg.8.2019.04.01.11.07.30; Mon, 01 Apr 2019 11:07:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=QsbdQ7AD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1730322AbfDARMH (ORCPT + 99 others); Mon, 1 Apr 2019 13:12:07 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:45816 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729869AbfDARME (ORCPT ); Mon, 1 Apr 2019 13:12:04 -0400 Received: by mail-pf1-f194.google.com with SMTP id e24so4873148pfi.12 for ; Mon, 01 Apr 2019 10:12:03 -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:user-agent; bh=HFIbZQ25f4RzvK0/BsFZbfNQa0GXntCHY2z9L/SWgJU=; b=QsbdQ7ADJEhzkoGPL3+/ra9c5lYN7tOF/Rhc0XBcCxSFoj++biSNDXYvh54PgXw1NQ Nuk0LNQJ0iAo14ZwMyVfsWf4b0OcHfbdPV/Ya4vca67LV85SIK/xRNWEb0FTZukPUxAR iepoSsLDVStcIR/vkbGXAwfnEEuPn4mfG9dBw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=HFIbZQ25f4RzvK0/BsFZbfNQa0GXntCHY2z9L/SWgJU=; b=gZkqZpxRT56J59ZkuuHYQVU/ZPB9nHXsk3oQUdIJp8rrN45jsqYbmTrYaKTxevG+zM prkiVYNGAgxumhLtBcapv/IZ2VMBBXi6423RcoO/+MNb36WKvd1omTLod+kVLzVOchws 93apTrZr78ga7YH0umRO8Ms3tfpjCiDpdw/MUjVh9A283Wv0i0KEKAdLPwsUfuQyl/YJ YRZbsoSTC/2mM2coxP0lgK0gYC+VzCUfu/+Md+QagkZAfEAZdDZAmYIXeX9rwf3R/wUk eR+T6G1iWYsu1Ix6nS1LpljaDOzXpdf4ilhqCny24VKyVwxZ3EMznc8f6yoDKaRdUezR wQGQ== X-Gm-Message-State: APjAAAV2Ngtc20an+9QCKh1ypqWSB1adCwK438JFNc3A48UYuCg3uMLW X1mPPBzwwTRkS7m+FrEASlzvXg== X-Received: by 2002:a63:fa46:: with SMTP id g6mr6522937pgk.382.1554138723328; Mon, 01 Apr 2019 10:12:03 -0700 (PDT) Received: from localhost ([2620:15c:202:1:75a:3f6e:21d:9374]) by smtp.gmail.com with ESMTPSA id n22sm12979659pfa.51.2019.04.01.10.12.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 01 Apr 2019 10:12:02 -0700 (PDT) Date: Mon, 1 Apr 2019 10:12:02 -0700 From: Matthias Kaehlcke To: Balakrishna Godavarthi Cc: Marcel Holtmann , Johan Hedberg , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, Hemantg Subject: Re: [PATCH 2/2] Bluetooth: hci_qca: wcn3990: Drop baudrate change vendor event Message-ID: <20190401171202.GH112750@google.com> References: <20190307004041.38059-1-mka@chromium.org> <20190307004041.38059-3-mka@chromium.org> <20190307182009.GB138592@google.com> <20190307233039.GA69116@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 01, 2019 at 01:48:23PM +0530, Balakrishna Godavarthi wrote: > Hi Matthias, > > On 2019-04-01 13:29, Balakrishna Godavarthi wrote: > > Hi Matthias, > > > > Sorry for the late reply i was on vacation. > > > > On 2019-03-08 05:00, Matthias Kaehlcke wrote: > > > On Thu, Mar 07, 2019 at 10:20:09AM -0800, Matthias Kaehlcke wrote: > > > > Hi Balakrishna, > > > > > > > > On Thu, Mar 07, 2019 at 10:35:08AM +0530, Balakrishna Godavarthi > > > > wrote: > > > > > hi Matthias, > > > > > > > > > > On 2019-03-07 06:10, Matthias Kaehlcke wrote: > > > > > > Firmware download to the WCN3990 often fails with a 'TLV response size > > > > > > mismatch' error: > > > > > > > > > > > > [ 133.064659] Bluetooth: hci0: setting up wcn3990 > > > > > > [ 133.489150] Bluetooth: hci0: QCA controller version 0x02140201 > > > > > > [ 133.495245] Bluetooth: hci0: QCA Downloading qca/crbtfw21.tlv > > > > > > [ 133.507214] Bluetooth: hci0: QCA TLV response size mismatch > > > > > > [ 133.513265] Bluetooth: hci0: QCA Failed to download patch (-84) > > > > > > > > > > > > This is caused by a vendor event that corresponds to an earlier command > > > > > > to change the baudrate. The event is not processed in the context of the > > > > > > baudrate change and later interpreted as response to the firmware > > > > > > download command (which is also a vendor command), but the driver > > > > > > detects > > > > > > that the event doesn't have the expected amount of associated data. > > > > > > > > > > > > More details: > > > > > > > > > > > > For the WCN3990 the vendor command for a baudrate change isn't sent as > > > > > > synchronous HCI command, because the controller sends the corresponding > > > > > > vendor event with the new baudrate. The event is received and decoded > > > > > > after the baudrate change of the host port. > > > > > > > > > > > > Identify the 'unused' event when it is received and don't add it to > > > > > > the queue of RX frames. > > > > > > > > > > > > Signed-off-by: Matthias Kaehlcke > > > > > > --- > > > > > > > > > > ... > > > > > > > > > > Can you test by reverting this change "94d6671473924". > > > > > > > > The issue is still reproducible. > > > > > > > > > We need at least 15ms minimum delay for the soc to change its baud rate and > > > > > respond to the with command complete event. > > > > > > > > The baudrate change has clearly been successful when the problem is > > > > observed, since the host receives the vendor event with the new > > > > baudrate. > > > > > > I forgot to mention this earlier: the controller doesn't send a > > > command complete event for the command, or at least not a correct > > > one. > > > > > > That's the data that is received: > > > > > > 04 0e 04 01 00 00 00 > > > ~~ ~~ > > > > > [Bala]: can you share me the command sent and event recevied. > > I see that we receive a command complete event for the baud rate > > change command. > > > > command sent: 01 48 fc 01 11 > > vendor specific event: 04 ff 02 92 01 > > command complete event: 04 0e 04 01 00 00 00. > > > > > > > > > This is *a* command complete event, but the opcode is 0x0000 instead > > > of the earlier command. The same happens for the firmware > > > download/read version command, which is the reason why the command > > > complete injection mess > > > (https://lore.kernel.org/patchwork/patch/1027955/) is needed in one > > > way or another. > > > > > [Bala]: fw download approach is different where we use > > __hci_cmd_sync() where as here we use hci_uart_tx_wakeup() > > which directly calls the hci_uart_write_work(). so even we > > send an valid opcode or not for baudrate change will bot matter. > > > [Bala]: i miss understood the comment. Yes your true. in the all vendor > commands SoC responds with an 0x0000 opcode. And IIUC this is not compliant with the spec, or at least the BT core expects the actual opcode to consider the command to be completed.