From patchwork Mon Dec 18 10:24:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: 15013537245@163.com X-Patchwork-Id: 755563 Received: from m12.mail.163.com (m12.mail.163.com [220.181.12.215]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C650913FFA; Mon, 18 Dec 2023 10:24:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="pJtVrrXy" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=unr0U lfwae3XPBopvjUBdsU4Sd/Qnsw8hRJtbljb50M=; b=pJtVrrXyQJr5ZAGKY6Wov I+z4hiy3DvF44rvb1Gac9af24EplrFWQ9XWPjR9SyQ7vqYqF7MtdsCyeRV08Dpkz EenqoGY02L+EMFSq9YghZCXj+D0qwPB4drV1z6BGNG+mli2nWyBQj0VeNbDaH/Ho hcAn6DcMFl0MKelsDbDyns= Received: from WH-D-007635B.QUECTEL.COM (unknown [223.76.229.213]) by zwqz-smtp-mta-g5-3 (Coremail) with SMTP id _____wA31RbTHYBl5dQBGA--.58997S2; Mon, 18 Dec 2023 18:24:20 +0800 (CST) From: 15013537245@163.com To: marcel@holtmann.org, johan.hedberg@gmail.com, luiz.dentz@gmail.com Cc: linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, zhongjun.yu@quectel.com, clancy shang Subject: [PATCH] Bluetooth: hci_sync: fix BR/EDR wakeup bug Date: Mon, 18 Dec 2023 18:24:17 +0800 Message-Id: <20231218102417.474022-1-15013537245@163.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CM-TRANSID: _____wA31RbTHYBl5dQBGA--.58997S2 X-Coremail-Antispam: 1Uf129KBjvJXoWrKFW5Ary5JFW3ZFW8GFWUCFg_yoW8JrWxpF y2kFZ3tFZ5JrWak3W3A3WIgFyUAF95WFsrCFWqy345X342qr48tr4jkr1rWF18CrZ2kr1f ZF4UtwsxW348Aa7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jkwIDUUUUU= X-CM-SenderInfo: rprviiitvtljiuv6il2tof0z/xtbBEBVK12VOBAnt+AAAsr From: clancy shang when Bluetooth set the event mask and enter suspend, the controller has hci mode change event coming, it cause controller can not enter sleep mode. so it should to set the hci mode change event mask before enter suspend. Signed-off-by: clancy shang --- net/bluetooth/hci_sync.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c index d85a7091a116..97284d9b2a2e 100644 --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c @@ -3800,12 +3800,14 @@ static int hci_set_event_mask_sync(struct hci_dev *hdev) if (lmp_bredr_capable(hdev)) { events[4] |= 0x01; /* Flow Specification Complete */ - /* Don't set Disconnect Complete when suspended as that - * would wakeup the host when disconnecting due to - * suspend. + /* Don't set Disconnect Complete and mode change when + * suspended as that would wakeup the host when disconnecting + * due to suspend. */ - if (hdev->suspended) + if (hdev->suspended) { events[0] &= 0xef; + events[2] &= 0xf7; + } } else { /* Use a different default for LE-only devices */ memset(events, 0, sizeof(events));