LVDS device tree configuration

Revision as of 11:07, 21 September 2023 by Registered User
Applicable for STM32MP25x lines

Unspecified MPUs checklist


1. Article purpose[edit source]

This article explains how to configure the LVDS [1] when the peripheral is assigned to the Linux® OS.

The configuration is performed using the device tree mechanism [2].

The Device tree provides a hardware description of the LVDS [1] used by the STM32 LVDS Linux driver.

2. DT bindings documentation[edit source]

The LVDS is represented by the STM32 LVDS device tree bindings [3].

3. DT configuration[edit source]

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

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 level)[edit source]

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

		lvds: lvds@48060000 {
			#clock-cells = <0>;
			compatible = "st,stm32-lvds";
			reg = <0x48060000 0x2000>;
			clocks = <&rcc CK_BUS_LVDS>, <&rcc CK_KER_LVDSPHY>,
				 <&syscfg 0>;
			clock-names = "pclk", "ref", "pixclk";
			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]

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

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

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

&ltdc {
	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 {
	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>;
			};
		};
	};
};

...
	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 = <0>;
		status = "okay";
	};

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.
The STM32CubeMX may not support all the properties described 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]

Please refer to the following links for additional information: