mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
To: Loic Poulain <loic.poulain@oss.qualcomm.com>,
	Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] media: qcom: camss: Add PM clock support and integrate with runtime PM
Date: Thu, 30 Jul 2026 09:38:58 +0100	[thread overview]
Message-ID: <a4a1dc46-ff07-4ecb-b41f-341b6aacb3ab@linaro.org> (raw)
In-Reply-To: <20260717-camss-version-v1-1-7ed71fea95e8@oss.qualcomm.com>

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@oss.qualcomm.com>
> ---
>   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 0;
> +}
> +
>   /*
>    * camss_probe - Probe CAMSS platform device
>    * @pdev: Pointer to CAMSS platform device
> @@ -5434,6 +5464,10 @@ static int camss_probe(struct platform_device *pdev)
>   
>   	pm_runtime_enable(dev);
>   
> +	ret = camss_init_pm_clks(camss);
> +	if (ret)
> +		goto err_v4l2_device_unregister;
> +
>   	ret = camss_parse_ports(camss);
>   	if (ret < 0)
>   		goto err_v4l2_device_unregister;
> @@ -5775,7 +5809,7 @@ static int __maybe_unused camss_runtime_suspend(struct device *dev)
>   			return ret;
>   	}
>   
> -	return 0;
> +	return pm_clk_suspend(dev);
   CC      drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_dbgfs.o
   CC      drivers/media/platform/mediatek/mdp3/mtk-mdp3-vpu.o
   AR      drivers/staging/media/ipu7/built-in.a
In file included from ./include/uapi/linux/posix_types.h:5,
                  from ./include/uapi/linux/types.h:14,
                  from ./include/linux/types.h:5,
                  from ./include/linux/kasan-checks.h:5,
                  from ./include/asm-generic/rwonce.h:26,
                  from ./arch/x86/include/generated/asm/rwonce.h:1,
                  from ./include/linux/compiler.h:369,
                  from ./include/linux/err.h:5,
                  from ./include/linux/clk.h:12,
                  from drivers/media/platform/qcom/camss/camss.c:10:
drivers/media/platform/qcom/camss/camss.c: In function 
‘camss_runtime_suspend’:
./include/linux/stddef.h:8:14: error: called object is not a function or 
function pointer
     8 | #define NULL ((void *)0)
       |              ^
./include/linux/pm_clock.h:77:25: note: in expansion of macro ‘NULL’
    77 | #define pm_clk_suspend  NULL
       |                         ^~~~
drivers/media/platform/qcom/camss/camss.c:5841:16: note: in expansion of 
macro ‘pm_clk_suspend’
  5841 |         return pm_clk_suspend(dev);
       |                ^~~~~~~~~~~~~~
drivers/media/platform/qcom/camss/camss.c: In function 
‘camss_runtime_resume’:
./include/linux/stddef.h:8:14: error: called object is not a function or 
function pointer
     8 | #define NULL ((void *)0)
       |              ^
./include/linux/pm_clock.h:78:25: note: in expansion of macro ‘NULL’
    78 | #define pm_clk_resume   NULL
       |                         ^~~~
drivers/media/platform/qcom/camss/camss.c:5851:15: note: in expansion of 
macro ‘pm_clk_resume’
  5851 |         ret = pm_clk_resume(dev);
       |               ^~~~~~~~~~~~~
make[7]: *** [scripts/Makefile.build:289: 
drivers/media/platform/qcom/camss/camss.o] Error 1
make[7]: *** Waiting for unfinished jobs....
   CC      drivers/media/usb/pwc/pwc-misc.o

Please fix.

---
bod

  parent reply	other threads:[~2026-07-30  8:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17 14:20 [PATCH 0/4] media: qcom: camss: Report CAMSS hardware version via media controller Loic Poulain
2026-07-17 14:20 ` [PATCH 1/4] media: qcom: camss: Add PM clock support and integrate with runtime PM Loic Poulain
2026-07-20 10:10   ` Bryan O'Donoghue
2026-07-30  8:38   ` Bryan O'Donoghue [this message]
2026-07-30  9:25     ` Loic Poulain
2026-07-17 14:20 ` [PATCH 2/4] media: qcom: camss: Add PM clock definitions for QCM2290 Loic Poulain
2026-07-20 10:11   ` Bryan O'Donoghue
2026-07-17 14:20 ` [PATCH 3/4] media: qcom: camss: Drop top_ahb/ahb/axi from QCM2290 subdevice clocks Loic Poulain
2026-07-17 14:20 ` [PATCH 4/4] media: qcom: camss: Report hardware version via media controller Loic Poulain
2026-07-20  9:12   ` Konrad Dybcio
2026-07-21  7:55     ` Loic Poulain
2026-07-21  8:11       ` Konrad Dybcio
2026-07-20 10:16   ` Bryan O'Donoghue

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=a4a1dc46-ff07-4ecb-b41f-341b6aacb3ab@linaro.org \
    --to=bryan.odonoghue@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=loic.poulain@oss.qualcomm.com \
    --cc=mchehab@kernel.org \
    --cc=vladimir.zapolskiy@linaro.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

all inboxes | Powered by JetHome®