Modifying the CSI data lanes of the radxa-nx5-io-rpi-camera device tree overlay

How do I modify the device tree overlay for the rpi camera from radxa-pkg/radxa-overlays to use different data lanes?: radxa-nx5-io-rpi-camera-v2-cam1.dts

A lot of the nodes are duplicated in the rk3588s.dtsi file (mipiX_csi2, csi2_dphyX, …) so it is unclear where they all match to on the SODIMM pins (is there documentation available for this?).

I have a custom board where the camera is mapped onto the D0/D1/CLK0 pins instead of the D2/D3/CLK1 pins (the latter is what the above device tree overlay supports), the following pins are different (NX5 CAM1 -> custom board):
MIPI_CSI0_RX_D2N (4) -> MIPI_CSI0_RX_D0N (3)
MIPI_CSI0_RX_D2P (6) -> MIPI_CSI0_RX_D0P (5)
MIPI_CSI0_RX_CLK1N (10) -> MIPI_CSI0_RX_CLK0N (9)
MIPI_CSI0_RX_CLK1P (12) -> MIPI_CSI0_RX_CLK0P (11)
MIPI_CSI0_RX_D3N (16) -> MIPI_CSI0_RX_D1N (15)
MIPI_CSI0_RX_D3P (18) -> MIPI_CSI0_RX_D1P (17)

This corresponds to using the pins on the left (used by custom board) instead of the right (used by CAM1/J9809):

Schematics: NX5 module schematic and NX5 IO schematic

1 Like

I managed to get the camera working by changing all following references:
mipi3 -> mipi2
lvds3 -> lvds2

This feels like pure luck (I decided to brute force it and it worked on the first try), how do I reason about this?