Add i.MX8MP LVDS driver in uboot

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Add i.MX8MP LVDS driver in uboot

Add i.MX8MP LVDS driver in uboot

 

Test environment

 

i.MX8MP EVK LVDS0

LVDS-HDMI  bridge(it6263)

L5.15.5_1.0.0

Background

 

Some customers need show logo using LVDS panel.

Current BSP doesn't support LVDS driver in Uboot.

This patch provides i.MX8MPlus LVDS driver support in Uboot.

If you want to connect it to LVDS panel , you need port your lvds panel driver like  simple-panel.c

 

Update

[2022.9.19] Verify on L5.15.32_2.0.0

 0001-L5.15.32-Add-i.MX8MP-LVDS-driver-in-uboot

'probe device is failed, ret -2, probe video device failed, ret -19' is caused by below code. It has been merged in attachment.

// /* Only handle devices that have a valid ofnode */
	// if (dev_has_ofnode(dev) && !(dev->driver->flags & DM_FLAG_IGNORE_DEFAULT_CLKS)) {
	// 	/*
	// 	 * Process 'assigned-{clocks/clock-parents/clock-rates}'
	// 	 * properties
	// 	 */
	// 	ret = clk_set_defaults(dev, CLK_DEFAULTS_PRE);
	// 	if (ret)
	// 		goto fail;
	// }

 

[2023.3.14] Verify on L5.15.71

0001-L5.15.71-Add-i.MX8MP-LVDS-support-in-uboot

 

[2023.9.12]

For some panel with low DE, you need uncomment CTRL_INV_DE line and set this bit to 1.

#include <linux/string.h>
@@ -110,9 +111,8 @@ static void lcdifv3_set_mode(struct lcdifv3_priv *priv,
 		writel(CTRL_INV_HS, (ulong)(priv->reg_base + LCDIFV3_CTRL_SET));
 
 	/* SEC MIPI DSI specific */
-	writel(CTRL_INV_PXCK, (ulong)(priv->reg_base + LCDIFV3_CTRL_CLR));
-	writel(CTRL_INV_DE, (ulong)(priv->reg_base + LCDIFV3_CTRL_CLR));
-
+	//writel(CTRL_INV_PXCK, (ulong)(priv->reg_base + LCDIFV3_CTRL_CLR));
+	//writel(CTRL_INV_DE, (ulong)(priv->reg_base + LCDIFV3_CTRL_CLR));
 }

 

Zhiming_Liu_0-1694493549149.png

 

 

[2024.5.15]

If you are uing simple-panel.c, need use below patch to set display timing from panel to lcdif controller.

diff --git a/drivers/video/simple_panel.c b/drivers/video/simple_panel.c
index f9281d5e83..692c96dcaa 100644
--- a/drivers/video/simple_panel.c
+++ b/drivers/video/simple_panel.c
@@ -18,12 +18,27 @@ struct simple_panel_priv {
 	struct gpio_desc enable;
 };
 
+/* define your panel timing here and
+ * copy it in simple_panel_get_display_timing */
+static const struct display_timing boe_ev121wxm_n10_1850_timing = {
+	.pixelclock.typ		= 71143000,
+	.hactive.typ		= 1280,
+	.hfront_porch.typ	= 32,
+	.hback_porch.typ	= 80,
+	.hsync_len.typ		= 48,
+	.vactive.typ		= 800,
+	.vfront_porch.typ	= 6,
+	.vback_porch.typ	= 14,
+	.vsync_len.typ		= 3,
+};
+
@@ -100,10 +121,18 @@ static int simple_panel_probe(struct udevice *dev)
 
 	return 0;
 }
+static int simple_panel_get_display_timing(struct udevice *dev,
+					    struct display_timing *timings)
+{
+	memcpy(timings, &boe_ev121wxm_n10_1850_timing, sizeof(*timings));
+
+	return 0;
+}
 
 static const struct panel_ops simple_panel_ops = {
 	.enable_backlight	= simple_panel_enable_backlight,
 	.set_backlight		= simple_panel_set_backlight,
+	.get_display_timing = simple_panel_get_display_timing,
 };
 
 static const struct udevice_id simple_panel_ids[] = {
@@ -115,6 +144,7 @@ static const struct udevice_id simple_panel_ids[] = {
 	{ .compatible = "lg,lb070wv8" },
 	{ .compatible = "sharp,lq123p1jx31" },
 	{ .compatible = "boe,nv101wxmn51" },
+	{ .compatible = "boe,ev121wxm-n10-1850" },
 	{ }
 };

 

Attachments
Comments

@Zhiming_Liu 

Hi Sir , 

I saw you had posted the LVDS driver patch for imx8MP. 

May I know if there's a patch for old U-boot versions just like L5.10.72 and L5.5.70 ? thnaks. 

 

 

Hi @Phil_liu 

You can try to use it in L5.10.72

HI @Zhiming_Liu,   

We tried the patch in Yocto 3.0 bsp , but we still get patch fail message.  So,please help to provide Yocto 3.0 patch , thanks. 

Where do we find the version number (like L5.15.71)?

 

Hello,

I need to apply 0001-L5.15.71-Add-i.MX8MP-LVDS-support-in-uboot.patch.

I have u-boot-imx 5.15.71 'IMX8MP) but after applying the patch, I have this compilation error :

u-boot-imx/2022.04-r0/git/drivers/video/nxp/imx/imx_lcdifv3.c:349: undefined reference to `display_enable'

Any idea ?

Thanks.

@clemntnxp 

I have the same issue, have you solved it?

Thanks.

Just enable CONFIG_DISPLAY in your u-boot configuration build.

Now it compile but no splash screen...

@Zhiming_Liu 

Hi Sir , 

I use the LVDS panel and apply the L5.10.72 patch to the imx8mp uboot (Android 11.0.0_2.6.0), and first remove all the kernel panel drivers to verify whether the uboot patch settings are correct. The result is that I can see Android log, but I can't see the bootloader logo.


Therefore, after the board is powered on, there will be a black screen for a period of time, and then you will see the Android log.


However I want to know how to enable uboot logo? It seems that it was not added originally. 

 

Wilson

Hi @Wilson_S 

The default code has enabled the logo. You can test under Yocto BSP, it's very fast to verify it. Just need bitbake imx-boot and download it to ram with 'uuu imx-boot-xxxx'. You will see logo or not.

@Zhiming_Liu

Hi Sir , 

We use Android 11.0.0_2.6.0. Has NXP verified the uboot logo on Android 11? Is the enable method of uboot logo the same as Yocto?

 

Thanks!

 

Wilson

Hi @Wilson_S 

Yes, the default uboot source code has enabled the logo

@Zhiming_Liu

Hi Sir , 

Thanks for your quick reply!

It seems that I used the L5.10.72 patch and did not bring up the panel during the bootloader stage.
We had already confirmed below

1. We used Logic Analyzer to measure the Panel’s power up sequence and it was correct.
2. Video Timing is also correct ,becasue it works fine in kernel.

So the only question left is the setting of PLL such as "clock_imx8mm.c" or LVDS configuration
such as "imx_lcdifv3."?

We use a 1920 x 720 panel, Pixel clock is 47Mhz, dual LVDS channel, what else needs to be set?

 

Wilson

Hi @Wilson_S 

1.The default lvds driver only enable one channel, you need add flags to enable another channel. Also need check pixel format in driver, the default setting is JEIDA format.

2.After enabling dual channel in LVDS_CTRL register, the clock is key point. You need add new PLL table to support dual channel panel. The default setting in patch is single channel PIXEL_CLK=74.25Mhz, so LDB_CLK_ROOT= PIXEL_CLK * 7, LDB_CLK_ROOT = VIDEO_PLL / 2

+		/* 519.75Mhz LVDS PLL ref from video PLL */
+		clock_set_target_val(MEDIA_LDB_CLK_ROOT, CLK_ROOT_ON | CLK_ROOT_SOURCE_SEL(7) |CLK_ROOT_POST_DIV(CLK_ROOT_POST_DIV2));

 

For dual channel, LDB_CLK_ROOT=PIXEL_CLK* 3.5, then you will get the VIDEO_PLL value :PIXEL_CLK*7.

For P,M,K,S value in PLL table, you can calculate them from formula in RM(CCM chapter).

@Zhiming_Liu

Hi Sir , 

1.The default lvds driver only enable one channel, you need add flags to enable another channel.

-> I only find LDB_CH1_MODE_EN_TO_DI0 & LDB_CH1_MODE_EN_TO_DI1 but I could not find where to set this flag in the imx8mp_lvds.c and could you tell me how to enable the flag ? or provide a patch ?

Thanks!

 

Wilson

Hi @Wilson_S 

This line:

Zhiming_Liu_0-1698396612707.png

 

Dear @Zhiming_Liu:

The LVDS patch disabled MIPI-DSI port. Currently, uboot only create one video link.

Is it possible to have two or three video link output in parallel on u-boot?

I mean the uboot video link :

MIPI-DSI =>

[*]-Video Link 0
[0] lcd-controller@32e80000, video
[1] mipi_dsi@32e60000, video_bridge
[2] panel_dsi, panel

LVDS =>

[*]-Video Link 0
[0] lcd-controller@32e90000, video
[1] lvds-channel@0, display
[2] panel_lvds, video_bridge

Actually, we also requre HDMI video link, we need three video link to display logo at the smae time.

 

Hi @ching-julo 

From the  default videolink design, only can output a videolink one time. Maybe you can refer the code and modify it, the code is very simple: drivers/video/video_link.c

For HDMI driver, there is no such reference driver currently.

 

 

It appears to me that this patch is incomplete. Particularly, it is missing clock configuration for a number of clocks needed for this to work.

Is my observation accurate?

I couldn't manage to adapt this patch for my specific LVDS screen (clock needs to be modified and I'm using the simple-panel driver).

U-boot freezes after calling the function imx8mp_lvds_phy_power_on (->media_blk_write(priv, LVDS_CTRL, HS_DISABLE);).

Do you know when this driver will be available in a future release of NXP u-boot?

 

Extract of my DTS :

panel {
  compatible = "simple-panel";
  backlight = <&backlight>;
  status = "okay";
  fsl,data-mapping = "spwg";
  fsl,data-width = <24>;
 
  port {
    panel_in: endpoint {
      remote-endpoint = <&lvds_out>;
    };
  };
 
  display-timings {
    native-mode = <&timing0>;
    timing0: timing0 {
      clock-frequency = <49600000>;
      hactive = <1024>;
      vactive = <600>;
      hback-porch = <40>;
      hfront-porch = <40>;
      hsync-len = <240>;
      vback-porch = <10>;
      vfront-porch = <15>;
      vsync-len = <10>;
    };
  };
};

Hi @Zhiming_Liu,

We're currently working on enabling an LVDS display in L5.15.52 for our customed IMX8MP board.

I have referred to your patch and the driver works like follows,

[*]-Video Link 0 (1280 x 800)
[0] lcd-controller@32e90000, video
[1] lvds-channel@0, display
[2] lvds-panel, panel

 

I use simple-panel as panel driver, and the following dts,

backlight: backlight {
    compatible = "pwm-backlight";
    pwms = <&pwm1 0 50000>; /* period = 5000000 ns => f = 200 Hz */
    brightness-levels = <0 100>;
    num-interpolated-steps = <100>;
    default-brightness-level = <100>;
    status = "okay";
};

lvds_panel: lvds-panel {
    compatible = "simple-panel";
    backlight = <&backlight>;

    display-timings {
        native-mode = <&timing0>;

        timing0: timing0 {
            clock-frequency = <71100000>;
            hactive = <1280>;
            vactive = <800>;
            hback-porch = <40>;
            hfront-porch = <40>;
            vback-porch = <3>;
            vfront-porch = <10>;
            hsync-len = <80>;
            vsync-len = <10>;
        };
    };

    port {
        panel_lvds_in: endpoint {
            remote-endpoint = <&lvds_out>;
        };
    };
};

&lcdif2 {
    status = "okay";
};

&ldb_phy {
    status = "okay";
};

&ldb {
    status = "okay";

    lvds-channel@0 {
        fsl,data-mapping = "spwg";
        fsl,data-width = <24>;
        status = "okay";

        port@1 {
               reg = <1>;

               lvds_out: endpoint {
                       remote-endpoint = <&panel_lvds_in>;
               };
         };

    };
};

 

The questions is that there is no data from the LVDS  port, I mean there are 4 data lines and 1 clk line on the LVDS cahnnel 0, the clk has 74M, data 0 and data 1 keep high, data 2 and data 3 has some data(I measured the results using an oscilloscope.).

I can confirm that the hardware is ok as the kernel can display LVDS well.

can you help check what happen?

We are using the NXP fsl-nxp-bsp-mickledore Yocto release that uses the NXP u-boot branch lf_v2023.04.

1. Are there any patches to support LVDS display of splash screen for this u-boot version ?

2. Is there some reason this support is not built into the NXP u-boot these days ?

100% helpful (3/3)
Version history
Last update:
Tuesday
Updated by: