From patchwork Tue Aug 20 00:00:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 13769198 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 4784BC3DA4A for ; Tue, 20 Aug 2024 00:03:27 +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=hrn9kJswz7J5k2KMeEwoyClXwEGKchhZrenYjTvg6wc=; b=lsiJnTRDyJ7nUbyOcIxqmsY1j2 7zfKSIQhFZ82kilut0yoGMjN+afwRBlLi5kUIGs8eiqEzR+DofLkqv39oUu39oZETaTvHBNH8VoTg RQFjWN234f2IorAQbAdraC6gVsWbp+Q7Pc+vUQxhdI0w47/szBSVjWEfErcZ3jqVzkDHHmuC99N+z PBau9ZHVHsm+uqUPH+scDDvxRP6e5WnQBqREz2F4hiCKwMJF5lVwQpdnRgEzRfVoxiHQy5SvzuhwG NrSA4CYSkjBUFb2OwwvyyB4hEgMUzDPZclkaIMgDAJpgQZDaIklAvx5h98swwTFljrElbufU0WLQf 8JyXWo6g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgCLC-00000003Hsa-02gC; Tue, 20 Aug 2024 00:03:14 +0000 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgCIZ-00000003HEu-1jgb for linux-arm-kernel@lists.infradead.org; Tue, 20 Aug 2024 00:00:33 +0000 Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-2d3d7a1e45fso2781473a91.3 for ; Mon, 19 Aug 2024 17:00:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1724112031; x=1724716831; 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=hrn9kJswz7J5k2KMeEwoyClXwEGKchhZrenYjTvg6wc=; b=jBkpvQ3Dr8ibheJiTMBgpA+QXLTRfoZyUbP4Xf3d87iSf72tsuMfUB7hR0rsjlRNIX DTcotOeJtpit4z0QgQmwGS7pgsZcELZ8KptdJWHWQfWhPPLbQcTRFVMVfUcpdrgI3cHt xxcTw1d4v8j5Fi9f0z5HmR/WuPey3NBZzwXxMsI/xbGGhVKJc44r9A3VOjP5dWBxLoVe 14e1BdoawGG6SCEX2PI12d2kBhk/MCnzv6T8UwrZ403NTRCJ3YUBoti/U/aPp65aNawd 0vcdDhUM6kIuSAYLqLpPK2jF80RTlh1VWqV+Aj7k6Yzlben8l0OjpbFVzOD9vkknQyil 2Y2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724112031; x=1724716831; 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=hrn9kJswz7J5k2KMeEwoyClXwEGKchhZrenYjTvg6wc=; b=cz6isG3+WNi7TDJZmiBp0Cfncn9Gil4DPl+jEwg5ASJdcjtG1JiRMNT+WMPVM9wkaS Akpv2nV+XRN7FRH/69WSXIVjnQGblZVljlg01hVaOaopaFGgGSzM/29mPF2+14kN/Lxe wa8wR1X915HdDQgvm2p/DxkPHewygsDhCN0be1aNiWREg/TnlJIPV+9zuawJKWe1O4Ju 0K4YGaVgsu7SBHMH5owk5IAdf5Ov0XWQQrmOLOMZQezASNN5Ej8pfs+VSNjpY3H2yale KIWrFN0Y7AMBOCSmvFOwl8uEpDHeG7Da/6DJNN9ajBHoyLi8qmekf6Uzvwu7vgd0bOOu Rnuw== X-Forwarded-Encrypted: i=1; AJvYcCWrq7tE5LKyiMjHmb/eGPfmyNVKNUd5Gu2dX3d70ZdacdZ+NiS5Gxb4DthIfpB6CJ1n9KKSuGBe5UomnbaxmexLyMqbCRBQFK+nP5JfWrioO6jpooY= X-Gm-Message-State: AOJu0YzYLVrLgJs0z0i8YGbDw3C6fYgh/HQgyRtBxp3YwOFnXFHe6llM G/Vl7+T2OfBOYicu4AUTEVywxcoCJaMRqnP4qFn/1cu3Hj010tPRz6K6TpLSp0k= X-Google-Smtp-Source: AGHT+IF1NfWUZbWpyfpHlbAfLpF5uRsQsGKCgn3DKqKJAf6OPFuUxpR9lOOfUl3xYac/G25kixBBow== X-Received: by 2002:a17:90a:9ec:b0:2c9:6514:39ff with SMTP id 98e67ed59e1d1-2d3e076c66amr10858991a91.33.1724112029182; Mon, 19 Aug 2024 17:00:29 -0700 (PDT) Received: from localhost ([71.212.170.185]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2d3e3c7502csm7857404a91.40.2024.08.19.17.00.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2024 17:00:28 -0700 (PDT) From: Kevin Hilman Date: Mon, 19 Aug 2024 17:00:12 -0700 Subject: [PATCH v2 2/3] pmdomain: ti_sci: add wakeup constraint management MIME-Version: 1.0 Message-Id: <20240819-lpm-v6-10-constraints-pmdomain-v2-2-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=1735; i=khilman@baylibre.com; h=from:subject:message-id; bh=tUlhhvUzqEYQ9xxjHzkEQgHRjJRMt3U1MS2Dj9MMzKs=; b=owEBbQKS/ZANAwAKAVk3GJrT+8ZlAcsmYgBmw9yaw4z8Tn2b14jGRvuZX85gZ7ivnQCQWDNjy eJOyqKt2oqJAjMEAAEKAB0WIQR7h0YOFpJ/qfW/8QxZNxia0/vGZQUCZsPcmgAKCRBZNxia0/vG Zaa9D/0T7h6tsTpPWJ/ttDQEwpzwuZgC0zUMUYapMHQMP+3gx1wS03bIEiCPiWYukJKn6Zu5G4j TwPRwPah8RJeC7muQk3sJNH2SCaI8pJb+QsYuVyTWKJ7x0Rl1XhZFpJzDze//8o0oAoPF1jGTrB O+8PMibGcfTv8rmiljFBwTyx52J8JGXdYXVPV9gw6G66TIpiiQW/dnGXqXEwhtAMH+3cAaKeusD 87bQ7zYcLtu++AgSIFmdU8G+UNxc8BoDcnEpnk1ToBVXCgZoXaWwztIW8Mow8Yl8EwAIi8TdZm7 CSXZhfkQbwYNBJWOQ6nE3rDaQNyaTRbfT0D+6sXeFaunQNqUrIN9M8rznM/aCzEUd+7lcHBM1eJ pRbEuKLjhHj+g+qzfHlPJ31F1RQ7eh5U9/Fu+C1pGcfzz4nawTx4/ViuPNP1KTN6ZbYPanIcrLF 3/F8/V6ZWZPH5DcciGWnTtR6N1R2R1+o68EXROklT1sq/pq+DN8l4z6vzMN+a5I8YoyzmiRRIBy w38cEq8seTPnFvlMx8e4PuqKRgHjhIcqxHXg3t+qwXjAJpmkVPFy+J/YO4m6sS9LCeLABn5gG/i luhEZyvX98OTmDRoK69HGHI7QDZR0fZszgX93Hhy/ILwfxO8ztS6xP6Cq/aTZcp2nHrnPe9HNFM gepXr4pmMzQgkZg== 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_555195_581C0247 X-CRM114-Status: GOOD ( 13.80 ) 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 During system-wide suspend, check all devices connected to PM domain to see if they are wakeup-enabled. If so, set a TI SCI device constraint. Note: DM firmware clears all constraints on resume. Co-developed-by: Vibhore Vardhan Signed-off-by: Vibhore Vardhan Signed-off-by: Kevin Hilman Signed-off-by: Dhruva Gole --- drivers/pmdomain/ti/ti_sci_pm_domains.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/pmdomain/ti/ti_sci_pm_domains.c b/drivers/pmdomain/ti/ti_sci_pm_domains.c index 963272fa387b..8af907579152 100644 --- a/drivers/pmdomain/ti/ti_sci_pm_domains.c +++ b/drivers/pmdomain/ti/ti_sci_pm_domains.c @@ -76,6 +76,23 @@ static int ti_sci_pd_set_lat_constraint(struct device *dev, s32 val) return ret; } +static inline bool ti_sci_pd_set_wkup_constraint(struct device *dev) +{ + struct generic_pm_domain *genpd = pd_to_genpd(dev->pm_domain); + struct ti_sci_pm_domain *pd = genpd_to_ti_sci_pd(genpd); + const struct ti_sci_handle *ti_sci = pd->parent->ti_sci; + int ret; + + if (device_may_wakeup(dev)) { + ret = ti_sci->ops.pm_ops.set_device_constraint(ti_sci, pd->idx, + TISCI_MSG_CONSTRAINT_SET); + if (!ret) + dev_dbg(dev, "ti_sci_pd: ID:%d set device constraint.\n", pd->idx); + } + + return true; +} + /* * ti_sci_pd_power_off(): genpd power down hook * @domain: pointer to the powerdomain to power off @@ -117,6 +134,8 @@ static int ti_sci_pd_suspend(struct device *dev) if (ti_sci_pd_is_valid_constraint(val)) ti_sci_pd_set_lat_constraint(dev, val); + ti_sci_pd_set_wkup_constraint(dev); + return 0; }