Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp207803rwb; Tue, 4 Oct 2022 02:56:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6v1cw9Q4JuaQFRbjIMUNGCnmIJ5fU/+eRjgSms9eiZFYOHUVFD5RrBha2js45FHYi8XJMG X-Received: by 2002:a63:6c06:0:b0:43c:783f:46b3 with SMTP id h6-20020a636c06000000b0043c783f46b3mr22340738pgc.101.1664877366346; Tue, 04 Oct 2022 02:56:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664877366; cv=none; d=google.com; s=arc-20160816; b=exWLWhDnLMbOgYQ5TLmLkAZI5XNtZ3UfxHAHi49Ljx6AguujO0/xIHAbSTMHdtciX3 miuxqxC7NAmB0ISzEg/CtjnrHojEruQ7o3AJN5OFGwLsQA2Rc+Hj5ZdIjEH4VyDiqpzl WI6Pc84IxuOmxCPd9NOpI7UCKyxtry7gQXWBwOAzvE6LLqtt/elVu8l2ZYI6a4vx6A9m 5p0HEM9rgf7sCjENB95ffFcUGIhuULwtrylPUAbLr6uAm7y5OdhzuIeNOXD0J5mUFgZv VHYx4J4HDXD4LOvS7ACB2gAlRnvYMSQDYL0UkzRi0PsNZrrrKIXHQE5aefHWiYjPyBhd UZzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=9xXwlJickjL5rEnB4sVoWH/A2L/KfsumqDvae/aJh1g=; b=XUDpuV953dfii3+WGPMpdhvwbDy0PTNEWzpOh5nbMRW3Xal0tYB1f3FTc4UR7k7edQ YseBcoRdKdhFw67/yljP088gLt7hTWt9NXkyyAd0v6fg1cl17Ax+gf1wuDD0RQd3EYDY DnN1KpHQ6I/C7+De/4BW41GLdF2R4vMMUhiM1+MCQ8ATikR2Hxf3I0Rc9ypChQif5Thq cIipQthmXnMPcZP4tI5mSTdukU90157V5Q4Dr70A6niAz0NARG+xpnj7JuP/s2xjwSxN 6w8GU2fWqPkkcdLTtVAkmFq3vqZnQe1lQp29B1eadsgIsA2ZIYQQwADTMadcAC7u+tHL sEVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=VPZB9c1t; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v2-20020a631502000000b0043c1481a835si13384259pgl.267.2022.10.04.02.55.52; Tue, 04 Oct 2022 02:56:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-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=@google.com header.s=20210112 header.b=VPZB9c1t; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229543AbiJDJvk (ORCPT + 99 others); Tue, 4 Oct 2022 05:51:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229677AbiJDJvO (ORCPT ); Tue, 4 Oct 2022 05:51:14 -0400 Received: from mail-oa1-x36.google.com (mail-oa1-x36.google.com [IPv6:2001:4860:4864:20::36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BC5962F4 for ; Tue, 4 Oct 2022 02:49:46 -0700 (PDT) Received: by mail-oa1-x36.google.com with SMTP id 586e51a60fabf-1322d768ba7so8705731fac.5 for ; Tue, 04 Oct 2022 02:49:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date; bh=9xXwlJickjL5rEnB4sVoWH/A2L/KfsumqDvae/aJh1g=; b=VPZB9c1tP8hehChiMZ0JfBLF5K01puyWWC8UoaOqB4Q6KV30Wa3t3mh19hh1j2VtVj A844YrdyqofCY+JskIFbNTPiakr2BAF3qYVL9QFbhywGRlSi3HDn8chcoByWDK1RBhkd dSWsoBxC6l09xGZm9jncY8Lb4G9cukNUBxv2LLuGfiGOU/nrPDoR2GdVYNxtNufJTswS PdQtAlf5Lhu078N7rXez2fkPdKBa3Bvj/udsrOEIGfLzBrUX2Uma5e4GhTHtUa0c6oKd Hw7PpAA/TXrtPLCkR2qEdPpJal5CvTftW3T6pTX7vE0sdHlcOYkM6fRD8Zo8NGyxbAvr FgPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date; bh=9xXwlJickjL5rEnB4sVoWH/A2L/KfsumqDvae/aJh1g=; b=1V5epCXOYmTYbw7Xa+iIPaO+mTSJ+lYyFf4a98GGR2RfsDj+fjbdMYw+JGb4I11GXD +vSMsA6tpG89T1wY5++lsLfy4nVOlZGWEXOAPw63xOd/eDbLVfQ0Qc75N2N/MUJe2xwi XeQxEU/YbMdDOxPL6kgwMR1NmohoYZnPLEfHDSWgZ5mE5JKH/0TA1kH808b4Z2xEtPYd 0vT6gGoo4m+a2bEW6RTv9OTQS9aeRLSPQYwKGjtPcyhjrKq+eU8vvYJTmYbKM824KDMO pkr4NlmU8F2SKF/PKmYBYf3Xzi6mxlVvzL6z8UR6SaIDzBw8BwZwpjLN7q1XlZIQpOk4 2kyw== X-Gm-Message-State: ACrzQf0bffBJxCUevIOGtai00DmIYzdazCM/E87+qckD3OfExWt+/VyA mwMyhGElyq5fgjRTETbTNhNzfyt3eDKB7ra8+WcObg== X-Received: by 2002:a05:6870:160f:b0:131:e2c3:8fe3 with SMTP id b15-20020a056870160f00b00131e2c38fe3mr7529516oae.54.1664876985452; Tue, 04 Oct 2022 02:49:45 -0700 (PDT) MIME-Version: 1.0 References: <20221004163224.1.I46e98b47be875d0b9abff2d19417c612077d1909@changeid> <96d37e06-3bba-ee4a-d81d-f784aa7dbf03@molgen.mpg.de> In-Reply-To: <96d37e06-3bba-ee4a-d81d-f784aa7dbf03@molgen.mpg.de> From: Archie Pusaka Date: Tue, 4 Oct 2022 17:49:34 +0800 Message-ID: Subject: Re: [PATCH] Bluetooth: btusb: Introduce generic USB reset To: Paul Menzel Cc: linux-bluetooth@vger.kernel.org, Luiz Augusto von Dentz , Marcel Holtmann , chromeos-bluetooth-upstreaming@chromium.org, Archie Pusaka , Abhishek Pandit-Subedi , Ying Hsu , Johan Hedberg , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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-bluetooth@vger.kernel.org Hi Paul, On Tue, 4 Oct 2022 at 17:18, Paul Menzel wrote: > > Dear Archie, > > > Thank you for the patch. > > Am 04.10.22 um 10:32 schrieb Archie Pusaka: > > From: Archie Pusaka > > > > On cmd_timeout and there is no reset_gpio, reset the USB port as a > > Maybe: > > s/there is no/with no/g > > > last resort. > > Can you please document your test setup, and also mention that you > change the behavior of: > > 1. btusb_intel_cmd_timeout > 2. btusb_rtl_cmd_timeout > > [=E2=80=A6] > > > Kind regards, > > Paul Thanks for the input! All done, uploaded v2. PTAL, thanks! > > > > Signed-off-by: Archie Pusaka > > Reviewed-by: Abhishek Pandit-Subedi > > Reviewed-by: Ying Hsu > > > > --- > > > > drivers/bluetooth/btusb.c | 26 ++++++++++++++++---------- > > 1 file changed, 16 insertions(+), 10 deletions(-) > > > > diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c > > index 271963805a38..11040124ef79 100644 > > --- a/drivers/bluetooth/btusb.c > > +++ b/drivers/bluetooth/btusb.c > > @@ -696,6 +696,19 @@ struct btusb_data { > > unsigned cmd_timeout_cnt; > > }; > > > > +static void generic_usb_reset(struct hci_dev *hdev, struct btusb_data = *data) > > +{ > > + int err; > > + > > + bt_dev_err(hdev, "Resetting usb device."); > > + /* This is not an unbalanced PM reference since the device will r= eset */ > > + err =3D usb_autopm_get_interface(data->intf); > > + if (!err) > > + usb_queue_reset_device(data->intf); > > + else > > + bt_dev_err(hdev, "Failed usb_autopm_get_interface: %d", e= rr); > > +} > > + > > static void btusb_intel_cmd_timeout(struct hci_dev *hdev) > > { > > struct btusb_data *data =3D hci_get_drvdata(hdev); > > @@ -705,7 +718,7 @@ static void btusb_intel_cmd_timeout(struct hci_dev = *hdev) > > return; > > > > if (!reset_gpio) { > > - bt_dev_err(hdev, "No way to reset. Ignoring and continuin= g"); > > + generic_usb_reset(hdev, data); > > return; > > } > > > > @@ -736,7 +749,7 @@ static void btusb_rtl_cmd_timeout(struct hci_dev *h= dev) > > return; > > > > if (!reset_gpio) { > > - bt_dev_err(hdev, "No gpio to reset Realtek device, ignori= ng"); > > + generic_usb_reset(hdev, data); > > return; > > } > > > > @@ -761,7 +774,6 @@ static void btusb_qca_cmd_timeout(struct hci_dev *h= dev) > > { > > struct btusb_data *data =3D hci_get_drvdata(hdev); > > struct gpio_desc *reset_gpio =3D data->reset_gpio; > > - int err; > > > > if (++data->cmd_timeout_cnt < 5) > > return; > > @@ -787,13 +799,7 @@ static void btusb_qca_cmd_timeout(struct hci_dev *= hdev) > > return; > > } > > > > - bt_dev_err(hdev, "Multiple cmd timeouts seen. Resetting usb devic= e."); > > - /* This is not an unbalanced PM reference since the device will r= eset */ > > - err =3D usb_autopm_get_interface(data->intf); > > - if (!err) > > - usb_queue_reset_device(data->intf); > > - else > > - bt_dev_err(hdev, "Failed usb_autopm_get_interface with %d= ", err); > > + generic_usb_reset(hdev, data); > > } > > > > static inline void btusb_free_frags(struct btusb_data *data) Cheers, Archie