Select the STM32MP25 LTDC pixel clock source for the RGB output
Subsystems (3)
cover Select the STM32MP25 LTDC pixel clock source for the RGB output
On STM32MP25 the LTDC pixel clock is selected in the SYSCFG DISPLAYCLKCR register among the DSI byte lane clock, the LVDS PHY pixel clock (reset value) and the LTDC kernel clock. The SYSCFG node is already described as provider of this clock, which the LTDC references as "ref" clock, but no driver registers it, so the RGB (DPI) output can't work.
This series adds a driver for this mux, probed as an auxiliary device of the STM32MP2 SYSCFG driver, and selects the pixel clock source on the Engicam MicroGEA-STM32MP257D-RMM display overlays. Patch 1 is an independent fix for the RGB display overlay.
Tested on the Engicam MicroGEA-STM32MP257D-RMM board with both the RGB (Rocktech RK050HR345-CT106A) and the LVDS (Ampire AM-1280800W8TZQW-T00H) displays.
I am sending it as RFC since I am not sure about:
- the mux parents are referenced by their global names. Should they rather be described by clocks/clock-names in the SYSCFG binding? Moreover, no driver registers "txbyteclk" yet.
- the pixel clock source is selected in the board devicetree by assigned-clock-parents. Should the LTDC driver rather select it according to its output (RGB, LVDS or DSI)?
Dario Binacchi (4):
arm64: dts: st: fix the Engicam RMM RGB display pixel clock
clk: stm32: add STM32MP25 SYSCFG clock driver
soc: st: stm32mp2-syscfg: register the STM32MP25 clock device
arm64: dts: st: select the Engicam RMM display pixel clock source
...gea-rmm-overlay-am-1280800w8tzqw-t00h.dtso | 3 + ...icrogea-rmm-overlay-rk050hr345-ct106a.dtso | 5 + drivers/clk/stm32/Kconfig | 12 ++ drivers/clk/stm32/Makefile | 1 + drivers/clk/stm32/clk-stm32mp25-syscfg.c | 111 ++++++++++++++++++ drivers/soc/st/Kconfig | 1 + drivers/soc/st/stm32mp2-syscfg.c | 28 ++++- 7 files changed, 159 insertions(+), 2 deletions(-) create mode 100644 drivers/clk/stm32/clk-stm32mp25-syscfg.c
---
base-commit: 65ba8f34ec886ec72b2c07ddc8cf3d815c32869d
branch: stm32mp25-ltdc-pixclk
Signature · 1 line
2.43.0
RFC PATCH 1/4 arm64: dts: st: fix the Engicam RMM RGB display pixel clock
On STM32MP255/257 the LTDC "lcd" clock is a fixed placeholder, since with the LVDS output the pixel clock comes from the LVDS PHY. With the RGB output the pixel clock is instead the LTDC kernel clock (ck_ker_ltdc). Since no consumer references it, the clock is turned off by clk_disable_unused() and its rate is never set. As a result, the LTDC does not run and every commit times out:
[CRTC:42:crtc-0] vblank wait timed out
[drm] *ERROR* flip_done timed out
Use ck_ker_ltdc as "lcd" clock for the RGB panel overlay.
---
...2mp257d-engicam-microgea-rmm-overlay-rk050hr345-ct106a.dtso | 3 +++ 1 file changed, 3 insertions(+)
arch/arm64/boot/dts/st/stm32mp257d-engicam-microgea-rmm-overlay-rk050hr345-ct106a.dtso +3 -0
@@ -10,6 +10,7 @@ /dts-v1/; /plugin/; +#include <dt-bindings/clock/st,stm32mp25-rcc.h> #include <dt-bindings/gpio/gpio.h> #include <dt-bindings/interrupt-controller/irq.h>
@@ -35,6 +36,8 @@ touchscreen@38 { }; <dc { + /* RGB output: the pixel clock is the LTDC kernel clock */ + clocks = <&rcc CK_KER_LTDC>, <&rcc CK_BUS_LTDC>, <&syscfg>, <&lvds>; pinctrl-names = "default", "sleep"; pinctrl-0 = <<dc_pins_a>; pinctrl-1 = <<dc_sleep_pins_a>;
Signature · 1 line
2.43.0
RFC PATCH 2/4 clk: stm32: add STM32MP25 SYSCFG clock driver
In reply to Dario BinacchiOn STM32MP25 the LTDC pixel clock is selected in the SYSCFG DISPLAYCLKCR register among the DSI byte lane clock, the LVDS PHY pixel clock (reset value) and the LTDC kernel clock, the latter being the one needed by the RGB (DPI) output.
The SYSCFG node already provides this clock ("#clock-cells = <0>"), referenced by the LTDC as "ref" clock, but no driver registers it, so the selection is stuck at the reset value and a display connected to the LTDC RGB output can't work.
Add a driver registering this clock as a mux. The SYSCFG node is already bound to the STM32MP2 SYSCFG driver, so the clock driver is bound to an auxiliary device created by the latter, which shares the SYSCFG node and regmap.
---
drivers/clk/stm32/Kconfig | 12 +++ drivers/clk/stm32/Makefile | 1 + drivers/clk/stm32/clk-stm32mp25-syscfg.c | 111 +++++++++++++++++++++++ 3 files changed, 124 insertions(+) create mode 100644 drivers/clk/stm32/clk-stm32mp25-syscfg.c
drivers/clk/stm32/Kconfig +12 -0
@@ -39,5 +39,17 @@ config COMMON_CLK_STM32MP257 help Support for stm32mp25x SoC family clocks. +config COMMON_CLK_STM32MP25_SYSCFG + tristate "Clock driver for stm32mp25x SYSCFG clocks" + depends on COMMON_CLK_STM32MP257 + select AUXILIARY_BUS + select MFD_SYSCON + default COMMON_CLK_STM32MP257 + help + Support for the clocks provided by the stm32mp25x SYSCFG, i.e. + the LTDC pixel clock source selection between the LTDC kernel + clock (RGB output), the LVDS PHY pixel clock and the DSI byte + lane clock. + endif
drivers/clk/stm32/Makefile +1 -0
@@ -2,3 +2,4 @@ obj-$(CONFIG_COMMON_CLK_STM32MP135) += clk-stm32mp13.o clk-stm32-core.o reset-st obj-$(CONFIG_COMMON_CLK_STM32MP157) += clk-stm32mp1.o reset-stm32.o obj-$(CONFIG_COMMON_CLK_STM32MP215) += clk-stm32mp21.o clk-stm32-core.o reset-stm32.o obj-$(CONFIG_COMMON_CLK_STM32MP257) += clk-stm32mp25.o clk-stm32-core.o reset-stm32.o +obj-$(CONFIG_COMMON_CLK_STM32MP25_SYSCFG) += clk-stm32mp25-syscfg.o
drivers/clk/stm32/clk-stm32mp25-syscfg.c new file +111 -0
111 lines not on this page · raw message
Signature · 1 line
2.43.0
RFC PATCH 3/4 soc: st: stm32mp2-syscfg: register the STM32MP25 clock device
In reply to Dario BinacchiThe STM32MP25 SYSCFG provides the LTDC pixel clock mux, whose driver is an auxiliary driver since the SYSCFG node is bound to this driver.
Create the auxiliary device for the clock driver on STM32MP25.
---
drivers/soc/st/Kconfig | 1 + drivers/soc/st/stm32mp2-syscfg.c | 28 ++++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-)
drivers/soc/st/Kconfig +1 -0
@@ -5,6 +5,7 @@ config SOC_STM32MP2 tristate "STM32MP2 SoC family support" depends on ARCH_STM32 || COMPILE_TEST default ARCH_STM32 && ARM64 + select AUXILIARY_BUS select SOC_BUS help If you say yes here, you get support for the ST STM32MP2 family
drivers/soc/st/stm32mp2-syscfg.c +26 -2
@@ -3,18 +3,42 @@* Copyright 2026 Marek Vasut */ +#include <linux/auxiliary_bus.h> #include <linux/module.h> #include <linux/of_platform.h> #include <linux/platform_device.h> +#include <linux/property.h> + +struct stm32mp2_syscfg_data { +bool has_clk; +};static int stm32mp2_syscfg_probe (struct platform_device *pdev) { -return devm_of_platform_populate (&pdev->dev); +const struct stm32mp2_syscfg_data *data; +struct device *dev = &pdev->dev; +int ret; + + ret =devm_of_platform_populate (dev); +if (ret) +return ret; + + data =device_get_match_data (dev); +if (data && data->has_clk && + !devm_auxiliary_device_create (dev,"clk" ,NULL )) +return dev_err_probe (dev, -ENODEV , +"failed to register the clock device\n" ); + +return 0 ; } +static const struct stm32mp2_syscfg_data stm32mp25_syscfg_data = { + .has_clk = true, +}; +static const struct of_device_id stm32mp2_syscfg_ids[] = { { .compatible ="st,stm32mp23-syscfg" }, - { .compatible ="st,stm32mp25-syscfg" }, + { .compatible ="st,stm32mp25-syscfg" , .data = &stm32mp25_syscfg_data }, { } };MODULE_DEVICE_TABLE (of, stm32mp2_syscfg_ids);
Signature · 1 line
2.43.0
RFC PATCH 4/4 arm64: dts: st: select the Engicam RMM display pixel clock source
In reply to Dario BinacchiOn STM32MP255/257 the LTDC pixel clock is selected by the SYSCFG pixel clock mux, whose reset value is the LVDS PHY pixel clock. With the RGB panel the LTDC is then clocked by the unused LVDS PHY, and every commit times out:
[CRTC:42:crtc-0] vblank wait timed out
[drm] *ERROR* flip_done timed out
Select the LTDC kernel clock as pixel clock source in the RGB panel overlay and, for consistency, without relying on the reset value, the LVDS PHY pixel clock in the LVDS panel overlay.
---
...57d-engicam-microgea-rmm-overlay-am-1280800w8tzqw-t00h.dtso | 3 +++ ...2mp257d-engicam-microgea-rmm-overlay-rk050hr345-ct106a.dtso | 2 ++ 2 files changed, 5 insertions(+)
arch/arm64/boot/dts/st/stm32mp257d-engicam-microgea-rmm-overlay-am-1280800w8tzqw-t00h.dtso +3 -0
@@ -32,6 +32,9 @@ &framebuffer { }; <dc { + /* LVDS output: the pixel clock is the LVDS PHY one */ + assigned-clocks = <&syscfg>; + assigned-clock-parents = <&lvds>; status = "okay"; port {
arch/arm64/boot/dts/st/stm32mp257d-engicam-microgea-rmm-overlay-rk050hr345-ct106a.dtso +2 -0
@@ -38,6 +38,8 @@ touchscreen@38 { <dc { /* RGB output: the pixel clock is the LTDC kernel clock */ clocks = <&rcc CK_KER_LTDC>, <&rcc CK_BUS_LTDC>, <&syscfg>, <&lvds>; + assigned-clocks = <&syscfg>; + assigned-clock-parents = <&rcc CK_KER_LTDC>; pinctrl-names = "default", "sleep"; pinctrl-0 = <<dc_pins_a>; pinctrl-1 = <<dc_sleep_pins_a>;
Signature · 1 line
2.43.0
Re: [RFC PATCH 4/4] arm64: dts: st: select the Engicam RMM display pixel clock source
Hi Dario,
The parent clock of ltdc must not be assigned in the DTS file. The ltdc driver must check the display path at probe and assign the parent clock based on the type of connected panel (LVDS/DSI or DPI).
Best regards
Quoted 47 lines · Dario Binacchi
On STM32MP255/257 the LTDC pixel clock is selected by the SYSCFG pixel clock mux, whose reset value is the LVDS PHY pixel clock. With the RGB panel the LTDC is then clocked by the unused LVDS PHY, and every commit times out:
[CRTC:42:crtc-0] vblank wait timed out
[drm] *ERROR*flip_donetimed outSelect the LTDC kernel clock as pixel clock source in the RGB panel overlay and, for consistency, without relying on the reset value, the LVDS PHY pixel clock in the LVDS panel overlay.
Signed-off-by Dario Binacchi <[email protected]>---
...57d-engicam-microgea-rmm-overlay-am-1280800w8tzqw-t00h.dtso | 3 +++ ...2mp257d-engicam-microgea-rmm-overlay-rk050hr345-ct106a.dtso | 2 ++ 2 files changed, 5 insertions(+)arch/arm64/boot/dts/st/stm32mp257d-engicam-microgea-rmm-overlay-am-1280800w8tzqw-t00h.dtso +3
-0@@ -32,6 +32,9 @@ &framebuffer { }; <dc { + /* LVDS output: the pixel clock is the LVDS PHY one */ + assigned-clocks = <&syscfg>; + assigned-clock-parents = <&lvds>; status = "okay"; port {arch/arm64/boot/dts/st/stm32mp257d-engicam-microgea-rmm-overlay-rk050hr345-ct106a.dtso +2
-0@@ -38,6 +38,8 @@ touchscreen@38 { <dc { /* RGB output: the pixel clock is the LTDC kernel clock */ clocks = <&rcc CK_KER_LTDC>, <&rcc CK_BUS_LTDC>, <&syscfg>, <&lvds>; + assigned-clocks = <&syscfg>; + assigned-clock-parents = <&rcc CK_KER_LTDC>; pinctrl-names = "default", "sleep"; pinctrl-0 = <<dc_pins_a>; pinctrl-1 = <<dc_sleep_pins_a>;
Hi Dario,
Thanks for working on this and for testing it on the Engicam board.
First, a small remark about patch 2/4: this driver is based on the one we deliver to our customers in the ST kernel on GitHub [1]. Please keep the original copyright and the Signed-off-by of the authors when you reuse such code, and add your own on top of them (e.g. with Co-developed-by).
Now about your two questions:
Quoted 3 lines · Dario Binacchi
- the mux parents are referenced by their global names. Should they rather be described by clocks/clock-names in the SYSCFG binding? Moreover, no driver registers "txbyteclk" yet.
Yes, I would also prefer to describe them in DT. I'm working on a version where the mux is described by a clock-controller sub-node of the SYSCFG node. This sub-node is populated by the STM32MP2 SYSCFG driver, so no auxiliary device is needed (patch 3/4 can be dropped):
syscfg: syscon@44230000 {
compatible = "st,stm32mp25-syscfg", "syscon";
...
syscfg_clk: clock-controller {
compatible = "st,stm32mp25-syscfg-clk"; #clock-cells = <1>;
clocks = <&rcc CK_KER_LTDC>, <&lvds>, <&clk_dsi_txbyte>; clock-names = "ltdc", "lvds", "dsi";
};
};
<dc {
clocks = ..., <&syscfg_clk CK_SYSCFG_PIX_LTDC>, ...; };
The driver takes the parents from the "clocks" property (clk_parent_data), so the inputs which don't exist on a given SoC (no LVDS/DSI on STM32MP231/251) are simply omitted. For "txbyteclk", we keep the existing clk_dsi_txbyte placeholder until the DSI driver provides this clock.
I also want to keep "#clock-cells = <1>" with a onecell provider: the SYSCFG has other clock selections, and I would like to be able to add them later in the same driver without changing the binding again.
Quoted 3 lines
- the pixel clock source is selected in the board devicetree by assigned-clock-parents. Should the LTDC driver rather select it according to its output (RGB, LVDS or DSI)?
I think the LTDC driver should select it: the source depends on the output used, not on the board. This is what we do in our downstream LTDC driver: it gets the mux as "ref" clock and calls clk_set_parent() according to the encoder type (LVDS PHY clock for LVDS, LTDC kernel clock otherwise) before setting the pixel clock rate. The board overlays then don't need assigned-clock-parents. Yannick and Raphael (in Cc) can comment on the LTDC side.
Since I have already reworked the clock driver this way (binding, driver and SoC DT), would you be OK if I take over the clk-stm32mp25-syscfg patch? I would send it in a series, keeping you as Co-developed-by, and you could then rebase your Engicam patches on top of it.
Best regards,
Gabriel
Quoted 47 lines · Dario Binacchi
On STM32MP25 the LTDC pixel clock is selected in the SYSCFG DISPLAYCLKCR register among the DSI byte lane clock, the LVDS PHY pixel clock (reset value) and the LTDC kernel clock. The SYSCFG node is already described as provider of this clock, which the LTDC references as "ref" clock, but no driver registers it, so the RGB (DPI) output can't work.
This series adds a driver for this mux, probed as an auxiliary device of the STM32MP2 SYSCFG driver, and selects the pixel clock source on the Engicam MicroGEA-STM32MP257D-RMM display overlays. Patch 1 is an independent fix for the RGB display overlay.
Tested on the Engicam MicroGEA-STM32MP257D-RMM board with both the RGB (Rocktech RK050HR345-CT106A) and the LVDS (Ampire AM-1280800W8TZQW-T00H) displays.
I am sending it as RFC since I am not sure about:
- the mux parents are referenced by their global names. Should they rather be described by clocks/clock-names in the SYSCFG binding? Moreover, no driver registers "txbyteclk" yet.
- the pixel clock source is selected in the board devicetree by assigned-clock-parents. Should the LTDC driver rather select it according to its output (RGB, LVDS or DSI)?
Dario Binacchi (4):
arm64: dts: st: fix the Engicam RMM RGB display pixel clock
clk: stm32: add STM32MP25 SYSCFG clock driver
soc: st: stm32mp2-syscfg: register the STM32MP25 clock device
arm64: dts: st: select the Engicam RMM display pixel clock source...gea-rmm-overlay-am-1280800w8tzqw-t00h.dtso | 3 + ...icrogea-rmm-overlay-rk050hr345-ct106a.dtso | 5 + drivers/clk/stm32/Kconfig | 12 ++ drivers/clk/stm32/Makefile | 1 + drivers/clk/stm32/clk-stm32mp25-syscfg.c | 111 ++++++++++++++++++ drivers/soc/st/Kconfig | 1 + drivers/soc/st/stm32mp2-syscfg.c | 28 ++++- 7 files changed, 159 insertions(+), 2 deletions(-)create mode 100644
drivers/clk/stm32/clk-stm32mp25-syscfg.c---
base-commit:65ba8f34ec886ec72b2c07ddc8cf3d815c32869d
branch: stm32mp25-ltdc-pixclk
Hi Gabriel,
Thanks for your review.
Quoted 10 lines · Gabriel FERNANDEZ
Hi Dario,
Thanks for working on this and for testing it on the Engicam board.
First, a small remark about patch 2/4: this driver is based on the one we deliver to our customers in the ST kernel on GitHub [1]. Please keep the original copyright and the Signed-off-by of the authors when you reuse such code, and add your own on top of them (e.g. with Co-developed-by).
You are right, I used your downstream driver as a reference and I should have kept your copyright and authorship. Sorry about that.
Quoted 50 lines
Now about your two questions:
Quoted 3 lines · Dario Binacchi
- the mux parents are referenced by their global names. Should they rather be described by clocks/clock-names in the SYSCFG binding? Moreover, no driver registers "txbyteclk" yet.
Yes, I would also prefer to describe them in DT. I'm working on a version where the mux is described by a clock-controller sub-node of the SYSCFG node. This sub-node is populated by the STM32MP2 SYSCFG driver, so no auxiliary device is needed (patch 3/4 can be dropped):
syscfg: syscon@44230000 { compatible = "st,stm32mp25-syscfg", "syscon"; ... syscfg_clk: clock-controller { compatible = "st,stm32mp25-syscfg-clk"; #clock-cells = <1>; clocks = <&rcc CK_KER_LTDC>, <&lvds>, <&clk_dsi_txbyte>; clock-names = "ltdc", "lvds", "dsi"; }; }; <dc { clocks = ..., <&syscfg_clk CK_SYSCFG_PIX_LTDC>, ...; };The driver takes the parents from the "clocks" property (
clk_parent_data), so the inputs which don't exist on a given SoC (no LVDS/DSI on STM32MP231/251) are simply omitted. For "txbyteclk", we keep the existingclk_dsi_txbyteplaceholder until the DSI driver provides this clock.I also want to keep "#clock-cells = <1>" with a onecell provider: the SYSCFG has other clock selections, and I would like to be able to add them later in the same driver without changing the binding again.
Quoted 3 lines
- the pixel clock source is selected in the board devicetree by assigned-clock-parents. Should the LTDC driver rather select it according to its output (RGB, LVDS or DSI)?
I think the LTDC driver should select it: the source depends on the output used, not on the board. This is what we do in our downstream LTDC driver: it gets the mux as "ref" clock and calls
clk_set_parent()according to the encoder type (LVDS PHY clock for LVDS, LTDC kernel clock otherwise) before setting the pixel clock rate. The board overlays then don't need assigned-clock-parents. Yannick and Raphael (in Cc) can comment on the LTDC side.
Quoted 5 lines
Since I have already reworked the clock driver this way (binding, driver and SoC DT), would you be OK if I take over the clk-stm32mp25-syscfg patch? I would send it in a series, keeping you as Co-developed-by, and you could then rebase your Engicam patches on top of it.
Yes, please go ahead. Please Cc me on your series, I will test it on the Engicam
MicroGEA-STM32MP257D-RMM with both the RGB and the LVDS displays.
About patch 1/4: in your SoC DT rework, will the LTDC "lcd" clock become CK_KER_LTDC on STM32MP255/257, as in your downstream kernel? In that case I will drop it, otherwise I will resend it on its own.
Thanks and regards,
Dario
Quoted 56 lines
Best regards,
GabrielQuoted 47 lines · Dario Binacchi
On STM32MP25 the LTDC pixel clock is selected in the SYSCFG DISPLAYCLKCR register among the DSI byte lane clock, the LVDS PHY pixel clock (reset value) and the LTDC kernel clock. The SYSCFG node is already described as provider of this clock, which the LTDC references as "ref" clock, but no driver registers it, so the RGB (DPI) output can't work.
This series adds a driver for this mux, probed as an auxiliary device of the STM32MP2 SYSCFG driver, and selects the pixel clock source on the Engicam MicroGEA-STM32MP257D-RMM display overlays. Patch 1 is an independent fix for the RGB display overlay.
Tested on the Engicam MicroGEA-STM32MP257D-RMM board with both the RGB (Rocktech RK050HR345-CT106A) and the LVDS (Ampire AM-1280800W8TZQW-T00H) displays.
I am sending it as RFC since I am not sure about:
- the mux parents are referenced by their global names. Should they rather be described by clocks/clock-names in the SYSCFG binding? Moreover, no driver registers "txbyteclk" yet.
- the pixel clock source is selected in the board devicetree by assigned-clock-parents. Should the LTDC driver rather select it according to its output (RGB, LVDS or DSI)?
Dario Binacchi (4):
arm64: dts: st: fix the Engicam RMM RGB display pixel clock
clk: stm32: add STM32MP25 SYSCFG clock driver
soc: st: stm32mp2-syscfg: register the STM32MP25 clock device
arm64: dts: st: select the Engicam RMM display pixel clock source...gea-rmm-overlay-am-1280800w8tzqw-t00h.dtso | 3 + ...icrogea-rmm-overlay-rk050hr345-ct106a.dtso | 5 + drivers/clk/stm32/Kconfig | 12 ++ drivers/clk/stm32/Makefile | 1 + drivers/clk/stm32/clk-stm32mp25-syscfg.c | 111 ++++++++++++++++++ drivers/soc/st/Kconfig | 1 + drivers/soc/st/stm32mp2-syscfg.c | 28 ++++- 7 files changed, 159 insertions(+), 2 deletions(-)create mode 100644
drivers/clk/stm32/clk-stm32mp25-syscfg.c---
base-commit:65ba8f34ec886ec72b2c07ddc8cf3d815c32869d
branch: stm32mp25-ltdc-pixclk
Signature · 9 lines
Dario Binacchi Senior Embedded Software Engineer M. +39 328 0625246 [email protected] ――――――――――――――― Amarula Solutions SRL Via Felice Cavallotti 25D, 41012 Carpi, MO, IT [email protected] www.amarulasolutions.com