Registered User mNo edit summary |
Registered User mNo edit summary Tag: 2017 source edit |
||
(26 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<noinclude>{{ApplicableFor | <noinclude> | ||
|MPUs list=STM32MP13x, STM32MP15x | {{ApplicableFor | ||
|MPUs checklist=STM32MP13x,STM32MP15x | |MPUs list=STM32MP13x, STM32MP15x, STM32MP21x, STM32MP23x, STM32MP25x | ||
}}</noinclude> | |MPUs checklist=STM32MP13x, STM32MP15x, STM32MP21x, STM32MP23x, STM32MP25x | ||
}} | |||
</noinclude> | |||
== Article purpose == | == Article purpose == | ||
Line 19: | Line 21: | ||
'''STM32CubeMX''' can be used to generate the board device tree. Refer to [[#How_to_configure_the_DT_using_STM32CubeMX|How to configure the DT using STM32CubeMX]] for more details. | '''STM32CubeMX''' can be used to generate the board device tree. Refer to [[#How_to_configure_the_DT_using_STM32CubeMX|How to configure the DT using STM32CubeMX]] for more details. | ||
===DT configuration (STM32/SoC level) === | |||
===DT configuration (STM32 level) === | |||
The LTDC device tree node is declared in: | The LTDC device tree node is declared in: | ||
<div class="mw-collapsible mw-collapsed" data-expandtext="Click here to show the example" data-collapsetext="Click here to hide the example"> | <div class="mw-collapsible mw-collapsed" data-expandtext="Click here to show the example" data-collapsetext="Click here to hide the example"> | ||
* {{CodeSource | Linux kernel | arch/arm/boot/dts/stm32mp135.dtsi}} on | * {{CodeSource | Linux kernel | arch/arm/boot/dts/st/stm32mp135.dtsi}} on {{MicroprocessorDevice | device=13}} | ||
<div class="mw-collapsible-content"> | <div class="mw-collapsible-content"> | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="dts"> | ||
... | |||
&etzpc { | |||
... | ... | ||
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>; | |||
access-controllers = <&etzpc 3>; | |||
status = "disabled"; | |||
}; | }; | ||
... | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</div> | </div> | ||
Line 47: | Line 47: | ||
<div class="mw-collapsible mw-collapsed" data-expandtext="Click here to show the example" data-collapsetext="Click here to hide the example"> | <div class="mw-collapsible mw-collapsed" data-expandtext="Click here to show the example" data-collapsetext="Click here to hide the example"> | ||
* {{CodeSource | Linux kernel | arch/arm/boot/dts/stm32mp151.dtsi}} on | * {{CodeSource | Linux kernel | arch/arm/boot/dts/st/stm32mp151.dtsi}} on {{MicroprocessorDevice | device=15}} | ||
<div class="mw-collapsible-content"> | <div class="mw-collapsible-content"> | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="dts"> | ||
/ { | / { | ||
... | |||
soc { | soc { | ||
... | ... | ||
Line 62: | Line 63: | ||
resets = <&rcc LTDC_R>; | resets = <&rcc LTDC_R>; | ||
status = "disabled"; | status = "disabled"; | ||
}; | }; | ||
... | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</div> | </div> | ||
</div> | </div> | ||
<div class="mw-collapsible mw-collapsed" data-expandtext="Click here to show the example" data-collapsetext="Click here to hide the example"> | <div class="mw-collapsible mw-collapsed" data-expandtext="Click here to show the example" data-collapsetext="Click here to hide the example"> | ||
* {{CodeSource | Linux kernel | arch/ | * {{CodeSource | Linux kernel | arch/arm64/boot/dts/st/stm32mp215.dtsi}} on {{MicroprocessorDevice | device=21}} | ||
<div class="mw-collapsible-content"> | <div class="mw-collapsible-content"> | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="dts"> | ||
... | ... | ||
&soc1 { | |||
ltdc: display-controller@48010000 { | |||
compatible = "st,stm32mp21-ltdc"; | |||
reg = <0x48010000 0x400>; | |||
st,syscon = <&syscfg>; | |||
interrupts = <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>, | |||
<GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>; | |||
clocks = <&rcc CK_BUS_LTDC>, <&rcc CK_KER_LTDC>; | |||
clock-names = "bus", "lcd"; | |||
resets = <&rcc LTDC_R>; | |||
power-domains = <&CLUSTER_PD>; | |||
status = "disabled"; | |||
access-controllers = <&rifsc 80>; | |||
access-controller-names = "cmn"; | |||
l1l2 { | |||
access-controllers = <&rifsc 119>; | |||
access-controller-names = "l1l2"; | |||
}; | |||
l3 { | |||
access-controllers = <&rifsc 120>; | |||
access-controller-names = "l3"; | |||
}; | }; | ||
rot { | |||
access-controllers = <&rifsc 121>; | |||
access-controller-names = "rot"; | |||
}; | }; | ||
}; | }; | ||
}; | |||
... | ... | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</div> | </div> | ||
Line 153: | Line 109: | ||
<div class="mw-collapsible mw-collapsed" data-expandtext="Click here to show the example" data-collapsetext="Click here to hide the example"> | <div class="mw-collapsible mw-collapsed" data-expandtext="Click here to show the example" data-collapsetext="Click here to hide the example"> | ||
* {{CodeSource | Linux kernel | arch/ | * {{CodeSource | Linux kernel | arch/arm64/boot/dts/st/stm32mp231.dtsi}} on {{MicroprocessorDevice | device=23}} | ||
<div class="mw-collapsible-content"> | <div class="mw-collapsible-content"> | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="dts"> | ||
... | |||
rifsc: bus@42080000 { | |||
... | ... | ||
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>; | |||
power-domains = <&CLUSTER_PD>; | |||
status = "disabled"; | |||
access-controllers = <&rifsc 80>; | |||
access-controller-names = "cmn"; | |||
l1l2 { | |||
access-controllers = <&rifsc 119>; | |||
access-controller-names = "l1l2"; | |||
}; | |||
l3 { | |||
access-controllers = <&rifsc 120>; | |||
access-controller-names = "l3"; | |||
}; | |||
rot { | |||
access-controllers = <&rifsc 121>; | |||
access-controller-names = "rot"; | |||
}; | |||
}; | |||
... | |||
</syntaxhighlight> | |||
</div> | |||
</div> | |||
<div class="mw-collapsible mw-collapsed" data-expandtext="Click here to show the example" data-collapsetext="Click here to hide the example"> | |||
* {{CodeSource | Linux kernel | arch/arm64/boot/dts/st/stm32mp251.dtsi}} on {{MicroprocessorDevice | device=25}} | |||
<div class="mw-collapsible-content"> | |||
<syntaxhighlight lang="dts"> | |||
... | |||
rifsc: bus@42080000 { | |||
... | |||
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>; | |||
power-domains = <&CLUSTER_PD>; | |||
status = "disabled"; | |||
access-controllers = <&rifsc 80>; | |||
access-controller-names = "cmn"; | |||
l1l2 { | |||
access-controllers = <&rifsc 119>; | |||
access-controller-names = "l1l2"; | |||
}; | |||
l3 { | |||
access-controllers = <&rifsc 120>; | |||
access-controller-names = "l3"; | |||
}; | |||
rot { | |||
access-controllers = <&rifsc 121>; | |||
access-controller-names = "rot"; | |||
}; | |||
}; | |||
... | ... | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</div> | </div> | ||
</div> | </div> | ||
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. | |||
{{Warning|This device tree part is related to STM32 microprocessors. It must be kept as is, without being modified by the end-user.}} | |||
=== DT configuration (board level) === | |||
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 | |||
{{Info | When the LTDC is directly connected to an external display panel or a bridge thanks to GPIO, a LTDC Pinctrl <ref>[[Pinctrl device tree configuration]]</ref> configuration is required: | |||
* {{CodeSource | Linux kernel | arch/arm/boot/dts/st/stm32mp13-pinctrl.dtsi}} on {{MicroprocessorDevice | device=13}} | |||
* {{CodeSource | Linux kernel | arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi}} on {{MicroprocessorDevice | device=15}} | |||
* {{CodeSource | Linux kernel | arch/arm64/boot/dts/st/stm32mp21-pinctrl.dtsi}} on {{MicroprocessorDevice | device=21}} | |||
* {{CodeSource | Linux kernel | arch/arm64/boot/dts/st/stm32mp23-pinctrl.dtsi}} on {{MicroprocessorDevice | device=23}} | |||
* {{CodeSource | Linux kernel | arch/arm64/boot/dts/st/stm32mp25-pinctrl.dtsi}} on {{MicroprocessorDevice | device=25}} | |||
}} | |||
Full examples: | |||
<div class="mw-collapsible mw-collapsed" data-expandtext="Click here to show the example" data-collapsetext="Click here to hide the example"> | <div class="mw-collapsible mw-collapsed" data-expandtext="Click here to show the example" data-collapsetext="Click here to hide the example"> | ||
* [[STM32MP135x-DK_-_hardware_description | STM32MP13x Discovery board]] device tree | * [[STM32MP135x-DK_-_hardware_description | STM32MP13x Discovery board]] device tree: {{CodeSource | Linux kernel | arch/arm/boot/dts/st/stm32mp135f-dk.dts}} | ||
<div class="mw-collapsible-content"> | <div class="mw-collapsible-content"> | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="dts"> | ||
/ { | / { | ||
... | ... | ||
Line 497: | Line 262: | ||
<div class="mw-collapsible mw-collapsed" data-expandtext="Click here to show the example" data-collapsetext="Click here to hide the example"> | <div class="mw-collapsible mw-collapsed" data-expandtext="Click here to show the example" data-collapsetext="Click here to hide the example"> | ||
* [[STM32MP157x-DKx_-_hardware_description | STM32MP15x Discovery board]] device tree | * [[STM32MP157x-DKx_-_hardware_description | STM32MP15x Discovery board]] device tree: {{CodeSource | Linux kernel | arch/arm/boot/dts/st/stm32mp15xx-dkx.dtsi}} | ||
<div class="mw-collapsible-content"> | <div class="mw-collapsible-content"> | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="dts"> | ||
... | ... | ||
&i2c1 { | &i2c1 { | ||
Line 553: | Line 318: | ||
</div> | </div> | ||
<div class="mw-collapsible mw-collapsed" data-expandtext="Click here to show the example" data-collapsetext="Click here to hide the example"> | |||
* [[STM32MP257x-EV1 - hardware description | STM32MP257 Evaluation board]] device tree: {{CodeSource | Linux kernel | arch/arm64/boot/dts/st/stm32mp257f-ev1.dts}} | |||
<div class="mw-collapsible-content"> | |||
<syntaxhighlight lang="dts"> | |||
... | |||
/ { | |||
model = "STMicroelectronics STM32MP257F-EV1 Evaluation Board"; | |||
compatible = "st,stm32mp257f-ev1", "st,stm32mp257"; | |||
... | |||
hdmi: connector { | |||
compatible = "hdmi-connector"; | |||
label = "hdmi"; | |||
type = "a"; | |||
port { | |||
hdmi_connector_in: endpoint { | |||
remote-endpoint = <&adv753x_out>; | |||
}; | |||
}; | |||
}; | |||
... | |||
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"; | |||
}; | |||
... | |||
&dsi { | |||
vdd-supply = <&scmi_vddcore>; | |||
vdda18-supply = <&scmi_v1v8>; | |||
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 = <&adv753x_in>; | |||
}; | |||
}; | |||
}; | |||
}; | |||
... | |||
&i2c2 { | |||
pinctrl-names = "default", "sleep"; | |||
pinctrl-0 = <&i2c2_pins_a>; | |||
pinctrl-1 = <&i2c2_sleep_pins_a>; | |||
i2c-scl-rising-time-ns = <100>; | |||
i2c-scl-falling-time-ns = <13>; | |||
clock-frequency = <400000>; | |||
status = "okay"; | |||
/* spare dmas for other usage */ | |||
/delete-property/dmas; | |||
/delete-property/dma-names; | |||
... | |||
adv753x: hdmi@3d { | |||
/* | |||
* With MB1232 board, use "adi,adv7533" (1080p30) | |||
* With MB1752 board, use "adi,adv7535" (1080p60) | |||
*/ | |||
compatible = "adi,adv7533"; | |||
reg = <0x3d>, <0x3c>, <0x3f>, <0x38>; | |||
reg-names = "main", "cec", "edid", "packet"; | |||
clocks = <&cec_clock>; | |||
clock-names = "cec"; | |||
interrupt-parent = <&gpiod>; | |||
interrupts = <10 IRQ_TYPE_EDGE_FALLING>; | |||
status = "disabled"; | |||
adi,dsi-lanes = <4>; | |||
reset-gpios = <&gpiog 14 GPIO_ACTIVE_LOW>; | |||
avdd-supply = <&scmi_v1v8>; | |||
dvdd-supply = <&scmi_v1v8>; | |||
pvdd-supply = <&scmi_v1v8>; | |||
a2vdd-supply = <&scmi_v1v8>; | |||
v3p3-supply = <&scmi_v3v3>; | |||
v1p2-supply = <&scmi_v1v8>; | |||
ports { | |||
#address-cells = <1>; | |||
#size-cells = <0>; | |||
port@0 { | |||
reg = <0>; | |||
adv753x_in: endpoint { | |||
remote-endpoint = <&dsi_out1>; | |||
}; | |||
}; | |||
port@1 { | |||
reg = <1>; | |||
adv753x_out: endpoint { | |||
remote-endpoint = <&hdmi_connector_in>; | |||
}; | |||
}; | |||
port@2 { | |||
reg = <2>; | |||
adv753x_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 { | |||
default-on; | |||
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 { | |||
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 = <<dc_ep1_out>; | |||
}; | |||
}; | |||
port@1 { | |||
reg = <1>; | |||
lvds_out0: endpoint { | |||
remote-endpoint = <&lvds_panel_in>; | |||
}; | |||
}; | |||
}; | |||
}; | |||
... | |||
</syntaxhighlight> | |||
</div> | |||
</div> | |||
=== LTDC output rotation === | |||
Depending on the [[LTDC internal peripheral]] version, it is possible to rotate the display output. | |||
{{Info | An alternative option to LTDC output rotation is to use the GPU when presents in the system being used. An example of GPU rotation is provided in the [[Wayland Weston overview]] article.}} | |||
==== 180 degree rotation (only {{MicroprocessorDevice | device=13}} and {{MicroprocessorDevice | device=2}}) ==== | |||
Add a <code>rotation</code> property in the board <code>panel</code> device tree node like in [[STM32MP257x-EV1 - hardware description | STM32MP257 Evaluation board]] device tree {{CodeSource | Linux kernel | arch/arm64/boot/dts/st/stm32mp257f-ev1.dts}} | |||
<syntaxhighlight lang="dts" line start="20" highlight="8"> | |||
... | |||
panel_lvds: panel-lvds { | |||
compatible = "edt,etml0700z9ndha", "panel-lvds"; | |||
enable-gpios = <&gpiog 15 GPIO_ACTIVE_HIGH>; | |||
backlight = <&panel_lvds_backlight>; | |||
status = "okay"; | |||
rotation = <180>; | |||
... | |||
</syntaxhighlight> | |||
{{Info | The LTDC rotation does not modify the touchscreen orientation. Refer to the panel touchscreen documentation to adjust its orientation, most of time thanks to dedicated device tree properties.}} | |||
==== 90 or 270 degree rotation (only {{MicroprocessorDevice | device=23}} and {{MicroprocessorDevice | device=25}}) ==== | |||
On {{MicroprocessorDevice | device=23}} and {{MicroprocessorDevice | device=25}}, it is possible to use the 90 or 270 degree LTDC output rotation. | |||
1. The 90 or 270 degree rotation requires additional memory area, defined in the <code>ltdc_sec_rotation</code> device tree node located in {{CodeSource | Linux kernel | arch/arm64/boot/dts/st/stm32mp257f-ev1-ca35tdcid-resmem.dtsi}}: | |||
<syntaxhighlight lang="dts" line start="20" highlight="7-10"> | |||
/ { | |||
reserved-memory { | |||
#address-cells = <2>; | |||
#size-cells = <2>; | |||
ranges; | |||
... | |||
ltdc_sec_rotation: ltdc-sec-rotation@ff000000 { | |||
reg = <0x0 0xff000000 0x0 0x1000000>; | |||
no-map; | |||
}; | |||
</syntaxhighlight> | |||
{{Info | The 16Mbytes default value is perfect for a 1080p resolution and for a good memory alignment. If this memory area size needs to be adjusted, please refer to the '''LTDC Rotation chapter''' in the related [[STM32 MPU resources#Reference manuals|STM32 MPU reference manual]] for computation details.}} | |||
2. The <code>rotation</code> property needs to be added in the board <code>panel</code> device tree node like in [[STM32MP257x-EV1 - hardware description | STM32MP257 Evaluation board]] device tree {{CodeSource | Linux kernel | arch/arm64/boot/dts/st/stm32mp257f-ev1.dts}} | |||
<syntaxhighlight lang="dts" line start="20" highlight="8"> | |||
... | |||
panel_lvds: panel-lvds { | |||
compatible = "edt,etml0700z9ndha", "panel-lvds"; | |||
enable-gpios = <&gpiog 15 GPIO_ACTIVE_HIGH>; | |||
backlight = <&panel_lvds_backlight>; | |||
status = "okay"; | |||
rotation = <90>; | |||
... | |||
</syntaxhighlight> | |||
3. The horizontal and vertical panel timings and dimensions need to be permuted in the board <code>panel</code> device tree node like in [[STM32MP257x-EV1 - hardware description | STM32MP257 Evaluation board]] device tree {{CodeSource | Linux kernel | arch/arm64/boot/dts/st/stm32mp257f-ev1.dts}} | |||
<syntaxhighlight lang="dts" line start="20" highlight="10-11, 14, 17-24"> | |||
... | |||
panel_lvds: panel-lvds { | |||
compatible = "edt,etml0700z9ndha", "panel-lvds"; | |||
enable-gpios = <&gpiog 15 GPIO_ACTIVE_HIGH>; | |||
backlight = <&panel_lvds_backlight>; | |||
status = "okay"; | |||
rotation = <90>; | |||
width-mm = <92>; /* width-mm & height-mm are permuted for 90° rotation */ | |||
height-mm = <156>; | |||
data-mapping = "vesa-24"; | |||
/* Find below timings for the 90° rotation ("h" & "v" timings are permuted) */ | |||
panel-timing { | |||
clock-frequency = <54000000>; | |||
hactive = <600>; | |||
vactive = <1024>; | |||
hfront-porch = <24>; | |||
hback-porch = <24>; | |||
hsync-len = <21>; | |||
vfront-porch = <150>; | |||
vback-porch = <150>; | |||
vsync-len = <21>; | |||
}; | |||
/* Find below original values for 0° rotation */ | |||
/* | |||
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>; | |||
}; | |||
}; | |||
}; | |||
... | |||
</syntaxhighlight> | |||
{{Info | In the above example, the panel timings are located in the <code>panel</code> device tree node. Depending on the panel driver, the panel timings may be located in the panel driver file.}} | |||
4. Find below some attention points: | |||
* '''Touchscreen''': The LTDC rotation does not modify the touchscreen orientation. Refer to the panel touchscreen documentation to adjust its orientation, most of time thanks to dedicated device tree properties. | |||
* '''Performances''': The 90 or 270 degree rotation requires additional memory area used by the LTDC internal peripheral. It means that the overall memory bandwidth used during a use case with rotation is bigger than without the rotation. Depending on the system load, some LTDC fifo issues may appears. | |||
{{ReviewsComments|[[User:Philippe Cornu|Philippe Cornu]] Add limitations to 1080x1898p60 for landscape panels}} | |||
==How to configure the DT using STM32CubeMX== | ==How to configure the DT using STM32CubeMX== | ||
Line 561: | Line 643: | ||
Please refer to the following links for additional information: | Please refer to the following links for additional information: | ||
<references /> | <references /> | ||
{{ReviewsComments|-- [[User:Philippe Cornu|Philippe Cornu]] ([[User talk:Philippe Cornu|talk]]) 16:32, 13 June 2024 (CEST)<br />Add secure layer support example}} | |||
{{ReviewsComments|-- [[User:Philippe Cornu|Philippe Cornu]] ([[User talk:Philippe Cornu|talk]]) 16:32, 13 June 2024 (CEST)<br />Add gamma support example}} | |||
<noinclude> | <noinclude> |
Latest revision as of 14:48, 14 October 2024
1. Article purpose[edit | 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 | edit source]
The LTDC is represented by the STM32 LTDC device tree bindings [3].
3. DT configuration[edit | 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 | edit source]
The LTDC device tree node is declared in:
- arch/arm/boot/dts/st/stm32mp135.dtsi on STM32MP13x lines
- arch/arm/boot/dts/st/stm32mp151.dtsi on STM32MP15x lines
- arch/arm64/boot/dts/st/stm32mp215.dtsi on STM32MP21x lines
- arch/arm64/boot/dts/st/stm32mp231.dtsi on STM32MP23x lines
- arch/arm64/boot/dts/st/stm32mp251.dtsi on STM32MP25x lines
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 | 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
Information |
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:
3.3. LTDC output rotation[edit | edit source]
Depending on the LTDC internal peripheral version, it is possible to rotate the display output.
Information |
An alternative option to LTDC output rotation is to use the GPU when presents in the system being used. An example of GPU rotation is provided in the Wayland Weston overview article. |
3.3.1. 180 degree rotation (only STM32MP13x lines and STM32MP2 series)[edit | edit source]
Add a rotation
property in the board panel
device tree node like in STM32MP257 Evaluation board device tree arch/arm64/boot/dts/st/stm32mp257f-ev1.dts
...
panel_lvds: panel-lvds {
compatible = "edt,etml0700z9ndha", "panel-lvds";
enable-gpios = <&gpiog 15 GPIO_ACTIVE_HIGH>;
backlight = <&panel_lvds_backlight>;
status = "okay";
rotation = <180>;
...
Information |
The LTDC rotation does not modify the touchscreen orientation. Refer to the panel touchscreen documentation to adjust its orientation, most of time thanks to dedicated device tree properties. |
3.3.2. 90 or 270 degree rotation (only STM32MP23x lines and STM32MP25x lines )[edit | edit source]
On STM32MP23x lines and STM32MP25x lines , it is possible to use the 90 or 270 degree LTDC output rotation.
1. The 90 or 270 degree rotation requires additional memory area, defined in the ltdc_sec_rotation
device tree node located in arch/arm64/boot/dts/st/stm32mp257f-ev1-ca35tdcid-resmem.dtsi :
/ {
reserved-memory {
#address-cells = <2>;
#size-cells = <2>;
ranges;
...
ltdc_sec_rotation: ltdc-sec-rotation@ff000000 {
reg = <0x0 0xff000000 0x0 0x1000000>;
no-map;
};
Information |
The 16Mbytes default value is perfect for a 1080p resolution and for a good memory alignment. If this memory area size needs to be adjusted, please refer to the LTDC Rotation chapter in the related STM32 MPU reference manual for computation details. |
2. The rotation
property needs to be added in the board panel
device tree node like in STM32MP257 Evaluation board device tree arch/arm64/boot/dts/st/stm32mp257f-ev1.dts
...
panel_lvds: panel-lvds {
compatible = "edt,etml0700z9ndha", "panel-lvds";
enable-gpios = <&gpiog 15 GPIO_ACTIVE_HIGH>;
backlight = <&panel_lvds_backlight>;
status = "okay";
rotation = <90>;
...
3. The horizontal and vertical panel timings and dimensions need to be permuted in the board panel
device tree node like in STM32MP257 Evaluation board device tree arch/arm64/boot/dts/st/stm32mp257f-ev1.dts
...
panel_lvds: panel-lvds {
compatible = "edt,etml0700z9ndha", "panel-lvds";
enable-gpios = <&gpiog 15 GPIO_ACTIVE_HIGH>;
backlight = <&panel_lvds_backlight>;
status = "okay";
rotation = <90>;
width-mm = <92>; /* width-mm & height-mm are permuted for 90° rotation */
height-mm = <156>;
data-mapping = "vesa-24";
/* Find below timings for the 90° rotation ("h" & "v" timings are permuted) */
panel-timing {
clock-frequency = <54000000>;
hactive = <600>;
vactive = <1024>;
hfront-porch = <24>;
hback-porch = <24>;
hsync-len = <21>;
vfront-porch = <150>;
vback-porch = <150>;
vsync-len = <21>;
};
/* Find below original values for 0° rotation */
/*
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>;
};
};
};
...
Information |
In the above example, the panel timings are located in the panel device tree node. Depending on the panel driver, the panel timings may be located in the panel driver file.
|
4. Find below some attention points:
- Touchscreen: The LTDC rotation does not modify the touchscreen orientation. Refer to the panel touchscreen documentation to adjust its orientation, most of time thanks to dedicated device tree properties.
- Performances: The 90 or 270 degree rotation requires additional memory area used by the LTDC internal peripheral. It means that the overall memory bandwidth used during a use case with rotation is bigger than without the rotation. Depending on the system load, some LTDC fifo issues may appears.
4. How to configure the DT using STM32CubeMX[edit | 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 | edit source]
Please refer to the following links for additional information: