From: Nicolas Dufresne <nicolas@ndufresne.ca>
To: "Sven Püschel" <s.pueschel@pengutronix.de>,
"Jacob Chen" <jacob-chen@iotwrt.com>,
"Ezequiel Garcia" <ezequiel@vanguardiasur.com.ar>,
"Mauro Carvalho Chehab" <mchehab@kernel.org>,
"Heiko Stuebner" <heiko@sntech.de>,
"Philipp Zabel" <p.zabel@pengutronix.de>
Cc: linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, kernel@pengutronix.de,
Detlev Casanova <detlev.casanova@collabora.com>,
Michael Tretter <m.tretter@pengutronix.de>,
Guangshuo Li <lgs201920130244@gmail.com>
Subject: Re: [PATCH v2 08/17] media: rockchip: rga: move power handling to device_run
Date: Tue, 24 Nov 2026 16:14:48 -0500 [thread overview]
Message-ID: <728acfd6e085408e7998bc9e7dfbb2d110cd53ed.camel@ndufresne.ca> (raw)
In-Reply-To: <20260916-spu-rga3multicore-v2-8-23aa2cb74e61@pengutronix.de>
[-- Attachment #1: Type: text/plain, Size: 3709 bytes --]
Le mercredi 16 septembre 2026 à 17:09 +0200, Sven Püschel a écrit :
> Move the power handling to the device_run function in preparation for
> enabling multiple cores. This allows to power the only the necessary cores
> instead of powering all available cores.
>
> As the decision on which core the given job is executed will be done in
> device_run, we can only power to correct core there.
>
> To avoid unpowering the core in a streaming state switch to autosuspend.
> This avoids powering down the core when the next frame is scheduled in
> the next 50ms. The timeout maps to a framerate of 20fps, which should be
> pretty uncommon in a normal video stream.
>
> Signed-off-by: Sven Püschel <s.pueschel@pengutronix.de>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
>
> ---
> v2
> - also set autosuspend flag with pm_runtime_use_autosuspend
> (https://sashiko.dev/#/patchset/20260606-spu-rga3multicore-v1-0-3ec2b15675f7%40pengutronix.de?part=6)
> ---
> drivers/media/platform/rockchip/rga/rga-buf.c | 12 ------------
> drivers/media/platform/rockchip/rga/rga.c | 13 +++++++++++++
> 2 files changed, 13 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/media/platform/rockchip/rga/rga-buf.c b/drivers/media/platform/rockchip/rga/rga-buf.c
> index c0ea6003336bf..3f7c3c68e0cb8 100644
> --- a/drivers/media/platform/rockchip/rga/rga-buf.c
> +++ b/drivers/media/platform/rockchip/rga/rga-buf.c
> @@ -242,14 +242,6 @@ static int rga_buf_prepare_streaming(struct vb2_queue *q)
> static int rga_buf_start_streaming(struct vb2_queue *q, unsigned int count)
> {
> struct rga_ctx *ctx = vb2_get_drv_priv(q);
> - struct rockchip_rga *rga = ctx->rga;
> - int ret;
> -
> - ret = pm_runtime_resume_and_get(rga->dev);
> - if (ret < 0) {
> - rga_buf_return_buffers(q, VB2_BUF_STATE_QUEUED);
> - return ret;
> - }
>
> if (V4L2_TYPE_IS_OUTPUT(q->type))
> ctx->osequence = 0;
> @@ -261,11 +253,7 @@ static int rga_buf_start_streaming(struct vb2_queue *q, unsigned int count)
>
> static void rga_buf_stop_streaming(struct vb2_queue *q)
> {
> - struct rga_ctx *ctx = vb2_get_drv_priv(q);
> - struct rockchip_rga *rga = ctx->rga;
> -
> rga_buf_return_buffers(q, VB2_BUF_STATE_ERROR);
> - pm_runtime_put(rga->dev);
> }
>
> const struct vb2_ops rga_qops = {
> diff --git a/drivers/media/platform/rockchip/rga/rga.c b/drivers/media/platform/rockchip/rga/rga.c
> index d7f0712177b70..c24bc8e26b91e 100644
> --- a/drivers/media/platform/rockchip/rga/rga.c
> +++ b/drivers/media/platform/rockchip/rga/rga.c
> @@ -37,6 +37,14 @@ static void device_run(void *prv)
> struct rockchip_rga *rga = ctx->rga;
> struct vb2_v4l2_buffer *src, *dst;
> unsigned long flags;
> + int ret;
> +
> + ret = pm_runtime_resume_and_get(rga->dev);
> + if (ret < 0) {
> + v4l2_m2m_buf_done_and_job_finish(rga->m2m_dev, ctx->fh.m2m_ctx,
> + VB2_BUF_STATE_ERROR);
> + return;
> + }
>
> spin_lock_irqsave(&rga->ctrl_lock, flags);
> if (ctx->cmdbuf_dirty) {
> @@ -81,6 +89,8 @@ static irqreturn_t rga_isr(int irq, void *prv)
> v4l2_m2m_buf_done(src, VB2_BUF_STATE_DONE);
> v4l2_m2m_buf_done(dst, VB2_BUF_STATE_DONE);
> v4l2_m2m_job_finish(rga->m2m_dev, ctx->fh.m2m_ctx);
> +
> + pm_runtime_put_autosuspend(rga->dev);
> }
>
> return IRQ_HANDLED;
> @@ -801,6 +811,9 @@ static int rga_probe(struct platform_device *pdev)
> if (ret)
> return ret;
>
> + pm_runtime_set_autosuspend_delay(rga->dev, 50);
> + pm_runtime_use_autosuspend(rga->dev);
> +
> rga->regs = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(rga->regs))
> return PTR_ERR(rga->regs);
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2026-11-24 21:14 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 15:09 [PATCH v2 00/17] media: rockchip: rga: Add multi-core support Sven Püschel
2026-09-16 15:09 ` [PATCH v2 01/17] media: rockchip: rga: zero cmdbuf in shared code Sven Püschel
2026-11-24 20:44 ` Nicolas Dufresne
2026-09-16 15:09 ` [PATCH v2 02/17] media: rockchip: rga: add comment about pixel alignment for YUV formats Sven Püschel
2026-11-24 20:45 ` Nicolas Dufresne
2026-09-16 15:09 ` [PATCH v2 03/17] media: rockchip: rga: move early return into if condition in vidioc_enum_fmt Sven Püschel
2026-11-24 20:46 ` Nicolas Dufresne
2026-09-16 15:09 ` [PATCH v2 04/17] media: rockchip: rga: removed unused regmap member Sven Püschel
2026-11-24 20:46 ` Nicolas Dufresne
2026-09-16 15:09 ` [PATCH v2 05/17] media: rockchip: rga: use devres version of pm_runtime_enable Sven Püschel
2026-11-24 20:51 ` Nicolas Dufresne
2026-09-16 15:09 ` [PATCH v2 06/17] media: v4l2-mem2mem: drop curr_ctx member from v4l2_m2m_dev struct Sven Püschel
2026-11-24 20:55 ` Nicolas Dufresne
2026-09-16 15:09 ` [PATCH v2 07/17] media: v4l2-mem2mem: support running multiple jobs in parallel Sven Püschel
2026-11-24 21:12 ` Nicolas Dufresne
2026-09-16 15:09 ` [PATCH v2 08/17] media: rockchip: rga: move power handling to device_run Sven Püschel
2026-11-24 21:14 ` Nicolas Dufresne [this message]
2026-09-16 15:09 ` [PATCH v2 09/17] media: rockchip: rga: adjust get_version to return the version Sven Püschel
2026-11-24 21:15 ` Nicolas Dufresne
2026-09-16 15:09 ` [PATCH v2 10/17] media: rockchip: rga: add rga_core structure Sven Püschel
2026-11-24 21:16 ` Nicolas Dufresne
2026-09-16 15:09 ` [PATCH v2 11/17] media: rockchip: rga: use components to manage multiple cores Sven Püschel
2026-11-24 21:29 ` Nicolas Dufresne
2026-09-16 15:09 ` [PATCH v2 12/17] media: rockchip: rga: move rockchip_rga allocation to master probe Sven Püschel
2026-11-24 21:30 ` Nicolas Dufresne
2026-09-16 15:09 ` [PATCH v2 13/17] media: rockchip: rga: move core initialization from bind to probe Sven Püschel
2026-11-24 21:35 ` Nicolas Dufresne
2026-09-16 15:09 ` [PATCH v2 14/17] media: rockchip: rga: move video device to the master Sven Püschel
2026-11-24 21:38 ` Nicolas Dufresne
2026-09-16 15:09 ` [PATCH v2 15/17] media: rockchip: rga: bind all cores " Sven Püschel
2026-11-24 21:43 ` Nicolas Dufresne
2026-09-16 15:09 ` [PATCH v2 16/17] media: rockchip: rga: put all cores into first core iommu domain Sven Püschel
2026-11-24 21:50 ` Nicolas Dufresne
2026-09-16 15:09 ` [PATCH v2 17/17] media: rockchip: rga: schedule jobs to multiple cores Sven Püschel
2026-11-24 21:52 ` Nicolas Dufresne
2026-11-14 4:50 ` [PATCH v2 00/17] media: rockchip: rga: Add multi-core support Arun Iyengar
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=728acfd6e085408e7998bc9e7dfbb2d110cd53ed.camel@ndufresne.ca \
--to=nicolas@ndufresne.ca \
--cc=detlev.casanova@collabora.com \
--cc=ezequiel@vanguardiasur.com.ar \
--cc=heiko@sntech.de \
--cc=jacob-chen@iotwrt.com \
--cc=kernel@pengutronix.de \
--cc=lgs201920130244@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=m.tretter@pengutronix.de \
--cc=mchehab@kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=s.pueschel@pengutronix.de \
/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®