Re: [PATCH v2 13/18] media: ti: Add CSI2RX support for J721E

From: Tomi Valkeinen
Date: Thu May 27 2021 - 09:30:05 EST


Hi Pratyush,

On 26/05/2021 18:23, Pratyush Yadav wrote:
TI's J721E uses the Cadence CSI2RX and DPHY peripherals to facilitate
capture over a CSI-2 bus.

The Cadence CSI2RX IP acts as a bridge between the TI specific parts and
the CSI-2 protocol parts. TI then has a wrapper on top of this bridge
called the SHIM layer. It takes in data from stream 0, repacks it, and
sends it to memory over PSI-L DMA.

This driver acts as the "front end" to V4L2 client applications. It
implements the required ioctls and buffer operations, passes the
necessary calls on to the bridge, programs the SHIM layer, and performs
DMA via the dmaengine API to finally return the data to a buffer
supplied by the application.

Signed-off-by: Pratyush Yadav <p.yadav@xxxxxx>

I noticed that my test app didn't work at all with this, and I also wasn't able to use v4l2-ctl to set the format.

At least for my test app the problem was that this driver doesn't initialize the format at all. My app first calls VIDIOC_G_FMT with v4l2_format.type == V4L2_BUF_TYPE_VIDEO_CAPTURE, then after the call modifies the fields it wants to change and calls VIDIOC_S_FMT. This failed, as G_FMT returned uninitialized fmt, i.e. type was 0, which my app didn't set again.

I believe the driver should have an initial format, something that it will accept if an app calls G_FMT and then S_FMT.

Tomi