* [PATCH] misc: sram: Enable runtime PM
@ 2026-11-15 23:02 Linus Walleij
2026-11-16 7:18 ` Arnd Bergmann
0 siblings, 1 reply; 2+ messages in thread
From: Linus Walleij @ 2026-11-15 23:02 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman
Cc: linux-kernel, Philipp Zabel, Ulf Hansson, Frank Li, linux-pm,
linux-arm-kernel, Linus Walleij
Enable runtime PM for generic SRAM devices after probe has initialized
the SRAM mappings and partitions.
This lets SRAM devices with attached power domains be managed through
runtime PM references from their consumers.
Keep sysfs-exported SRAM and SRAM requiring platform initialization
powered while the driver is bound. This preserves exported contents
and avoids unpowered sysfs accesses or an unsupported resume sequence.
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>
---
Enable runtime PM for SRAM suppliers so consumers can manage their power
domains through runtime PM device links. Keep sysfs-exported SRAM and
SRAM with platform initialization powered while the driver is bound.
The Ux500 genpd prerequisites have been merged into the powerdomain tree.
Arnd/Greg: you can either apply this directly (if it checks out) or ask
me to send it to the SoC tree.
---
drivers/misc/sram.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c
index c8990e83a65a..4d2477bb5cd9 100644
--- a/drivers/misc/sram.c
+++ b/drivers/misc/sram.c
@@ -13,6 +13,7 @@
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/mfd/syscon.h>
@@ -380,6 +381,8 @@ static int sram_probe(struct platform_device *pdev)
int ret;
struct resource *res;
struct clk *clk;
+ bool keep_active;
+ unsigned int i;
config = of_device_get_match_data(&pdev->dev);
@@ -425,6 +428,24 @@ static int sram_probe(struct platform_device *pdev)
goto err_free_partitions;
}
+ /*
+ * Sysfs users need retained contents; init-only platforms have no
+ * runtime resume support. Keep both powered while the driver is bound.
+ */
+ keep_active = config && config->init;
+ for (i = 0; i < sram->partitions; i++)
+ keep_active |= sram->partition[i].battr.size != 0;
+
+ if (keep_active) {
+ ret = devm_pm_runtime_get_noresume(sram->dev);
+ if (ret)
+ goto err_free_partitions;
+ }
+
+ ret = devm_pm_runtime_set_active_enabled(&pdev->dev);
+ if (ret)
+ goto err_free_partitions;
+
if (sram->pool)
dev_dbg(sram->dev, "SRAM pool: %zu KiB @ 0x%p\n",
gen_pool_size(sram->pool) / 1024, sram->virt_base);
---
base-commit: 9ae477db090b44816741fd9c49a3c459fc7d407b
change-id: 20261115-ux500-sram-runtime-pm-2e1578439a63
Best regards,
--
Linus Walleij <linusw@kernel.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] misc: sram: Enable runtime PM
2026-11-15 23:02 [PATCH] misc: sram: Enable runtime PM Linus Walleij
@ 2026-11-16 7:18 ` Arnd Bergmann
0 siblings, 0 replies; 2+ messages in thread
From: Arnd Bergmann @ 2026-11-16 7:18 UTC (permalink / raw)
To: Linus Walleij, Greg Kroah-Hartman
Cc: linux-kernel, Philipp Zabel, Ulf Hansson, Frank Li, linux-pm,
linux-arm-kernel
On Mon, Nov 16, 2026, at 00:02, Linus Walleij wrote:
> Enable runtime PM for generic SRAM devices after probe has initialized
> the SRAM mappings and partitions.
>
> This lets SRAM devices with attached power domains be managed through
> runtime PM references from their consumers.
>
> Keep sysfs-exported SRAM and SRAM requiring platform initialization
> powered while the driver is bound. This preserves exported contents
> and avoids unpowered sysfs accesses or an unsupported resume sequence.
>
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Signed-off-by: Linus Walleij <linusw@kernel.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-16 7:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-15 23:02 [PATCH] misc: sram: Enable runtime PM Linus Walleij
2026-11-16 7:18 ` Arnd Bergmann
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®