Re: [PATCH 1/4] media: qcom: camss: Add PM clock support and integrate with runtime PM
From: Bryan O'Donoghue
Date: Mon Jul 20 2026 - 06:22:57 EST
On 17/07/2026 15:20, Loic Poulain wrote:
Add optional PM clock support to the CAMSS driver using the PM clock
framework. This allows CAMSS clocks to be registered once and
automatically managed during runtime suspend and resume.
This is especially useful for global CAMSS clocks that are shared across
multiple CAMSS subblocks.
This avoids the need for each subblock to reference and manage the
shared clocks individually. A typical example is the set of clocks in
the top_group, which may be used by CSID, PHY, CCI, and other CAMSS
blocks.
Introduce a small PM clock descriptor table in the CAMSS resources
structure to describe clocks and their optional rates. Initialize
these clocks at probe time and delegate clock ownership to the PM
core.
Hook PM clock handling into the runtime PM callbacks to ensure clocks
are properly suspended and resumed alongside power domains and ICC
paths.
Signed-off-by: Loic Poulain <loic.poulain@xxxxxxxxxxxxxxxx>
---
drivers/media/platform/qcom/camss/camss.c | 40 ++++++++++++++++++++++++++++++-
drivers/media/platform/qcom/camss/camss.h | 1 +
2 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
index 2123f6388e3d7eafe669efd6b033e22d8eb5cf79..6a2bf3373e8755805c8cd0f8fe5037b788d68fa2 100644
--- a/drivers/media/platform/qcom/camss/camss.c
+++ b/drivers/media/platform/qcom/camss/camss.c
@@ -18,6 +18,7 @@
#include <linux/of_graph.h>
#include <linux/pm_runtime.h>
#include <linux/pm_domain.h>
+#include <linux/pm_clock.h>
#include <linux/slab.h>
#include <linux/videodev2.h>
@@ -5346,6 +5347,35 @@ static void camss_genpd_cleanup(struct camss *camss)
dev_pm_domain_detach(camss->genpd, true);
}
+/*
+ * camss_init_pm_clks - register shared CAMSS clocks with the PM clock framework
+ *
+ * Clocks listed in res->pm_clks are shared across all CAMSS sub-devices (e.g.
+ * top_ahb, axi). They are managed automatically by the PM framework.
+ */
+static int camss_init_pm_clks(struct camss *camss)
+{
+ struct device *dev = camss->dev;
+ unsigned int i;
+ int ret;
+
+ if (!camss->res->pm_clks[0])
+ return 0;
+
+ ret = devm_pm_clk_create(dev);
+ if (ret)
+ return ret;
+
+ for (i = 0; i < CAMSS_RES_MAX && camss->res->pm_clks[i]; i++) {
+ ret = pm_clk_add(dev, camss->res->pm_clks[i]);
+ if (ret)
+ dev_warn(dev, "failed to add pm_clk %s: %d\n",
+ camss->res->pm_clks[i], ret);
return ret;
---
bod