From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: guoniu.zhou@oss.nxp.com
Cc: rmfrfs@gmail.com, martink@posteo.de, kernel@puri.sm,
mchehab@kernel.org, s.hauer@pengutronix.de,
kernel@pengutronix.de, festevam@gmail.com,
linux-media@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: nxp: imx8-isi: Add suspend/resume support for ISI mem2mem
Date: Thu, 14 Aug 2025 01:39:10 +0300 [thread overview]
Message-ID: <20250813223910.GA11412@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20250717024353.1811576-1-guoniu.zhou@oss.nxp.com>
Hi Guoniu,
Thank you for the patch.
On Thu, Jul 17, 2025 at 10:43:54AM +0800, guoniu.zhou@oss.nxp.com wrote:
> From: Guoniu Zhou <guoniu.zhou@nxp.com>
>
> Add suspend/resume support for ISI when work at memory to memory mode.
>
> Signed-off-by: Guoniu Zhou <guoniu.zhou@nxp.com>
> ---
> .../platform/nxp/imx8-isi/imx8-isi-core.c | 8 ++++
> .../platform/nxp/imx8-isi/imx8-isi-core.h | 11 +++++
> .../platform/nxp/imx8-isi/imx8-isi-m2m.c | 48 +++++++++++++++++++
> 3 files changed, 67 insertions(+)
>
> diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c
> index 981648a03113..6eef45302e6c 100644
> --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c
> +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c
> @@ -372,6 +372,7 @@ static int mxc_isi_pm_suspend(struct device *dev)
> struct mxc_isi_pipe *pipe = &isi->pipes[i];
>
> mxc_isi_video_suspend(pipe);
> + mxc_isi_m2m_suspend(pipe);
> }
Given that only the first pipe can be used for M2M, I would move the
mxc_isi_m2m_suspend() call after the loop, and pass it a &isi->m2m
argument.
>
> return pm_runtime_force_suspend(dev);
> @@ -401,6 +402,13 @@ static int mxc_isi_pm_resume(struct device *dev)
> */
> err = ret;
> }
> +
> + ret = mxc_isi_m2m_resume(pipe);
> + if (ret) {
> + dev_err(dev, "Failed to resume ISI%u (%d) for m2m\n", i,
> + ret);
> + err = ret;
> + }
Same here, that can be moved after the loop.
> }
>
> return err;
> diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.h b/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.h
> index 206995bedca4..b979b79b5525 100644
> --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.h
> +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.h
> @@ -343,6 +343,8 @@ int mxc_isi_video_buffer_prepare(struct mxc_isi_dev *isi, struct vb2_buffer *vb2
> #ifdef CONFIG_VIDEO_IMX8_ISI_M2M
> int mxc_isi_m2m_register(struct mxc_isi_dev *isi, struct v4l2_device *v4l2_dev);
> int mxc_isi_m2m_unregister(struct mxc_isi_dev *isi);
> +void mxc_isi_m2m_suspend(struct mxc_isi_pipe *pipe);
> +int mxc_isi_m2m_resume(struct mxc_isi_pipe *pipe);
> #else
> static inline int mxc_isi_m2m_register(struct mxc_isi_dev *isi,
> struct v4l2_device *v4l2_dev)
> @@ -353,6 +355,15 @@ static inline int mxc_isi_m2m_unregister(struct mxc_isi_dev *isi)
> {
> return 0;
> }
> +
> +static inline void mxc_isi_m2m_suspend(struct mxc_isi_pipe *pipe)
> +{
> +}
> +
> +static inline int mxc_isi_m2m_resume(struct mxc_isi_pipe *pipe)
> +{
> + return 0;
> +}
> #endif
>
> int mxc_isi_channel_acquire(struct mxc_isi_pipe *pipe,
> diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c
> index 22e49d3a1287..fe9d85335b6c 100644
> --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c
> +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c
> @@ -732,6 +732,54 @@ static const struct v4l2_file_operations mxc_isi_m2m_fops = {
> .mmap = v4l2_m2m_fop_mmap,
> };
>
> +/* -----------------------------------------------------------------------------
> + * Suspend & resume
> + */
> +
> +void mxc_isi_m2m_suspend(struct mxc_isi_pipe *pipe)
> +{
> + struct mxc_isi_m2m *m2m = &pipe->isi->m2m;
> + struct mxc_isi_m2m_ctx *ctx = m2m->last_ctx;
> +
> + /*
> + * Check pipe for ISI memory to memory since only
> + * channel 0 support this feature.
> + */
> + if (m2m->pipe != pipe || m2m->usage_count == 0)
If we pass the mxc_isi_m2m pointer to the function, you can drop the
comment and the first part of the condition. Same in
mxc_isi_m2m_resume().
> + return;
> +
> + v4l2_m2m_suspend(m2m->m2m_dev);
> +
> + if (ctx->chained)
Shouldn't you check m2m->chained_count instead ? Same in
mxc_isi_m2m_resume().
> + mxc_isi_channel_unchain(pipe);
> +
> + mxc_isi_channel_disable(pipe);
> + mxc_isi_channel_put(pipe);
> +}
> +
> +int mxc_isi_m2m_resume(struct mxc_isi_pipe *pipe)
> +{
> + struct mxc_isi_m2m *m2m = &pipe->isi->m2m;
> + struct mxc_isi_m2m_ctx *ctx = m2m->last_ctx;
> +
> + /*
> + * Check pipe for ISI memory to memory since only
> + * channel 0 support this feature.
> + */
> + if (m2m->pipe != pipe || m2m->usage_count == 0)
> + return 0;
> +
> + mxc_isi_channel_get(pipe);
> +
> + if (ctx->chained)
> + mxc_isi_channel_chain(pipe, false);
> +
> + m2m->last_ctx = NULL;
> + v4l2_m2m_resume(m2m->m2m_dev);
> +
> + return 0;
> +}
> +
> /* -----------------------------------------------------------------------------
> * Registration
> */
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2025-08-13 22:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-17 2:43 guoniu.zhou
2025-07-17 15:45 ` [PATCH] media: nxp: imx8-isi: Add suspend/resume support for ISI mem2memy Frank Li
2025-08-12 9:29 ` [PATCH] media: nxp: imx8-isi: Add suspend/resume support for ISI mem2mem G.N. Zhou
2025-08-13 22:39 ` Laurent Pinchart [this message]
2025-08-15 8:50 ` G.N. Zhou (OSS)
-- strict thread matches above, loose matches on Subject: below --
2024-10-14 9:09 guoniu.zhou
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=20250813223910.GA11412@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=festevam@gmail.com \
--cc=guoniu.zhou@oss.nxp.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=kernel@puri.sm \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=martink@posteo.de \
--cc=mchehab@kernel.org \
--cc=rmfrfs@gmail.com \
--cc=s.hauer@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®