18c2ecf20Sopenharmony_ciSTMicroelectronics MIPID02 CSI-2 to PARALLEL bridge
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ciMIPID02 has two CSI-2 input ports, only one of those ports can be active at a
48c2ecf20Sopenharmony_citime. Active port input stream will be de-serialized and its content outputted
58c2ecf20Sopenharmony_cithrough PARALLEL output port.
68c2ecf20Sopenharmony_ciCSI-2 first input port is a dual lane 800Mbps per lane whereas CSI-2 second
78c2ecf20Sopenharmony_ciinput port is a single lane 800Mbps. Both ports support clock and data lane
88c2ecf20Sopenharmony_cipolarity swap. First port also supports data lane swap.
98c2ecf20Sopenharmony_ciPARALLEL output port has a maximum width of 12 bits.
108c2ecf20Sopenharmony_ciSupported formats are RAW6, RAW7, RAW8, RAW10, RAW12, RGB565, RGB888, RGB444,
118c2ecf20Sopenharmony_ciYUV420 8-bit, YUV422 8-bit and YUV420 10-bit.
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciRequired Properties:
148c2ecf20Sopenharmony_ci- compatible: shall be "st,st-mipid02"
158c2ecf20Sopenharmony_ci- clocks: reference to the xclk input clock.
168c2ecf20Sopenharmony_ci- clock-names: shall be "xclk".
178c2ecf20Sopenharmony_ci- VDDE-supply: sensor digital IO supply. Must be 1.8 volts.
188c2ecf20Sopenharmony_ci- VDDIN-supply: sensor internal regulator supply. Must be 1.8 volts.
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ciOptional Properties:
218c2ecf20Sopenharmony_ci- reset-gpios: reference to the GPIO connected to the xsdn pin, if any.
228c2ecf20Sopenharmony_ci	       This is an active low signal to the mipid02.
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ciRequired subnodes:
258c2ecf20Sopenharmony_ci  - ports: A ports node with one port child node per device input and output
268c2ecf20Sopenharmony_ci	   port, in accordance with the video interface bindings defined in
278c2ecf20Sopenharmony_ci	   Documentation/devicetree/bindings/media/video-interfaces.txt. The
288c2ecf20Sopenharmony_ci	   port nodes are numbered as follows:
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci	   Port Description
318c2ecf20Sopenharmony_ci	   -----------------------------
328c2ecf20Sopenharmony_ci	   0    CSI-2 first input port
338c2ecf20Sopenharmony_ci	   1    CSI-2 second input port
348c2ecf20Sopenharmony_ci	   2    PARALLEL output
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ciEndpoint node required property for CSI-2 connection is:
378c2ecf20Sopenharmony_ci- data-lanes: shall be <1> for Port 1. for Port 0 dual-lane operation shall be
388c2ecf20Sopenharmony_ci<1 2> or <2 1>. For Port 0 single-lane operation shall be <1> or <2>.
398c2ecf20Sopenharmony_ciEndpoint node optional property for CSI-2 connection is:
408c2ecf20Sopenharmony_ci- lane-polarities: any lane can be inverted or not.
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ciEndpoint node required property for PARALLEL connection is:
438c2ecf20Sopenharmony_ci- bus-width: shall be set to <6>, <7>, <8>, <10> or <12>.
448c2ecf20Sopenharmony_ciEndpoint node optional properties for PARALLEL connection are:
458c2ecf20Sopenharmony_ci- hsync-active: active state of the HSYNC signal, 0/1 for LOW/HIGH respectively.
468c2ecf20Sopenharmony_ciLOW being the default.
478c2ecf20Sopenharmony_ci- vsync-active: active state of the VSYNC signal, 0/1 for LOW/HIGH respectively.
488c2ecf20Sopenharmony_ciLOW being the default.
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ciExample:
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_cimipid02: csi2rx@14 {
538c2ecf20Sopenharmony_ci	compatible = "st,st-mipid02";
548c2ecf20Sopenharmony_ci	reg = <0x14>;
558c2ecf20Sopenharmony_ci	status = "okay";
568c2ecf20Sopenharmony_ci	clocks = <&clk_ext_camera_12>;
578c2ecf20Sopenharmony_ci	clock-names = "xclk";
588c2ecf20Sopenharmony_ci	VDDE-supply = <&vdd>;
598c2ecf20Sopenharmony_ci	VDDIN-supply = <&vdd>;
608c2ecf20Sopenharmony_ci	ports {
618c2ecf20Sopenharmony_ci		#address-cells = <1>;
628c2ecf20Sopenharmony_ci		#size-cells = <0>;
638c2ecf20Sopenharmony_ci		port@0 {
648c2ecf20Sopenharmony_ci			reg = <0>;
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci			ep0: endpoint {
678c2ecf20Sopenharmony_ci				data-lanes = <1 2>;
688c2ecf20Sopenharmony_ci				remote-endpoint = <&mipi_csi2_in>;
698c2ecf20Sopenharmony_ci			};
708c2ecf20Sopenharmony_ci		};
718c2ecf20Sopenharmony_ci		port@2 {
728c2ecf20Sopenharmony_ci			reg = <2>;
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci			ep2: endpoint {
758c2ecf20Sopenharmony_ci				bus-width = <8>;
768c2ecf20Sopenharmony_ci				hsync-active = <0>;
778c2ecf20Sopenharmony_ci				vsync-active = <0>;
788c2ecf20Sopenharmony_ci				remote-endpoint = <&parallel_out>;
798c2ecf20Sopenharmony_ci			};
808c2ecf20Sopenharmony_ci		};
818c2ecf20Sopenharmony_ci	};
828c2ecf20Sopenharmony_ci};
83