mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Guoniu Zhou <guoniu.zhou@nxp.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>, Frank Li <Frank.Li@nxp.com>,
	linux-media@vger.kernel.org, imx@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] media: nxp: imx8-isi: Add suspend/resume support for ISI mem2mem
Date: Fri, 15 Aug 2025 13:59:28 +0300	[thread overview]
Message-ID: <20250815105928.GL6201@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20250815-isi_m2m-v2-1-32e3720880cc@nxp.com>

On Fri, Aug 15, 2025 at 05:28:51PM +0800, Guoniu Zhou wrote:
> 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>
> ---
> Changes in v2:
>   - Move mxc_isi_m2m_suspend()/resume() out of loop.
>   - Replace ctx->chained with m2m->chained_count.
>   - Link to v1: https://lore.kernel.org/all/20250717024353.1811576-1-guoniu.zhou@oss.nxp.com/
> ---
>  .../media/platform/nxp/imx8-isi/imx8-isi-core.c    |  9 ++++++
>  .../media/platform/nxp/imx8-isi/imx8-isi-core.h    | 11 +++++++
>  drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c | 34 ++++++++++++++++++++++
>  3 files changed, 54 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 981648a0311374597a033a7ecbf39f7b0b252cb0..408e9cb61554d05ac92562c322d6a728080bb9e5 100644
> --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c
> +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c
> @@ -374,6 +374,8 @@ static int mxc_isi_pm_suspend(struct device *dev)
>  		mxc_isi_video_suspend(pipe);
>  	}
>  
> +	mxc_isi_m2m_suspend(&isi->m2m);
> +
>  	return pm_runtime_force_suspend(dev);
>  }
>  
> @@ -403,6 +405,13 @@ static int mxc_isi_pm_resume(struct device *dev)
>  		}
>  	}
>  
> +	ret = mxc_isi_m2m_resume(&isi->m2m);
> +	if (ret) {
> +		dev_err(dev, "Failed to resume ISI%u (%d) for m2m\n", i,

Drop %u and i.

No need to resubmit, I'll make the change locally.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> +			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 206995bedca4a4c5d7873f3bc872fbae18b3cb75..6493eef907010934217d9f14a0d6d56acdc59ee0 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_m2m *m2m);
> +int mxc_isi_m2m_resume(struct mxc_isi_m2m *m2m);
>  #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_m2m *m2m)
> +{
> +}
> +
> +static inline int mxc_isi_m2m_resume(struct mxc_isi_m2m *m2m)
> +{
> +	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 22e49d3a128732c077beb7ac2e2f688e0899f8e2..26361fe2ca858098d907d4a0719b0fdacc6becd2 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,40 @@ 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_m2m *m2m)
> +{
> +	if (m2m->usage_count == 0)
> +		return;
> +
> +	v4l2_m2m_suspend(m2m->m2m_dev);
> +
> +	if (m2m->chained_count > 0)
> +		mxc_isi_channel_unchain(m2m->pipe);
> +
> +	mxc_isi_channel_disable(m2m->pipe);
> +	mxc_isi_channel_put(m2m->pipe);
> +}
> +
> +int mxc_isi_m2m_resume(struct mxc_isi_m2m *m2m)
> +{
> +	if (m2m->usage_count == 0)
> +		return 0;
> +
> +	mxc_isi_channel_get(m2m->pipe);
> +
> +	if (m2m->chained_count > 0)
> +		mxc_isi_channel_chain(m2m->pipe, false);
> +
> +	m2m->last_ctx = NULL;
> +	v4l2_m2m_resume(m2m->m2m_dev);
> +
> +	return 0;
> +}
> +
>  /* -----------------------------------------------------------------------------
>   * Registration
>   */
> 
> ---
> base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
> change-id: 20250815-isi_m2m-3db166a97969

-- 
Regards,

Laurent Pinchart

      reply	other threads:[~2025-08-15 10:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-15  9:28 Guoniu Zhou
2025-08-15 10:59 ` Laurent Pinchart [this message]

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=20250815105928.GL6201@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=Frank.Li@nxp.com \
    --cc=festevam@gmail.com \
    --cc=guoniu.zhou@nxp.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.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®