From nobody Sun Apr 19 09:13:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 500CEC433EF for ; Mon, 4 Jul 2022 10:33:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233604AbiGDKdm (ORCPT ); Mon, 4 Jul 2022 06:33:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233674AbiGDKda (ORCPT ); Mon, 4 Jul 2022 06:33:30 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7334DFF5 for ; Mon, 4 Jul 2022 03:33:29 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id z12-20020a17090a7b8c00b001ef84000b8bso2889109pjc.1 for ; Mon, 04 Jul 2022 03:33:29 -0700 (PDT) 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=OAEfJl4UOkGeoQKG3Jzbkgk5YoutB15/ljohBagXkQ0=; b=kg7qypDoNH+WIJFjpZTDrJcvfscysQIUVIlnJS5HY+bmf25+LgK8uZdo21Azt+Mu0k R7c8ubwdz+j6d1O+rU3lkG73UBkDXTV/t/fMJB7IMU+w/cJBMRaKDVZ3wGDTls1ajo9V zWGwrMdTBcoXjPC6d+w3z6HKgKAnag0tZw7rU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OAEfJl4UOkGeoQKG3Jzbkgk5YoutB15/ljohBagXkQ0=; b=i01MfovmBNrbmcXp42too7Zia5oDj3prH3FH8hjwLubC52m5eDsPTtvJ1oMkxVGTfA KzVbvUe6R27hvRVjHER8Pdx/Z89WRf5oCtNDAlk1A5vxZqnuzjkedVABAxT6hTGVvmlE sIFnYwmAj0UPuAiaV9ZeBp2oBzRS2EGb/klGyIsq1FvA5LjgZxO1lNAtHokaFCnlCFLd OPNLZJuN6r0MsCI9QGAyxvJ4G/IM2EoRnD8pL+8U09Pb56eHgMpr3x75tDfJ8s4GrccW X7+/ozRgdW/MBwtOOHdixGQOFWNfZdJZosFCLnB+8HuoMT/NDfIyrVwbIFzDpVr9l3bp sidA== X-Gm-Message-State: AJIora+j66RRXJATLtpjHEPqkPK6Zr9qaxGWcWKWzkU2/xWdy21r1yz/ QGXMiUm/yJv5vjtr/SaHoyYgng== X-Google-Smtp-Source: AGRyM1shkm04UiZgNjN1Pi4wfOUrQkZlLN9qJiBGOUPmxXbvlKWmJhoK3IBB+fOMNEw3BVDDs43AuA== X-Received: by 2002:a17:90b:278e:b0:1ee:f086:9c9d with SMTP id pw14-20020a17090b278e00b001eef0869c9dmr35271127pjb.182.1656930809235; Mon, 04 Jul 2022 03:33:29 -0700 (PDT) Received: from localhost ([2401:fa00:1:17:7b03:b0ef:74bd:729]) by smtp.gmail.com with UTF8SMTPSA id rw5-20020a17090b2c4500b001ef9114eb9dsm218374pjb.42.2022.07.04.03.33.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 Jul 2022 03:33:28 -0700 (PDT) From: Ying Hsu To: marcel@holtmann.org Cc: chromeos-bluetooth-upstreaming@chromium.org, Ying Hsu , Alain Michaud , Johan Hedberg , Luiz Augusto von Dentz , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] Bluetooth: Add default wakeup callback for HCI UART driver Date: Mon, 4 Jul 2022 18:33:24 +0800 Message-Id: <20220704183320.1.Ib7423c21f71003643a5bbe954ed0538ee532b29c@changeid> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Bluetooth HCI devices indicate if they are able to wakeup in the wakeup callback since 'commit 4539ca67fe8e ("Bluetooth: Rename driver .prevent_wake to .wakeup")'. This patch adds a default wakeup callback for Bluetooth HCI UAR devices. It assumes Bluetooth HCI UART devices are wakeable for backward compatibility. For those who need a customized behavior, one can override it before calling hci_uart_register_device(). Fixes: 4539ca67fe8e ("Bluetooth: Rename driver .prevent_wake to .wakeup") Signed-off-by: Ying Hsu Reviewed-by: Alain Michaud --- Tested this commit on trogdor (wcn399x) and hayato (RTL8822-UART). For platforms with QCA UART connectivity, such as trogdor, we revert the commit c1a74160eaf1 ("Bluetooth: hci_qca: Add device_may_wakeup support") downstream as qca_wakeup() returns false and breaks wake-on-bt. drivers/bluetooth/hci_serdev.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/bluetooth/hci_serdev.c b/drivers/bluetooth/hci_serdev.c index 4cda890ce647..c0e5f42ec6b7 100644 --- a/drivers/bluetooth/hci_serdev.c +++ b/drivers/bluetooth/hci_serdev.c @@ -231,6 +231,15 @@ static int hci_uart_setup(struct hci_dev *hdev) return 0; } =20 +/* Check if the device is wakeable */ +static bool hci_uart_wakeup(struct hci_dev *hdev) +{ + /* HCI UART devices are assumed to be wakeable by default. + * Implement wakeup callback to override this behavior. + */ + return true; +} + /** hci_uart_write_wakeup - transmit buffer wakeup * @serdev: serial device * @@ -342,6 +351,8 @@ int hci_uart_register_device(struct hci_uart *hu, hdev->flush =3D hci_uart_flush; hdev->send =3D hci_uart_send_frame; hdev->setup =3D hci_uart_setup; + if (!hdev->wakeup) + hdev->wakeup =3D hci_uart_wakeup; SET_HCIDEV_DEV(hdev, &hu->serdev->dev); =20 if (test_bit(HCI_UART_NO_SUSPEND_NOTIFIER, &hu->flags)) --=20 2.37.0.rc0.161.g10f37bed90-goog