Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp766792ybh; Wed, 11 Mar 2020 10:21:34 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtFE7Rhpr6q1y0ScGaduDzW4r1S55U+B9JiYmqm1VGdVMoAWdTg+xUx+3x3NmIuK+4Gy7gE X-Received: by 2002:a05:6830:11:: with SMTP id c17mr2487882otp.292.1583947293996; Wed, 11 Mar 2020 10:21:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583947293; cv=none; d=google.com; s=arc-20160816; b=qgQeZd1K9oEGIgGOXrUpcJTrHfuK6UPl+0Q5Bs5/NSLvV4pXTdpYRWQO3MJmCjJtXh 8B+vm1ikP6ZyNX2ERF90UL9QAy/WGqYdOlKE/UTpKMUZDEM9/ZF6ln4IIOERR4qouFap qP/6ggohH4jafzH5qYpsYfhXwaMDqhp9im/YEi2Diw1gMnfo6Coi3gk5t3LLlCtES3+j IC3ZOTYTbAYATFaujScaRAXhB2TJ3+KaOIgWii9itOPRL1Ogbb0q8cLZv9h4xnpK6brb xMPiTqT8Nu0cgR4lRbYFQJtgMKTD/FRBo+l0rRVZQmmMDyvzKVZbEMtiGmjJjUt3824X +rBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=MEkaiHQZMx1UJA9RPgEM4Gg2VNhyN6paaXR7j/Fo1Hs=; b=rWjeurUj+jbnEjU6nFFuD/5dEqzL8GPcHfrn6Sv+vE7AVaPrwh0B3QbeqctqdpBx/u 3zeYOiMmw5FTOe8GvdSLReLMyInCe/cra6KtMxlrdota+GRWIUK0B/mS6PIa+DrdfFmG uJVTkZ9DDUJDr1VBkq3zgM1xS2BdS+YIxw4o5KYXRTuMmrJ3xXuqQzhxv51lemXn5kpS Y3cBbefhmN1IemutFfJ6oSXILyihO5Ld4wTWbLerox1OBqEAJaMjuU2UV8MdvONdAGBj ljemDzvPPZU5FY1ljwrcDbtT+AjAzw15NeRb7f6+K+JVuPC52VO+E4rJ6MQ8uL+EGUFi DPsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DxkJwdYB; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l24si1251626otk.115.2020.03.11.10.21.08; Wed, 11 Mar 2020 10:21:33 -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; dkim=pass header.i=@chromium.org header.s=google header.b=DxkJwdYB; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730445AbgCKRUd (ORCPT + 99 others); Wed, 11 Mar 2020 13:20:33 -0400 Received: from mail-vs1-f66.google.com ([209.85.217.66]:43743 "EHLO mail-vs1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730211AbgCKRU2 (ORCPT ); Wed, 11 Mar 2020 13:20:28 -0400 Received: by mail-vs1-f66.google.com with SMTP id 7so1833296vsr.10 for ; Wed, 11 Mar 2020 10:20:27 -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=MEkaiHQZMx1UJA9RPgEM4Gg2VNhyN6paaXR7j/Fo1Hs=; b=DxkJwdYB2pE55yk2uohYiCIxvUd2RfSY0xgbwxZSRdlVNQXspPc65ZzAEqaVwDUvvw HQvs8uHNlP3u+/LIioDnxGa26S8ZMPqF/OJv3pA2r5z5GqhGONIrzSHeT5rt/OumVHTY efB2XSO4fgf1K5Rft2dfoGNnenwPrk5roFVOE= 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=MEkaiHQZMx1UJA9RPgEM4Gg2VNhyN6paaXR7j/Fo1Hs=; b=hFiQ0JYdNx/h34gtmKkXU79q+mrPkywi5ySRoSPrJ8HXKqoQtKBa8ncAQRBBI3Gx1y R29Fuu+8G9DIBRf/i6G6BNb2l3HBltrTUjVQ4mPNnRojHcHDTD9n17o9VgLSFxoAjNZW 0LcoDKHycKNgNtRP23CL0QN/A+8slVSUerVkZ+2q8ZP9ndX2SVzm8dvYAyTPZ7NhsWC+ Ms0d6WYkWnbC1hccFL0vH/atj+JssvqRxcpHE4uVrRjCkzx6P112EYCK+yIEtfxzm00E Mefg4urSHsI0WEnoUIJnzc8Dwk2g8/Kq5co23/bjVp0fjhylDGNuMUbbd4ih+3XL5l4f ARyg== X-Gm-Message-State: ANhLgQ2fsELaADJRCrLWPSfwYEipMwvEjFqyyKClhFTtOKl/38FilO0N Uqmg3JLDUTv1o3F18fI5dKLQa2B5oZHNQJlfnIDVIA== X-Received: by 2002:a67:f641:: with SMTP id u1mr2714335vso.86.1583947226874; Wed, 11 Mar 2020 10:20:26 -0700 (PDT) MIME-Version: 1.0 References: <20200311155404.209990-1-abhishekpandit@chromium.org> <99C097F2-FD84-49B8-B3D7-F03C34C4F563@holtmann.org> In-Reply-To: <99C097F2-FD84-49B8-B3D7-F03C34C4F563@holtmann.org> From: Abhishek Pandit-Subedi Date: Wed, 11 Mar 2020 10:20:16 -0700 Message-ID: Subject: Re: [RFC PATCH v6 0/5] Bluetooth: Handle system suspend gracefully To: Marcel Holtmann Cc: Luiz Augusto von Dentz , Alain Michaud , Bluez mailing list , ChromeOS Bluetooth Upstreaming , "David S. Miller" , Johan Hedberg , netdev , LKML , Jakub Kicinski Content-Type: text/plain; charset="UTF-8" Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Let's continue the discussion on the bluez list. I will update the patch series so that the "set_wake_capable" management change is last in the series there as well and send out an update today. Thanks Abhishek On Wed, Mar 11, 2020 at 10:05 AM Marcel Holtmann wrote: > > Hi Abhishek, > > > This patch series prepares the Bluetooth controller for system suspend > > by disconnecting all devices and preparing the event filter and LE > > whitelist with devices that can wake the system from suspend. > > > > The main motivation for doing this is so we can enable Bluetooth as > > a wake up source during suspend without it being noisy. Bluetooth should > > wake the system when a HID device receives user input but otherwise not > > send any events to the host. > > > > This patch series was tested on several Chromebooks with both btusb and > > hci_serdev on kernel 4.19. The set of tests was basically the following: > > * Reconnects after suspend succeed > > * HID devices can wake the system from suspend (needs some related bluez > > changes to call the Set Wake Capable management command) > > * System properly pauses and unpauses discovery + advertising around > > suspend > > * System does not wake from any events from non wakeable devices > > > > Series 2 has refactored the change into multiple smaller commits as > > requested. I tried to simplify some of the whitelist filtering edge > > cases but unfortunately it remains quite complex. > > > > Series 3 has refactored it further and should have resolved the > > whitelisting complexity in series 2. > > > > Series 4 adds a fix to check for powered down and powering down adapters. > > > > Series 5 moves set_wake_capable to the last patch in the series and > > changes BT_DBG to bt_dev_dbg. > > > > Please review and provide any feedback. > > > > Thanks > > Abhishek > > > > > > Changes in v6: > > * Removed unused variables in hci_req_prepare_suspend > > * Add int old_state to this patch > > > > Changes in v5: > > * Convert BT_DBG to bt_dev_dbg > > * Added wakeable list and changed BT_DBG to bt_dev_dbg > > * Add wakeable to hci_conn_params and change BT_DBG to bt_dev_dbg > > * Changed BT_DBG to bt_dev_dbg > > * Wakeable entries moved to other commits > > * Patch moved to end of series > > > > Changes in v4: > > * Added check for mgmt_powering_down and hdev_is_powered in notifier > > > > Changes in v3: > > * Refactored to only handle BR/EDR devices > > * Split LE changes into its own commit > > * Added wakeable property to le_conn_param > > * Use wakeable list for BR/EDR and wakeable property for LE > > > > Changes in v2: > > * Moved pm notifier registration into its own patch and moved params out > > of separate suspend_state > > * Refactored filters and whitelist settings to its own patch > > * Refactored update_white_list to have clearer edge cases > > * Add connected devices to whitelist (previously missing corner case) > > * Refactored pause discovery + advertising into its own patch > > > > Abhishek Pandit-Subedi (5): > > Bluetooth: Handle PM_SUSPEND_PREPARE and PM_POST_SUSPEND > > Bluetooth: Handle BR/EDR devices during suspend > > Bluetooth: Handle LE devices during suspend > > Bluetooth: Pause discovery and advertising during suspend > > Bluetooth: Add mgmt op set_wake_capable > > > > include/net/bluetooth/hci.h | 17 +- > > include/net/bluetooth/hci_core.h | 43 ++++ > > include/net/bluetooth/mgmt.h | 7 + > > net/bluetooth/hci_core.c | 102 ++++++++++ > > net/bluetooth/hci_event.c | 24 +++ > > net/bluetooth/hci_request.c | 331 ++++++++++++++++++++++++++----- > > net/bluetooth/hci_request.h | 2 + > > net/bluetooth/mgmt.c | 92 +++++++++ > > 8 files changed, 558 insertions(+), 60 deletions(-) > > patches 1-4 have been applied to bluetooth-next tree. > > I skipped patch 5 since now we have to discuss how best the API for setting the wakeable devices will be. Care to start up a discussion thread for that? > > Regards > > Marcel >