From: Ashish Mhetre <amhetre@nvidia.com>
To: <krzk@kernel.org>, <thierry.reding@kernel.org>, <jonathanh@nvidia.com>
Cc: <ketanp@nvidia.com>, <linux-kernel@vger.kernel.org>,
<linux-tegra@vger.kernel.org>, Ashish Mhetre <amhetre@nvidia.com>
Subject: [PATCH] memory: tegra: Wire up system sleep PM ops
Date: Wed, 29 Apr 2026 06:11:22 +0000 [thread overview]
Message-ID: <20260429061122.807346-1-amhetre@nvidia.com> (raw)
The tegra-mc platform driver does not register any dev_pm_ops, so the
the SoC-specific ->resume() is never invoked (e.g. tegra186_mc_resume)
on system wake. On Tegra186 and later this means MC client Stream-ID
override registers are not reprogrammed.
Register a dev_pm_ops on the tegra-mc driver and route the system
resume callback into mc->soc->ops->resume() so the existing SID
restore path runs again on wake.
The MC interrupt mask registers also lose state across SC7, so
re-apply them on resume. Factor the existing intmask programming
out of tegra_mc_probe() into tegra_mc_setup_intmask() and reuse it
from both probe and resume to avoid duplicating the loop.
No suspend callback is needed as the resume path reprograms all MC
state from the static SoC tables, so there is nothing to save.
Signed-off-by: Ashish Mhetre <amhetre@nvidia.com>
---
drivers/memory/tegra/mc.c | 46 +++++++++++++++++++++++++++++++++------
1 file changed, 39 insertions(+), 7 deletions(-)
diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c
index d620660da331..cddcefdd16c5 100644
--- a/drivers/memory/tegra/mc.c
+++ b/drivers/memory/tegra/mc.c
@@ -13,6 +13,7 @@
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
+#include <linux/pm.h>
#include <linux/slab.h>
#include <linux/sort.h>
#include <linux/tegra-icc.h>
@@ -910,6 +911,19 @@ static void tegra_mc_num_channel_enabled(struct tegra_mc *mc)
}
}
+static void tegra_mc_setup_intmask(struct tegra_mc *mc)
+{
+ unsigned int i;
+
+ for (i = 0; i < mc->soc->num_intmasks; i++) {
+ if (mc->soc->num_channels)
+ mc_ch_writel(mc, MC_BROADCAST_CHANNEL, mc->soc->intmasks[i].mask,
+ mc->soc->intmasks[i].reg);
+ else
+ mc_writel(mc, mc->soc->intmasks[i].mask, mc->soc->intmasks[i].reg);
+ }
+}
+
static int tegra_mc_probe(struct platform_device *pdev)
{
struct tegra_mc *mc;
@@ -970,13 +984,7 @@ static int tegra_mc_probe(struct platform_device *pdev)
}
}
- for (i = 0; i < mc->soc->num_intmasks; i++) {
- if (mc->soc->num_channels)
- mc_ch_writel(mc, MC_BROADCAST_CHANNEL, mc->soc->intmasks[i].mask,
- mc->soc->intmasks[i].reg);
- else
- mc_writel(mc, mc->soc->intmasks[i].mask, mc->soc->intmasks[i].reg);
- }
+ tegra_mc_setup_intmask(mc);
}
if (mc->soc->reset_ops) {
@@ -1010,10 +1018,34 @@ static void tegra_mc_sync_state(struct device *dev)
icc_sync_state(dev);
}
+static int tegra_mc_resume(struct device *dev)
+{
+ struct tegra_mc *mc = dev_get_drvdata(dev);
+ int err;
+
+ if (mc->soc->ops && mc->soc->ops->resume) {
+ err = mc->soc->ops->resume(mc);
+ if (err)
+ return err;
+ }
+
+ tegra_mc_setup_intmask(mc);
+
+ return 0;
+}
+
+/*
+ * No suspend callback is needed because the resume path reinitializes all
+ * necessary MC register state (SID overrides, interrupt masks) from static
+ * SoC data tables rather than from saved runtime state.
+ */
+static DEFINE_SIMPLE_DEV_PM_OPS(tegra_mc_pm_ops, NULL, tegra_mc_resume);
+
static struct platform_driver tegra_mc_driver = {
.driver = {
.name = "tegra-mc",
.of_match_table = tegra_mc_of_match,
+ .pm = pm_sleep_ptr(&tegra_mc_pm_ops),
.suppress_bind_attrs = true,
.sync_state = tegra_mc_sync_state,
},
--
2.50.1
next reply other threads:[~2026-04-29 6:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-29 6:11 Ashish Mhetre [this message]
2026-04-29 9:53 ` [PATCH] memory: tegra: Wire up system sleep PM ops Jon Hunter
2026-04-30 5:33 ` Ashish Mhetre
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=20260429061122.807346-1-amhetre@nvidia.com \
--to=amhetre@nvidia.com \
--cc=jonathanh@nvidia.com \
--cc=ketanp@nvidia.com \
--cc=krzk@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=thierry.reding@kernel.org \
/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