[PATCH v2 05/11] video: lcdif: make functional on i.MX8MP

Johannes Schneider <[email protected]>
Newsgroups org.infradead.lists.barebox
Message-ID <[email protected]>
The driver matches fsl,imx8mp-lcdif and its help text mentions i.MX8MP,
but two oversights left it unusable on that SoC:

  - Kconfig depends on ARCH_IMX9 || ARCH_IMX93, so setting
    CONFIG_DRIVER_VIDEO_LCDIF=y in an IMX8MP defconfig is silently
    forced back to n and the driver is never built.

  - lcdif_probe() acquires clk references but never ungates them.  In
    Linux runtime PM via the LCDIF power-domain genpd handles that;
    barebox has no runtime_pm wiring, so the LCDIF clock domain stays
    gated and the MMIO setup in atomic_enable silently no-ops --
    /dev/fb0 registers correctly but DISP_PARA / CTRLDESCL stay at 0
    and the panel is dark.

Add ARCH_IMX8MP to the depends-on clause, update the menu prompt to
match the help text, and clk_prepare_enable() the three clocks at the
start of lcdif_crtc_atomic_enable, after the pixel-clock rate is set.

Signed-off-by: Johannes Schneider <[email protected]>
---
 drivers/video/Kconfig     | 4 ++--
 drivers/video/lcdif_kms.c | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index ce10237221..2faad19a99 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -67,8 +67,8 @@ config DRIVER_VIDEO_IMX_IPU_OVERLAY
 	depends on DRIVER_VIDEO_IMX_IPU && (ARCH_IMX35 || ARCH_IMX31)
 
 config DRIVER_VIDEO_LCDIF
-	bool "i.MX9 framebuffer driver"
-	depends on ARCH_IMX9 || ARCH_IMX93
+	bool "i.MX8MP/9/93 LCDIFv3 framebuffer driver"
+	depends on ARCH_IMX8MP || ARCH_IMX9 || ARCH_IMX93
 	help
 	  Add support for the LCDIFv3 LCD controller found on
 	  i.MX8MP and i.MX93 SoCs.
diff --git a/drivers/video/lcdif_kms.c b/drivers/video/lcdif_kms.c
index 033df23186..3a31633818 100644
--- a/drivers/video/lcdif_kms.c
+++ b/drivers/video/lcdif_kms.c
@@ -326,6 +326,11 @@ static void lcdif_crtc_atomic_enable(struct lcdif_drm_private *lcdif,
 
 	clk_set_rate(lcdif->clk, mode->clock * 1000);
 
+	/* no runtime PM; ungate the LCDIF clocks ourselves */
+	clk_prepare_enable(lcdif->clk_axi);
+	clk_prepare_enable(lcdif->clk_disp_axi);
+	clk_prepare_enable(lcdif->clk);
+
 	lcdif_crtc_mode_set_nofb(lcdif, mode, vcstate);
 
 	/* Write cur_buf as well to avoid an initial corrupt frame */
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.