From patchwork Tue Aug 20 00:00:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 13769197 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 29988C3DA4A for ; Tue, 20 Aug 2024 00:02:47 +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=hfJuZFlwIrV/yx/dP7X0WZTWclq0poFO0QEtz4ByiOo=; b=TcKUhop0ujC1L6pqnGp4998Dkm dCYHCzHWk2p7NnYQgQolNcN/kqG60u2xmZcR2YSkt30yIVxF1oWoDHOySlgKww22xZYPXWtALyHtY jbC4u9JJHegRG2+ZPwgdXSWbARnoXPwjbRq8Br0dNFYSjI9rGdOXssKq9RqxZzqu9U9Ex44WKZFGN P+YxflIBKvv5vKYyIRgi8nb/DLFnSK7RWYlm90N6i0Ulxkk5QELHbmjsvEfL8j8WUP4OSexp/+wrm aRnzSUY0a0/gVNFiHgDeCljYjP/grec6x8CBgK3mLWgGd7XYD0vSlPKF0eyVgzSwHWhVXSCZa8/a2 H4w7SWbw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgCKX-00000003Hgh-1UtM; Tue, 20 Aug 2024 00:02:33 +0000 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgCIZ-00000003HEY-0DUH for linux-arm-kernel@lists.infradead.org; Tue, 20 Aug 2024 00:00:33 +0000 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-713f3b4c9f7so1204859b3a.2 for ; Mon, 19 Aug 2024 17:00:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1724112030; x=1724716830; 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=hfJuZFlwIrV/yx/dP7X0WZTWclq0poFO0QEtz4ByiOo=; b=uxs/c5coQfRpE7gWkgiAQ4vHrmr5m/3K4l2vVAAbICl+cuRsiYWSnxstCagyFGYevC 14XfGxXF/lfjVChMozq0JdvCoM4oDMknTJXJRyVznHnEVx2rvEVnSt6l7pnrkyWLX6Dd GrWZ9BEmbEnGJLpBX9Kctwvt8b3cslh4Dxz7QP7uV0+1u4ai9N4Pf0YDjfdHjm28dJyS eieK8b3LqvFHVl/bS6gwPpW5tUbeBPNNWrsrBI7HNu8ODaVlAjbERQvVwjVEWTQkVTVP WRuK576FI6u3MVNLLQ5uymo+Ofj6oYKFw5oBGMEvHXUU320JkWcHp26Wjt+dgm+ejbVM M6Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724112030; x=1724716830; 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=hfJuZFlwIrV/yx/dP7X0WZTWclq0poFO0QEtz4ByiOo=; b=mUY8rrudwfciWDgRAe5hWyj5Si4eRyQxn+044x3zX1+xxcIYWSbN9Zyc18rj3bxgga O71svN5y8vVJWdRoyy85+iGw4OXh0j4orxPoczyWSa5dUGmrw9S21DjEg+ZYQ7J9LLE+ lYHslcuKl1UOJ1sX0q5HshTV37EqAhzHuZ02fb4WS+M7q2WLFFn6nWMBy5tKc4iM+ore nBmpvZgFh6ofQlOHx4ab6mo+J9srcynTrf7x6INC1K3RQTJd6BRKA+PjuBoJoFHh3JqB p2aTRdOb7d7W4Om3K+GnGcuDxzE1RRtE3teIdfxDzRqVxPHUV3+lLOwjZM/AybqKwx7m VMrQ== X-Forwarded-Encrypted: i=1; AJvYcCU2BWDJFthYrNGyqqXyiTksVLXWAj4jlncri6Xhnxqw/ksYTao2rwmV6DN15jzKTllXA+VLLSfy9kJw7NMbhDHZ@lists.infradead.org X-Gm-Message-State: AOJu0YxormB+uG/jiKak6vzRN2TKJimxYQ1YP6XsSExxuBBiV7jBnhVi cKJGKvD8U9nlriNkKuJpANMIKxY2VUicqRn+F9WypvKJqv33HnzuZyb+UKV5tLA= X-Google-Smtp-Source: AGHT+IEjigYtUu+PbI7wCwmy0Ii9OICfFb3avBHTHKA3P6Hw3f5ftxJbKPUF8yyUXK/WBPt5jDQEfg== X-Received: by 2002:a05:6a00:2e99:b0:713:e70e:f7db with SMTP id d2e1a72fcca58-713e70f02damr7068548b3a.18.1724112030040; Mon, 19 Aug 2024 17:00:30 -0700 (PDT) Received: from localhost ([71.212.170.185]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7127ae0739dsm7115321b3a.61.2024.08.19.17.00.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2024 17:00:29 -0700 (PDT) From: Kevin Hilman Date: Mon, 19 Aug 2024 17:00:13 -0700 Subject: [PATCH v2 3/3] pmdomain: ti_sci: handle wake IRQs for IO daisy chain wakeups MIME-Version: 1.0 Message-Id: <20240819-lpm-v6-10-constraints-pmdomain-v2-3-461325a6008f@baylibre.com> References: <20240819-lpm-v6-10-constraints-pmdomain-v2-0-461325a6008f@baylibre.com> In-Reply-To: <20240819-lpm-v6-10-constraints-pmdomain-v2-0-461325a6008f@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 X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1545; i=khilman@baylibre.com; h=from:subject:message-id; bh=L4fq2gAJAjxK1sLC9lcg4L6kyHQ2+G8MiyoeO5HwSb8=; b=owEBbQKS/ZANAwAKAVk3GJrT+8ZlAcsmYgBmw9yaIa+swVNTOJfnTzx2jNlfK8fU9hmVzvfkW YvGVUUN02WJAjMEAAEKAB0WIQR7h0YOFpJ/qfW/8QxZNxia0/vGZQUCZsPcmgAKCRBZNxia0/vG ZbHqD/9AOVXyi2FjVlLWmnOgTyw/r/8682U5ynfjVoIEs65YqH3/oEsnehsr/kj12+uZT+/Ryq9 UlKviY1R9vBFUihHTR4o0s93HKbqsdM1Pv+J6AA9j1u9nOKapr2aDoOn8CRMkeTZKUGXkHqF8cj GH/HFug511+/BRfu8QetRE9K99DRodxTYIrPuITvQFFGq4GYO4jPZunFD9hzHKAmuB3w1IzZA/I C/+BryWDW7B1Q4Ax1LJVun9jywG4CTFBNOn5/mkpDSNdx1vp4T/GePnLGwP/OiCn3lDHnKcBEAC 9DXHx5PMWMIqvmPO3TnKg2bzJlmLW2VkyaYYbaac9JzPuPJkriIRTfZ+4pHle+RpA8nucH6EExQ 7KdK5Wxtr6AhSmW0RtIW9bDQHSMfzI/+5C3grmCQ1iDBMI8kbMoew5zt4nioHXM3rBIuE5LDZkP KZ1sgXaTuGwb9L/WmPwCZWes/gkGd3Ra+022fQ8kfnpbXw9I9Xb3/R3dQufV5Wb3jvPpMTRgrCm gwu6H3ceeRU4PBigHyGFlnbdWZIHMp2Wi1dOa4/oKpR3fGftRnWVgu0rbmh/ypVFW9rHrrvYQge lnJ0iNs4wN3AczLWtwz/m2J5R8hDs60skpG7k62B/H0pYmR5njtmQTBOUU6OpJA6mANCsIeYBZP Z6LIyKQO3Ag3JOw== 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-20240819_170031_124769_2ACDEF97 X-CRM114-Status: GOOD ( 13.82 ) 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 8af907579152..f7c327cb059c 100644 --- a/drivers/pmdomain/ti/ti_sci_pm_domains.c +++ b/drivers/pmdomain/ti/ti_sci_pm_domains.c @@ -84,6 +84,15 @@ static inline bool 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 false; + } + ret = ti_sci->ops.pm_ops.set_device_constraint(ti_sci, pd->idx, TISCI_MSG_CONSTRAINT_SET); if (!ret)