Received: by 2002:ab2:3c46:0:b0:1f5:f2ab:c469 with SMTP id x6csp141871lqf; Fri, 26 Apr 2024 02:09:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVZD/1G4xNKxwXU2wFoimrkx1zMOBd3yjDGsqAU1NJbPb/rN39We4vL3MCLpMWB7GMM46FCuV4Jr5oHIp5faKrSa2WyVcS96Q1tZ0Euzw== X-Google-Smtp-Source: AGHT+IHsZV/JwvWMZESpErP3SCGoWcKk5+JFRXewTbjQhoUx975tw+3AFFQZeOn0LHyicb3QQs12 X-Received: by 2002:a05:6402:2750:b0:572:61:8560 with SMTP id z16-20020a056402275000b0057200618560mr5085944edd.20.1714122543570; Fri, 26 Apr 2024 02:09:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714122543; cv=pass; d=google.com; s=arc-20160816; b=yP5gZS45IFH3Uyf5QCXdN+YrTrpeWgMONgP5uN0c+0hHOcATFTQFuuJTHiCNnFt5xx +JlfWbpkTXdEQnBG8RsWyfgQCiQi7x4X/hwwamoyC+FTWbD/0IjTQaKM5ImHsSKapmOn ZWmDJPaA1T0YtDaqm4yPDjUsi7KpN+Qref/FdfMFzkSvH/7Kot5ve4IFvcL+oyZmEMDc tVRRQ62WdVmeXOSNajT6iXEswuMwgs9vpByzKmwyYvWWVR22TDi+Toj+z2u/B1we+rbS 0d+NmzNVWG1uF7EzsmhEG6HyuyhZcdxTtHALpiZIUG/E0V6OwdV7RSkchb6XEM8MQDzB u+rw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=Ja2hNeJD5lpzreFTljFzef74K+wsxiiyhKIsFU5oS/c=; fh=d/7N2b4PqxoaTI0tbnnozV5BE0hxWqd4hLG8OXh4hLY=; b=ll9cpcQOokuTuf7ypQ3POJRAffLK8dK7cXj/PuORgFaJrHVUQ+Tc5AGwZXkwWd1piZ KpTMTbTMDCxKQpD354PzU45ttPIeM8iZS+ujjgQYU476oVcmWMqvRFsb9ghJA2iEKwS1 XrR+eOp6muXab9N7A2Egw6We8iUf1lZcHQfhNAZkw8B2w3UM64OQK5t5PEav7z7OBGKZ +i0Tf++owjuL/NNasD+VHyv3KIXQ6Xv+s0Z79K0x3CzscMyY/JltJ5Wkdw5j5uj+MwHC gxmByOzXZ/shp6d1bMqJpzeDCaXQ8Cc1Br/7gn3JUlTCkDqhw78FAsDd1NWnoKY2A2TA CvyA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=4Wr1jHtE; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-bluetooth+bounces-4098-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4098-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id s20-20020a50ab14000000b0056e32d350a2si11106229edc.479.2024.04.26.02.09.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 02:09:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-4098-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=4Wr1jHtE; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-bluetooth+bounces-4098-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4098-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 22C391F22D45 for ; Fri, 26 Apr 2024 09:09:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A8D6713D525; Fri, 26 Apr 2024 09:08:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="4Wr1jHtE" X-Original-To: linux-bluetooth@vger.kernel.org Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (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 795DF25605 for ; Fri, 26 Apr 2024 09:08:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714122536; cv=none; b=KMikuWpKZhc97bKJQl60l50LWt4FyG2D6xyVqCfGQxfNvsP49hHkvpC2QUMwJZZ2tiU3OO9f/lEv3FurwJB1KAa62WoG3KVEhwkxtypHODJsDBuCBo02KAXhb8zuAetpYnGncyAqCbz/208gNHjtD6/4n8MuyR3D4AfCS916U2w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714122536; c=relaxed/simple; bh=PwJip2bI3d8w1d8xY7szIeXVyb2xY9y6x9ioLdBZf+E=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=W42D6vPY4H/HcueEBg/KckOZx8rjPhzQEkYPx6ywtR2iNfXTELx6YLJLdbXACqB7Ea4sc6Li9wf1abj2jyNzGn/QJDvylYKKq5+BcakRcC0LmQICEWIhRIdZHgvCL35nNFpfXix6D/A4XwSDfJd3c76vfX/I7H5WZq+Mc6g2MDw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=4Wr1jHtE; arc=none smtp.client-ip=209.85.208.48 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=google.com Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-5724736770cso5821a12.1 for ; Fri, 26 Apr 2024 02:08:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1714122533; x=1714727333; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Ja2hNeJD5lpzreFTljFzef74K+wsxiiyhKIsFU5oS/c=; b=4Wr1jHtE5ZUeI4hAwB/3/w+vHyhPBxN8zJK6cxhevx94lHoZbN0Qwna2OiAPhhaiAe 5v6c0X5toAedPZE+eF1GPggKgB0PDKgvWQjXOrOAR/TS9YsZbV3G9EtOLLMgS0g49W3T SMFTfv4erAZC1JnuKZKCCfCcxAZlQctUxu81V3PLcIRqKiup1KiZMcwx45p3KAIaCmut EXvi+fNLYFzbbfCVkAwQUF3T83OBY5WLBais42PosFl6OFgZD4z7MIYMQss0pB/aCjhg mAhe9hza0D0CgwlZa9r++boN0y5VNpvoNkcDK+s15XmWsZ+nik+v7VN9jHLa9GfpyxML ZC6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714122533; x=1714727333; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ja2hNeJD5lpzreFTljFzef74K+wsxiiyhKIsFU5oS/c=; b=qDzVWOb2jFUo/5Tg0c4nn1J1HCSdkJ0p+FegTOeaa2c+Xaj5U8kcRaaAhxQf7yPApu mFOudRfTssFI5LlholCw3qvzs63oQrgPPpx8DBfnQk6KhkGgTa7PQtQ8Wy2kPC8X1pM1 ZOLby7THsjr4p8Y8xUl3lf+w46gGXKn3AmgHW5hYGIylbPKkgZpR+aU4iDXOs9KlA37p m9qGcbWU/8GVVtIkmwzNyy7mznFlVwiA+9dSaHFUDrNzVnTaw1kkSdT55ovdu50xAUd/ XVLkqfxf1ch3TlAN41Cmi+mf1X9Ix/EknsGhNWF/7TIUSeQeWaP97ycuxNRoyTPk0weS viYA== X-Gm-Message-State: AOJu0YxZMC+iLMhMVbOptiF7JLO8Na0mflSxBwOclWmhdBSKclwgav+B 9IpFTTFCy3RcHpkIO2kWWgTIhFkTDNieJIzvzbVvLLuciV0NPINVn8i32jvQlzuzcvcBaR+yeyA I4edOcNpnKvRdx6rbRdyFWdfy7mNjwWlkMN31 X-Received: by 2002:aa7:c512:0:b0:572:5d62:7971 with SMTP id o18-20020aa7c512000000b005725d627971mr16853edq.0.1714122532540; Fri, 26 Apr 2024 02:08:52 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240422152500.1.I8939e49084a6fef78496eb73edafdf3c2c4afbf4@changeid> In-Reply-To: From: Archie Pusaka Date: Fri, 26 Apr 2024 17:08:40 +0800 Message-ID: Subject: Re: [PATCH] Bluetooth: btusb: Add debugfs to force toggling remote wakeup To: Luiz Augusto von Dentz Cc: linux-bluetooth , Johan Hedberg , Marcel Holtmann , CrosBT Upstreaming , Archie Pusaka , Abhishek Pandit-Subedi , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Luiz, On Thu, 25 Apr 2024 at 03:05, Luiz Augusto von Dentz wrote: > > Hi Archie, > > On Mon, Apr 22, 2024 at 3:25=E2=80=AFAM Archie Pusaka wrote: > > > > 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 *int= f, > > > > debugfs_create_file("force_poll_sync", 0644, hdev->debugfs, dat= a, > > &force_poll_sync_fops); > > + debugfs_create_bool("force_enable_remote_wake", 0644, hdev->deb= ugfs, > > + &data->force_enable_remote_wake); > > + debugfs_create_bool("force_disable_remote_wake", 0644, hdev->de= bugfs, > > + &data->force_disable_remote_wake); > > > > return 0; > > > > @@ -4702,6 +4709,18 @@ static int btusb_suspend(struct usb_interface *i= ntf, pm_message_t message) > > } > > } > > > > + if (!PMSG_IS_AUTO(message)) { > > + if (data->force_enable_remote_wake) { > > + data->udev->do_remote_wakeup =3D 1; > > + if (test_bit(BTUSB_WAKEUP_AUTOSUSPEND, &data->f= lags)) > > + data->udev->reset_resume =3D 0; > > + } else if (data->force_disable_remote_wake) { > > + data->udev->do_remote_wakeup =3D 0; > > + if (test_bit(BTUSB_WAKEUP_AUTOSUSPEND, &data->f= lags)) > > + data->udev->reset_resume =3D 1; > > + } > > + } > > + > > return 0; > > } > > > > -- > > 2.44.0.769.g3c40516874-goog > > There is a D-Bus interface available to overwrite the wakeup setting: > > https://github.com/bluez/bluez/blob/master/doc/org.bluez.Device.rst#boole= an-wakeallowed-readwrite > > Or do you want a master switch for it? On the other hand aren't we > getting into the rfkill area if you really want to switch off radio > activity while suspended? That seems like a better idea then just > disable remote wakeup. Yes, the initial idea was a master switch. Thanks for your suggestions. Let me discuss it with Abhishek. > > -- > Luiz Augusto von Dentz Thanks, Archie