Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp6960557ybe; Wed, 18 Sep 2019 11:52:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqyUKFBQwAJnDvcqMicf2er/iK5rxqI5lCj3cg1lfD0WPVj5/Z4GWw6ZU8RIB0W6wZXen6ks X-Received: by 2002:a17:906:4ec2:: with SMTP id i2mr3743853ejv.83.1568832758689; Wed, 18 Sep 2019 11:52:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568832758; cv=none; d=google.com; s=arc-20160816; b=pqGGsaYXPGGJrsLPWjFxWTYqiyKLmkchmyyTDAerBx+YBxkngZlRDPJt+0ACOnawFl W42W9E5DXIE+VeTq05t0ryCAM+TYguFng8SmTfLS3ohYVDJuRWVV0GNyqorRGLEny4de ALqSwYb+Usha+KMs70Oe5twUHgnsOsQSutaFE/IPrv3ALjstvmwAxgPbtPax0zVNQa4I KRfGIhx3lxewMxtFz+WfDhBHqkXR2WGh7pXSRG2rv5eW9gzjmHycbw0jZPLvvR2ZT7Nk n9al3ObWu2CJYvM7jCnvoDyHx7HCEIKh/Gajc/jJgjMi+abk4+wTbDX6AQh5e2/oJN3j gqUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date; bh=mqTQ1Q2bRIEV6IBSILQthMWD5yD3Gqr0q7jCUhGlAJo=; b=hu+wc9ONsTPPkSKZ2k9VPEbSBlsHyj37nIgIYofsp12xm4P27W3mK8hjE3c8aOkags 6xK1pBUaUVCZmS5nx0eMxLblTQ2RZ2TgOAYn+qVJks7TpJ7zI1CmHfbmYdhB0MWxKGDM D2b4DYna4ULiL5xci5G6R4V9gjXnRlcUPHOFr9SgMPSQ2XT2EWgCvnhJHLlWGCILxdcv mwOBtcU+XQ9YMrzwKDq0YUys+YujglZRqlssZEuM0OcA3YCfrMHEVmfWBd4C3Qv1B+1B B4oVIsG+mKl+JzVPto4CMo1EiZnU1sxIlbG4V/NN+kySlPTBZGM22ZjQfA67a+jIQgRA V8Kw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c31si4060940edb.309.2019.09.18.11.51.58; Wed, 18 Sep 2019 11:52:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730433AbfIRSvI (ORCPT + 99 others); Wed, 18 Sep 2019 14:51:08 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:54384 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1730139AbfIRSvI (ORCPT ); Wed, 18 Sep 2019 14:51:08 -0400 Received: (qmail 7253 invoked by uid 2102); 18 Sep 2019 14:51:07 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 18 Sep 2019 14:51:07 -0400 Date: Wed, 18 Sep 2019 14:51:07 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Abhishek Pandit-Subedi cc: linux-bluetooth@vger.kernel.org, , Douglas Anderson , Kai-Heng Feng , Hui Peng , , Johan Hedberg , Suzuki K Poulose , Mark Brown , "Rafael J. Wysocki" , Wolfram Sang , , Marcel Holtmann , Len Brown , Mathias Payer , Dmitry Torokhov , Greg Kroah-Hartman , Mans Rullgard , Pavel Machek , YueHaibing Subject: Re: [PATCH 0/2] Reset realtek bluetooth devices during user suspend In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org On Wed, 18 Sep 2019, Abhishek Pandit-Subedi wrote: > Sorry, last reply went out with HTML. Re-sending in plain text. > > On Wed, Sep 18, 2019 at 7:23 AM Alan Stern wrote: > > > > On Tue, 17 Sep 2019, Abhishek Pandit-Subedi wrote: > > > > > On a Realtek USB bluetooth device, I wanted a simple and consistent way > > > to put the device in reset during suspend (2 reasons: to save power and > > > disable BT as a wakeup source). Resetting it in the suspend callback > > > causes a detach and the resume callback is not called. Hence the changes > > > in this series to do the reset in suspend_noirq. > > > > What about people who _want_ BT to be a wakeup source? > > When BT is enabled as a wakeup source, there is no reset. > > > Why does putting the device in reset save power? That is, a suspended > > device is very strictly limited in the amount of current it's allowed > > to draw from the USB bus; why should it draw significantly less when it > > is reset? > > I don't know that it's significantly less (only that it's OFF). My > greater motivation is to make sure the bluetooth chip isn't > accumulating events while the host is turned off. Sorry, I should have > made that more clear in the cover letter. > > When the host is off, it continues to accumulate events for the host > to process (packets from connected devices, LE advertisements, etc). > At some point, the firmware buffers fill up and no more events can be > stored. When the host is resumed later on, the firmware is in a bad > state and doesn't respond. I had originally just reset in ->resume but > then connected wireless devices wouldn't disconnect from the BT either > and I had trouble getting them to reconnect. > > > > > > I looked into using PERSIST and reset on resume but those seem mainly > > > for misbehaving devices that reset themselves. > > > > They are, but that doesn't mean you can't use them for other things > > too. > > > > > This patch series has been tested with Realtek BT hardware as well as > > > Intel BT (test procedure = disable as wake source, user suspend and > > > observe a detach + reattach on resume). > > > > This series really seems like overkill for a single kind of device. > > > > Is there any way to turn off the device's BT radio during suspend (if > > wakeup is disabled) and then turn it back on during resume? Wouldn't > > that accomplish what you want just as well? > > Probably (but I couldn't find a way to do that). There's no way to turn off the device's BT radio? Then what happens when the user turns off Bluetooth from the wireless control panel? > I want to prevent > bluetooth from waking up the host and to reliably be in a good state > when the host resumes. The reset logic I implemented causes the hci > device to disappear and reappear, which userspace seems to handle > gracefully. Have you tried out the persist/reset-on-resume approach? Alan Stern