[PATCH 09/16] media: cadence: csi2rx: Turn subdev power on before starting stream

From: Pratyush Yadav
Date: Tue Mar 30 2021 - 13:35:45 EST


The subdevice power needs to be turned on before the stream is started.
Otherwise it might not be in the proper state to stream the data. Turn
it off when stopping the stream.

Signed-off-by: Pratyush Yadav <p.yadav@xxxxxx>
---
drivers/media/platform/cadence/cdns-csi2rx.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c b/drivers/media/platform/cadence/cdns-csi2rx.c
index 7d1ac51e0698..3385e1bc213e 100644
--- a/drivers/media/platform/cadence/cdns-csi2rx.c
+++ b/drivers/media/platform/cadence/cdns-csi2rx.c
@@ -256,6 +256,10 @@ static int csi2rx_start(struct csi2rx_priv *csi2rx)

writel(reg, csi2rx->base + CSI2RX_STATIC_CFG_REG);

+ ret = v4l2_subdev_call(csi2rx->source_subdev, core, s_power, true);
+ if (ret && ret != -ENOIOCTLCMD)
+ goto err_disable_pclk;
+
ret = v4l2_subdev_call(csi2rx->source_subdev, video, s_stream, true);
if (ret)
goto err_disable_pclk;
@@ -358,6 +362,10 @@ static void csi2rx_stop(struct csi2rx_priv *csi2rx)
if (v4l2_subdev_call(csi2rx->source_subdev, video, s_stream, false))
dev_warn(csi2rx->dev, "Couldn't disable our subdev\n");

+ ret = v4l2_subdev_call(csi2rx->source_subdev, core, s_power, false);
+ if (ret && ret != -ENOIOCTLCMD)
+ dev_warn(csi2rx->dev, "Couldn't power off subdev\n");
+
if (csi2rx->dphy) {
writel(0, csi2rx->base + CSI2RX_DPHY_LANE_CTRL_REG);

--
2.30.0