From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0138CC4CED0 for ; Wed, 18 Sep 2019 17:19:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CB6B621D7C for ; Wed, 18 Sep 2019 17:19:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ARUEYQc2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732181AbfIRRTg (ORCPT ); Wed, 18 Sep 2019 13:19:36 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:36301 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732174AbfIRRTf (ORCPT ); Wed, 18 Sep 2019 13:19:35 -0400 Received: by mail-qk1-f194.google.com with SMTP id y189so263125qkc.3 for ; Wed, 18 Sep 2019 10:19:35 -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=TZ6zNmTN5K3wsuw0UnWMZDNmXyrZg+XulUxUtSzlTDQ=; b=ARUEYQc20VKVq0DC9iR4ZW+0ILmmp38aDfsgHOE6Je7RahPrHGv+1PsoTjZaYCGYHx HuK5+jLbDz/QruHJpkhdLZ2xPx123034b3vz53chKCSsjZKah3Cgo3DJDPz0dRmryALo 7webVgnyiqJ1mCH0v1wKqCqToqpzY+EixxruU= 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=TZ6zNmTN5K3wsuw0UnWMZDNmXyrZg+XulUxUtSzlTDQ=; b=GdMp8udgB7hWtWDgOBV6l3PqeiQsoZPxsmoN6bBjMmjkagznIBA7oHW9tdZcGH6PHe 2qS88zrSJDYx4O8p9dD8JQABnCLpgj6iDMcyNFIf/Y64NW9mymYySUyQXR2uxwxH67df fESjfP2+QGraNsSu9KApESKJ68+hL5pW331EdnhV/BaRtTd+dos38HGORg9BQry8Llfo HC+R5ZjZBo3AqTWB9/MGJZnv3/x11MiZBlabi7u5BTNxbtxR73sPyHD2V2CrShTvmvY2 jyfwVaM3PbfikETsklIVoqidFpGzsqp4noUTFZ1aR7/eFPABE5XNyWkU/LZZRlIiHuVL Xl8w== X-Gm-Message-State: APjAAAUPO5kf6q0VXTbVY8gMEapQgkutD2XOHI4JPxyJBxnoqXI2JNxp b6o+aQjAKcf6kWn5djgL5xKCGGp0wU+TqHnraF1+qg== X-Google-Smtp-Source: APXvYqySXTHIUcstv5cPNi86ktBT04PmHseptOwBc0q27Fdkd1xYMUXPo9eFDDE5gpLKq/LzteJUa6hnXEf8sBpw5jw= X-Received: by 2002:ae9:e817:: with SMTP id a23mr4977536qkg.294.1568827174941; Wed, 18 Sep 2019 10:19:34 -0700 (PDT) MIME-Version: 1.0 References: <20190917212702.35747-1-abhishekpandit@chromium.org> In-Reply-To: From: Abhishek Pandit-Subedi Date: Wed, 18 Sep 2019 10:19:24 -0700 Message-ID: Subject: Re: [PATCH 0/2] Reset realtek bluetooth devices during user suspend To: Alan Stern Cc: linux-bluetooth@vger.kernel.org, linux-usb@vger.kernel.org, Douglas Anderson , Kai-Heng Feng , Hui Peng , linux-pm@vger.kernel.org, Johan Hedberg , Suzuki K Poulose , Mark Brown , "Rafael J. Wysocki" , Wolfram Sang , linux-kernel@vger.kernel.org, Marcel Holtmann , Len Brown , Mathias Payer , Dmitry Torokhov , Greg Kroah-Hartman , Mans Rullgard , Pavel Machek , YueHaibing Content-Type: text/plain; charset="UTF-8" Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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). 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. > Alan Stern >