From: Jai Luthra <j-luthra@ti.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Cc: <linux-media@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<devicetree@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
Maxime Ripard <mripard@kernel.org>,
<niklas.soderlund+renesas@ragnatech.se>,
Benoit Parrot <bparrot@ti.com>,
Vaishnav Achath <vaishnav.a@ti.com>,
Vignesh Raghavendra <vigneshr@ti.com>, <nm@ti.com>,
<devarsht@ti.com>, <j-luthra@ti.com>, <a-bhatia1@ti.com>,
Martyn Welch <martyn.welch@collabora.com>,
Julien Massot <julien.massot@collabora.com>
Subject: [PATCH v9 07/13] media: cadence: csi2rx: Soft reset the streams before starting capture
Date: Fri, 11 Aug 2023 16:17:29 +0530 [thread overview]
Message-ID: <20230811-upstream_csi-v9-7-8943f7a68a81@ti.com> (raw)
In-Reply-To: <20230811-upstream_csi-v9-0-8943f7a68a81@ti.com>
From: Pratyush Yadav <p.yadav@ti.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@ti.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Jai Luthra <j-luthra@ti.com>
---
Changes from v8:
- Simplify reset sequence, minimizing delays
drivers/media/platform/cadence/cdns-csi2rx.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c b/drivers/media/platform/cadence/cdns-csi2rx.c
index 933edec89520..b57e0c3b1944 100644
--- a/drivers/media/platform/cadence/cdns-csi2rx.c
+++ b/drivers/media/platform/cadence/cdns-csi2rx.c
@@ -40,6 +40,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)
@@ -134,12 +135,23 @@ struct csi2rx_priv *v4l2_subdev_to_csi2rx(struct v4l2_subdev *subdev)
static void csi2rx_reset(struct csi2rx_priv *csi2rx)
{
+ unsigned int i;
+
+ /* Reset module */
writel(CSI2RX_SOFT_RESET_PROTOCOL | CSI2RX_SOFT_RESET_FRONT,
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));
+ }
- udelay(10);
+ usleep_range(10, 20);
+ /* Clear resets */
writel(0, csi2rx->base + CSI2RX_SOFT_RESET_REG);
+ for (i = 0; i < csi2rx->max_streams; i++)
+ writel(0, csi2rx->base + CSI2RX_STREAM_CTRL_REG(i));
}
static int csi2rx_configure_ext_dphy(struct csi2rx_priv *csi2rx)
--
2.41.0
next prev parent reply other threads:[~2023-08-11 10:48 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-11 10:47 [PATCH v9 00/13] CSI2RX support on J721E and AM62 Jai Luthra
2023-08-11 10:47 ` [PATCH v9 01/13] media: dt-bindings: Make sure items in data-lanes are unique Jai Luthra
2023-08-11 10:47 ` [PATCH v9 02/13] media: dt-bindings: cadence-csi2rx: Add TI compatible string Jai Luthra
2023-08-25 3:44 ` Laurent Pinchart
2023-08-11 10:47 ` [PATCH v9 03/13] media: cadence: csi2rx: Unregister v4l2 async notifier Jai Luthra
2023-08-11 10:47 ` [PATCH v9 04/13] media: cadence: csi2rx: Cleanup media entity properly Jai Luthra
2023-08-11 10:47 ` [PATCH v9 05/13] media: cadence: csi2rx: Add get_fmt and set_fmt pad ops Jai Luthra
2023-08-15 12:05 ` Tomi Valkeinen
2023-08-25 3:48 ` Laurent Pinchart
2023-08-11 10:47 ` [PATCH v9 06/13] media: cadence: csi2rx: Configure DPHY using link freq Jai Luthra
2023-08-11 10:47 ` Jai Luthra [this message]
2023-08-15 12:10 ` [PATCH v9 07/13] media: cadence: csi2rx: Soft reset the streams before starting capture Tomi Valkeinen
2023-08-11 10:47 ` [PATCH v9 08/13] media: cadence: csi2rx: Set the STOP bit when stopping a stream Jai Luthra
2023-08-11 10:47 ` [PATCH v9 09/13] media: cadence: csi2rx: Fix stream data configuration Jai Luthra
2023-08-11 10:47 ` [PATCH v9 10/13] media: cadence: csi2rx: Populate subdev devnode Jai Luthra
2023-08-11 10:47 ` [PATCH v9 11/13] media: cadence: csi2rx: Add link validation Jai Luthra
2023-08-11 10:47 ` [PATCH v9 12/13] media: dt-bindings: Add TI J721E CSI2RX Jai Luthra
2023-08-11 14:00 ` Rob Herring
2023-08-11 14:54 ` Rob Herring
2023-08-11 10:47 ` [PATCH v9 13/13] media: ti: Add CSI2RX support for J721E Jai Luthra
2023-08-15 13:00 ` Tomi Valkeinen
2023-08-18 10:25 ` Jai Luthra
2023-08-29 15:55 ` Laurent Pinchart
2023-10-04 13:51 ` Vinod Koul
2023-10-04 20:03 ` Laurent Pinchart
2023-10-05 4:10 ` Vinod Koul
2023-10-06 10:26 ` Jai Luthra
2023-08-29 16:44 ` Laurent Pinchart
2023-10-05 8:34 ` Jai Luthra
2023-08-24 15:18 ` [PATCH v9 00/13] CSI2RX support on J721E and AM62 Julien Massot
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=20230811-upstream_csi-v9-7-8943f7a68a81@ti.com \
--to=j-luthra@ti.com \
--cc=a-bhatia1@ti.com \
--cc=bparrot@ti.com \
--cc=conor+dt@kernel.org \
--cc=devarsht@ti.com \
--cc=devicetree@vger.kernel.org \
--cc=julien.massot@collabora.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--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=martyn.welch@collabora.com \
--cc=mchehab+samsung@kernel.org \
--cc=mchehab@kernel.org \
--cc=mripard@kernel.org \
--cc=niklas.soderlund+renesas@ragnatech.se \
--cc=nm@ti.com \
--cc=robh+dt@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=tomi.valkeinen@ideasonboard.com \
--cc=vaishnav.a@ti.com \
--cc=vigneshr@ti.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®