https://www.cnblogs.com/minyue33/p/8072571.html
Development platform: Xunwei iTOP-4418/6818 development board
4418&6818 screen modification needs to modify uboot and kernel respectively. First, modify uboot.
1. First enter the android source code directory:
For 4418 platform, the uboot file that needs to be modified is: u-boot/board/s5p4418/drone2/board.c. Use the vi command to open this file. The default parameters of the screen are set from lines 49 to 93, as shown below:
figure 2
4418 temporarily supports 9.7-inch, 7-inch, and 4.3-inch screens, and their settings are in this file, as shown in the following figure:
image 3
The function of the code in the above figure is to first read which screen is currently in use from the environment variables of uboot, and then select the corresponding branch setting according to the screen type. For example, the width, height, and refresh rate of the screen. If users use other screens, they need to be modified here (you need to modify the default variables in Figure 2 according to your own screen parameters) (the modified file for 6818 is: u-boot/ board/s5p6818/dronel/board.c, the method is the same as above)
2. Modification of the Linux kernel part:
The first is the file kernel/arch/arm/plat-s5p4418/topeet/include/cfg_main.h (the corresponding file for 6818 is: kernel/arch/arm/plat-s5p6818/topeet/include/cfg_main.h)
A group of screen-related macros defined in this file are as follows:
/*------------------------------------------------------------------------------
* Display (DPC and MLC)
*/
/* Primary */
#define CFG_DISP_PRI_SCREEN_LAYER 0
#define CFG_DISP_PRI_SCREEN_RGB_FORMAT MLC_RGBFMT_A8R8G8B8
#define CFG_DISP_PRI_SCREEN_PIXEL_BYTE 4
#define CFG_DISP_PRI_SCREEN_COLOR_KEY 0x090909
#define CFG_DISP_PRI_VIDEO_PRIORITY 2 // 0, 1, 2, 3
#define CFG_DISP_PRI_BACK_GROUND_COLOR 0x000000
#define CFG_DISP_PRI_MLC_INTERLACE CFALSE
#define CFG_DISP_PRI_LCD_WIDTH_MM 154
#define CFG_DISP_PRI_LCD_HEIGHT_MM 85
/* modify by cym 20150811 */
#if 0
#define CFG_DISP_PRI_RESOL_WIDTH 1024 // X Resolution
#define CFG_DISP_PRI_RESOL_HEIGHT 600 // Y Resolution
#else
#define CFG_DISP_PRI_RESOL_WIDTH 800//1024 // X Resolution
#define CFG_DISP_PRI_RESOL_HEIGHT 1280//768 // Y Resolution
#endif
/* end remove */
#define CFG_DISP_PRI_HSYNC_SYNC_WIDTH 20
#define CFG_DISP_PRI_HSYNC_BACK_PORCH 160
#define CFG_DISP_PRI_HSYNC_FRONT_PORCH 160
#define CFG_DISP_PRI_HSYNC_ACTIVE_HIGH CTRUE
#define CFG_DISP_PRI_VSYNC_SYNC_WIDTH 3
#define CFG_DISP_PRI_VSYNC_BACK_PORCH 23
#define CFG_DISP_PRI_VSYNC_FRONT_PORCH 12
#define CFG_DISP_PRI_VSYNC_ACTIVE_HIGH CTRUE
#define CFG_DISP_PRI_CLKGEN0_SOURCE DPC_VCLK_SRC_PLL2
#define CFG_DISP_PRI_CLKGEN0_DIV 12 // even divide
#define CFG_DISP_PRI_CLKGEN0_DELAY 0
#define CFG_DISP_PRI_CLKGEN0_INVERT 0
#define CFG_DISP_PRI_CLKGEN1_SOURCE DPC_VCLK_SRC_VCLK2
#define CFG_DISP_PRI_CLKGEN1_DIV 1
#define CFG_DISP_PRI_CLKGEN1_DELAY 0
#define CFG_DISP_PRI_CLKGEN1_INVERT 0
#define CFG_DISP_PRI_CLKSEL1_SELECT 0
#define CFG_DISP_PRI_PADCLKSEL DPC_PADCLKSEL_VCLK /* VCLK=CLKGEN1, VCLK12=CLKGEN0 */
#define CFG_DISP_PRI_PIXEL_CLOCK 800000000/CFG_DISP_PRI_CLKGEN0_DIV
#define CFG_DISP_PRI_OUT_SWAPRB CFALSE
#define CFG_DISP_PRI_OUT_FORMAT DPC_FORMAT_RGB888
#define CFG_DISP_PRI_OUT_YCORDER DPC_YCORDER_CbYCrY
#define CFG_DISP_PRI_OUT_INTERLACE CFALSE
#define CFG_DISP_PRI_OUT_INVERT_FIELD CFALSE
#define CFG_DISP_LCD_MPY_TYPE 0
/*------------------------------------------------------------------------------
* LVDS
*/
/* modify by cym 20150811 */
#if 0
#define CFG_DISP_LVDS_LCD_FORMAT LVDS_LCDFORMAT_VESA
#else
#define CFG_DISP_LVDS_LCD_FORMAT LVDS_LCDFORMAT_JEIDA
#endif
/* end modify */
Then there is the file: kernel/arch/arm/plat-s5p4418/topeet/device.c (6818 corresponding file: kernel/arch/arm/plat-s5p6818/topeet/device.c)
Find the function setup_width_height_param in this file, as follows:
/* add by cym 20151128 */
#if 1
static int __init setup_width_height_param(char *str)
{
if (!strncasecmp("9.7", str, 3)) {
//printk("fun:%s, line = %d(lcdtype:%s)\n", __FUNCTION__, __LINE__, str);
#if defined(CONFIG_TOUCHSCREEN_FT5X0X)
//printk("fun:%s, line = %d(lcdtype:%s)\n", __FUNCTION__, __LINE__, str);
ft5x0x_pdata.screen_max_x = 768;
ft5x0x_pdata.screen_max_y = 1024;
#endif
#if defined (CONFIG_FB_NXP)
#if defined (CONFIG_FB0_NXP)
//printk("fun:%s, line = %d(lcdtype:%s)\n", __FUNCTION__, __LINE__, str);
fb0_plat_data.x_resol = 1024;
fb0_plat_data.y_resol = 768;
#endif
#endif
}
else if(!strncasecmp("7.0", str, 3))
{
#if defined(CONFIG_TOUCHSCREEN_FT5X0X)
//printk("fun:%s, line = %d(lcdtype:%s)\n", __FUNCTION__, __LINE__, str);
ft5x0x_pdata.screen_max_x = 800;
ft5x0x_pdata.screen_max_y = 1280;
#endif
#if defined (CONFIG_FB_NXP)
#if defined (CONFIG_FB0_NXP)
//printk("fun:%s, line = %d(lcdtype:%s)\n", __FUNCTION__, __LINE__, str);
fb0_plat_data.x_resol = 800;
fb0_plat_data.y_resol = 1280;
#endif
#endif
}
/* add by cym 20160222 */
#if 1
else if(!strncasecmp("4.3", str, 3))
{
#if defined (CONFIG_FB_NXP)
#if defined (CONFIG_FB0_NXP)
//printk("fun:%s, line = %d(lcdtype:%s)\n", __FUNCTION__, __LINE__, str);
fb0_plat_data.x_resol = 480;
fb0_plat_data.y_resol = 272;
#endif
#endif
}
#endif
/* end add */
/* add by cym 20170810 */
#if 1
else if(!strncasecmp("1024x600", str, 8))
{
#if defined(CONFIG_TOUCHSCREEN_FT5X0X)
//printk("fun:%s, line = %d(lcdtype:%s)\n", __FUNCTION__, __LINE__, str);
ft5x0x_pdata.screen_max_x = 600;
ft5x0x_pdata.screen_max_y = 1024;
ft5x0x_i2c_bdi.irq = PB_PIO_IRQ(CFG_IO_TSC2007_TOUCH_PENDOWN_DETECT);
ft5x0x_pdata.gpio_irq = CFG_IO_TSC2007_TOUCH_PENDOWN_DETECT;
tsc2007_i2c_bdi.irq = NULL;//PB_PIO_IRQ(CFG_IO_TOUCH_PENDOWN_DETECT);
#endif
#if defined (CONFIG_FB_NXP)
#if defined (CONFIG_FB0_NXP)
//printk("fun:%s, line = %d(lcdtype:%s)\n", __FUNCTION__, __LINE__, str);
fb0_plat_data.x_resol = 1024;
fb0_plat_data.y_resol = 600;
#endif
#endif
}
#endif
/* end add */
/* add by cym 20161104 */
#if 1
else if(!strncasecmp("hdmi", str, 3))
{
#if defined (CONFIG_FB_NXP)
#if defined (CONFIG_FB0_NXP)
//printk("fun:%s, line = %d(lcdtype:%s)\n", __FUNCTION__, __LINE__, str);
fb0_plat_data.x_resol = 1920;
fb0_plat_data.y_resol = 1080;
#endif
#endif
}
#endif
/* end add */
//printk("fun:%s, line = %d\n", __FUNCTION__, __LINE__);
}
early_param("lcdtype", setup_width_height_param);
#endif
/* end add */
This function selects the setting of the corresponding screen according to the lcdtype passed by uboot, here is mainly to modify the resolution of the screen, if you use other screens, you can modify the corresponding resolution.
Then there is the file: kernel/arch/arm/mach-s5p4418/dev-display.c (the file corresponding to 6818: kernel/arch/arm/mach-s5p4418/dev-display.c)
Also find the function in this file: setup_width_height_param, as shown below:
/* add by cym 20151128 */
#if 1
static int __init setup_width_height_param(char *str)
{
if (!strncasecmp("9.7", str, 3)) {
#if defined (CONFIG_NXP_DISPLAY_LCD)
#if defined(CFG_DISP_PRI_RESOL_WIDTH) && defined(CFG_DISP_PRI_RESOL_HEIGHT)
__lcd_vsync.h_active_len = 1024;
__lcd_vsync.v_active_len = 768;
__lcd_vsync.clk_div_lv0 = 14;
#endif
#endif
#if defined (CONFIG_NXP_DISPLAY_LVDS)
#if defined(CFG_DISP_PRI_RESOL_WIDTH) && defined(CFG_DISP_PRI_RESOL_HEIGHT)
__lvds_vsync.h_active_len = 1024;
__lvds_vsync.v_active_len = 768;
__lvds_vsync.clk_div_lv0 = 14;
#endif
#endif
#if defined (CONFIG_NXP_DISPLAY_MIPI)
#if defined(CFG_DISP_PRI_RESOL_WIDTH) && defined(CFG_DISP_PRI_RESOL_HEIGHT)
__mipi_vsync.h_active_len = 1024;
__mipi_vsync.v_active_len = 768;
__mipi_vsync.clk_div_lv0 = 14;
#endif
#endif
}
else if(!strncasecmp("7.0", str, 3))
{
#if defined (CONFIG_NXP_DISPLAY_LCD)
#if defined(CFG_DISP_PRI_RESOL_WIDTH) && defined(CFG_DISP_PRI_RESOL_HEIGHT)
__lcd_vsync.h_active_len = 800;
__lcd_vsync.v_active_len = 1280;
#endif
#endif
#if defined (CONFIG_NXP_DISPLAY_LVDS)
#if defined(CFG_DISP_PRI_RESOL_WIDTH) && defined(CFG_DISP_PRI_RESOL_HEIGHT)
__lvds_vsync.h_active_len = 800;
__lvds_vsync.v_active_len = 1280;
#endif
#endif
#if defined (CONFIG_NXP_DISPLAY_MIPI)
#if defined(CFG_DISP_PRI_RESOL_WIDTH) && defined(CFG_DISP_PRI_RESOL_HEIGHT)
__mipi_vsync.h_active_len = 800;
__mipi_vsync.v_active_len = 1280;
#endif
#endif
}
/* add by cym 20160222 */
#if 1
else if(!strncasecmp("4.3", str, 3))
{
#if defined (CONFIG_NXP_DISPLAY_LCD)
#if defined(CFG_DISP_PRI_RESOL_WIDTH) && defined(CFG_DISP_PRI_RESOL_HEIGHT)
__lcd_vsync.h_active_len = 480;
__lcd_vsync.v_active_len = 272;
__lcd_vsync.clk_div_lv0 = 24;
__lcd_vsync.clk_div_lv1 = 2;
#endif
#endif
#if defined (CONFIG_NXP_DISPLAY_LVDS)
#if defined(CFG_DISP_PRI_RESOL_WIDTH) && defined(CFG_DISP_PRI_RESOL_HEIGHT)
__lvds_vsync.h_active_len = 480;
__lvds_vsync.v_active_len = 272;
__lvds_vsync.clk_div_lv0 = 24;
__lvds_vsync.clk_div_lv1 = 2;
#endif
#endif
#if defined (CONFIG_NXP_DISPLAY_MIPI)
#if defined(CFG_DISP_PRI_RESOL_WIDTH) && defined(CFG_DISP_PRI_RESOL_HEIGHT)
__mipi_vsync.h_active_len = 480;
__mipi_vsync.v_active_len = 272;
__mipi_vsync.clk_div_lv0 = 24;
__mipi_vsync.clk_div_lv1 = 2;
#endif
#endif
}
#endif
/* end add */
/* add by cym 20170810 */
#if 1
else if(!strncasecmp("1024x600", str, 8))
{
#if defined (CONFIG_NXP_DISPLAY_LCD)
#if defined(CFG_DISP_PRI_RESOL_WIDTH) && defined(CFG_DISP_PRI_RESOL_HEIGHT)
__lcd_vsync.h_active_len = 1024;
__lcd_vsync.v_active_len = 600;
//__lcd_vsync.clk_div_lv0 = 24;
//__lcd_vsync.clk_div_lv1 = 2;
#endif
#endif
#if defined (CONFIG_NXP_DISPLAY_LVDS)
#if defined(CFG_DISP_PRI_RESOL_WIDTH) && defined(CFG_DISP_PRI_RESOL_HEIGHT)
__lvds_vsync.h_active_len = 1024;
__lvds_vsync.v_active_len = 600;
//__lvds_vsync.clk_div_lv0 = 24;
//__lvds_vsync.clk_div_lv1 = 2;
#endif
#endif
#if defined (CONFIG_NXP_DISPLAY_MIPI)
#if defined(CFG_DISP_PRI_RESOL_WIDTH) && defined(CFG_DISP_PRI_RESOL_HEIGHT)
__mipi_vsync.h_active_len = 1024;
__mipi_vsync.v_active_len = 600;
//__mipi_vsync.clk_div_lv0 = 24;
//__mipi_vsync.clk_div_lv1 = 2;
#endif
#endif
}
#endif
/* end add */
/* add by cym 20161104 */
#if 1
else if(!strncasecmp("hdmi", str, 3))
{
#if defined (CONFIG_NXP_DISPLAY_LCD)
#if defined(CFG_DISP_PRI_RESOL_WIDTH) && defined(CFG_DISP_PRI_RESOL_HEIGHT)
__lcd_vsync.h_active_len = 1920;
__lcd_vsync.v_active_len = 1080;
#endif
#endif
#if defined (CONFIG_NXP_DISPLAY_LVDS)
#if defined(CFG_DISP_PRI_RESOL_WIDTH) && defined(CFG_DISP_PRI_RESOL_HEIGHT)
__lvds_vsync.h_active_len = 1920;
__lvds_vsync.v_active_len = 1080;
#endif
#endif
#if defined (CONFIG_NXP_DISPLAY_MIPI)
#if defined(CFG_DISP_PRI_RESOL_WIDTH) && defined(CFG_DISP_PRI_RESOL_HEIGHT)
__mipi_vsync.h_active_len = 1920;
__mipi_vsync.v_active_len = 1080;
#endif
#endif
}
#endif
/* end add */
//printk("fun:%s, line = %d\n", __FUNCTION__, __LINE__);
}
early_param("lcdtype", setup_width_height_param);
#endif
/* end add */
This function selects the settings of the corresponding screen according to the lcdtype passed by uboot. Here it is mainly to modify the resolution and refresh rate of the screen. If you use other screens, you can modify the corresponding resolution.
Regarding the screen settings, the main thing is to modify the above files
Learn more: http://topeetboard.com/ Learn more: https://arm-board.taobao.com/