A Porting Solution for a 8-Channel Output LVDS Display on the 8MP Platform with Android 11
For example, porting 8-channel output LVDS display with a resolution of 1024x768, a clock of 65MHz, and a refresh rate of 76.
Kernel Stage Modifications
1. Modify screen parameters in device tree
vi vendor/nxp-opensource/kernel_imx/arch/arm64/boot/dts/freescale/OK8MP-C.dts
Locate the lvds0_panel node and update the screen parameters and clock settings:
These settings include screen resolution, front and back porch, and clock. The system calculates the refresh rate based on these variables, so accuracy is crucial. Small deviations are allowed, but they should not be excessive. The calculation formula is as follows:
clock-frequency= fframe*(hfront+hback+hsync+xres)*(vfront+vback+vsync+yres)
Eg.:65000000=76*(34+20+1024+2)*(4+10+768+5)
2. Remove clock limitations in U-Boot stage
vi vendor/nxp-opensource/kernel_imx/drivers/gpu/drm/imx/imx8mp-ldb.c
Comment out the relevant restriction.
3. Calculate the clock and modify it according to the actual situation of the ported screen
(1) vi vendor/nxp-opensource/kernel_imx/drivers/clk/imx/clk-imx8mp.c
Locate imx8mp_videopll_tbl and add a 910 clock as an example:
Parameters to set: rate, mdiv, pdiv, sdiv, kdiv.
- rate = 910,000,000 (calculated as 65,000,000 × 7 × 2, which is clock-frequency × 14).
- mdiv = 152
- pdiv = 2
- sdiv = 1
- kdiv = 0 (default value)
Calculation formula:
Fout = (M*Fin)/(P*2 S)
Fin = 24 (known value, used directly), Fout = 910, and MPS are all unknown and must be derived independently.
So:910 = (M*24)/(P*2S) -->910 = (152*24)/(2*21)
(2)vi vendor/nxp-opensource/kernel_imx/arch/arm64/boot/dts/freescale/imx8mp.dtsi
Locate the clock node and change the clock from 1039 500 000 to 910 000 000:
4. Recompile and flash after the above modifications
U-Boot Stage Modifications
The steps to modify the uboot stage are basically the same as the kernel stage, both require changing the device tree and adding clocks.
1. Modify screen parameters in device Tree
vi vendor/nxp-opensource/uboot-imx/arch/arm/dts/OK8MP-C.dts
Locate the lvds0_panel node and update the screen parameters and clock settings:
2. Calculate the clock and modify it according to the actual situation of the ported screen.
(1)vi vendor/nxp-opensource/uboot-imx/arch/arm/mach-imx/imx8m/clock_imx8mm.c
Locate imx8mm_fracpll_tbl and add a 910 clock:
(2)Locate VIDEO_PLL_RATE, then modiffy the value from 1,039,500,000 to 910,000,000:
3. Modify U-Boot environment variables
vi vendor/nxp-opensource/uboot-imx/include/configs/OK8MP-C_android.h
Locate CONFIG_EXTRA_ENV_SETTINGS, and modify video_mipi and video_hdmi to ''off''.