mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mikko Perttunen <mperttunen@nvidia.com>
To: Thierry Reding <thierry.reding@kernel.org>,
	 Jonathan Hunter <jonathanh@nvidia.com>,
	Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	Aaron Kling <webgeek1234@gmail.com>
Cc: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org,
	 devicetree@vger.kernel.org,
	Mikko Perttunen <mperttunen@nvidia.com>,
	 stable@vger.kernel.org
Subject: [PATCH 1/2] soc/tegra: pmc: Support nested PMC power domains
Date: Thu, 15 Oct 2026 18:58:02 +0900	[thread overview]
Message-ID: <20261015-b4-t210-pd_nvdec-nesting-v1-1-39a36b622eac@nvidia.com> (raw)
In-Reply-To: <20261015-b4-t210-pd_nvdec-nesting-v1-0-39a36b622eac@nvidia.com>

The PMC power domain provider implementation currently supports having
parent domains for its domains, but only if the parent domain is
registered before any of the PMC power partitions. In practice, this is
the core power domain.

On Tegra210, the TRM documents that part of the NVDEC hardware unit is
in the NVJPG power domain, and that the NVJPG power domain must be kept
powered while the NVDEC domain is powered on. Hence, we should model the
NVDEC power domain as a subdomain of NVJPG.

To enable this, support one level of self-referential subdomains in the
driver, by registering all power domains first before adding subdomain
links, and correspondingly removing all subdomain links before removing
power domains. Without this, a non-topological ordering of power domains
in the device tree would cause a probe deferral that would never be
resolved.

Cc: stable@vger.kernel.org # 6.19.x
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
---
 drivers/soc/tegra/pmc.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
index 2c70eedf514e..3d820c462829 100644
--- a/drivers/soc/tegra/pmc.c
+++ b/drivers/soc/tegra/pmc.c
@@ -1525,8 +1525,11 @@ static int tegra_powergate_init(struct tegra_pmc *pmc,
 	for_each_child_of_node_scoped(np, child) {
 		err = tegra_powergate_add(pmc, child);
 		if (err < 0)
-			break;
+			goto put;
+	}
 
+	/* A parent powergate may come after its subdomains in DT order. */
+	for_each_child_of_node_scoped(np, child) {
 		if (of_parse_phandle_with_args(child, "power-domains",
 					       "#power-domain-cells",
 					       0, &parent_args))
@@ -1541,6 +1544,7 @@ static int tegra_powergate_init(struct tegra_pmc *pmc,
 			break;
 	}
 
+put:
 	of_node_put(np);
 
 	return err;
@@ -1564,6 +1568,7 @@ static void tegra_powergate_remove(struct generic_pm_domain *genpd)
 
 static void tegra_powergate_remove_all(struct device_node *parent)
 {
+	struct of_phandle_args child_args, parent_args;
 	struct generic_pm_domain *genpd;
 	struct device_node *np, *child;
 
@@ -1571,6 +1576,20 @@ static void tegra_powergate_remove_all(struct device_node *parent)
 	if (!np)
 		return;
 
+	/* A parent powergate cannot be removed while it has subdomains. */
+	for_each_child_of_node(np, child) {
+		if (of_parse_phandle_with_args(child, "power-domains",
+					       "#power-domain-cells",
+					       0, &parent_args))
+			continue;
+
+		child_args.np = child;
+		child_args.args_count = 0;
+
+		of_genpd_remove_subdomain(&parent_args, &child_args);
+		of_node_put(parent_args.np);
+	}
+
 	for_each_child_of_node(np, child) {
 		of_genpd_del_provider(child);
 

-- 
2.55.0


  reply	other threads:[~2026-10-15  9:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15  9:58 [PATCH 0/2] Fix NVDEC boot on Tegra210 Mikko Perttunen
2026-10-15  9:58 ` Mikko Perttunen [this message]
2026-10-15  9:58 ` [PATCH 2/2] arm64: tegra: Make the NVDEC power domain a subdomain of NVJPG " Mikko Perttunen
2026-10-27  6:54 ` [PATCH 0/2] Fix NVDEC boot " Karl Mehltretter
2026-11-17 12:50 ` Thierry Reding

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261015-b4-t210-pd_nvdec-nesting-v1-1-39a36b622eac@nvidia.com \
    --to=mperttunen@nvidia.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=thierry.reding@kernel.org \
    --cc=webgeek1234@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®