Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp9515921ybl; Fri, 17 Jan 2020 13:28:17 -0800 (PST) X-Google-Smtp-Source: APXvYqxCDZjnV0C6PAuwbmpgSsyHqkrxYpv6oNYVdOIEhXMEr2wPSifOZKDGQnjXlx1KCILecqMF X-Received: by 2002:a54:4f04:: with SMTP id e4mr4705384oiy.111.1579296497054; Fri, 17 Jan 2020 13:28:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579296497; cv=none; d=google.com; s=arc-20160816; b=PtHJUrKISXQJW4cnUWiDIPaAgk2Vf8bwlm0lklTE3cUbDQnA+GCuyuGaQwxZ5O4Zf9 9ztJWte1w/pDzZkDzZOycX7o6XNydynXhYfrqbaaoVAOsdNN0OAbV0RUEZ6QbmdXmkgl BrQLyHRm1su+QHPnmoDZ3/QFGP7PdiMPNVcVQrJ+m6Gsh0kpEnCfr2OG/JfobNjdp1Ji 38CatQVHkMu5X1xOJFQTiaJAE5VGE5VjI3DL51UIlDAQ2czqnmv0HPYqvRcy+G54TKCU mf7Snd7PubV7nyvLVmHQEfxNk0XYhYgAHVCY8NSg3a62HIUELbwTBM310FWdS7ImJoU4 lTFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=g1l3obKwRCGQ8frlt+kT/Fwgd/74cacl1ClW7zB9H/o=; b=x627ZUJoeuFXUS5OhX8qPTwVyvpVYP5DNjqv8NpGicNXUJLzGOUcKrWrpWwqAtu3Fr 8uOj7YbMDCk3BAECH226Gu+tSN5rT5C++IrG1UPfgNshEfSfNIOtm39dHEOOBbgL10hj DqhAPBcHFQ6iNEcuGxcZubjLRE06d28nCcijBl8C2QsnepgGjDrnhUdBPFkw0fTZnfwh wn7c7OTvVzFouLw5dYBqhnwP9Mn9pWid5KZ2kYw/v/tWvjZfebBVLY5p5MnhOtoDfi0G H0bI5DzB2rDy35l4NqEHaS3QV7jCiqIbMZIVCT2nNIMsaCSiCaL5ga107ldg1YRGkGpE 84VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="CYHEf/2C"; 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 f190si14477297oig.229.2020.01.17.13.27.50; Fri, 17 Jan 2020 13:28:17 -0800 (PST) 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="CYHEf/2C"; 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 S1729291AbgAQV1f (ORCPT + 99 others); Fri, 17 Jan 2020 16:27:35 -0500 Received: from mail-pj1-f67.google.com ([209.85.216.67]:50354 "EHLO mail-pj1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729279AbgAQV1f (ORCPT ); Fri, 17 Jan 2020 16:27:35 -0500 Received: by mail-pj1-f67.google.com with SMTP id r67so3697054pjb.0 for ; Fri, 17 Jan 2020 13:27:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=g1l3obKwRCGQ8frlt+kT/Fwgd/74cacl1ClW7zB9H/o=; b=CYHEf/2Cn6TJeeZKMkiqa5bNKoh9HBjN2YlyR5SrXNyPtSogq9fsIX8WlZlhoP9xBI kUuFDVSg1b3/6VFpjCZKPOzOFZaFrWYvpEztWhQRjrDeDeig3MJprxaKPanOi9CzgY41 GjMkeexGflv2Z9YfniznQcGAokcOlZb99+4xw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=g1l3obKwRCGQ8frlt+kT/Fwgd/74cacl1ClW7zB9H/o=; b=AX2kUgs+8CMqqSfiUqnDa132cl6OsndnaZHtjpHLcD+gq7GCJpN1nCoP04hZ9eZaXn 2/eSpEQv1Qsd6v975hiAReIEZ4K5ZGsgsOfLBsAaq8/jrDVDBAwmsPzaZM8qELFOSro3 E2ptCyJZvczpXb+hk29kO6ur0ituiYLP+dK4kQJ/YLhtk5orr4EUReswfFt6peyPMNg9 weX6vLtRlyS1IMUX/7OabEDYoLSZtFguOrmlL+95HaxX4k1jyViDFxcsLVhJa3lHDzpU HQBlaBrnEuyAybRVuqGYsweQhcdrtM81Uho1mcz1dcEB5y4+JYqYhY20ZaBkEveBm3jp 0DpQ== X-Gm-Message-State: APjAAAWEezSy7ys0ZJ5DK1KoMUB1hJha3xmCrrOnkLbv7feYcCruN4ai vld4DobzEVb1D1/fvo+sDi9iBqgR67SRUA== X-Received: by 2002:a17:902:9a42:: with SMTP id x2mr1384059plv.194.1579296454733; Fri, 17 Jan 2020 13:27:34 -0800 (PST) Received: from apsdesk.mtv.corp.google.com ([2620:15c:202:1:e09a:8d06:a338:aafb]) by smtp.gmail.com with ESMTPSA id k5sm6999655pju.29.2020.01.17.13.27.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jan 2020 13:27:34 -0800 (PST) From: Abhishek Pandit-Subedi To: marcel@holtmann.org, luiz.dentz@gmail.com, alainm@chromium.org Cc: linux-bluetooth@vger.kernel.org, chromeos-bluetooth-upstreaming@chromium.org, Abhishek Pandit-Subedi , "David S. Miller" , Johan Hedberg , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 0/2] Bluetooth: Handle system suspend gracefully Date: Fri, 17 Jan 2020 13:27:03 -0800 Message-Id: <20200117212705.57436-1-abhishekpandit@chromium.org> X-Mailer: git-send-email 2.25.0.341.g760bfbb309-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi linux-bluetooth, 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 Please review and provide any feedback. Thanks Abhishek Abhishek Pandit-Subedi (2): Bluetooth: Add mgmt op set_wake_capable Bluetooth: Handle PM_SUSPEND_PREPARE and PM_POST_SUSPEND include/net/bluetooth/hci.h | 30 +++- include/net/bluetooth/hci_core.h | 46 +++++ include/net/bluetooth/mgmt.h | 7 + net/bluetooth/hci_core.c | 71 ++++++++ net/bluetooth/hci_event.c | 24 ++- net/bluetooth/hci_request.c | 297 ++++++++++++++++++++++++++++--- net/bluetooth/hci_request.h | 4 +- net/bluetooth/mgmt.c | 94 +++++++++- 8 files changed, 537 insertions(+), 36 deletions(-) -- 2.25.0.341.g760bfbb309-goog