From patchwork Mon Aug 5 23:38:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 13754251 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 70122C3DA7F for ; Mon, 5 Aug 2024 23:41:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=lMoK0Qo5SMl4nszA83I1OdSyVHO6YrX7RhAtuco02KE=; b=09e9yAK0RQBOBmOz46xi7rf/u8 F45yUeqn03S3agSP9YHeG/oIxHb1DIHvhqLJm4H/d9a5NCARwAVT/6NzmPIJ7Oh02vNL+641C2GX8 i9cmvt6dyZxiKrm0oG6T+QiPJezGE4yGn6S/WYx8XcHKL8GK3YLFSFLv/UCUPbk/QBkxMp0nHYst4 hSmzsXl9/cmh8lGGo+PL0hgj11/vbIC/CZheqv8j3C5UuULtwma3HDHsO9YnzoDYdpPAAXcl9KsPN 4bPgtqFoBDS2PiJ8a28MN+IbCpkvG9qZTc/RSs5whIOMW+9F4z3Zq5/HwbooN3XyoeaGGg+OspF8j ogWrMxtQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sb7KL-000000000D2-1mST; Mon, 05 Aug 2024 23:41:21 +0000 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sb7IL-0000000Hafw-2RrL for linux-arm-kernel@lists.infradead.org; Mon, 05 Aug 2024 23:39:19 +0000 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1fc52394c92so2096875ad.1 for ; Mon, 05 Aug 2024 16:39:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1722901157; x=1723505957; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=lMoK0Qo5SMl4nszA83I1OdSyVHO6YrX7RhAtuco02KE=; b=Yff/LdR3W4bK2oSjkcZ5pOMmVZMKeYSYhAfCuBLYeGfRZ2BQmBa8PBTXYX/8bEq47e 6X6m0TQiYkJ+B7DZZtFAjkZrsJVwo//GglUkirnVeYlGwejB5J7RqxklkzcFOUVCORhw dvBGJrzKBLnboDf9AP0rmUuSMZMFz7VHaPKpOS/50TT2tEffan/cGgaOaj+BFQ8i4ILY xhGDnRleYcB4tOsdhFE5wjkiFp1nTW8XDYGy8yDonYtOVGJRNjkaotjcDpak6+BFghEF lLKLYuAErC+rKTL+54Y/sw2A0aTk1E8u02C8DaAiny/ilkiq4LkSJFOzJW3+fGBtML4W 8UfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722901157; x=1723505957; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lMoK0Qo5SMl4nszA83I1OdSyVHO6YrX7RhAtuco02KE=; b=jPujVUgzs1MflrXqVAaNYi93w0FUiEZonnWyQH6tnn2UfmLEshCAiVu+urO4artNOC PTFuGcQwWClOae8XagTiKod5tbK7hqfml31EZLWFwcMJqCcoe8IGXSk4Gr0XauwoshO/ fZwMNquY9+rKMNjEYY5eVaIwabDjzAFlAVE0ia9AaVkxqneyrAgssWI6/PfUC6uEtspO 1p8FCIf9BznPJriI3svrhs7rugNr6JYs5CmoTu4DPDTeSuV2GaGqz0AdYCPU6t4URVOL 2nOBB6rl/TDT+sGNTvpwaNvtlAMidNbNwbQcCMA90zVpg42U8cHv9h97YCb43d29jIjO MBiQ== X-Forwarded-Encrypted: i=1; AJvYcCX9HplsMUytZXrKxxPxgc7/WL9BfMLct1hGpGuvYTu1EKVqCHyLwtgQG/EFNtQNZnWm1eHVmnGLKQ+JDW45PPyuz4I2MTFcu0OKcQioEm6p/3XVU9g= X-Gm-Message-State: AOJu0Yx3dcHPFUaOVy0cWOeE+sYrCa+rKS9IvniIDLoHSHkl/dZCILhJ kODdQ4xXX/16ikPytjifR6MltHg8DaTOmGiyOpJZCfeSKmjce1etGaKigmfRLUI= X-Google-Smtp-Source: AGHT+IGU2ua9T3+pEZaILj3eRYOvNhkdYAh1SxJhl0qoN7WB7rqpH1SxarYAFcOGXTS/PVZZH6t9lA== X-Received: by 2002:a17:902:e743:b0:1ff:5150:911d with SMTP id d9443c01a7336-1ff574a2318mr180660445ad.60.1722901156706; Mon, 05 Aug 2024 16:39:16 -0700 (PDT) Received: from localhost ([71.212.170.185]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff5927efe8sm73931945ad.224.2024.08.05.16.39.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Aug 2024 16:39:16 -0700 (PDT) From: Kevin Hilman Date: Mon, 05 Aug 2024 16:38:41 -0700 Subject: [PATCH 3/3] pmdomain: ti_sci: handle wake IRQs for IO daisy chain wakeups MIME-Version: 1.0 Message-Id: <20240805-lpm-v6-10-constraints-pmdomain-v1-3-d186b68ded4c@baylibre.com> References: <20240805-lpm-v6-10-constraints-pmdomain-v1-0-d186b68ded4c@baylibre.com> In-Reply-To: <20240805-lpm-v6-10-constraints-pmdomain-v1-0-d186b68ded4c@baylibre.com> To: Ulf Hansson Cc: Nishanth Menon , Vibhore Vardhan , Dhruva Gole , Akashdeep Kaur , Sebin Francis , Markus Schneider-Pargmann , linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, 20240801195422.2296347-1-msp@baylibre.com X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1549; i=khilman@baylibre.com; h=from:subject:message-id; bh=aUhXQyVPFrL0JWTJ8beXrItrMemL62+rc4k2qIkw/uA=; b=owEBbQKS/ZANAwAKAVk3GJrT+8ZlAcsmYgBmsWKg+0bREECCIN99S3Y6KtlAALU9lAthCgDzf Bf4iUGVt6aJAjMEAAEKAB0WIQR7h0YOFpJ/qfW/8QxZNxia0/vGZQUCZrFioAAKCRBZNxia0/vG Zcf1EACSk4ZidtH82/O+s8oj6aWPnpde20zrx47lXaBfxZfk0Bg80Aac1G+fXTSB1wBWdiVYqXZ f8R4hmikfvYDiac9B30IHEdPIUbIPqdRn7ouG+s/sqMxGOBoH2PQJJ1J3Jtc9KtbTRCncF34XX6 LTuThT7ogDmORnkIaXRVyagjAZ1IJTc0EnMnR1p18UmEyvRU4Tnx19xTKSBf89qtRJ6XIyT3RCB xkv+zSXstVjWJ9BhWjjesoRPAsBWo/nAUe45SCa9QYIYP8HBsJqquVQgO6gkAPZoCGmJ8qp0tYl NWiBge+F5xzaRtPytFj56HpbbCL0WhVPmxlacDy13Iu1G7RR3OWn7MvcIOezcRzAdu8z42NYsHe 9uqVT9dysnzMrnBrigY6PFsrbVG003BAC6bpvVwtujdtftYYnYVdyrsr0tSetCUDLjvBbYhLiMp leryBok4AlVHNLdzo+7B1L4JyAy2/2cjlDPSSJi9NQ9XLkPRXJiH3WV9EBEG+Sfzaf3LJi3VqpC CAPBKtyhB+JRgFpkUtLeSVMthYqDXQWJvUPVOeq6XJFA8xZoo2l/yLxXZ9K9+NVQMopkdd2q08b iIkDPIN+/rSFqJnfNQCy5tLkaHjHQbHkkVNWUXGLM/SeV237JdTeCmuGy/WtkFE4+uiXPQWBK3U 95qwGdvjz76jp1A== X-Developer-Key: i=khilman@baylibre.com; a=openpgp; fpr=7B87460E16927FA9F5BFF10C5937189AD3FBC665 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240805_163917_847775_1E186AFB X-CRM114-Status: GOOD ( 13.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When a device supports IO daisy-chain wakeups, it uses a dedicated wake IRQ. Devices with IO daisy-chain wakeups enabled should not set wakeup constraints since these can happen even from deep power states, so should not prevent the DM from picking deep power states. Wake IRQs are set with dev_pm_set_wake_irq() or dev_pm_set_dedicated_wake_irq(). The latter is used by the serial driver used on K3 platforms (drivers/tty/serial/8250/8250_omap.c) when the interrupts-extended property is used to describe the dedicated wakeup interrupt. Detect these wake IRQs in the suspend path, and if set, skip sending constraint. Signed-off-by: Kevin Hilman --- drivers/pmdomain/ti/ti_sci_pm_domains.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/pmdomain/ti/ti_sci_pm_domains.c b/drivers/pmdomain/ti/ti_sci_pm_domains.c index 7cd6ae957289..4c85ce50510f 100644 --- a/drivers/pmdomain/ti/ti_sci_pm_domains.c +++ b/drivers/pmdomain/ti/ti_sci_pm_domains.c @@ -99,6 +99,15 @@ static inline bool ti_sci_pd_check_wkup_constraint(struct device *dev) int ret; if (device_may_wakeup(dev)) { + /* + * If device can wakeup using IO daisy chain wakeups, + * we do not want to set a constraint. + */ + if (dev->power.wakeirq) { + dev_dbg(dev, "%s: has wake IRQ, not setting constraints\n", __func__); + return false; + } + ret = ti_sci->ops.pm_ops.set_device_constraint(ti_sci, pd->idx, TISCI_MSG_CONSTRAINT_SET); if (!ret) {