Skip to content

Commit

Permalink
dts: flatten video's ports { port@0 { endpoint@0 { ... }; }; };
Browse files Browse the repository at this point in the history
This change removes the "port@0 { ... };" block, making the devicetree less
nested while systematically including the "ports { ... };" root block.

In practice, this looks like only adding an "s" to "port" blocks, but the
changes are also semantic.

Complex configurations are still possible with this scheme:

	video@10380000 {
		ports {
			#address-cells = <1>;
			#size-cells = <0>;

			port@0 {
				reg = <0>;
				#address-cells = <1>;
				#size-cells = <0>;

				endpoint@0 {
					reg = <0>;
					remote-endpoint = <&other>;
				};

				endpoint@1 {
					reg = <1>;
					remote-endpoint = <&other>;
				};
			};

			port@1 {
				reg = <1>;
				#address-cells = <1>;
				#size-cells = <0>;

				endpoint@0 {
					reg = <0>;
					remote-endpoint = <&other>;
				};
			};
		};
	};

Is turned into something like this:

	video@10380000 {
		ports {
			#address-cells = <2>;
			#size-cells = <0>;

			endpoint@00 {
				reg = <0 0>;
				data-lanes = <0 1 2 3>;
				remote-endpoint = <&other>;
			};

			endpoint@01 {
				reg = <0 1>;
				data-lanes = <4 5 6 7>;
				remote-endpoint = <&other>;
			};

			endpoint@10 {
				reg = <1 0>;
				data-lanes = <0 1 2 3>;
				remote-endpoint = <&other>;
			};
		};
	};

Which helps simpler device to be simpler, and allows more complex
device with arbitrary number of nesting to remain simple.

Both very-nested and completely flat (1 port 1 endpoint) look exactly
the same way, which helps with use of generic macros to traverse the
devicetree across all video devices.

The use of "ports { ... };" is required so that the "#address-cells"
property can be different between "ports" and i.e. "display-timings".

This prevents to apply devicetree properties to an entire port,
affecting each of its endpoint, but in the Linux source, this was
only used once, in imx8mp-tqma8mpql-mba8mpxl-lvds-g133han01.dtso.

Signed-off-by: Josuah Demangeon <[email protected]>
  • Loading branch information
josuah committed May 20, 2024
1 parent 34c84ec commit 045a59c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions boards/madmachine/mm_swiftio/mm_swiftio.dts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@

reset-gpios = <&gpio2 20 GPIO_ACTIVE_HIGH>;

port {
ports {
ov7725_ep_out: endpoint {
remote-endpoint = <&csi_ep_in>;
};
Expand Down Expand Up @@ -196,7 +196,7 @@
pinctrl-0 = <&pinmux_csi>;
pinctrl-names = "default";

port {
ports {
csi_ep_in: endpoint {
remote-endpoint = <&ov7725_ep_out>;
};
Expand Down
4 changes: 2 additions & 2 deletions boards/nxp/mimxrt1050_evk/mimxrt1050_evk.dts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@

panel {
compatible = "rocktech,rk043fn02h-ct";
port {
ports {
lcd_panel_in: endpoint {
remote-endpoint = <&lcd_panel_out>;
};
Expand Down Expand Up @@ -135,7 +135,7 @@ arduino_serial: &lpuart3 {
pinctrl-0 = <&pinmux_lcdif>;
pinctrl-names = "default";
backlight-gpios = <&gpio2 31 GPIO_ACTIVE_HIGH>;
port {
ports {
lcd_panel_out: endpoint {
remote-endpoint = <&lcd_panel_in>;
};
Expand Down
4 changes: 2 additions & 2 deletions boards/nxp/mimxrt1060_evk/mimxrt1060_evk.dts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@

panel {
compatible = "rocktech,rk043fn02h-ct";
port {
ports {
lcd_panel_in: endpoint {
remote-endpoint = <&lcd_panel_out>;
};
Expand Down Expand Up @@ -137,7 +137,7 @@ arduino_serial: &lpuart3 {
pinctrl-0 = <&pinmux_lcdif>;
pinctrl-names = "default";
backlight-gpios = <&gpio2 31 GPIO_ACTIVE_HIGH>;
port {
ports {
lcd_panel_out: endpoint {
remote-endpoint = <&lcd_panel_in>;
};
Expand Down
8 changes: 4 additions & 4 deletions boards/nxp/mimxrt1064_evk/mimxrt1064_evk.dts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@

panel {
compatible = "rocktech,rk043fn02h-ct";
port {
ports {
lcd_panel_in: endpoint {
remote-endpoint = <&lcd_panel_out>;
};
Expand Down Expand Up @@ -136,7 +136,7 @@ arduino_i2c: &lpi2c1 {};
pinctrl-0 = <&pinmux_lcdif>;
pinctrl-names = "default";
backlight-gpios = <&gpio2 31 GPIO_ACTIVE_HIGH>;
port {
ports {
lcd_panel_out: endpoint {
remote-endpoint = <&lcd_panel_in>;
};
Expand All @@ -154,7 +154,7 @@ arduino_i2c: &lpi2c1 {};
reg = <0x48>;
status = "okay";

port {
ports {
mt9m114_ep_out: endpoint {
remote-endpoint = <&csi_ep_in>;
};
Expand Down Expand Up @@ -276,7 +276,7 @@ zephyr_udc0: &usb1 {
pinctrl-0 = <&pinmux_csi>;
pinctrl-names = "default";

port {
ports {
csi_ep_in: endpoint {
remote-endpoint = <&mt9m114_ep_out>;
};
Expand Down
2 changes: 1 addition & 1 deletion dts/bindings/video/st,stm32-dcmi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ description: |
STM32_DMA_MEM_INC | STM32_DMA_PERIPH_8BITS | STM32_DMA_MEM_32BITS |
STM32_DMA_PRIORITY_HIGH) STM32_DMA_FIFO_1_4>;
port {
ports {
dcmi_ep_in: endpoint {
remote-endpoint = <&ov2640_ep_out>;
};
Expand Down

0 comments on commit 045a59c

Please sign in to comment.