Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp699666pxk; Wed, 23 Sep 2020 13:44:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymQVS2bz4rmTGQEM/nWS3KOD+uazyFN0/NUrlhXwpoW5+KmxqsIP9EZa++8AipUwuVEWMJ X-Received: by 2002:a05:6402:1711:: with SMTP id y17mr1162646edu.345.1600893885976; Wed, 23 Sep 2020 13:44:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600893885; cv=none; d=google.com; s=arc-20160816; b=vFyaVLKW3VG+hzJ7oail+PhtogYKHXm2keQtP3IM2zweX2WRUNkepEWKOpwp+ZHql+ yaoOyIy8X1PUwO0Xlj8WO3Y7j4vF31XDGSbHTePJQKvyvaawaZS9PgLm84yfs9T/vCrE 7FMal2JBdwGMHWYHKiMq51RBy5o2DwQ3VDCg0ufnxYbWR0UP0l61Bh6D2/jvE/X4Fx0W WUPUDTP2IujvprNee6qWY4rQ3WXNMz/p0H8DmtJ9ebiT8xo17Y/wqrWIa4vLMN430vMS +r6jA1pVqAf1iUqBt8wWqct79KrZsWr3pTyvPIvLW/NV8GRZCFH6lqbwANrmlkErbWY2 a8Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=WtnMpKEFk8XdbisKvZAYgb55+Tp7Iu2JFYEB4yZJj24=; b=R8LCv8t6usRbv1M94N3P1XRVKOXNcrif1RJbSmhD3df/ZvfONVS4l+kQIKDzRkKwJY VdVmxGx7VGiBoJkWdhihnSmzj+87s/ahiobiAJBZT0k3d3t2zqNKtBiGX1A4GHoRUwiU FuazlYbFuh87nlVpvsbMKrgL2Wp0dVvG+xFUQ2B/pZS+yEh2NoA7bMrpbSu4+eiJlYLQ nTGAn1hjQxvUQGwLD7sdurqVOyBgEvMM+xYPcv6thpsIZvvoNa0+MCVrQT/ylQQ1h2DA Db93bvHqXnA6ZRPztHAz5d8VMpeSc3W2si6HkmFuUh8wcggVkUqDO09gcnZYeLtA2bum YUeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="FkDj/yGD"; 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 df4si637548edb.378.2020.09.23.13.44.05; Wed, 23 Sep 2020 13:44:45 -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="FkDj/yGD"; 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 S1726703AbgIWUlY (ORCPT + 99 others); Wed, 23 Sep 2020 16:41:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726599AbgIWUlY (ORCPT ); Wed, 23 Sep 2020 16:41:24 -0400 Received: from mail-vs1-xe41.google.com (mail-vs1-xe41.google.com [IPv6:2607:f8b0:4864:20::e41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CDD5C0613D1 for ; Wed, 23 Sep 2020 13:41:24 -0700 (PDT) Received: by mail-vs1-xe41.google.com with SMTP id e23so802410vsk.2 for ; Wed, 23 Sep 2020 13:41:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WtnMpKEFk8XdbisKvZAYgb55+Tp7Iu2JFYEB4yZJj24=; b=FkDj/yGDWO7dTaq0x0xSMUm5/lbKNuWMUJOEmj8IECuFSkAIZqsWYybVdHKjdkeG+Q PKnmtqkRABkKepN55NXhuZlD+hNLVxGr6gYYQqdHZO3hMixceQBlVYZpBlk8m39QsHjx 5Ag5qUa6bJnhUbOhNMnfFNd7xu7F/RWZibwtA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WtnMpKEFk8XdbisKvZAYgb55+Tp7Iu2JFYEB4yZJj24=; b=nEfocc+s+4+luwUUneznrfgTsSWlVRFcx0GF9YJde8EwAuPs/io/s0dbfrSsxpXKml RIpjvVGtKTV56EgL86crPxxDDH/I7yfUdHSSTSUjyzZUbIvQZn9SFrPycPvegnh5HJeb MQOW27i2VELI6RxCfw8MKAFtIEaKAC7qE6v2nYjqCZs/6D5qVX9h4ou9c7/ruHpvjY8x Z0L+/YW1exgbnVo33CziM8y/YwX7KAZ25Lrqnx000/t3Ja7oLlRfeHkIzQV1s0HT/6fq AI0/aInbuwYxWYIlImZGh+wCpRlhFprOhw0/UUTKWcIGtNrMxRj4iFex1fLDLSDCMJJW 7G4g== X-Gm-Message-State: AOAM533ga0ZU9aSGN25Atj8PctR95z68Us0nHsG76H1dJgcRXTeEZ0kp 56zs3/CG7tAR1IwZV4oPQ44MO1v+NJoyPmejdlbNBQ== X-Received: by 2002:a67:fc48:: with SMTP id p8mr1728292vsq.53.1600893683267; Wed, 23 Sep 2020 13:41:23 -0700 (PDT) MIME-Version: 1.0 References: <20200923175602.9523-1-kai.heng.feng@canonical.com> In-Reply-To: <20200923175602.9523-1-kai.heng.feng@canonical.com> From: Abhishek Pandit-Subedi Date: Wed, 23 Sep 2020 13:41:11 -0700 Message-ID: Subject: Re: [PATCH] Bluetooth: btusb: Avoid unnecessary reset upon system resume To: Kai-Heng Feng Cc: Marcel Holtmann , Johan Hedberg , Alex Lu , "open list:BLUETOOTH DRIVERS" , open list Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Kai-Heng, Which Realtek controller is this on? Specifically for RTL8822CE, we tested without reset_resume being set and that was causing the controller being reset without bluez ever learning about it (resulting in devices being unusable without toggling the BT power). If the firmware doesn't cut off power during suspend, maybe you shouldn't set the BTUSB_WAKEUP_DISABLE flag for that controller. I would prefer this doesn't get accepted in its current state. Abhishek On Wed, Sep 23, 2020 at 10:56 AM Kai-Heng Feng wrote: > > Realtek bluetooth controller may fail to work after system sleep: > [ 1272.707670] Bluetooth: hci0: command 0x1001 tx timeout > [ 1280.835712] Bluetooth: hci0: RTL: HCI_OP_READ_LOCAL_VERSION failed (-110) > > If platform firmware doesn't cut power off during suspend, the firmware > is considered retained in controller but the driver is still asking USB > core to perform a reset-resume. This can make bluetooth controller > unusable. > > So avoid unnecessary reset to resolve the issue. > > For devices that really lose power during suspend, USB core will detect > and handle reset-resume correctly. > > Signed-off-by: Kai-Heng Feng > --- > drivers/bluetooth/btusb.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c > index 8d2608ddfd08..de86ef4388f9 100644 > --- a/drivers/bluetooth/btusb.c > +++ b/drivers/bluetooth/btusb.c > @@ -4255,17 +4255,15 @@ static int btusb_suspend(struct usb_interface *intf, pm_message_t message) > enable_irq(data->oob_wake_irq); > } > > - /* For global suspend, Realtek devices lose the loaded fw > - * in them. But for autosuspend, firmware should remain. > - * Actually, it depends on whether the usb host sends > + /* For global suspend, Realtek devices lose the loaded fw in them if > + * platform firmware cut power off. But for autosuspend, firmware > + * should remain. Actually, it depends on whether the usb host sends > * set feature (enable wakeup) or not. > */ > if (test_bit(BTUSB_WAKEUP_DISABLE, &data->flags)) { > if (PMSG_IS_AUTO(message) && > device_can_wakeup(&data->udev->dev)) > data->udev->do_remote_wakeup = 1; > - else if (!PMSG_IS_AUTO(message)) > - data->udev->reset_resume = 1; > } > > return 0; > -- > 2.17.1 >