[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230314115516.667-6-vaishnav.a@ti.com>
Date: Tue, 14 Mar 2023 17:25:08 +0530
From: Vaishnav Achath <vaishnav.a@...com>
To: <linux-media@...r.kernel.org>, <devicetree@...r.kernel.org>,
<mripard@...nel.org>, <mchehab@...nel.org>, <robh+dt@...nel.org>,
<krzysztof.kozlowski+dt@...aro.org>,
<laurent.pinchart@...asonboard.com>,
<sakari.ailus@...ux.intel.com>, <tomi.valkeinen@...asonboard.com>
CC: <linux-kernel@...r.kernel.org>, <bparrot@...com>,
<niklas.soderlund+renesas@...natech.se>, <j-luthra@...com>,
<devarsht@...com>, <praneeth@...com>, <u-kumar1@...com>,
<vigneshr@...com>, <nm@...com>, <martyn.welch@...labora.com>,
<vaishnav.a@...com>
Subject: [PATCH v7 05/13] media: cadence: csi2rx: Soft reset the streams before starting capture
From: Pratyush Yadav <p.yadav@...com>
This resets the stream state machines and FIFOs, giving them a clean
slate. On J721E if the streams are not reset before starting the
capture, the captured frame gets wrapped around vertically on every run
after the first.
Signed-off-by: Pratyush Yadav <p.yadav@...com>
Signed-off-by: Vaishnav Achath <vaishnav.a@...com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@...asonboard.com>
---
(no changes since v5)
Changes in v5:
- Make i unsigned.
- Add Laurent's R-by.
drivers/media/platform/cadence/cdns-csi2rx.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c b/drivers/media/platform/cadence/cdns-csi2rx.c
index 6933626adfc8..8ecd889690b7 100644
--- a/drivers/media/platform/cadence/cdns-csi2rx.c
+++ b/drivers/media/platform/cadence/cdns-csi2rx.c
@@ -39,6 +39,7 @@
#define CSI2RX_STREAM_BASE(n) (((n) + 1) * 0x100)
#define CSI2RX_STREAM_CTRL_REG(n) (CSI2RX_STREAM_BASE(n) + 0x000)
+#define CSI2RX_STREAM_CTRL_SOFT_RST BIT(4)
#define CSI2RX_STREAM_CTRL_START BIT(0)
#define CSI2RX_STREAM_DATA_CFG_REG(n) (CSI2RX_STREAM_BASE(n) + 0x008)
@@ -135,12 +136,22 @@ struct csi2rx_priv *v4l2_subdev_to_csi2rx(struct v4l2_subdev *subdev)
static void csi2rx_reset(struct csi2rx_priv *csi2rx)
{
+ unsigned int i;
+
writel(CSI2RX_SOFT_RESET_PROTOCOL | CSI2RX_SOFT_RESET_FRONT,
csi2rx->base + CSI2RX_SOFT_RESET_REG);
udelay(10);
writel(0, csi2rx->base + CSI2RX_SOFT_RESET_REG);
+
+ /* Reset individual streams. */
+ for (i = 0; i < csi2rx->max_streams; i++) {
+ writel(CSI2RX_STREAM_CTRL_SOFT_RST,
+ csi2rx->base + CSI2RX_STREAM_CTRL_REG(i));
+ usleep_range(10, 20);
+ writel(0, csi2rx->base + CSI2RX_STREAM_CTRL_REG(i));
+ }
}
static int csi2rx_configure_external_dphy(struct csi2rx_priv *csi2rx)
--
2.17.1
Powered by blists - more mailing lists