mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@nxp.com>
To: guoniu.zhou@oss.nxp.com
Cc: laurent.pinchart@ideasonboard.com, 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 mem2memy
Date: Thu, 17 Jul 2025 11:45:15 -0400	[thread overview]
Message-ID: <aHkai3+d25+PnuZT@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20250717024353.1811576-1-guoniu.zhou@oss.nxp.com>

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>

Reviewed-by: Frank Li <Frank.Li@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);
>  	}
>
>  	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;
> +		}
>  	}
>
>  	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)
> +		return;
> +
> +	v4l2_m2m_suspend(m2m->m2m_dev);
> +
> +	if (ctx->chained)
> +		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
>   */
> --
> 2.34.1
>

  reply	other threads:[~2025-07-17 15:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-17  2:43 [PATCH] media: nxp: imx8-isi: Add suspend/resume support for ISI mem2mem guoniu.zhou
2025-07-17 15:45 ` Frank Li [this message]
2025-08-12  9:29 ` G.N. Zhou
2025-08-13 22:39 ` Laurent Pinchart
2025-08-15  8:50   ` G.N. Zhou (OSS)

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=aHkai3+d25+PnuZT@lizhi-Precision-Tower-5810 \
    --to=frank.li@nxp.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=laurent.pinchart@ideasonboard.com \
    --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®