All of lore.kernel.org
 help / color / mirror / Atom feed
From: guoniu.zhou@oss.nxp.com
To: rmfrfs@gmail.com, laurent.pinchart@ideasonboard.com,
	martink@posteo.de, kernel@puri.sm, mchehab@kernel.org,
	shawnguo@kernel.org, s.hauer@pengutronix.de,
	kernel@pengutronix.de, festevam@gmail.com
Cc: imx@lists.linux.dev, linux-media@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] media: nxp: imx8mq-mipi-csi2: Fix CSI clocks always enabled issue
Date: Sun, 29 Sep 2024 18:16:35 +0800	[thread overview]
Message-ID: <20240929101635.1648234-1-guoniu.zhou@oss.nxp.com> (raw)

From: "Guoniu.zhou" <guoniu.zhou@nxp.com>

Fix CSI clocks always enabled issue after run system suspend/resume.

The clocks for CSI will be enabled in imx8mq_mipi_csi_pm_resume()
when system resume and the state of CSI will be set to ST_POWERED.
It not only cause clock always enabled issue but also system hang
issue on iMX8ULP platform since imx8mq_mipi_csi_pm_suspend() will
access CSI registers if run system suspend/resume again, but the
CSI power domain is not active.

In order to fix this issue, using pm_runtime_force_suspend/resume
instead of calling imx8mq_mipi_csi_pm_suspend/resume directly.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
---
 drivers/media/platform/nxp/imx8mq-mipi-csi2.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c
index d4a6c5532969..15029bb81b35 100644
--- a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c
+++ b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c
@@ -697,8 +697,11 @@ static int imx8mq_mipi_csi_suspend(struct device *dev)
 {
 	struct v4l2_subdev *sd = dev_get_drvdata(dev);
 	struct csi_state *state = mipi_sd_to_csi2_state(sd);
+	int ret;
 
-	imx8mq_mipi_csi_pm_suspend(dev);
+	ret = pm_runtime_force_suspend(dev);
+	if (ret < 0)
+		return ret;
 
 	state->state |= ST_SUSPENDED;
 
@@ -713,7 +716,7 @@ static int imx8mq_mipi_csi_resume(struct device *dev)
 	if (!(state->state & ST_SUSPENDED))
 		return 0;
 
-	return imx8mq_mipi_csi_pm_resume(dev);
+	return pm_runtime_force_resume(dev);
 }
 
 static int imx8mq_mipi_csi_runtime_suspend(struct device *dev)
-- 
2.34.1


             reply	other threads:[~2024-09-29 10:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-29 10:16 guoniu.zhou [this message]
2024-09-29 12:00 ` [PATCH] media: nxp: imx8mq-mipi-csi2: Fix CSI clocks always enabled issue Laurent Pinchart
2024-09-29 12:40   ` 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=20240929101635.1648234-1-guoniu.zhou@oss.nxp.com \
    --to=guoniu.zhou@oss.nxp.com \
    --cc=festevam@gmail.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 \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.