Last edited one month ago

LVDS device tree configuration

Applicable for STM32MP25x lines

1. Article purpose[edit source]

The purpose of this article is to explain how to configure the LVDS internal peripheral using the device tree mechanism, relying on the bindings documentation. The latter corresponds to the description of the required and optional device-tree properties.

2. DT bindings documentation[edit source]

The device tree binding documents are stored, either in the given applicable components listed below, or in the Linux kernel repository:

3. DT configuration[edit source]

This hardware description is a combination of the STM32 microprocessor device tree files (.dtsi extension) and the board device tree files (.dts extension). See the Device tree for an explanation of the device-tree file organization.

STM32CubeMX can be used to generate the board device tree. Refer to How to configure the DT using STM32CubeMX for more details.

3.1. DT configuration (STM32/SoC level)[edit source]

The LVDS node is located in the device tree file for the software components, supporting the peripheral and listed in the above DT bindings documentation paragraph.

The LVDS device tree node is declared in stm32mp255.dtsi [1]. The declaration (shown below) defines the hardware register base address, the clocks, and the reset.

	soc@0 {
		rifsc: rifsc@42080000 {
...
			lvds: lvds@48060000 {
				#clock-cells = <0>;
				compatible = "st,stm32mp25-lvds";
				reg = <0x48060000 0x2000>;
				clocks = <&rcc CK_BUS_LVDS>, <&rcc CK_KER_LVDSPHY>;
				clock-names = "pclk", "ref";
				resets = <&rcc LVDS_R>;
				feature-domains = <&rifsc STM32MP25_RIFSC_LVDS_ID>;
				power-domains = <&CLUSTER_PD>;
				status = "disabled";
			};
...
Warning white.png Warning
This device tree part is related to STM32 microprocessors. It must be kept as is, without being modified by the end-user.


3.2. DT configuration (board level)[edit source]

Depending on the board hardware, the LVDS device tree related to a particular board may have the following nodes:

  • lvds node: it contains the in/out port descriptions.
  • ltdc node: it contains the in/out port description related to the lvds node.
  • panel_lvds node: it contains the LVDS panel description.
  • panel_lvds_backlight node: it is related to the panel node.

A full example of the STM32MP257 Evaluation board device tree is available in stm32mp257f-ev1.dts [2].

/ {
...
	panel_lvds: panel-lvds {
		compatible = "edt,etml0700z9ndha", "panel-lvds";
		enable-gpios = <&gpiog 15 GPIO_ACTIVE_HIGH>;
		backlight = <&panel_lvds_backlight>;
		status = "okay";

		width-mm = <156>;
		height-mm = <92>;
		data-mapping = "vesa-24";

		panel-timing {
			clock-frequency = <54000000>;
			hactive = <1024>;
			vactive = <600>;
			hfront-porch = <150>;
			hback-porch = <150>;
			hsync-len = <21>;
			vfront-porch = <24>;
			vback-porch = <24>;
			vsync-len = <21>;
		};

		port {
			lvds_panel_in: endpoint {
				remote-endpoint = <&lvds_out0>;
			};
		};
	};

	panel_lvds_backlight: panel-lvds-backlight {
		compatible = "gpio-backlight";
		gpios = <&gpioi 5 GPIO_ACTIVE_HIGH>;
		default-on;
		default-brightness-level = <1>;
		status = "okay";
	};

...
};

&ltdc {
	default-on;
	rotation-memory = <&ltdc_sec_rotation>;
	status = "okay";

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

		ltdc_ep0_out: endpoint@0 {
			reg = <0>;
			remote-endpoint = <&dsi_in>;
		};

		ltdc_ep1_out: endpoint@1 {
			reg = <1>;
			remote-endpoint = <&lvds_in>;
		};
	};
};

&lvds {
	default-on;
	vdd-supply =  <&scmi_vddcore>;
	vdda18-supply = <&scmi_v1v8>;
	status = "okay";

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

		port@0 {
			reg = <0>;
			lvds_in: endpoint {
				remote-endpoint = <&ltdc_ep1_out>;
			};
		};

		port@1 {
			reg = <1>;
			lvds_out0: endpoint {
				remote-endpoint = <&lvds_panel_in>;
			};
		};
	};
};
...

4. How to configure the DT using STM32CubeMX[edit source]

The STM32CubeMX tool can be used to configure the STM32MPU device and get the corresponding platform configuration device tree files.
STM32CubeMX may not support all the properties described in the DT binding files listed in the above DT bindings documentation paragraph. If so, the tool inserts user sections in the generated device tree. These sections can then be edited to add some properties, and they are preserved from one generation to another. Refer to STM32CubeMX user manual for further information.

5. References[edit source]

Refer to the following links for additional information: