From patchwork Fri Sep 6 16:14:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 13794444 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 82FB4E6FE2F for ; Fri, 6 Sep 2024 16:25:15 +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=wHpYPG0F7ARkJaF7S/WPtuawc45vlNVeHmm3gtL++pA=; b=itJ/y+Pk3o+TkLRLVQtwAyBJd6 /ApkhQmlkNIk2t2y51w2XktaX78zCJ+406Cvb6gMgt/CITLtSNWg/WMcs57KJTTJCPy/o+jyh2Kzf RyY/jwK2NVER6JG8dmz6KBUB84X0nIv5cjYjxjapfGhiM/tiYLKRkjh4ZokMxD+qo838g3t/lt//L JkD9M4PLiTPvwsYZ7BGsZQtNjY6DKWlr6iUHTpdpq6GAZyTvmILWlmmNtwIFGWFgLm7ikd8+B0ueW Xb7e5EQdgiw/eILv9uoZHbjcsltu33TuMIBqJF5YCGxAp54+TP3hbV5PjpjkQBzz+VIM200wwhcjl BfM/bqjQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smblg-0000000CxRK-1eLZ; Fri, 06 Sep 2024 16:25:04 +0000 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smbc9-0000000Cv0e-0YGB for linux-arm-kernel@lists.infradead.org; Fri, 06 Sep 2024 16:15:14 +0000 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-201d5af11a4so21133835ad.3 for ; Fri, 06 Sep 2024 09:15:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725639312; x=1726244112; 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=wHpYPG0F7ARkJaF7S/WPtuawc45vlNVeHmm3gtL++pA=; b=WiVYdcdcZPU/1ruNL6lxumhFyYVxv41ntco/1tk8kZuQm1v0Sun9+Sj9A0YohA6eLR F06Z8conRpWIdT35SclmiaoFwNNfMjuOUxRHC6+Gr95P1YIrlo1Mmwxp+CtfM+fggfxa EVC5pRdo2Swi7CdgQW9l/DYKhXlA9JMtyn8emYvBDtdxmrhnbLsKrMdUB36vKkj8p7Pq UuVPOtxfhSwLlNaD/S9AbPTACWkWyDisb2rP30RRX9oYw6qTCX7jS4rtG+GgF1kVl/5h lpeBboJElBo+mVPAZXW7hybmSBcHuHOqNY5+ftjScCEajU4hW9m7x2iwW8Bi5rc0nZ3E kjxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725639312; x=1726244112; 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=wHpYPG0F7ARkJaF7S/WPtuawc45vlNVeHmm3gtL++pA=; b=wtgCcXrxh/n9lxJv++KGduB8RQ8AjSEtyvzMnkWnzT4J5Aok3xnkjwPLPHapNHpeFz fdeUA0G5f4LqG00ZIPHtXIYwtjV8jUqxDHbLVlcID4vl51NTRaOCpG7Ormqsy9Cryd8N g5S4TgYSzIxwFZQAdiHZCCOBSCzmCqEBhwWFUgGqqjZghoNxgRSAmQQtAkL8wBGqY1NO yrcJ3QqaZfN7r7S0zlxtFtej93H8ldYILRggqtGwJ5d5USeZe8Lo3wDNOn49xyBPNJG6 iGpt4SlIjj8WqMNzztCgix6HfMGUzbt4rzZxz+azk+EUC1DWmyyrL03jjtgiTjzwjRcS B9Iw== X-Forwarded-Encrypted: i=1; AJvYcCUn2qfYHI/5Ro59VmSak/y3rs0Ve/IOM9YIJ1JINU3ac+xzB6a6z4MSslYpcdgukegZKipAlqKxMQ+9Vrlc2o9g@lists.infradead.org X-Gm-Message-State: AOJu0YwBf2K+V4dztOz3uErCLaNhGnAt348YW1nc4nF4xhaasfX6jB/N ihTegrynLdQrEwJLd7QLQRe102myiF1Ule87qwhufv2eQTOJU9f5j47peH/7x66PG02KZlNtKca o X-Google-Smtp-Source: AGHT+IESwuJ5dl0Z6KD7hUnigeZrm7cUkuRf9V0jjKkRN2+AzCtxauGn4MqXh2z3XQDnxgcU4F8gcw== X-Received: by 2002:a17:902:f709:b0:206:cc5b:ad0c with SMTP id d9443c01a7336-206f053479amr36155775ad.28.1725639311833; Fri, 06 Sep 2024 09:15:11 -0700 (PDT) Received: from localhost ([71.212.170.185]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-206aea54e7bsm44826065ad.183.2024.09.06.09.15.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 09:15:11 -0700 (PDT) From: Kevin Hilman Date: Fri, 06 Sep 2024 09:14:51 -0700 Subject: [PATCH v4 3/3] pmdomain: ti_sci: handle wake IRQs for IO daisy chain wakeups MIME-Version: 1.0 Message-Id: <20240906-lpm-v6-10-constraints-pmdomain-v4-3-4055557fafbc@baylibre.com> References: <20240906-lpm-v6-10-constraints-pmdomain-v4-0-4055557fafbc@baylibre.com> In-Reply-To: <20240906-lpm-v6-10-constraints-pmdomain-v4-0-4055557fafbc@baylibre.com> To: Ulf Hansson , linux-pm@vger.kernel.org Cc: Nishanth Menon , Vibhore Vardhan , Dhruva Gole , Akashdeep Kaur , Sebin Francis , Markus Schneider-Pargmann , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Kevin Hilman X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1579; i=khilman@baylibre.com; h=from:subject:message-id; bh=9FdOyIfVNqdxWITOueSVvAjoQfrL1FwTK+07Gro9K44=; b=owEBbQKS/ZANAwAKAVk3GJrT+8ZlAcsmYgBm2yqL/PIURu2uNA/h3Fwo/1sgpktG8Pixx/6mQ DAnA057AgGJAjMEAAEKAB0WIQR7h0YOFpJ/qfW/8QxZNxia0/vGZQUCZtsqiwAKCRBZNxia0/vG ZWE8D/wIk6Ofc+XVqFuDQ0NyitdIu9sTbMxYy2i+0cqK1UaRlvQ3Jk0fNkebAHDh03LT0y2OKbu UpUdE6GUxbfPx32hl4Xlq4OmowhHI8SVOzW5VoCrqPhf6H1gCgL2cBp9sMlXfAMX9/1MMOKxX9W K1eQNh8BlZp/xjhU+jKY2GEw0h7uhb/dCC9Sr/YjHng/LIwFK50wJghGLf5ce/krvwSjBEjJ2xB hRKhbmzV8Wm6Kb276Afm31RPPuW59JI2BwtGPR7GxBhFIXg5wPKlXaqawt1mol76ErBE7EH5YsE oa6EwAgpI+RAgSjUPSjYT8r/PQryjwEYeRe98O1hot4r5kuIoLpKUhm9aYRW/djKuXR5KzAWtif /FZWROQDFCvyYyR9liyjiex88DIOdeL9ywLDvwNUtTYrxjmk9Kxq0LDgCl9Apvww0xJnifCzT1U f8xOpc4YTgKdor1/d+pK8czdxq8JBKRgqAuyqHjWfZkCkbnNK2cN7hn4/du6O/90aqzpLR6a+58 FUaASt50dqSLB5p5qZbQg7z3TD0fQHTVQlp8zgjJbN4mjF4jzmjjWHqwcrLNehFv751mOS0bgxb zBdBE5nMU0CKYhAir9AZewEg7SCS+tJ806Rkg1TYKzIjjNSZ5v0vjRgKUhSKpSGsnc9fwbWV4pS 2XF7jXvOcur+sVw== 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-20240906_091513_358895_CEBD1F09 X-CRM114-Status: GOOD ( 13.69 ) 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. Tested-by: Dhruva Gole Signed-off-by: Kevin Hilman Reviewed-by: Ulf Hansson Reviewed-by: Markus Schneider-Pargmann --- 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 1ab1e46924ab..566af9f055b8 100644 --- a/drivers/pmdomain/ti/ti_sci_pm_domains.c +++ b/drivers/pmdomain/ti/ti_sci_pm_domains.c @@ -82,6 +82,15 @@ static inline void ti_sci_pd_set_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; + } + ret = ti_sci->ops.pm_ops.set_device_constraint(ti_sci, pd->idx, TISCI_MSG_CONSTRAINT_SET); if (!ret)