Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp34313pxb; Wed, 18 Nov 2020 15:45:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJzafCtdUWZGPNTXJ4ZbVOt9tTZUNHJ/wry26faXkCT0mvHEfA/NZmpIdbXVGo93dLnReGG0 X-Received: by 2002:aa7:de01:: with SMTP id h1mr27842174edv.269.1605743112976; Wed, 18 Nov 2020 15:45:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605743112; cv=none; d=google.com; s=arc-20160816; b=UCMjjtywHXKCAFEBqLK8QROqXM3ne+itccCsERpo4FeSXrDC5WslJAjjSHz9C+/rkm lUhFiOwETqoHVxYiEZ+i3keJUJ/TelPFraauNFiA14dBGgfDv4YSs7b0LXcKo6k13z+G xbB2jep+Tj4R0JbncOxoumjrfYVRJ3+c7P1eoUrtPGETvpgrcCd07TDfKx+NmW/Zvgqt 4S3sxNQcAG9EawoEj80Spl4CQCQUekcny/R45q9LUEqyqGIc6BlvrdPIM++w/Z9YaahH vxSS+gpi+iC5VGaOg1pUMAaWAZv4TmK4CgJgOBfOQ6RLPH/rBjJb+sKfi89GnPqIGMLZ yShA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=FtRxO4GemGjvQrMlES911DtV5VS1GNyC2f2uIjqIY44=; b=wqzmis1YdEEANN6BhPFgtS1cgjz4ohfG7Top1M63NGUV1/Dk7Z+0Rp76t0NW0nSaSG Vg59H44mt8hBRBtUwV2Iku+Bf3zUjNTh8kwpNO8AV2RKJdGGDtq2NirDYqS7Bbn3d8+x 06xYeOG9JUPOz6U1ZI3Y/Yl4uTfN+eIEErRLQfUmMKkpYxzh8b89GMuAGZQJoOuodAWg NVMNKVQO69VIjnSjLDpQ95dOI/Jo00dVIRBTt7OfEj/NTaGkthwT7S7XYcdf8agHnxtI XyvkJ97sOTxZgw/mmf3we+eA+XxSrmNANDO4SqAr6xyivhcSFCnfG61271ckQ2DNtbWI hz/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=N9sqPWGr; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o2si15653424ejn.501.2020.11.18.15.44.24; Wed, 18 Nov 2020 15:45:12 -0800 (PST) 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; dkim=pass header.i=@chromium.org header.s=google header.b=N9sqPWGr; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726413AbgKRXoF (ORCPT + 99 others); Wed, 18 Nov 2020 18:44:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726162AbgKRXoE (ORCPT ); Wed, 18 Nov 2020 18:44:04 -0500 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9DE5C0613D6 for ; Wed, 18 Nov 2020 15:44:04 -0800 (PST) Received: by mail-pl1-x643.google.com with SMTP id u2so1897282pls.10 for ; Wed, 18 Nov 2020 15:44:04 -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=FtRxO4GemGjvQrMlES911DtV5VS1GNyC2f2uIjqIY44=; b=N9sqPWGrOl4w0sTA0YeGv0oEUvPcX29fc3q7s9Lc6kKxI1cin/1FGLDsPklUFx3WH4 Ndz3RykX+GS/Umt850AWO/UZmdJ6w8noHEcBr13whNVSIyFNUAiDVC73BcdUMd5gUGK5 KhCWhrKUWg8O8mCW6g3b4mzekeBcI7oVzT3qU= 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=FtRxO4GemGjvQrMlES911DtV5VS1GNyC2f2uIjqIY44=; b=uTfgr0uuf3fZYeIGteyMT+sEZDSPA/VVSQgrRPlen3oNdhRMEa0ndAiR8ciobx3yFL lla9AYX33NZI07p2RfiFXA96ZvJpWP30QkGM8B6Qe6ckcfL8OML8k54hOOyQSGtFioFC RjqSl0beRxGJ5smkP1EpiFuKGMVJ1Zrv7hNW2Bp4SahhyzagvlTwTwxQg4gSmPIITUG+ 28iveooPPCDHSFDmTR/iSC2WZ35mnQNy/+xU50aikqNxrGijXX0fxMPK51Y0aJyN0AsS KmhVFTMFEPfuB0w0mHU9r/Tc2nnLne1nossWnR46KXXcx40WJMfun3XVeC+eS4QlneZn tMLg== X-Gm-Message-State: AOAM53088xSwEpES40NXyUv3QeguzUZB3ELvCqRvkleNSjmdnmGU3Nfg vgB3zGQ3/KdOQiANuWpvm719zQ== X-Received: by 2002:a17:902:be07:b029:d8:afa1:3d76 with SMTP id r7-20020a170902be07b02900d8afa13d76mr6507615pls.14.1605743044245; Wed, 18 Nov 2020 15:44:04 -0800 (PST) Received: from apsdesk.mtv.corp.google.com ([2620:15c:202:1:7220:84ff:fe09:2b94]) by smtp.gmail.com with ESMTPSA id f6sm21437435pgi.70.2020.11.18.15.44.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2020 15:44:03 -0800 (PST) From: Abhishek Pandit-Subedi To: marcel@holtmann.org, linux-bluetooth@vger.kernel.org Cc: chromeos-bluetooth-upstreaming@chromium.org, mcchou@chromium.org, danielwinkler@chromium.org, Abhishek Pandit-Subedi , "David S. Miller" , Johan Hedberg , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jakub Kicinski Subject: [PATCH 0/3] Bluetooth: Power down controller when suspending Date: Wed, 18 Nov 2020 15:43:49 -0800 Message-Id: <20201118234352.2138694-1-abhishekpandit@chromium.org> X-Mailer: git-send-email 2.29.2.299.gdc1121823c-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Marcel and linux-bluetooth, This patch series adds support for a quirk that will power down the Bluetooth controller when suspending and power it back up when resuming. On Marvell SDIO Bluetooth controllers (SD8897 and SD8997), we are seeing a large number of suspend failures with the following log messages: [ 4764.773873] Bluetooth: hci_cmd_timeout() hci0 command 0x0c14 tx timeout [ 4767.777897] Bluetooth: btmrvl_enable_hs() Host sleep enable command failed [ 4767.777920] Bluetooth: btmrvl_sdio_suspend() HS not actived, suspend failed! [ 4767.777946] dpm_run_callback(): pm_generic_suspend+0x0/0x48 returns -16 [ 4767.777963] call mmc2:0001:2+ returned -16 after 4882288 usecs The daily failure rate with this signature is quite significant and users are likely facing this at least once a day (and some unlucky users are likely facing it multiple times a day). Given the severity, we'd like to power off the controller during suspend so the driver doesn't need to take any action (or block in any way) when suspending and power on during resume. This will break wake-on-bt for users but should improve the reliability of suspend. We don't want to force all users of MVL8897 and MVL8997 to encounter this behavior if they're not affected (especially users that depend on Bluetooth for keyboard/mouse input) so the new behavior is enabled via module param. We are limiting this quirk to only Chromebooks (i.e. laptop). Chromeboxes will continue to have the old behavior since users may depend on BT HID to wake and use the system. These changes were tested in the following ways on a Chromebook running the 4.19 kernel and a MVL-SD8897 chipset. We added the module param in /etc/modprobe.d/btmrvl_sdio.conf with the contents "options btmrvl_sdio power_down_suspend=Y". Tests run: With no devices paired: - suspend_stress_test --wake_min 10 --suspend_min 10 --count 500 With an LE keyboard paired: - suspend_stress_test --wake_min 10 --suspend_min 10 --count 500 Using the ChromeOS AVL test suite (stress tests are 25 iterations): - bluetooth_AdapterSRHealth (basic suite) - bluetooth_AdapterSRHealth.sr_reconnect_classic_hid_stress - bluetooth_AdapterSRHealth.sr_reconnect_le_hid_stress Thanks, Abhishek Abhishek Pandit-Subedi (3): Bluetooth: Rename and move clean_up_hci_state Bluetooth: Add quirk to power down on suspend Bluetooth: btmrvl_sdio: Power down when suspending drivers/bluetooth/btmrvl_sdio.c | 10 ++++ include/net/bluetooth/hci.h | 7 +++ include/net/bluetooth/hci_core.h | 6 +++ net/bluetooth/hci_core.c | 93 +++++++++++++++++++++++++++++++- net/bluetooth/hci_request.c | 26 ++++++++- net/bluetooth/mgmt.c | 46 +--------------- 6 files changed, 140 insertions(+), 48 deletions(-) -- 2.29.2.299.gdc1121823c-goog