1. Article purpose[edit source]
This article explains how to configure the LTDC [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 LTDC [1] used by the STM32 LTDC Linux driver.
2. DT bindings documentation[edit source]
The LTDC is represented by the STM32 LTDC 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/SoC level)[edit source]
The LTDC device tree node is declared in:
- arch/arm/boot/dts/stm32mp135.dtsi on STM32MP13x lines
...
/ {
soc {
etzpc: etzpc@5c007000 {
...
ltdc: display-controller@5a001000 {
compatible = "st,stm32-ltdc";
reg = <0x5a001000 0x400>;
interrupts = <GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc LTDC_PX>;
clock-names = "lcd";
resets = <&scmi_reset RST_SCMI_LTDC>;
feature-domains = <&etzpc STM32MP1_ETZPC_LTDC_ID>;
status = "disabled";
};
};
};
};
- arch/arm/boot/dts/stm32mp151.dtsi on STM32MP15x lines
/ {
#address-cells = <1>;
#size-cells = <1>;
...
soc {
...
ltdc: display-controller@5a001000 {
compatible = "st,stm32-ltdc";
reg = <0x5a001000 0x400>;
interrupts = <GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc LTDC_PX>;
clock-names = "lcd";
resets = <&rcc LTDC_R>;
status = "disabled";
};
...
- arch/arm64/boot/dts/st/stm32mp251.dtsi on STM32MP25x lines
...
rifsc: rifsc@42080000 {
compatible = "st,stm32mp25-sys-bus";
reg = <0x42080000 0x1000>;
#address-cells = <1>;
#size-cells = <1>;
ranges;
feature-domain-controller;
#feature-domain-cells = <1>;
...
ltdc: display-controller@48010000 {
compatible = "st,stm32mp25-ltdc";
reg = <0x48010000 0x400>;
st,syscon = <&syscfg>;
interrupts = <GIC_SPI 158 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 159 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc CK_BUS_LTDC>, <&rcc CK_KER_LTDC>;
clock-names = "bus", "lcd";
resets = <&rcc LTDC_R>;
feature-domains = <&rifsc STM32MP25_RIFSC_LTDC_CMN_ID>;
power-domains = <&CLUSTER_PD>;
status = "disabled";
};
...
The declaration (shown above) provides the hardware registers base address, the clocks, the interrupts and the reset. The port may be pre-populated to facilitate its use in the many other device tree files.
3.2. DT configuration (board level)[edit source]
The LTDC device tree related to a particular board may have the following nodes, depending on the board hardware:
- ltdc node: containing the LTDC pinctrl references and the in/out port descriptions
- panel or i2cx bridge rgb node (depending of the board hardware): containing the in/out port descriptions related to the LTDC node
- panel_backlight node (depending of the board hardware): related to the panel or bridge node
![]() |
When the LTDC is directly connected to an external display panel or a bridge thanks to GPIO, a LTDC Pinctrl [4] configuration is required:
|
Full examples:
/ {
...
panel_rgb: panel-rgb {
compatible = "rocktech,rk043fn48h", "panel-dpi";
enable-gpios = <&gpioi 7 GPIO_ACTIVE_HIGH>;
backlight = <&panel_backlight>;
power-supply = <&scmi_v3v3_sw>;
status = "okay";
width-mm = <105>;
height-mm = <67>;
port {
panel_in_rgb: endpoint {
remote-endpoint = <<dc_out_rgb>;
};
};
panel-timing {
clock-frequency = <10000000>;
hactive = <480>;
vactive = <272>;
hsync-len = <52>;
hfront-porch = <10>;
hback-porch = <10>;
vsync-len = <10>;
vfront-porch = <10>;
vback-porch = <10>;
};
};
...
};
...
<dc {
pinctrl-names = "default", "sleep";
pinctrl-0 = <<dc_pins_a>;
pinctrl-1 = <<dc_sleep_pins_a>;
status = "okay";
port {
#address-cells = <1>;
#size-cells = <0>;
ltdc_out_rgb: endpoint@0 {
reg = <0>;
remote-endpoint = <&panel_in_rgb>;
};
};
};
...
&i2c1 {
...
hdmi-transmitter@39 {
compatible = "sil,sii9022";
reg = <0x39>;
iovcc-supply = <&v3v3_hdmi>;
cvcc12-supply = <&v1v2_hdmi>;
reset-gpios = <&gpioa 10 GPIO_ACTIVE_LOW>;
interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
interrupt-parent = <&gpiog>;
#sound-dai-cells = <0>;
status = "okay";
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
sii9022_in: endpoint {
remote-endpoint = <<dc_ep0_out>;
};
};
port@3 {
reg = <3>;
sii9022_tx_endpoint: endpoint {
remote-endpoint = <&i2s2_endpoint>;
};
};
};
};
...
};
<dc {
pinctrl-names = "default", "sleep";
pinctrl-0 = <<dc_pins_a>;
pinctrl-1 = <<dc_sleep_pins_a>;
status = "okay";
port {
ltdc_ep0_out: endpoint@0 {
reg = <0>;
remote-endpoint = <&sii9022_in>;
};
};
};
...
/ {
model = "STMicroelectronics STM32MP257F-EV1 Evaluation Board";
compatible = "st,stm32mp257f-ev1", "st,stm32mp257";
...
panel_dsi_backlight: panel-dsi-backlight {
compatible = "gpio-backlight";
gpios = <&gpioi 5 GPIO_ACTIVE_LOW>;
default-on;
default-brightness-level = <0>;
status = "disabled";
};
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";
};
...
};
...
&dsi {
#address-cells = <1>;
#size-cells = <0>;
status = "disabled";
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
dsi_in: endpoint {
remote-endpoint = <<dc_ep0_out>;
};
};
port@1 {
reg = <1>;
dsi_out1: endpoint {
remote-endpoint = <&adv7535_in>;
};
};
};
};
...
&i2c2 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&i2c2_pins_a>;
pinctrl-1 = <&i2c2_sleep_pins_a>;
i2c-scl-rising-time-ns = <185>;
i2c-scl-falling-time-ns = <20>;
clock-frequency = <100000>;
status = "okay";
/* spare dmas for other usage */
/delete-property/dmas;
/delete-property/dma-names;
...
adv7535: hdmi@3d {
compatible = "adi,adv7535";
reg = <0x3d>, <0x3c>, <0x3f>, <0x38>;
reg-names = "main", "cec", "edid", "packet";
status = "disabled";
adi,dsi-lanes = <4>;
reset-gpios = <&gpiog 14 GPIO_ACTIVE_LOW>;
avdd-supply = <&scmi_v3v3>;
dvdd-supply = <&scmi_v3v3>;
pvdd-supply = <&scmi_v3v3>;
a2vdd-supply = <&scmi_v3v3>;
v3p3-supply = <&scmi_v3v3>;
v1p2-supply = <&scmi_v3v3>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
adv7535_in: endpoint {
remote-endpoint = <&dsi_out1>;
};
};
port@2 {
reg = <2>;
adv7535_tx_endpoint: endpoint {
remote-endpoint = <&i2s2_endpoint>;
};
};
};
};
ili2511: ili2511@41 {
compatible = "ilitek,ili251x";
reg = <0x41>;
interrupt-parent = <&gpioi>;
interrupts = <13 IRQ_TYPE_EDGE_FALLING>;
reset-gpios = <&gpiog 14 GPIO_ACTIVE_LOW>;
status = "okay";
};
};
<dc {
rotation-memory = <<dc_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 = <<dc_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.
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: