mbox series

[v2,0/4] media: v4l: fwnode: Add support for CSI-2 C-PHY line orders

Message ID 20241121134108.2029925-1-niklas.soderlund+renesas@ragnatech.se (mailing list archive)
Headers show
Series media: v4l: fwnode: Add support for CSI-2 C-PHY line orders | expand

Message

Niklas Söderlund Nov. 21, 2024, 1:41 p.m. UTC
Hello,

This series aims to extend the video interface bindings with a new
property to describe the CSI-2 C-PHY line orders. In comparison with
CSI-2 D-PHY where each data-lane is constructed from two lines making up
a differential pair the C-PHY uses three phase encoding constructed from
three lines to create a single data lane.

The three lines making up the C-PHY data lane are labeled A, B and C in
the specification and can be ordered in any combination (ABC, ACB, BAC,
BCA, CAB and CBA). This can be compared to the D-PHY model where the two
lines in the differential pair can be "normal" or "inverted" to do the
same thing.

For the D-PHY uses-case the exists a property 'lane-polarities' can be
used to describe this line wiring. However there are no property to
describe this ordering of the C-PHY lines in the video interfaces
definition nor in the V4L2 fwnode structures or parser.

Patch 1/4 extends the video bindings with a new property 'line-orders'
which can describe this property of the C-PHY. The property name and the
const values used for different line configurations are taken from the
MIPI Discovery and Configuration (DisCo) Specification for Imaging
document.

Patch 2/4 extends the V4L2 fwnode data structure and parser to consume
and exposes this property to drivers.

While patch 3/4 and 4/4 adds an example use of the property both in the
bindings and in the driver using the R-Car CSI-2 receiver driver on V4H.

A note on the changes to the R-Car driver not relevant to the core V4L2
or bindings work. The V4H WhiteHawk development platform is the only
model where the CSI-2 bus is used in a C-PHY configuration. Early
datasheets where used to add support for it and at that time the line
order registers where not documented so magic values where used as-is.
This have been addressed in later versions of the datasheet and this can
now be done properly.

The magic values used however configured one of the data lanes used in a
BCA configuration, which is required for proper operation on that
development platform. Thus the change in patch 4/4 breaks proper
operation with older DTS files lacking the new line-orders property.

I think this is fine as the only known use-case for this platform is
together with the MAX96712 CSI-2 transmitter and for this we only have a
staging driver capable of generating test patterns. To extend this to a
capture pipeline capable of capturing frames from a real source DTS
changes are needed to describe the video source, so an updated DTS are
need anyhow.

See individual patches for changelog.

Niklas Söderlund (4):
  media: dt-bindings: Add property to describe CSI-2 C-PHY line orders
  media: v4l: fwnode: Parse MiPI DisCo for C-PHY line-orders
  arm64: dts: renesas: white-hawk-csi-dsi: Define CSI-2 data line orders
  media: rcar-csi2: Allow specifying C-PHY line order

 .../bindings/media/video-interfaces.yaml      | 21 ++++++
 .../boot/dts/renesas/white-hawk-csi-dsi.dtsi  |  6 ++
 drivers/media/platform/renesas/rcar-csi2.c    | 74 +++++++++++++++++--
 drivers/media/v4l2-core/v4l2-fwnode.c         | 43 ++++++++++-
 include/dt-bindings/media/video-interfaces.h  |  7 ++
 include/media/v4l2-mediabus.h                 | 21 ++++++
 6 files changed, 164 insertions(+), 8 deletions(-)