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.

Assisted-by: LLM
Signed-off-by: Linus Walleij <[email protected]>
---
 drivers/misc/sram.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c
index c8990e83a65a..7f19dca7b818 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>
@@ -425,6 +426,10 @@ static int sram_probe(struct platform_device *pdev)
                        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);

-- 
2.55.0

Reply via email to