diff mbox series

[1/3] media: imx8mq-mipi-csi2: Drop stream stop/restart at suspend/resume time

Message ID 20240929133646.19991-2-laurent.pinchart@ideasonboard.com (mailing list archive)
State New, archived
Headers show
Series media: imx8mq-mipi-csi2: Simplify power management handling | expand

Commit Message

Laurent Pinchart Sept. 29, 2024, 1:36 p.m. UTC
The imx8mq-mipi-csi2 driver stops streaming at suspend time, and
restarts it at resume time, in both the runtime and system
suspend/resume handlers. This isn't needed:

- The device is runtime resumed only from the .s_stream() handler,
  before starting streaming, and runtime suspended in the same function,
  after stopping streaming.

- For system suspend/resume, the whole capture pipeline is stopped and
  restarted in a controlled manner by the top-level driver (the CSI
  bridge in this case). When the system suspend handler is called,
  streaming will have been stopped already.

Drop stream stop/restart from the PM handlers.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/media/platform/nxp/imx8mq-mipi-csi2.c | 13 -------------
 1 file changed, 13 deletions(-)
diff mbox series

Patch

diff --git a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c
index d4a6c5532969..8eb9c7049425 100644
--- a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c
+++ b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c
@@ -64,7 +64,6 @@ 
 
 enum {
 	ST_POWERED	= 1,
-	ST_STREAMING	= 2,
 	ST_SUSPENDED	= 4,
 };
 
@@ -420,12 +419,9 @@  static int imx8mq_mipi_csi_s_stream(struct v4l2_subdev *sd, int enable)
 		ret = v4l2_subdev_call(state->src_sd, video, s_stream, 1);
 		if (ret < 0)
 			goto unlock;
-
-		state->state |= ST_STREAMING;
 	} else {
 		v4l2_subdev_call(state->src_sd, video, s_stream, 0);
 		imx8mq_mipi_csi_stop_stream(state);
-		state->state &= ~ST_STREAMING;
 	}
 
 unlock:
@@ -668,7 +664,6 @@  static int imx8mq_mipi_csi_pm_resume(struct device *dev)
 {
 	struct v4l2_subdev *sd = dev_get_drvdata(dev);
 	struct csi_state *state = mipi_sd_to_csi2_state(sd);
-	struct v4l2_subdev_state *sd_state;
 	int ret = 0;
 
 	mutex_lock(&state->lock);
@@ -677,17 +672,9 @@  static int imx8mq_mipi_csi_pm_resume(struct device *dev)
 		state->state |= ST_POWERED;
 		ret = imx8mq_mipi_csi_clk_enable(state);
 	}
-	if (state->state & ST_STREAMING) {
-		sd_state = v4l2_subdev_lock_and_get_active_state(sd);
-		ret = imx8mq_mipi_csi_start_stream(state, sd_state);
-		v4l2_subdev_unlock_state(sd_state);
-		if (ret)
-			goto unlock;
-	}
 
 	state->state &= ~ST_SUSPENDED;
 
-unlock:
 	mutex_unlock(&state->lock);
 
 	return ret ? -EAGAIN : 0;