Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1204783rwb; Wed, 28 Sep 2022 14:58:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7coaoMb7bVF7xnW7iRREViqZ1OKci8bRfFaI5OafrHor+FmuEiJW6RJYf4dlVYT7D1e9GU X-Received: by 2002:a17:90b:4a8a:b0:202:8eec:b87a with SMTP id lp10-20020a17090b4a8a00b002028eecb87amr12782278pjb.48.1664402337542; Wed, 28 Sep 2022 14:58:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664402337; cv=none; d=google.com; s=arc-20160816; b=GqBO3GAPGhQlzHvwd+IyNZMBGnzV+N875iIo1cNmZQkIljMieIUZPI9tEf3Zj8ReZ4 2jMCwtFWp2Me5g0y7bn0c0HE1HnldERp96O2EHvg0vSoYng21GBRWtgWaUEnM7aiatRC w+P36uJ0JtynODVwbwyy6S0NdXyYe90V8xPe4H9Wef0k+Q379+fQsLst/Guei4kc/D1A SCeInAeFo9LJQRBlrfCXN6XeWZpdmZV/oy7Geexm0HNBS66arjz/dQTEicoH//QRZdOK 7E9OLXMKzq6r1G8CQ5Cp698/nuIZLdvVlVmROJJVw/0q5UbQPXM43NPHfjGolIGpZFxO eNWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=9t1zC330HUR2z0lQkNzGtWIQnlQT+GzrLYZrL9egK1U=; b=Zxi9CHCqgR+FwMvt0GPVQtFEjpfGjJAPxfWDzfhA8jFDmAiOQVY6ioI03s+VoykmHz blDh66+JMWTztEShMlaCXJyUfCYfANhNlRijbYXEVU6bafM95aOicr2/kzSJgpcpSfDt 0IrmgU/38fPZD7dV04m2whNtDHdfveBAjzEa9Rv2q6C1QAhsrk4uVbyX1NwIfdb7i8Ol 4bW7kqkuqVwRy9hNbdjYcgfk9bwd+rZk7cr+oyD+Sqi4BGD0rzYK4akWuPgK1FfN1kH/ LFPB42DuLWKvJ+8puyU4P06mtrkCSdTtFBUA68NOFR9QcAkzjGOvRQ02revDtYaq4Hpp J9+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=JDX3GYUh; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z5-20020a170902ccc500b0017857e48068si5995609ple.146.2022.09.28.14.58.46; Wed, 28 Sep 2022 14:58:57 -0700 (PDT) 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=@chromium.org header.s=google header.b=JDX3GYUh; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232827AbiI1VQv (ORCPT + 99 others); Wed, 28 Sep 2022 17:16:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234558AbiI1VQ2 (ORCPT ); Wed, 28 Sep 2022 17:16:28 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8C5910BB18 for ; Wed, 28 Sep 2022 14:10:55 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id c24so12777564plo.3 for ; Wed, 28 Sep 2022 14:10:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=9t1zC330HUR2z0lQkNzGtWIQnlQT+GzrLYZrL9egK1U=; b=JDX3GYUhPjHCWI9lm9NZcjbU+aMhiRXuYEclhJtT4AZ7VuiPWPseLSUDBsDNdO/Xg/ RTeu3E/XB8AoR2yDZEyCK0Cazj/HOIFifbRDPm9EDijegDsq78fkSCnmQZe4OKRlzXCp xCD5SSeVhuf6yuf7sxeUwcIFK0U9QHmM3LN3k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=9t1zC330HUR2z0lQkNzGtWIQnlQT+GzrLYZrL9egK1U=; b=3p+SYXbk6dBt2xVBxkdj/YUaPDc0Ym15IRVjs52Yj/MMavtdMjYlmwF99jvvE516Zt 0siKOQkal9JsCFHAQMc2A+NUTi0KhyWR5QVU1jrg8nx+L1ACzlrB1/YYFIiUYZ3BM4c6 Tn6AJbG4EO2P90Hg02RMttjlFTIiBQvuxr2673Z5Buk4rO7+icbzZ5FVdnWH73S8ApAV 1EZGOICQky9iT2IcSeR48wqoWJBh5roFFqkLzvpUVgXfz+QV7/skCzcalGguoIWBaklO 85X+qCr3rkSCx6jtymd0NBujj+Ze6VJRZxsSkMBzhLPanojIfriir2k8/pDsnRNzdEMH i4wQ== X-Gm-Message-State: ACrzQf0rTxGk0SJBrq/DOBsvwvakw6Xec8YZQtVFuBumxkN5BFRYqt5L pvpUjyKhtgj3nZyYtgk01EInBxfDQS6esg== X-Received: by 2002:a17:902:d2c5:b0:176:d0b0:bf53 with SMTP id n5-20020a170902d2c500b00176d0b0bf53mr1670099plc.88.1664399454366; Wed, 28 Sep 2022 14:10:54 -0700 (PDT) Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com. [209.85.216.46]) by smtp.gmail.com with ESMTPSA id ix21-20020a170902f81500b0016c574aa0fdsm2194539plb.76.2022.09.28.14.10.51 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 Sep 2022 14:10:52 -0700 (PDT) Received: by mail-pj1-f46.google.com with SMTP id u59-20020a17090a51c100b00205d3c44162so3957550pjh.2 for ; Wed, 28 Sep 2022 14:10:51 -0700 (PDT) X-Received: by 2002:a17:902:f68d:b0:178:41dd:12ad with SMTP id l13-20020a170902f68d00b0017841dd12admr1645115plg.25.1664399451471; Wed, 28 Sep 2022 14:10:51 -0700 (PDT) MIME-Version: 1.0 References: <20220921155205.1332614-1-rrangel@chromium.org> <20220921094736.v5.8.I7d9202463f08373feccd6e8fd87482c4f40ece5d@changeid> In-Reply-To: From: Raul Rangel Date: Wed, 28 Sep 2022 15:10:40 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v5 08/13] ACPI: PM: Take wake IRQ into consideration when entering suspend-to-idle To: "Rafael J. Wysocki" Cc: ACPI Devel Maling List , linux-input , Tim Van Patten , Mika Westerberg , Andy Shevchenko , Dmitry Torokhov , "jingle.wu" , Hans de Goede , Mario Limonciello , Linus Walleij , Len Brown , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Sep 24, 2022 at 11:00 AM Rafael J. Wysocki wrote: > > On Wed, Sep 21, 2022 at 5:52 PM Raul E Rangel wrote: > > > > This change adds support for ACPI devices that use ExclusiveAndWake or > > SharedAndWake in their _CRS GpioInt definition (instead of using _PRW), > > and also provide power resources. Previously the ACPI subsystem had no > > idea if the device had a wake capable interrupt armed. This resulted > > in the ACPI device PM system placing the device into D3Cold, and thus > > cutting power to the device. With this change we will now query the > > _S0W method to figure out the appropriate wake capable D-state. > > > > Signed-off-by: Raul E Rangel > > --- > > > > Changes in v5: > > - Go back to using adev->wakeup.flags.valid to keep the diff cleaner > > - Fix a typo in comment > > > > drivers/acpi/device_pm.c | 19 +++++++++++++++++-- > > 1 file changed, 17 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c > > index 9dce1245689ca2..3111fc426e04fd 100644 > > --- a/drivers/acpi/device_pm.c > > +++ b/drivers/acpi/device_pm.c > > @@ -681,8 +681,23 @@ static int acpi_dev_pm_get_state(struct device *dev, struct acpi_device *adev, > > d_min = ret; > > wakeup = device_may_wakeup(dev) && adev->wakeup.flags.valid > > && adev->wakeup.sleep_state >= target_state; Just an FYI, I didn't update the code that handles the target state > S0. I need to get a device that has S3 capabilities and the correct firmware to test this. I figure I can do that as a different patch when I have time to test with an S3 device. > > - } else { > > - wakeup = adev->wakeup.flags.valid; > > + } else if (adev->wakeup.flags.valid) { > > + /* ACPI GPE specified in _PRW. */ > > + wakeup = true; > > I would retain the "else" clause as it was and just add a new "else > if" one before it. > Done > > + } else if (device_may_wakeup(dev) && dev->power.wakeirq) { > > + /* > > + * The ACPI subsystem doesn't manage the wake bit for IRQs > > + * defined with ExclusiveAndWake and SharedAndWake. Instead we > > + * expect them to be managed via the PM subsystem. Drivers > > + * should call dev_pm_set_wake_irq to register an IRQ as a wake > > + * source. > > + * > > + * If a device has a wake IRQ attached we need to check the > > + * _S0W method to get the correct wake D-state. Otherwise we > > + * end up putting the device into D3Cold which will more than > > + * likely disable wake functionality. > > + */ > > + wakeup = true; > > } > > > > /* > > -- I'll send out v6 soon unless anyone else has any comments.