Message ID | 20230121134812.16637-3-mario.limonciello@amd.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp733106wrn; Sat, 21 Jan 2023 06:08:23 -0800 (PST) X-Google-Smtp-Source: AMrXdXvAd4u+4AHsJadzjtFarrww6snP9RUOPr9fW9dgfNQG1ZWRlLOCvmnl6AI9/N5oApq5pQLv X-Received: by 2002:aa7:9461:0:b0:58d:9428:e488 with SMTP id t1-20020aa79461000000b0058d9428e488mr19200733pfq.9.1674310103156; Sat, 21 Jan 2023 06:08:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674310103; cv=pass; d=google.com; s=arc-20160816; b=XR0PBvT8jSuYMs9hR1MtjfMlk/5F9UvJbpczPSQn1EVhigzC84GYu6zWKzN55CBqFr Ip2tmnuE1umXMZtitwfL/6QxJ6oNOnKqm13lXRDdFUghkl12ZcoxtDJGByJm8unmSaoZ bG0eIKqFIYHZw34NtDKez7rbaV+++7zU8BavqDRkv/9kTUZkPDJl4PopY5eajDvVaAA9 kwOtnzyrew7+MQSC4Plz/M4m73DYvTP3Kyi6fG3TENwPxM2uxhlWECMba/yXmbjsrTdM Oh857qSRxn3MRpOBexg0Cvzb6/A5I6OWHeI4Cb4ZF8Qb1fiLoCX0m31+DEyWVK6pgcAL Nuug== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wRnCveg1irG4fhoslR3hYLzkp/CAtElgDK9PLHL2yqE=; b=AaVmIPd5OyE4jRpChu6xF91HfxdhOooZmV/loGLgGZ2NiH30BB6pAMS9JZeFopWkMk kVWtee0yX1W2M43sFJHbHeyDVnMOU6/r5EP8KHXSoGUsVSTZZYF1rfHiVH6bqSxsSzNe xjOUZY0GfxBAGlSRWXCxs9FI1iVSSqNKdIe/sK+bt+0qFzEqSilrMXXnR/h44TQoubHW +tCmRwDt9FuLhBRLH7gW0R412Ekz7/b6dv5pp18x/CpcjnkchDqxMhZpOspeg8ULYFCF reU/AXgcd8J0PQdBr8Yw0hBw2HcDYiA4aMZI8pm7QEbYsDUvWWzEGcEAI+Wn7gpjoPOO kK3A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Krh5MIdd; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j14-20020a056a00234e00b0058191bea796si20151031pfj.0.2023.01.21.06.08.10; Sat, 21 Jan 2023 06:08:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Krh5MIdd; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229796AbjAUNsK (ORCPT <rfc822;forouhar.linux@gmail.com> + 99 others); Sat, 21 Jan 2023 08:48:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229604AbjAUNsH (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 21 Jan 2023 08:48:07 -0500 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2045.outbound.protection.outlook.com [40.107.237.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF210193C6; Sat, 21 Jan 2023 05:48:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ev5WuH17j1IFyHD8MFrWHZWhuf/fhdrT49AWAeWLgxI+xnRD5tjuPLnAZ/JgTOjThuGx81OsSWPtuAgVmqvN/HLzVCrNvP2J9wHndkLf1gQj6mrsZyaeusKEt5Qg1mVKcXKOSFm74EsWZ5RTh6C1IN9mim0GL+FtTaWzfFzlJskPa9FQKi6xGASN8quiafWc/l9qUosiv4MjEXHoMcx8TlShBUEioiF/GWdlO+n4lhFcJFbW1FmgDPNQrXSjKpBjzAMGEXMgZLwa3F4ujjy/8o+nILsA8fiCtE95vbElbmLc3lZtMELGlBRUTEPpBXLxbHiThLTOm6M6ZhTs6kXo1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wRnCveg1irG4fhoslR3hYLzkp/CAtElgDK9PLHL2yqE=; b=TLCm6rd9ALJ0TYwEuhph5EwzHL1YBTwbqhKfVmcMhn/iqzpblyoiTsYfUHug7Z3s/lbC3yxS8JEM0R5B/gxUi+6p5dLwIC7b5/42+GfHdZpjRtGYg183sHO21Qno7Wzkj5P2o17p06CnFxIuZN7kVGt9Pu1PefCx6Y1rIt+QSCJHh2DUsUsO/uGJY3tkppyqUcVNlcwzqERzN/k45voGyElZcWU8MlwIyyKjkHz4Cug95fQUKo67S6cdKVWdBE6ikVPtR67m1ENMHPvyHA3Rbdmjs7Iymijeqxbzp0QkA8oXaaMHjxyoyEgU2tkmzq+7rtc7pTk6m9Ri5AGxI0nNVA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linux.intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wRnCveg1irG4fhoslR3hYLzkp/CAtElgDK9PLHL2yqE=; b=Krh5MIdd6p3NHI7NALaD1QzSQnQkjpBUSc11heaY9mKFwlSiFIv2EAEFZIQvVDZJKWtQ/vakO6pbcM04X01PdgIASqgcQpEnLYry9SnEZgrR1ZmBkk9J9KAvFMOx7CZXUJxWuY79Kh45cHme+mgn6NKY3DbmdhdEAxGHg2cxI30= Received: from MW4PR03CA0318.namprd03.prod.outlook.com (2603:10b6:303:dd::23) by SA1PR12MB6776.namprd12.prod.outlook.com (2603:10b6:806:25b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.28; Sat, 21 Jan 2023 13:48:02 +0000 Received: from CO1NAM11FT088.eop-nam11.prod.protection.outlook.com (2603:10b6:303:dd:cafe::63) by MW4PR03CA0318.outlook.office365.com (2603:10b6:303:dd::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.28 via Frontend Transport; Sat, 21 Jan 2023 13:48:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT088.mail.protection.outlook.com (10.13.175.131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6023.16 via Frontend Transport; Sat, 21 Jan 2023 13:48:01 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Sat, 21 Jan 2023 07:48:00 -0600 From: Mario Limonciello <mario.limonciello@amd.com> To: Mika Westerberg <mika.westerberg@linux.intel.com>, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Linus Walleij <linus.walleij@linaro.org>, Bartosz Golaszewski <brgl@bgdev.pl>, "Raul E Rangel" <rrangel@chromium.org>, Dmitry Torokhov <dmitry.torokhov@gmail.com>, Benjamin Tissoires <benjamin.tissoires@redhat.com>, Wolfram Sang <wsa@kernel.org>, "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> CC: Mario Limonciello <mario.limonciello@amd.com>, Nathan Smythe <ncsmythe@scruboak.org>, <linux-gpio@vger.kernel.org>, <linux-acpi@vger.kernel.org>, <linux-kernel@vger.kernel.org> Subject: [PATCH 2/2] gpiolib-acpi: Don't set GPIOs for wakeup in S3 mode Date: Sat, 21 Jan 2023 07:48:11 -0600 Message-ID: <20230121134812.16637-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230121134812.16637-1-mario.limonciello@amd.com> References: <20230121134812.16637-1-mario.limonciello@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT088:EE_|SA1PR12MB6776:EE_ X-MS-Office365-Filtering-Correlation-Id: 4db76c4b-c217-4453-7955-08dafbb61d0c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: isafuOfY4TwG/7d6ra8IaHtgs2wWg4TKr6qPQzchWJFSK8c0nsLuN+sS8y4aJmklXGFh2GhV5pTt7wYVQOPYyf5C1bInW0sgdeeyZ9SK2/WUK/V+sJI0+eWlvodMMzXGQAZH8YOFksImyhZBUKhAWxg3gUIK3Upqhxha064exm+Pml9YooXCVFGU3kothFamwmHEaRIT4YVgqNL+td4M3um/TmM9ZIZIVyDoUJVwbUfnIRPi4+a1S3+prkGPa1B/r1O1imCm4PUmJ6qheiTTqfi5PZnMHCKiMZSM/vs/cvltKqK/jegLGfXwPvxy95ewKjO0mqL2ACPPYbJgqGq74iF7o6Fb95qjvGVOSg765oOVd6pXoR4QMvQRh+SdWKob4AGo6ii1P+pShX6xpwmmZeqml+MKNT17LbkgoHCi01cma8qnhQ/saskx0B1e7rAnKVOL7v040CgIB7GsjdU2IfHrwg/SbtBKxTruvtAReRLCuCWgITGEi2BdaXnv6HINFkohva+4IvwoF1MUrObWQJVQq5kvljt8TOqnj4MFK2C2RjLbJZU1HBXUtjnlzKOx6qEydIY4JXMbg6NUELwWMbDjGUE7Q3kQOubOuD/ZNJb1YuhKvvOEVgaYd9vlAVgCfybBF9Zp+2F+7l8j4IT9bqrILFr2rcPEEBqMdGHnq4Z9sML1iP6IIdnGAC3OHIyw7NelKwDtkJuO/C2eKMrBajgt3QCFj1z0QEEABCOQ3ct5dLB6lVDv5xnBZOlQNP2VDhdSQHIFnTIChLkn7+mvBg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(136003)(346002)(396003)(376002)(451199015)(36840700001)(46966006)(40470700004)(44832011)(86362001)(2906002)(40480700001)(70206006)(70586007)(336012)(16526019)(186003)(26005)(41300700001)(426003)(4326008)(8676002)(1076003)(47076005)(2616005)(478600001)(7696005)(40460700003)(966005)(54906003)(110136005)(6666004)(82740400003)(316002)(81166007)(5660300002)(356005)(8936002)(7416002)(83380400001)(36860700001)(82310400005)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jan 2023 13:48:01.4916 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4db76c4b-c217-4453-7955-08dafbb61d0c X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT088.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6776 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755641390722440354?= X-GMAIL-MSGID: =?utf-8?q?1755641390722440354?= |
Series |
Fix some more fallout from GPIOs from _CRS
|
|
Commit Message
Mario Limonciello
Jan. 21, 2023, 1:48 p.m. UTC
commit 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable") adjusted the policy to enable wakeup by default if the ACPI tables indicated that a device was wake capable. It was reported however that this broke suspend on at least two System76 systems in S3 mode and two Lenovo Gen2a systems, but only with S3. When the machines are set to s2idle, wakeup behaves properly. Configuring the GPIOs for wakeup with S3 doesn't work properly, so only set it when the system supports low power idle. Fixes: 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable") Fixes: b38f2d5d9615c ("i2c: acpi: Use ACPI wake capability bit to set wake_irq") Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2357 Link: https://bugzilla.redhat.com/show_bug.cgi?id=2162013 Reported-by: Nathan Smythe <ncsmythe@scruboak.org> Tested-by: Nathan Smythe <ncsmythe@scruboak.org> Suggested-by: Raul Rangel <rrangel@chromium.org> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> --- drivers/gpio/gpiolib-acpi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Comments
On Sat, Jan 21, 2023 at 07:48:11AM -0600, Mario Limonciello wrote: > commit 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable") > adjusted the policy to enable wakeup by default if the ACPI tables > indicated that a device was wake capable. > > It was reported however that this broke suspend on at least two System76 > systems in S3 mode and two Lenovo Gen2a systems, but only with S3. > When the machines are set to s2idle, wakeup behaves properly. > > Configuring the GPIOs for wakeup with S3 doesn't work properly, so only > set it when the system supports low power idle. Fine by me, Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > Fixes: 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable") > Fixes: b38f2d5d9615c ("i2c: acpi: Use ACPI wake capability bit to set wake_irq") > Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2357 > Link: https://bugzilla.redhat.com/show_bug.cgi?id=2162013 > Reported-by: Nathan Smythe <ncsmythe@scruboak.org> > Tested-by: Nathan Smythe <ncsmythe@scruboak.org> > Suggested-by: Raul Rangel <rrangel@chromium.org> > Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> > --- > drivers/gpio/gpiolib-acpi.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c > index 9ef0f5641b521..17c53f484280f 100644 > --- a/drivers/gpio/gpiolib-acpi.c > +++ b/drivers/gpio/gpiolib-acpi.c > @@ -1104,7 +1104,8 @@ int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, in > dev_dbg(&adev->dev, "IRQ %d already in use\n", irq); > } > > - if (wake_capable) > + /* avoid suspend issues with GPIOs when systems are using S3 */ > + if (wake_capable && acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) > *wake_capable = info.wake_capable; > > return irq; > -- > 2.34.1 >
On Sat, Jan 21, 2023 at 2:48 PM Mario Limonciello <mario.limonciello@amd.com> wrote: > > commit 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable") > adjusted the policy to enable wakeup by default if the ACPI tables > indicated that a device was wake capable. > > It was reported however that this broke suspend on at least two System76 > systems in S3 mode and two Lenovo Gen2a systems, but only with S3. > When the machines are set to s2idle, wakeup behaves properly. > > Configuring the GPIOs for wakeup with S3 doesn't work properly, so only > set it when the system supports low power idle. > > Fixes: 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable") > Fixes: b38f2d5d9615c ("i2c: acpi: Use ACPI wake capability bit to set wake_irq") > Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2357 > Link: https://bugzilla.redhat.com/show_bug.cgi?id=2162013 > Reported-by: Nathan Smythe <ncsmythe@scruboak.org> > Tested-by: Nathan Smythe <ncsmythe@scruboak.org> > Suggested-by: Raul Rangel <rrangel@chromium.org> > Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> > --- > drivers/gpio/gpiolib-acpi.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c > index 9ef0f5641b521..17c53f484280f 100644 > --- a/drivers/gpio/gpiolib-acpi.c > +++ b/drivers/gpio/gpiolib-acpi.c > @@ -1104,7 +1104,8 @@ int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, in > dev_dbg(&adev->dev, "IRQ %d already in use\n", irq); > } > > - if (wake_capable) > + /* avoid suspend issues with GPIOs when systems are using S3 */ > + if (wake_capable && acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) > *wake_capable = info.wake_capable; > > return irq; > -- > 2.34.1 > Applied, thanks! Bart
On Mon, Jan 23, 2023 at 8:03 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote: > > On Sat, Jan 21, 2023 at 2:48 PM Mario Limonciello > <mario.limonciello@amd.com> wrote: > > > > commit 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable") > > adjusted the policy to enable wakeup by default if the ACPI tables > > indicated that a device was wake capable. > > > > It was reported however that this broke suspend on at least two System76 > > systems in S3 mode and two Lenovo Gen2a systems, but only with S3. > > When the machines are set to s2idle, wakeup behaves properly. > > > > Configuring the GPIOs for wakeup with S3 doesn't work properly, so only > > set it when the system supports low power idle. > > > > Fixes: 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable") > > Fixes: b38f2d5d9615c ("i2c: acpi: Use ACPI wake capability bit to set wake_irq") > > Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2357 > > Link: https://bugzilla.redhat.com/show_bug.cgi?id=2162013 > > Reported-by: Nathan Smythe <ncsmythe@scruboak.org> > > Tested-by: Nathan Smythe <ncsmythe@scruboak.org> > > Suggested-by: Raul Rangel <rrangel@chromium.org> > > Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> > > --- > > drivers/gpio/gpiolib-acpi.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c > > index 9ef0f5641b521..17c53f484280f 100644 > > --- a/drivers/gpio/gpiolib-acpi.c > > +++ b/drivers/gpio/gpiolib-acpi.c > > @@ -1104,7 +1104,8 @@ int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, in > > dev_dbg(&adev->dev, "IRQ %d already in use\n", irq); > > } > > > > - if (wake_capable) > > + /* avoid suspend issues with GPIOs when systems are using S3 */ > > + if (wake_capable && acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) > > *wake_capable = info.wake_capable; > > > > return irq; > > -- > > 2.34.1 > > > > Applied, thanks! > > Bart We still need to figure out a proper fix for this. If you read my post here: https://gitlab.freedesktop.org/drm/amd/-/issues/2357#note_1732372 I think we misinterpreted what the SharedAndWake bit is used for. To me it sounds like it's only valid for HW Reduced ACPI platforms, and S0ix. My changes made it so we call `dev_pm_set_wake_irq` when the Wake bit is set. Does anyone have any additional context on the Wake bit? I think we either need to make `dev_pm_set_wake_irq` (or a variant) only enable the wake on S0i3, or we can teach the ACPI subsystem to manage arming the IRQ's wake bit. Kind of like we already manage the GPE events for the device.
[Public] > -----Original Message----- > From: Raul Rangel <rrangel@chromium.org> > Sent: Monday, January 23, 2023 09:55 > To: Bartosz Golaszewski <brgl@bgdev.pl> > Cc: Limonciello, Mario <Mario.Limonciello@amd.com>; Mika Westerberg > <mika.westerberg@linux.intel.com>; Andy Shevchenko > <andriy.shevchenko@linux.intel.com>; Linus Walleij > <linus.walleij@linaro.org>; Dmitry Torokhov <dmitry.torokhov@gmail.com>; > Benjamin Tissoires <benjamin.tissoires@redhat.com>; Wolfram Sang > <wsa@kernel.org>; Rafael J. Wysocki <rafael.j.wysocki@intel.com>; Nathan > Smythe <ncsmythe@scruboak.org>; linux-gpio@vger.kernel.org; linux- > acpi@vger.kernel.org; linux-kernel@vger.kernel.org; Mark Hasemeyer > <markhas@chromium.org> > Subject: Re: [PATCH 2/2] gpiolib-acpi: Don't set GPIOs for wakeup in S3 mode > > On Mon, Jan 23, 2023 at 8:03 AM Bartosz Golaszewski <brgl@bgdev.pl> > wrote: > > > > On Sat, Jan 21, 2023 at 2:48 PM Mario Limonciello > > <mario.limonciello@amd.com> wrote: > > > > > > commit 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable") > > > adjusted the policy to enable wakeup by default if the ACPI tables > > > indicated that a device was wake capable. > > > > > > It was reported however that this broke suspend on at least two > System76 > > > systems in S3 mode and two Lenovo Gen2a systems, but only with S3. > > > When the machines are set to s2idle, wakeup behaves properly. > > > > > > Configuring the GPIOs for wakeup with S3 doesn't work properly, so only > > > set it when the system supports low power idle. > > > > > > Fixes: 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable") > > > Fixes: b38f2d5d9615c ("i2c: acpi: Use ACPI wake capability bit to set > wake_irq") > > > Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2357 > > > Link: https://bugzilla.redhat.com/show_bug.cgi?id=2162013 > > > Reported-by: Nathan Smythe <ncsmythe@scruboak.org> > > > Tested-by: Nathan Smythe <ncsmythe@scruboak.org> > > > Suggested-by: Raul Rangel <rrangel@chromium.org> > > > Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> > > > --- > > > drivers/gpio/gpiolib-acpi.c | 3 ++- > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c > > > index 9ef0f5641b521..17c53f484280f 100644 > > > --- a/drivers/gpio/gpiolib-acpi.c > > > +++ b/drivers/gpio/gpiolib-acpi.c > > > @@ -1104,7 +1104,8 @@ int acpi_dev_gpio_irq_wake_get_by(struct > acpi_device *adev, const char *name, in > > > dev_dbg(&adev->dev, "IRQ %d already in use\n", irq); > > > } > > > > > > - if (wake_capable) > > > + /* avoid suspend issues with GPIOs when systems are using > S3 */ > > > + if (wake_capable && acpi_gbl_FADT.flags & > ACPI_FADT_LOW_POWER_S0) > > > *wake_capable = info.wake_capable; > > > > > > return irq; > > > -- > > > 2.34.1 > > > > > > > Applied, thanks! > > > > Bart > > > We still need to figure out a proper fix for this. If you read my post > here: https://gitlab.freedesktop.org/drm/amd/-/issues/2357#note_1732372 > I think we misinterpreted what the SharedAndWake bit is used for. To > me it sounds like it's only valid for HW Reduced ACPI platforms, and > S0ix. My changes made it so we call `dev_pm_set_wake_irq` when the > Wake bit is set. Does anyone have any additional context on the Wake > bit? I think we either need to make `dev_pm_set_wake_irq` (or a > variant) only enable the wake on S0i3, or we can teach the ACPI > subsystem to manage arming the IRQ's wake bit. Kind of like we already > manage the GPE events for the device. There is an FADT flag for HW reduced (ACPI_FADT_HW_REDUCED). So maybe something on top of my change to look at that too? IE: if (wake_capable && (acpi_gbl_FADT.flags & (ACPI_FADT_LOW_POWER_S0 | ACPI_FADT_HW_REDUCED)
On Mon, Jan 23, 2023 at 9:07 AM Limonciello, Mario <Mario.Limonciello@amd.com> wrote: > > [Public] > > > > > -----Original Message----- > > From: Raul Rangel <rrangel@chromium.org> > > Sent: Monday, January 23, 2023 09:55 > > To: Bartosz Golaszewski <brgl@bgdev.pl> > > Cc: Limonciello, Mario <Mario.Limonciello@amd.com>; Mika Westerberg > > <mika.westerberg@linux.intel.com>; Andy Shevchenko > > <andriy.shevchenko@linux.intel.com>; Linus Walleij > > <linus.walleij@linaro.org>; Dmitry Torokhov <dmitry.torokhov@gmail.com>; > > Benjamin Tissoires <benjamin.tissoires@redhat.com>; Wolfram Sang > > <wsa@kernel.org>; Rafael J. Wysocki <rafael.j.wysocki@intel.com>; Nathan > > Smythe <ncsmythe@scruboak.org>; linux-gpio@vger.kernel.org; linux- > > acpi@vger.kernel.org; linux-kernel@vger.kernel.org; Mark Hasemeyer > > <markhas@chromium.org> > > Subject: Re: [PATCH 2/2] gpiolib-acpi: Don't set GPIOs for wakeup in S3 mode > > > > On Mon, Jan 23, 2023 at 8:03 AM Bartosz Golaszewski <brgl@bgdev.pl> > > wrote: > > > > > > On Sat, Jan 21, 2023 at 2:48 PM Mario Limonciello > > > <mario.limonciello@amd.com> wrote: > > > > > > > > commit 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable") > > > > adjusted the policy to enable wakeup by default if the ACPI tables > > > > indicated that a device was wake capable. > > > > > > > > It was reported however that this broke suspend on at least two > > System76 > > > > systems in S3 mode and two Lenovo Gen2a systems, but only with S3. > > > > When the machines are set to s2idle, wakeup behaves properly. > > > > > > > > Configuring the GPIOs for wakeup with S3 doesn't work properly, so only > > > > set it when the system supports low power idle. > > > > > > > > Fixes: 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable") > > > > Fixes: b38f2d5d9615c ("i2c: acpi: Use ACPI wake capability bit to set > > wake_irq") > > > > Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2357 > > > > Link: https://bugzilla.redhat.com/show_bug.cgi?id=2162013 > > > > Reported-by: Nathan Smythe <ncsmythe@scruboak.org> > > > > Tested-by: Nathan Smythe <ncsmythe@scruboak.org> > > > > Suggested-by: Raul Rangel <rrangel@chromium.org> > > > > Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> > > > > --- > > > > drivers/gpio/gpiolib-acpi.c | 3 ++- > > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > > > diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c > > > > index 9ef0f5641b521..17c53f484280f 100644 > > > > --- a/drivers/gpio/gpiolib-acpi.c > > > > +++ b/drivers/gpio/gpiolib-acpi.c > > > > @@ -1104,7 +1104,8 @@ int acpi_dev_gpio_irq_wake_get_by(struct > > acpi_device *adev, const char *name, in > > > > dev_dbg(&adev->dev, "IRQ %d already in use\n", irq); > > > > } > > > > > > > > - if (wake_capable) > > > > + /* avoid suspend issues with GPIOs when systems are using > > S3 */ > > > > + if (wake_capable && acpi_gbl_FADT.flags & > > ACPI_FADT_LOW_POWER_S0) > > > > *wake_capable = info.wake_capable; > > > > > > > > return irq; > > > > -- > > > > 2.34.1 > > > > > > > > > > Applied, thanks! > > > > > > Bart > > > > > > We still need to figure out a proper fix for this. If you read my post > > here: https://gitlab.freedesktop.org/drm/amd/-/issues/2357#note_1732372 > > I think we misinterpreted what the SharedAndWake bit is used for. To > > me it sounds like it's only valid for HW Reduced ACPI platforms, and > > S0ix. My changes made it so we call `dev_pm_set_wake_irq` when the > > Wake bit is set. Does anyone have any additional context on the Wake > > bit? I think we either need to make `dev_pm_set_wake_irq` (or a > > variant) only enable the wake on S0i3, or we can teach the ACPI > > subsystem to manage arming the IRQ's wake bit. Kind of like we already > > manage the GPE events for the device. > > There is an FADT flag for HW reduced (ACPI_FADT_HW_REDUCED). So > maybe something on top of my change to look at that too? > > IE: > if (wake_capable && (acpi_gbl_FADT.flags & (ACPI_FADT_LOW_POWER_S0 | ACPI_FADT_HW_REDUCED) The problem with the ACPI_FADT_LOW_POWER_S0 FADT flag is that it defines if S0ix is supported. That's not mutually exclusive with S3. So we really need a runtime check to see which suspend mode we are entering.
On Mon, Jan 23, 2023 at 08:55:02AM -0700, Raul Rangel wrote: > On Mon, Jan 23, 2023 at 8:03 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote: > > > > On Sat, Jan 21, 2023 at 2:48 PM Mario Limonciello > > <mario.limonciello@amd.com> wrote: > > > > > > commit 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable") > > > adjusted the policy to enable wakeup by default if the ACPI tables > > > indicated that a device was wake capable. > > > > > > It was reported however that this broke suspend on at least two System76 > > > systems in S3 mode and two Lenovo Gen2a systems, but only with S3. > > > When the machines are set to s2idle, wakeup behaves properly. > > > > > > Configuring the GPIOs for wakeup with S3 doesn't work properly, so only > > > set it when the system supports low power idle. > > > > > > Fixes: 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable") > > > Fixes: b38f2d5d9615c ("i2c: acpi: Use ACPI wake capability bit to set wake_irq") > > > Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2357 > > > Link: https://bugzilla.redhat.com/show_bug.cgi?id=2162013 > > > Reported-by: Nathan Smythe <ncsmythe@scruboak.org> > > > Tested-by: Nathan Smythe <ncsmythe@scruboak.org> > > > Suggested-by: Raul Rangel <rrangel@chromium.org> > > > Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> > > > --- > > > drivers/gpio/gpiolib-acpi.c | 3 ++- > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c > > > index 9ef0f5641b521..17c53f484280f 100644 > > > --- a/drivers/gpio/gpiolib-acpi.c > > > +++ b/drivers/gpio/gpiolib-acpi.c > > > @@ -1104,7 +1104,8 @@ int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, in > > > dev_dbg(&adev->dev, "IRQ %d already in use\n", irq); > > > } > > > > > > - if (wake_capable) > > > + /* avoid suspend issues with GPIOs when systems are using S3 */ > > > + if (wake_capable && acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) > > > *wake_capable = info.wake_capable; > > > > > > return irq; > > > -- > > > 2.34.1 > > > > > > > Applied, thanks! > > > > Bart > > > We still need to figure out a proper fix for this. If you read my post > here: https://gitlab.freedesktop.org/drm/amd/-/issues/2357#note_1732372 > I think we misinterpreted what the SharedAndWake bit is used for. To > me it sounds like it's only valid for HW Reduced ACPI platforms, and > S0ix. My changes made it so we call `dev_pm_set_wake_irq` when the > Wake bit is set. Does anyone have any additional context on the Wake > bit? I think we either need to make `dev_pm_set_wake_irq` (or a > variant) only enable the wake on S0i3, or we can teach the ACPI > subsystem to manage arming the IRQ's wake bit. Kind of like we already > manage the GPE events for the device. From the spec: Shared is an optional argument and can be one of Shared, Exclusive, SharedAndWake or ExclusiveAndWake. If not specified, Exclusive is assumed. The “Wake” designation indicates that the interrupt is capable of waking the system from a low-power idle state or a system sleep state. The bit field name _SHR is automatically created to refer to this portion of the resource descriptor. Note: "...a low-power idle state or a system sleep state.". I believe it applies to both.
On Mon, Jan 23, 2023 at 04:06:59PM +0000, Limonciello, Mario wrote: > > From: Raul Rangel <rrangel@chromium.org> > > Sent: Monday, January 23, 2023 09:55 > > On Mon, Jan 23, 2023 at 8:03 AM Bartosz Golaszewski <brgl@bgdev.pl> > > wrote: > > > On Sat, Jan 21, 2023 at 2:48 PM Mario Limonciello > > > <mario.limonciello@amd.com> wrote: ... > > > > + /* avoid suspend issues with GPIOs when systems are using > > S3 */ > > > > + if (wake_capable && acpi_gbl_FADT.flags & > > ACPI_FADT_LOW_POWER_S0) > > > > *wake_capable = info.wake_capable; > > > > > > > > return irq; ... > > We still need to figure out a proper fix for this. If you read my post > > here: https://gitlab.freedesktop.org/drm/amd/-/issues/2357#note_1732372 > > I think we misinterpreted what the SharedAndWake bit is used for. To > > me it sounds like it's only valid for HW Reduced ACPI platforms, and > > S0ix. My changes made it so we call `dev_pm_set_wake_irq` when the > > Wake bit is set. Does anyone have any additional context on the Wake > > bit? I think we either need to make `dev_pm_set_wake_irq` (or a > > variant) only enable the wake on S0i3, or we can teach the ACPI > > subsystem to manage arming the IRQ's wake bit. Kind of like we already > > manage the GPE events for the device. > > There is an FADT flag for HW reduced (ACPI_FADT_HW_REDUCED). So > maybe something on top of my change to look at that too? > > IE: > if (wake_capable && (acpi_gbl_FADT.flags & (ACPI_FADT_LOW_POWER_S0 | ACPI_FADT_HW_REDUCED) I'm not sure why we are talking about HW reduced case? In HP reduced case IIRC the GPE are absent as a class.
On Mon, Jan 23, 2023 at 10:30 AM Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > > On Mon, Jan 23, 2023 at 08:55:02AM -0700, Raul Rangel wrote: > > On Mon, Jan 23, 2023 at 8:03 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote: > > > > > > On Sat, Jan 21, 2023 at 2:48 PM Mario Limonciello > > > <mario.limonciello@amd.com> wrote: > > > > > > > > commit 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable") > > > > adjusted the policy to enable wakeup by default if the ACPI tables > > > > indicated that a device was wake capable. > > > > > > > > It was reported however that this broke suspend on at least two System76 > > > > systems in S3 mode and two Lenovo Gen2a systems, but only with S3. > > > > When the machines are set to s2idle, wakeup behaves properly. > > > > > > > > Configuring the GPIOs for wakeup with S3 doesn't work properly, so only > > > > set it when the system supports low power idle. > > > > > > > > Fixes: 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable") > > > > Fixes: b38f2d5d9615c ("i2c: acpi: Use ACPI wake capability bit to set wake_irq") > > > > Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2357 > > > > Link: https://bugzilla.redhat.com/show_bug.cgi?id=2162013 > > > > Reported-by: Nathan Smythe <ncsmythe@scruboak.org> > > > > Tested-by: Nathan Smythe <ncsmythe@scruboak.org> > > > > Suggested-by: Raul Rangel <rrangel@chromium.org> > > > > Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> > > > > --- > > > > drivers/gpio/gpiolib-acpi.c | 3 ++- > > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > > > diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c > > > > index 9ef0f5641b521..17c53f484280f 100644 > > > > --- a/drivers/gpio/gpiolib-acpi.c > > > > +++ b/drivers/gpio/gpiolib-acpi.c > > > > @@ -1104,7 +1104,8 @@ int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, in > > > > dev_dbg(&adev->dev, "IRQ %d already in use\n", irq); > > > > } > > > > > > > > - if (wake_capable) > > > > + /* avoid suspend issues with GPIOs when systems are using S3 */ > > > > + if (wake_capable && acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) > > > > *wake_capable = info.wake_capable; > > > > > > > > return irq; > > > > -- > > > > 2.34.1 > > > > > > > > > > Applied, thanks! > > > > > > Bart > > > > > > We still need to figure out a proper fix for this. If you read my post > > here: https://gitlab.freedesktop.org/drm/amd/-/issues/2357#note_1732372 > > I think we misinterpreted what the SharedAndWake bit is used for. To > > me it sounds like it's only valid for HW Reduced ACPI platforms, and > > S0ix. My changes made it so we call `dev_pm_set_wake_irq` when the > > Wake bit is set. Does anyone have any additional context on the Wake > > bit? I think we either need to make `dev_pm_set_wake_irq` (or a > > variant) only enable the wake on S0i3, or we can teach the ACPI > > subsystem to manage arming the IRQ's wake bit. Kind of like we already > > manage the GPE events for the device. > > From the spec: > > Shared is an optional argument and can be one of Shared, Exclusive, > SharedAndWake or ExclusiveAndWake. If not specified, Exclusive is assumed. > The “Wake” designation indicates that the interrupt is capable of waking > the system from a low-power idle state or a system sleep state. The bit > field name _SHR is automatically created to refer to this portion of > the resource descriptor. > > > Note: "...a low-power idle state or a system sleep state.". I believe it > applies to both. Without the _PRW, how do we determine the valid system sleep states the device can wake the system from? > > -- > With Best Regards, > Andy Shevchenko > >
On Mon, Jan 23, 2023 at 10:54:29AM -0700, Raul Rangel wrote: > On Mon, Jan 23, 2023 at 10:30 AM Andy Shevchenko > <andriy.shevchenko@linux.intel.com> wrote: > > On Mon, Jan 23, 2023 at 08:55:02AM -0700, Raul Rangel wrote: > > > On Mon, Jan 23, 2023 at 8:03 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote: > > > > On Sat, Jan 21, 2023 at 2:48 PM Mario Limonciello > > > > <mario.limonciello@amd.com> wrote: ... > > > We still need to figure out a proper fix for this. If you read my post > > > here: https://gitlab.freedesktop.org/drm/amd/-/issues/2357#note_1732372 > > > I think we misinterpreted what the SharedAndWake bit is used for. To > > > me it sounds like it's only valid for HW Reduced ACPI platforms, and > > > S0ix. My changes made it so we call `dev_pm_set_wake_irq` when the > > > Wake bit is set. Does anyone have any additional context on the Wake > > > bit? I think we either need to make `dev_pm_set_wake_irq` (or a > > > variant) only enable the wake on S0i3, or we can teach the ACPI > > > subsystem to manage arming the IRQ's wake bit. Kind of like we already > > > manage the GPE events for the device. > > > > From the spec: > > > > Shared is an optional argument and can be one of Shared, Exclusive, > > SharedAndWake or ExclusiveAndWake. If not specified, Exclusive is assumed. > > The “Wake” designation indicates that the interrupt is capable of waking > > the system from a low-power idle state or a system sleep state. The bit > > field name _SHR is automatically created to refer to this portion of > > the resource descriptor. > > > > > > Note: "...a low-power idle state or a system sleep state.". I believe it > > applies to both. > > Without the _PRW, how do we determine the valid system sleep states > the device can wake the system from? Good question. I believe you need to ask somebody from ASWG for the clarifications.
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 9ef0f5641b521..17c53f484280f 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -1104,7 +1104,8 @@ int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, in dev_dbg(&adev->dev, "IRQ %d already in use\n", irq); } - if (wake_capable) + /* avoid suspend issues with GPIOs when systems are using S3 */ + if (wake_capable && acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) *wake_capable = info.wake_capable; return irq;