Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2867001pxk; Sun, 20 Sep 2020 21:25:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGWwiXJtXqHtv2+8CASneNm4Mhqs3zQjC7lolOVSWVBFmvEBY5NJQcX6cKP1evo2wL448o X-Received: by 2002:aa7:d593:: with SMTP id r19mr32176067edq.331.1600662300416; Sun, 20 Sep 2020 21:25:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600662300; cv=none; d=google.com; s=arc-20160816; b=d6aj8BoZlz9WNu/bsFqVL2Q1D0ffKWa4s+aiweQmixAj56SO8yD+t6VaeebN/aSfwE znEtQ0r8ReiBunoRWufQJfrI8l+Vkr+7Y3dz8rEKB0tYqK5FJj+PKaT98L0WJDE0b+8/ ndDrx1tqFYsSWCobIMHLiJnqivNPtGwJFEm79hBe+d+o+vZtM8a7KhH3qCLtnDqOngO7 lEDpNLyXrCIKyJfhgUnMKLlrL28g6MxzL8ToKtJrv4Jm4HKq2uPP4iMFxwoC9uwX7tjT IkJYJ02BkRS4NVxTHLfRT8Tx5L4kCn23XQv1QxOLeyUOvm8o1u0BBTCnFwTw7BgkAnuz DhRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:sender:dkim-signature; bh=Yq3AQHq0oby0gIEHvauwatHEbFOs+SQiwBq1B7FgTKo=; b=0756TMDG1no5gjZxN8aOf/vc/1DgDktXudiUpSqT3XJH3IYUWqs+Nd0o48FDBlHVGE P0DSWwhwRR3VqGNMSCZF1i52CuQJIly3GQA5Dxm9YiSl6DU17KSFRHjKrH/qOnTvKk/f GhUapY9FzKjfsuoXx6ny3ekevUGseegeXlI6/MrcBIqiRbpftDLT3xH3+5srbhuCg7Gd u67myw+wnjMJ9EeYTGi4Oi+yUx+nFR/DeyAMKQqg8Hkw/ogw8ukIiZlsd/7NSK3/ci1D QpW+t+fsYEvgW77g+5LUiXIwct/9UO0A3PQbFG1fMeoPPenpAvuEu8LicIR1eRjxL/r8 jyVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=LKoEVcaL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ce16si7769230edb.302.2020.09.20.21.24.37; Sun, 20 Sep 2020 21:25:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@google.com header.s=20161025 header.b=LKoEVcaL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726357AbgIUEX1 (ORCPT + 99 others); Mon, 21 Sep 2020 00:23:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726011AbgIUEXZ (ORCPT ); Mon, 21 Sep 2020 00:23:25 -0400 Received: from mail-qv1-xf49.google.com (mail-qv1-xf49.google.com [IPv6:2607:f8b0:4864:20::f49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD126C0613CE for ; Sun, 20 Sep 2020 21:23:24 -0700 (PDT) Received: by mail-qv1-xf49.google.com with SMTP id di5so8368478qvb.13 for ; Sun, 20 Sep 2020 21:23:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=Yq3AQHq0oby0gIEHvauwatHEbFOs+SQiwBq1B7FgTKo=; b=LKoEVcaLu9J1s6MC0b/XU0LBbNUgQCSb9C/Gu8Ngkvh1qchoHOqiUZeTCvxbqADEEr 8HN4+XPGK92MEZgQ6pSijf3ZPuTuV8ue9rmc3lNM27s8n2j9068gHzZP7rN7yIf33RAk 84MSu6m5JkR8bblDYVXxwMtsHBGVFxcBBHdk/JErR8jcdJxefVt1JtNeK7Q/0JittbhG Mgcral7UzED8/qt0+UpJuVFSx2gtT5q62w4wCpMjCGVcNrPmM3ZWRReeuGOh2AEbjl8F hCa1RY+SwLDjb0Q+8hUzatNLFYnhWnIMo635KhiILGh0M54/aWO8g4FrsXe+7KEkSrjP 9Dxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=Yq3AQHq0oby0gIEHvauwatHEbFOs+SQiwBq1B7FgTKo=; b=eeKSkJgVhQO4P/eiZx6EJ3Uc9itHKrVlSwgEtgNbP4HwcEF4Dnq3EbL55aZRR3HxPp MDh0O8UeyhxmJWdxnLyUrlW1MrtNXw2zKSyrVDjUSh0DjHPmuV8wS/Xa1r3/MO2xrdDD zPBehNhewOCe1T4kJ9EHdBWzvLtQSXuewAgqWAt9SCPHrLV1BZsD6EzBG4CnNBUJ5Wcy go/VAnp3C8TfyPxhDvThlWx0+AW+B2CVty8Kr0k/jTuBOEeFSjU1V2e/jIhaWX/D02rj ZpgJ0Hhm1kgFWkRfqtMH+gv7uRu1JM3LXMHINzvZQsAsRE/H8RN5t6FGA/GPehmztjHN iMCw== X-Gm-Message-State: AOAM533EGF+ol2L6AJq3k3A/1QzuwXeQZp3HV7Hj6dJbVgC/5P1Vn+ak LS4CZmOTVr3ZW5y+EnFiVXL9lUw1eE+IrNnrRw== Sender: "howardchung via sendgmr" X-Received: from howardchung-p920.tpe.corp.google.com ([2401:fa00:1:10:f693:9fff:fef4:4e45]) (user=howardchung job=sendgmr) by 2002:ad4:58e3:: with SMTP id di3mr28838122qvb.54.1600662203923; Sun, 20 Sep 2020 21:23:23 -0700 (PDT) Date: Mon, 21 Sep 2020 12:23:06 +0800 In-Reply-To: <20200921122216.v4.1.Ib75f58e90c477f9b82c5598f00c59f0e95a1a352@changeid> Message-Id: <20200921122216.v4.2.I3774a8f0d748c7c6ec3402c4adcead32810c9164@changeid> Mime-Version: 1.0 References: <20200921122216.v4.1.Ib75f58e90c477f9b82c5598f00c59f0e95a1a352@changeid> X-Mailer: git-send-email 2.28.0.681.g6f77f65b4e-goog Subject: [PATCH v4 2/4] Bluetooth: Handle system suspend resume case From: Howard Chung To: linux-bluetooth@vger.kernel.org, marcel@holtmann.org, luiz.dentz@gmail.com Cc: alainm@chromium.org, mcchou@chromium.org, mmandlik@chromium.orgi, Howard Chung , Manish Mandlik , Abhishek Pandit-Subedi , "David S. Miller" , Jakub Kicinski , Johan Hedberg , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds code to handle the system suspension during interleave scan. The interleave scan will be canceled when the system is going to sleep, and will be restarted after waking up. Signed-off-by: Howard Chung Reviewed-by: Alain Michaud Reviewed-by: Manish Mandlik Reviewed-by: Abhishek Pandit-Subedi Reviewed-by: Miao-chen Chou --- (no changes since v1) net/bluetooth/hci_request.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c index 89443b48d90ce..d9082019b6386 100644 --- a/net/bluetooth/hci_request.c +++ b/net/bluetooth/hci_request.c @@ -1081,6 +1081,9 @@ void hci_req_add_le_passive_scan(struct hci_request *req) filter_policy |= 0x02; if (hdev->suspended) { + /* Block suspend notifier on response */ + set_bit(SUSPEND_SCAN_ENABLE, hdev->suspend_tasks); + window = hdev->le_scan_window_suspend; interval = hdev->le_scan_int_suspend; } else if (hci_is_le_conn_scanning(hdev)) { @@ -1167,10 +1170,8 @@ static void hci_req_config_le_suspend_scan(struct hci_request *req) hci_req_add_le_scan_disable(req, false); /* Configure params and enable scanning */ - hci_req_add_le_passive_scan(req); + __hci_update_background_scan(req); - /* Block suspend notifier on response */ - set_bit(SUSPEND_SCAN_ENABLE, req->hdev->suspend_tasks); } static void cancel_adv_timeout(struct hci_dev *hdev) @@ -1282,8 +1283,10 @@ void hci_req_prepare_suspend(struct hci_dev *hdev, enum suspended_state next) hci_req_add(&req, HCI_OP_WRITE_SCAN_ENABLE, 1, &page_scan); /* Disable LE passive scan if enabled */ - if (hci_dev_test_flag(hdev, HCI_LE_SCAN)) + if (hci_dev_test_flag(hdev, HCI_LE_SCAN)) { + cancel_interleave_scan(hdev); hci_req_add_le_scan_disable(&req, false); + } /* Mark task needing completion */ set_bit(SUSPEND_SCAN_DISABLE, hdev->suspend_tasks); -- 2.28.0.681.g6f77f65b4e-goog