迅為4418開發板/6818開發板教你如何修改屏幕
開發平臺:迅為iTOP-4418/6818開發板
4418&6818屏幕修改分別需要修改uboot和內核,首先是修改uboot。
1.首先進入到android源碼目錄下:
圖1
4418平臺,需要修改uboot的文件是:u-boot/board/s5p4418/drone2/board.c,使用vi命令打開這個文件,屏幕的默認參數設置在49行到93行,如下圖:
圖2
4418暫時支持9.7寸,7寸,4.3寸屏幕,他們的設置在該文件,如下圖所示的地方:
圖3
上圖中代碼的功能,首先是從uboot的環境變量裏面讀取出當前使用的哪款屏幕,然後根據屏幕類型選擇對應分支的設置。比如屏幕的寬,高,刷新率,如果用戶使用其它的屏幕,需要在此處修改(需要根據自己屏幕的參數,修改圖2中的那些默認變量)(6818的修改文件是:u-boot/board/s5p6818/dronel/board.c,方法同上)
2,linux內核部分的修改:
首先是文件kernel/arch/arm/plat-s5p4418/topeet/include/cfg_main.h(6818對應的文件是:kernel/arch/arm/plat-s5p6818/topeet/include/cfg_main.h)
這個文件裏定義裏一組與屏幕相關的宏,如下所示:
/*------------------------------------------------------------------------------
* 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 */
然後是文件:kernel/arch/arm/plat-s5p4418/topeet/device.c(6818對應的文件:kernel/arch/arm/plat-s5p6818/topeet/device.c)
在這個文件找到函數setup_width_height_param,如下:
/* 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 */
這個函數根據uboot傳遞過來的lcdtype選擇對應屏幕的設置,這裏主要是修改屏幕的分辨率,如果使用其它屏幕,修改對應的分辨率就可以了。
然後是文件:kernel/arch/arm/mach-s5p4418/dev-display.c(6818對應的文件:kernel/arch/arm/mach-s5p4418/dev-display.c)
同樣在這個文件找到函數:setup_width_height_param,如下所示:
/* 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 */
這個函數根據uboot傳遞過來的lcdtype選擇對應屏幕的設置,這裏主要是修改屏幕的分辨率,刷新率,如果使用其它屏幕,修改對應的分辨率就可以了。
關於屏幕的設置主要就是修改上面的文件
詳情了解:http://topeetboard.com/ 更多了解:https://arm-board.taobao.com/
迅為4418開發板/6818開發板教你如何修改屏幕