If the connected MIPI CSI-2 RX driver uses the new pre_streamon subdev call, we don't have to reinitialize the CSI-2 TX after streamoff. Just put all lanes into LP-11 state during pre_streamon if requested. Signed-off-by: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx> --- drivers/media/i2c/tc358743.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c index 3205cd8298dd..40eec67604e0 100644 --- a/drivers/media/i2c/tc358743.c +++ b/drivers/media/i2c/tc358743.c @@ -93,6 +93,7 @@ struct tc358743_state { struct v4l2_dv_timings timings; u32 mbus_fmt_code; u8 csi_lanes_in_use; + bool pre_streamon_used; struct gpio_desc *reset_gpio; @@ -1637,8 +1638,10 @@ static int tc358743_get_mbus_config(struct v4l2_subdev *sd, static int tc358743_s_stream(struct v4l2_subdev *sd, int enable) { + struct tc358743_state *state = to_state(sd); + enable_stream(sd, enable); - if (!enable) { + if (!enable && !state->pre_streamon_used) { /* Put all lanes in LP-11 state (STOPSTATE) */ tc358743_set_csi(sd); } @@ -1646,6 +1649,19 @@ static int tc358743_s_stream(struct v4l2_subdev *sd, int enable) return 0; } +static int tc358743_pre_streamon(struct v4l2_subdev *sd, u32 flags) +{ + struct tc358743_state *state = to_state(sd); + + /* Put all lanes in LP-11 state (STOPSTATE) if requested */ + if (flags & V4L2_SUBDEV_PRE_STREAMON_FL_MANUAL_LP) + tc358743_set_csi(sd); + + state->pre_streamon_used = true; + + return 0; +} + /* --------------- PAD OPS --------------- */ static int tc358743_enum_mbus_code(struct v4l2_subdev *sd, @@ -1840,6 +1856,7 @@ static const struct v4l2_subdev_video_ops tc358743_video_ops = { .g_dv_timings = tc358743_g_dv_timings, .query_dv_timings = tc358743_query_dv_timings, .s_stream = tc358743_s_stream, + .pre_streamon = tc358743_pre_streamon, }; static const struct v4l2_subdev_pad_ops tc358743_pad_ops = { -- 2.30.2