Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp102130pxk; Thu, 24 Sep 2020 00:11:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUQnTohB7KITy03DlBqeS7xOWPq6g64CsD//4ROK4Y0834YPneqjxSfvaBJf3+3p1pTl9U X-Received: by 2002:a17:906:cc8d:: with SMTP id oq13mr3192987ejb.280.1600931489224; Thu, 24 Sep 2020 00:11:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600931489; cv=none; d=google.com; s=arc-20160816; b=RvtFMA7M6KceflBJEauKMLMhoMeziO8zaL3dRZdUEWGD2IxKbg7GrbEnTjpNWH/X6f LuXsvJI8auh78lvPo3Gps8pTDTZs1DeE9WApWzUwi82npHiWvJoM2bZ1Eey2vRZho8fB 44QwR4Sz9t7vrbZSb+iDAxI6IreXec7l8T8Xy0koB564KoGyaFTwK3u5Pn+hkZCC/F/X 53CEG1QsDgur0vpIHKXs4iq/YilPOZXcGnTbTRLpTUBtjkdhV+Ft0y6QCQkqvWPUTwJw uB6Ns3xd7jryJnBY7xVFjowGoG8AfzjsoGo+HHTM9q64jLDetpf0c8YRCauiFXK87aiA BlMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=7SEmDPTjvz/G8PTwd4jD95iui7ejrnQ3k8IN+4zZ/wY=; b=FIrc5VhuZBFOThdb44QrxPxeOBqbpvqXEC0V5y2hkuL4RKI/TWFgxV87KpEQveFVS4 5YOBq1aGxiwQASMNeDKKmdy4AbttcrFh6dEPdEVwZjUU7mWosMs3MjvLB2K69LV1GPbA mAxzFTAuZnRebAonpSKF9asT8xtzET2MgPIYbytKbNdgdWUXTwPACB2vlHupW1y5hLDH kVG/AkS36WXssF3P7aWuPRsgZ0mbAgEU7ucITW2xvekfCUH2DgpZXx+xveBhnAdFWlgO oO6JBuMCaWJT4j85mrfWwhqlGPAJk5Qu2fbc/S+G/dWQJkCltkUWImaAL6NQhzySAjIJ ZGVw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y24si1542802eju.401.2020.09.24.00.10.46; Thu, 24 Sep 2020 00:11:29 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727004AbgIXHKl convert rfc822-to-8bit (ORCPT + 99 others); Thu, 24 Sep 2020 03:10:41 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:45491 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727014AbgIXHKl (ORCPT ); Thu, 24 Sep 2020 03:10:41 -0400 Received: from mail-pf1-f198.google.com ([209.85.210.198]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kLLOo-0003b6-Ky for linux-bluetooth@vger.kernel.org; Thu, 24 Sep 2020 07:10:38 +0000 Received: by mail-pf1-f198.google.com with SMTP id q5so1269315pfl.16 for ; Thu, 24 Sep 2020 00:10:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Nbrq59GvwtLcN9qKevu8+3dfH8r78wKpe+smKwZezME=; b=fcxPMeoHyMCaT1UFyUIUgdMmCiNIDouti3QG3r0ZVkandCZTABJrs4SOZCMtPLxodd 90Tf7/POfDab7QyvFZsoua9pJ2nxXdBx8Hw6+ijSJljcfwtVqvqaztOre7KXBnURVT0Q lbegwu7VeSqgM4WrT/mWVGcuVBZCZg3bzZ6p6N2hqb0NX95zcV4vJYeVmF94bPUlASt5 oZa5cVJCTrKcno8YdZpc0HGnx8TUlQ2zlYq5AHOxbNsGkdRWPJ3IphYN5/9c4fZe4e8W X3qnPZqYQ9E6uLTgLH7Eb4CpEmHKgWV26rApGzKD1n/khGQPGTOhelqzG0Qj2544hdPG d3+w== X-Gm-Message-State: AOAM532rOmT2Tz9isJBbKuv7tV2d2bkbQso+XqSOFqBXaUq8qX8mAC4T UEK9g7XUB1V3kQVIT6hug47/MS7TpbQTy6kCzNmXphtg3n+sCmw1Qm+GFfVwUFnXrF169t5+JHf y/6w7MGtgqGNZDgu+ziIE4ytpHmvlOwxNoFmfcWAsQ/TnwA== X-Received: by 2002:a17:90a:2ecb:: with SMTP id h11mr2601220pjs.195.1600931436188; Thu, 24 Sep 2020 00:10:36 -0700 (PDT) X-Received: by 2002:a17:90a:2ecb:: with SMTP id h11mr2601198pjs.195.1600931435690; Thu, 24 Sep 2020 00:10:35 -0700 (PDT) Received: from [192.168.1.208] (220-133-187-190.HINET-IP.hinet.net. [220.133.187.190]) by smtp.gmail.com with ESMTPSA id q10sm1351546pja.48.2020.09.24.00.10.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Sep 2020 00:10:35 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\)) Subject: Re: [PATCH] Bluetooth: btusb: Avoid unnecessary reset upon system resume From: Kai-Heng Feng In-Reply-To: Date: Thu, 24 Sep 2020 15:10:31 +0800 Cc: Marcel Holtmann , Johan Hedberg , Alex Lu , "open list:BLUETOOTH DRIVERS" , open list , "open list:USB XHCI DRIVER" Content-Transfer-Encoding: 8BIT Message-Id: References: <20200923175602.9523-1-kai.heng.feng@canonical.com> To: Abhishek Pandit-Subedi X-Mailer: Apple Mail (2.3608.120.23.2.1) Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org [+Cc linux-usb] Hi Abhishek, > On Sep 24, 2020, at 04:41, Abhishek Pandit-Subedi wrote: > > Hi Kai-Heng, > > Which Realtek controller is this on?' The issue happens on 8821CE. > > 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). The reset is done by the kernel, so how does that affect bluez? From what you described, it sounds more like runtime resume since bluez is already running. If we need reset resume for runtime resume, maybe it's another bug which needs to be addressed? > If the firmware doesn't cut off power during suspend, maybe you > shouldn't set the BTUSB_WAKEUP_DISABLE flag for that controller. We don't know beforehand if the platform firmware (BIOS for my case) will cut power off or not. In general, laptops will cut off the USB power during S3. When AC is plugged, some laptops cuts USB power off and some don't. This also applies to many desktops. Not to mention there can be BIOS options to control USB power under S3/S4/S5... So we don't know beforehand. > > I would prefer this doesn't get accepted in its current state. Of course. I think we need to find the root cause for your case before applying this one. Kai-Heng > > 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 >>