Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2087699lqt; Mon, 22 Apr 2024 00:29:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUDV7d3XjCmNr/t9JVHRG9wLX/AP0iXnHodhmmpXefH5RwKYS+ghgYvZ4XoFjZPsTE7CFI4r9XPScf/phZzOKHYcvS0w558jFaurSNGpg== X-Google-Smtp-Source: AGHT+IEyNUFmsOWf0HlBOwLdHWdU2CmbJfKsA/kKnw9YAlvH7xrpf+Utu7UNCSUZ+P9yp44EZAhh X-Received: by 2002:a17:90a:d901:b0:2a2:11f0:6759 with SMTP id c1-20020a17090ad90100b002a211f06759mr6638130pjv.48.1713770973361; Mon, 22 Apr 2024 00:29:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713770973; cv=pass; d=google.com; s=arc-20160816; b=vHsKkLWTOBCf3F4cClUhX4xNvfSHJF7phH0BDjaPBIVN6OTWtr9eb45pDXCciVAuu6 645oCm1Xwyu73JVHtkxRpNFz9K5droGnrnaYelDAF9xsNXJxP45CxIvPQaj8X2DLcJYA ftFm+SzuuA3SeTCvknYeEMu6JyKrWg79Ia4MLuWT7v5BlIR98uC1gUoNYRQg98RqhnZW 0TPc30Xx8PxJUtddGs7gZ3l5JmnfHFdQHfkHU4gZeO50yA4E2QXOTpRDJdw9sv5/Bcms YGwxaW9QprEJ+hFxo5ISE31DG7rscN0D6TJHZ3SWJretbUlhUqsnsSMhtQok4/roGbFS pxlw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature; bh=GFcyxEC9zbVLPap6Ey9gG9OoDKAWEGSfij/agCtqgRs=; fh=z5bM/+3S9PxGxAH1ubAfCh6p+8iwi67maDQA+jrv7+I=; b=FloZYUPk+b7JHRfE/5ZrT8iNyDeEMOngsk9X55TmrPUmJT/w3on02gC/68FF9X2u+g IOM2cjXVFg655VBtU1k1nA8LspF5gLGQp8PLAdbPTFIAykvp9/uuZ1kpnCgFY/XH2zV1 2ETaqx7RirKrVm2+Jno8KSKnEJacfVVK9bmP5ct1f6jtBbMljOe6uBnwqjPUGp3X2Yq6 C/09TmXi6cWfTSvL1k484AJYH0xzLhKzwPFDR5OfyZPOFg1RBmRF2V2I3sMX4ND6sUjt H4/aquzFpSYlpHm7WsMPzU4P0Cj2yHGRdGWbOgSJ9y2ILOx+IDKafVixY2+Y9gcGy78g j9Fw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=FVMy6d43; arc=pass (i=1 spf=pass spfdomain=flex--apusaka.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-152873-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152873-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id g13-20020a17090a708d00b002a2ab60261fsi7387143pjk.95.2024.04.22.00.29.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 00:29:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-152873-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=FVMy6d43; arc=pass (i=1 spf=pass spfdomain=flex--apusaka.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-152873-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152873-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 0A7A7B21F08 for ; Mon, 22 Apr 2024 07:28:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1C04853E02; Mon, 22 Apr 2024 07:25:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="FVMy6d43" Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E0BFB4AEE0 for ; Mon, 22 Apr 2024 07:25:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713770717; cv=none; b=ONaSZ0tr2Y2dPJyhCdTiCltpDPzo9myFN+RXnflfviLWEtT/MtzthLQDChoFq++fQgQjbVECrs5OJAILvxC9ga4HPDDzmVvycpfWf+2ws30RAQxlvR6Q/upjUo4pHutXqsepslMtT0NSrdIAko14sYQSe1ORM/ts5fr2hZAB1oY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713770717; c=relaxed/simple; bh=EDcOlr+IXSRQzC67CmMiUWrT6tgVWB6LEzOR9zHRnqg=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=c6y2pkMmcY0OrhI2ekTdSjAoFzfDzganPH4lErbQqyhVODIATUWfhntE47lAdjRl0d5Hz2W7xQQgFS4Qma26wQBWytS4l6pfbJUJuEUBUxLyTs3LJ7ePWD+Hs7xqoya2SHxyKn4AzUwa4AMKQWu4RwZxIyP+El2XxnyjmzQk4cI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--apusaka.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=FVMy6d43; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--apusaka.bounces.google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-de45dba157dso6940645276.1 for ; Mon, 22 Apr 2024 00:25:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1713770715; x=1714375515; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=GFcyxEC9zbVLPap6Ey9gG9OoDKAWEGSfij/agCtqgRs=; b=FVMy6d43K6gnbRNYkqijdJdtK0/iyqlLPjSJmTK16pVT4vLJv1ySiOvikzHufk2/0s tM8FDaf7ghlObrm85vA57+RM21bvQcTzD7NFHuw1tOcH5pI9B0+vmfh45HGZlRjXSipc rUojJk6idHABZe4K0Hox63xBEd7cUrwtK3pHR4mne5xFAevzsw//bopOG8jmUsN/E7EB H+yA5fDnJrrL31MOIN1jcPdskamNl/reSOZzVFK0HxHsHbzFrNuHMIzLWc7lV+WUkUm0 YXlQ1S0Hb4t/evVywnEglFEyXenoRRJ5MJhsnPr5R+6zDlOTyT5EWA83oz7q735JdgQ+ ivDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713770715; x=1714375515; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=GFcyxEC9zbVLPap6Ey9gG9OoDKAWEGSfij/agCtqgRs=; b=tu/cxZ2QrJNVDO0KHoqWzRK7gQGHUOM5GXLh/Mq/nzwU4rmlTInkM78c9lTKE/bSbk C7WemJOsjQvWHAP7mhNZ7h4CQ0yZuXU/M7BlAWV7ZpokYQ0Bl8BydXKaX/u6sSVgGcK+ pNAJimnm2ZWHeNxFLF2QJYbkM/Y9gZriCuOMH1hVN0MxbXsbIUZ4gGIWPs3ioWILpDj9 aXgVH7S2W3pd5cgI5+/YtydURUascL7pCPUAy70/zcIs2hNfjlFnO32pjHIJDphlJDYN FNG92xYcZUX5V0NCWfYIVfIa29XkNmF1d+/1oatM9X/CzUNgSS/T6IcoLCQrYcsgDqPt EvWg== X-Forwarded-Encrypted: i=1; AJvYcCVqH842B3N/w+wI/rB6gGAV4/YslSW35RPefWTIRp/NJ7USSyu/tnFr0/WwRn6ONWxlTEG+Eh7WzmzxZaJGNRSUmB6Tjysa/VqW0jFt X-Gm-Message-State: AOJu0Yxxb3wZ20AavkoudIyhyqCDnAsxC6kdoT9pdGOG9slv8xjkLq37 nWYgiyOm8PgHJPIGDcYabHKdZYAMpjxzpB4s3jnuSiVfCO7E06AaQiJ6S3WbmSespa/NZFPXyRV HdsiB4A== X-Received: from apusaka-p920.tpe.corp.google.com ([2401:fa00:1:17:59d7:73d5:a990:d869]) (user=apusaka job=sendgmr) by 2002:a05:6902:725:b0:dbe:30cd:8fcb with SMTP id l5-20020a056902072500b00dbe30cd8fcbmr735816ybt.0.1713770714905; Mon, 22 Apr 2024 00:25:14 -0700 (PDT) Date: Mon, 22 Apr 2024 15:25:01 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.44.0.769.g3c40516874-goog Message-ID: <20240422152500.1.I8939e49084a6fef78496eb73edafdf3c2c4afbf4@changeid> Subject: [PATCH] Bluetooth: btusb: Add debugfs to force toggling remote wakeup From: Archie Pusaka To: linux-bluetooth , Luiz Augusto von Dentz , Johan Hedberg , Marcel Holtmann Cc: CrosBT Upstreaming , Archie Pusaka , Abhishek Pandit-Subedi , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" From: Archie Pusaka Sometimes we want the controller to not wake the host up, e.g. to save the battery. Add some debugfs knobs to force the wake by BT behavior. Signed-off-by: Archie Pusaka Reviewed-by: Abhishek Pandit-Subedi --- drivers/bluetooth/btusb.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 8bede0a335668..846b15fc3c04c 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -873,6 +873,9 @@ struct btusb_data { unsigned cmd_timeout_cnt; struct qca_dump_info qca_dump; + + bool force_enable_remote_wake; + bool force_disable_remote_wake; }; static void btusb_reset(struct hci_dev *hdev) @@ -4596,6 +4599,10 @@ static int btusb_probe(struct usb_interface *intf, debugfs_create_file("force_poll_sync", 0644, hdev->debugfs, data, &force_poll_sync_fops); + debugfs_create_bool("force_enable_remote_wake", 0644, hdev->debugfs, + &data->force_enable_remote_wake); + debugfs_create_bool("force_disable_remote_wake", 0644, hdev->debugfs, + &data->force_disable_remote_wake); return 0; @@ -4702,6 +4709,18 @@ static int btusb_suspend(struct usb_interface *intf, pm_message_t message) } } + if (!PMSG_IS_AUTO(message)) { + if (data->force_enable_remote_wake) { + data->udev->do_remote_wakeup = 1; + if (test_bit(BTUSB_WAKEUP_AUTOSUSPEND, &data->flags)) + data->udev->reset_resume = 0; + } else if (data->force_disable_remote_wake) { + data->udev->do_remote_wakeup = 0; + if (test_bit(BTUSB_WAKEUP_AUTOSUSPEND, &data->flags)) + data->udev->reset_resume = 1; + } + } + return 0; } -- 2.44.0.769.g3c40516874-goog