From patchwork Mon Oct 24 11:28:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9662 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp534527wru; Mon, 24 Oct 2022 09:11:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5yQU4uxklJobYKqAX704UrIpZ7M8f15f9PX94j+T7v8OiKmwKqPdqerLdYfWIDPeVkEmK2 X-Received: by 2002:a65:45c1:0:b0:461:5855:8d86 with SMTP id m1-20020a6545c1000000b0046158558d86mr28411400pgr.436.1666627874789; Mon, 24 Oct 2022 09:11:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627874; cv=none; d=google.com; s=arc-20160816; b=V+f8B4KTuVB1KHHlTXdrWGfwWdTdXGBxAorF/g8EnqgN1JdLnhDq7AL0jE6B8Ny86g j+RU9nSRvIGB6OtFUkSU9Suqy+FN010/UXkvmT66Ng+yvu12uAHC/IMKjT+w2/4XfgPa mnuTxHblbSp/bq9epqTsSS9BTj6xwAR7p8L2rEpkB7lcJup2dU4LCQyU2e6NX7TWUT2k g+ZVog8qtWN0QbanPczNvpZo2omcpHC7r7UQngKrYJjlLFkoWAMox8i3B0LnUQM3Saq9 6kCGOP/gjlMmPmjLeOfFSpHZFZSBLe170Wvy8hDVQFzvJGNEP5S5qSdXzT+Gr1uZkJHK SkQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kOC0fZ+gXywZK//FDdKImoTEfrBjW2CPNINv9vsSX1g=; b=yGzoEb3SjMc6n/N5Q+4zaSFOWdZnPCSv+TI+Sm+anCwaxIo8PWz2kip+mLzoRN1Id6 PQNjIg7DKjZZesGF/ZYEM+w6LXmW57fzVGCdbcSh8hBdKGLAS/0y85AqWmAaGeemo+Wm 6Nbjm0jYvX1TDwa5Ngw71y9XvIUz9PK6XwJs3SyOOx0hAgieM/Own1SmzGoZ0G9rLR4j 7ASKJdEgRnepAVt7Y21X3wlEbNms+exKcS4hqjsudIDHKT4IFZ93qJ1aAJyjj/Yt9e8Q Vk3iIkI8POb4D+8+8JQJl+/ABwKHiDMd9qqsauHhZTBYu3P/vSp+VYqrN6U4C8eI/ij1 aAPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Z4duEwLj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u18-20020a170902e5d200b0018388edd187si41933788plf.56.2022.10.24.09.11.00; Mon, 24 Oct 2022 09:11:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Z4duEwLj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233756AbiJXQJK (ORCPT + 99 others); Mon, 24 Oct 2022 12:09:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233642AbiJXQEv (ORCPT ); Mon, 24 Oct 2022 12:04:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 332EB2037A; Mon, 24 Oct 2022 07:57:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7A534B8163F; Mon, 24 Oct 2022 12:20:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8142C433C1; Mon, 24 Oct 2022 12:20:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614032; bh=wpKkHDRmyTSy6cvFrclZFS/LNJIZ/HR7B2aaDTv16G4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z4duEwLj9KZW+1HmYDnPsp5zo2PGKfF+m+/Pn05fZobZHPLW7snYXqwmuK11gl8Ji 1nvVj8qT/js/Nr4zFRKobdlTbTu0rsa3YyhEF7X/XEVgUUqvBcSdzlk83B81zqU/EU LVKByTtanpwhpZeP0XerTTllbJ3cesEwaxAew15A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Chen , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.10 106/390] Bluetooth: btusb: Fine-tune mt7663 mechanism. Date: Mon, 24 Oct 2022 13:28:23 +0200 Message-Id: <20221024113027.200760921@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585990072367039?= X-GMAIL-MSGID: =?utf-8?q?1747585990072367039?= From: Mark Chen [ Upstream commit 48c13301e6baba5fd0960b412af519c0baa98011 ] Fine-tune read register for mt7663/mt7921. For mediatek chip spcific wmt protocol, we add more delay to send EP0 In-Token. Signed-off-by: Mark Chen Signed-off-by: Marcel Holtmann Stable-dep-of: fd3f106677ba ("Bluetooth: btusb: mediatek: fix WMT failure during runtime suspend") Signed-off-by: Sasha Levin --- drivers/bluetooth/btusb.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index a699e6166aef..eb6e33d168d8 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -2816,6 +2816,7 @@ enum { enum { BTMTK_WMT_INVALID, BTMTK_WMT_PATCH_UNDONE, + BTMTK_WMT_PATCH_PROGRESS, BTMTK_WMT_PATCH_DONE, BTMTK_WMT_ON_UNDONE, BTMTK_WMT_ON_DONE, @@ -2831,7 +2832,7 @@ struct btmtk_wmt_hdr { struct btmtk_hci_wmt_cmd { struct btmtk_wmt_hdr hdr; - u8 data[256]; + u8 data[1000]; } __packed; struct btmtk_hci_wmt_evt { @@ -2934,7 +2935,7 @@ static void btusb_mtk_wmt_recv(struct urb *urb) * to generate the event. Otherwise, the WMT event cannot return from * the device successfully. */ - udelay(100); + udelay(500); usb_anchor_urb(urb, &data->ctrl_anchor); err = usb_submit_urb(urb, GFP_ATOMIC); @@ -3238,9 +3239,9 @@ static int btusb_mtk_reg_read(struct btusb_data *data, u32 reg, u32 *val) return err; } -static int btusb_mtk_id_get(struct btusb_data *data, u32 *id) +static int btusb_mtk_id_get(struct btusb_data *data, u32 reg, u32 *id) { - return btusb_mtk_reg_read(data, 0x80000008, id); + return btusb_mtk_reg_read(data, reg, id); } static int btusb_mtk_setup(struct hci_dev *hdev) @@ -3258,7 +3259,7 @@ static int btusb_mtk_setup(struct hci_dev *hdev) calltime = ktime_get(); - err = btusb_mtk_id_get(data, &dev_id); + err = btusb_mtk_id_get(data, 0x80000008, &dev_id); if (err < 0) { bt_dev_err(hdev, "Failed to get device id (%d)", err); return err;