Description
Describe the situation
Following #74415 and #80649, video drivers are in the middle of a migration away from an ad-hoc devicetree API.
Migration to use the video-interfaces
binding and the endpoint DT macros is strongly recommended because of the following benefices:
- We can actually use the
remote-endpoint-label
to retrieve the peer remote device object in the driver without the need of redundant direct phandle reference in DT. - We can avoid some sort of chicken-egg issue due to direct phandle reference as described here.
- We can use the common properties defined in the
video-interfaces
binding to avoid declaring so many vendor custom properties in each vendor binding.
With the new video-interfaces
binding, remote-endpoint
must be replaced by remote-endpoint-label
in the devicetree.
The reason for it was #57708 and the workaround is #74415. A final conversion from remote-endpoint-label
to remote-endpoint
will need to happen once #57708 is addressed, but will be trivial to propagate.
Old API, drivers that need conversion
&source_dev {
status = "okay";
};
&sink_dev {
source = <&source_dev>;
/* or */
sensor = <&source_dev>;
/* or nothing */
};
- https://github.com/zephyrproject-rtos/zephyr/blob/main/dts/bindings/video/espressif%2Cesp32-cam.yaml
- drivers: video: Migrate ov7670 and smartdma to use video interfaces binding #88323
- https://github.com/zephyrproject-rtos/zephyr/blob/main/dts/bindings/video/ovti%2Cov2640.yaml
- dts: bindings: video: st,stm32-dcmi: update to use video interface #85452
- video: gc2145: addition of CSI output support #89571
New API, drivers that got converted
&source_dev {
status = "okay";
port {
source_dev_ep_out: endpoint {
remote-endpoint-label = "sink_dev_ep_in";
};
};
};
&sink_dev {
port {
sink_dev_ep_in: endpoint {
remote-endpoint-label = "source_dev_ep_out";
};
};
};
- https://github.com/zephyrproject-rtos/zephyr/blob/main/dts/bindings/video/nxp%2Cimx-csi.yaml
- https://github.com/zephyrproject-rtos/zephyr/blob/main/dts/bindings/video/nxp%2Cmipi-csi2rx.yaml
- https://github.com/zephyrproject-rtos/zephyr/blob/main/dts/bindings/video/ovti%2Cov5640.yaml
- https://github.com/zephyrproject-rtos/zephyr/blob/main/dts/bindings/video/aptina%2Cmt9m114.yaml
- https://github.com/zephyrproject-rtos/zephyr/blob/main/dts/bindings/video/ovti%2Cov7725.yaml
Impact
- Need to also convert the board and shields
- Only one API through the sources, more similar to Linux.
- A stable API that covers complex situations.
Additional context
Zephyr v4.0 is in feature-freeze: not possible to rush every vendor to complete the migration of their driver in time.
This can be done gradually as here, as commented in the following PR, for example: