Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp108677rwn; Wed, 14 Sep 2022 17:00:32 -0700 (PDT) X-Google-Smtp-Source: AA6agR6Cs6SVrtNL5Cy02OSBBdzK2i17xgAFA1oTndYV6ZosLC92iemb/nEZpDkInj+JMgbTnv9u X-Received: by 2002:a63:e909:0:b0:438:c9c9:61e3 with SMTP id i9-20020a63e909000000b00438c9c961e3mr18930819pgh.194.1663200031689; Wed, 14 Sep 2022 17:00:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663200031; cv=none; d=google.com; s=arc-20160816; b=XmqrmS1Xzo1MSISHnsR9w9rU6V6hzmhCekHxTMPrq/nHkgschwTCyqZ1pjzmz5N8zp Dkst1/JIU4kTyK8d4o4m4uFHhJoh9TPLMntzLkxOpMzFqH2QcrnrPtGWQ02BxWWsVry4 lsZsbxAygSlcgkvSF6eaJwyqTsKEWUD+G/3GZMkiWRi1t5CQav91SxoubB3TEZZjuAy7 4lOP804Vw9e5vYAyYbDvs/U83UiNpfhoLdngP+l+wi+M/HNZo/bKOoNQ59GadvN1dVYm TsyP5deKI7JXFsQz4/uG69/d8evdZtmJ6E7Ij20v/84ylnKVJwbI7jxRUnGCFJ9cP474 avdg== ARC-Message-Signature: i=1; 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=F4E89pQ2FrSepPnER/REAyEkKBd4VwJQnWtxeznDInw=; b=xjAstM1qhBweyYmmdXMgm02D2/XT5HDQQ+KVG1Qu4hhmHMMmboPhwUTFUGEdZh/5cr ehFmCrlysuGnYha5flhc1wp28Otj6boIqJ30zf6Vfrye9rw+H4vmH22BOD1FKeIiKZdl wfRmXNNKqW6BWfP1eskEWEJ5mXus3Q/OOKwMYDDuNf4ZnK6F2FojRqf9MTQsTNdJWeOA xBDTJBOsMDoByj1uYxDLzvpm6SxuNsAOOb8qRCCA4O6hbx0M3FFjBlleHj531D5JQT6f /WNF/F9v7ep5CGopewwUpFQRkBu1/8pdNBjgXSc966Ml4v45Avrox8tbIZjSTwTWDWUQ ynrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=gIASrLgf; 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 t16-20020a63dd10000000b0041c0863aa81si5536749pgg.571.2022.09.14.17.00.19; Wed, 14 Sep 2022 17:00:31 -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=gIASrLgf; 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 S229709AbiINX7U (ORCPT + 99 others); Wed, 14 Sep 2022 19:59:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229845AbiINX7A (ORCPT ); Wed, 14 Sep 2022 19:59:00 -0400 Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 212EF89933 for ; Wed, 14 Sep 2022 16:58:19 -0700 (PDT) Received: by mail-io1-xd33.google.com with SMTP id n81so13220338iod.6 for ; Wed, 14 Sep 2022 16:58:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=F4E89pQ2FrSepPnER/REAyEkKBd4VwJQnWtxeznDInw=; b=gIASrLgf9OZ8PhCuu5JVaGjTRHApQbKQ2UubkA8t7hWpqS7r2E/RwDlv7HQWzQ6LKL 6+JM6MNE9aTtuT9HqVQ6yw1x4Qq5HE5cVQWl+oPEpoTnD1HyKjgxUHHc7TcGO4Yo0txa Kr8d3LFOQUiPV7G76rXMBecTPmCqhBTW03g/8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=F4E89pQ2FrSepPnER/REAyEkKBd4VwJQnWtxeznDInw=; b=kdi0euZ0QqxLGoNYGuf43uRmHbIAfe6EMw9e0FRDB+VenLwrz4uJOUpDjBGSTq8IkJ K7djxrI+WDjDYbtOS5HjbZADFeoHnOgj0pQ5c/DaIgzoXP0cYjM/XesoJvA3tdmKbtl/ T849zu5vCSsc9ipw14AHeLsK+OUGBYTyrzaXaVpEMXxYhG7riVvb7203SNvAEe2fP5TA 26pBzgOrg1byiwfFG0FV/rLaZmM0IjSuu9UnFe86j+UuM/GJzyklmJ7MY/nZ77Cw7ujV RbXX2bSakAwhJu47wnUdeAMcsEmfq5FiC0eK4595JdCCFbUc2OgZej82Q7BHL1EA7VVr Z6Jw== X-Gm-Message-State: ACgBeo19ISzT5SjHGmREiQbKq2ZMsKa4ezYJs/UBDAuJZ4s3+GFlQMEK aMxtOSht8aql4MD/j9bVRXnGIA== X-Received: by 2002:a05:6602:2a47:b0:689:e971:8e67 with SMTP id k7-20020a0566022a4700b00689e9718e67mr16872002iov.47.1663199899601; Wed, 14 Sep 2022 16:58:19 -0700 (PDT) Received: from rrangel920.bld.corp.google.com (h24-56-189-219.arvdco.broadband.dynamic.tds.net. [24.56.189.219]) by smtp.gmail.com with ESMTPSA id a14-20020a027a0e000000b0034c0e8829c0sm353721jac.0.2022.09.14.16.58.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Sep 2022 16:58:19 -0700 (PDT) From: Raul E Rangel To: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org Cc: jingle.wu@emc.com.tw, rafael@kernel.org, andriy.shevchenko@linux.intel.com, mario.limonciello@amd.com, hdegoede@redhat.com, linus.walleij@linaro.org, timvp@google.com, dmitry.torokhov@gmail.com, Raul E Rangel , Len Brown , linux-kernel@vger.kernel.org Subject: [PATCH v3 08/13] ACPI: PM: Take wake IRQ into consideration when entering suspend-to-idle Date: Wed, 14 Sep 2022 17:57:56 -0600 Message-Id: <20220914155914.v3.8.I7d9202463f08373feccd6e8fd87482c4f40ece5d@changeid> X-Mailer: git-send-email 2.37.3.968.ga6b4b080e4-goog In-Reply-To: <20220914235801.1731478-1-rrangel@chromium.org> References: <20220914235801.1731478-1-rrangel@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 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,T_SCC_BODY_TEXT_LINE 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 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 --- (no changes since v1) 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..6bc81f525d5160 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; - } else { - wakeup = adev->wakeup.flags.valid; + } else if (acpi_device_can_wakeup(adev)) { + /* ACPI GPE from specified by _PRW. */ + wakeup = true; + } 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; } /* -- 2.37.3.968.ga6b4b080e4-goog