Rk3288 Android5.1 HDMI 分辨率

参考RK3288 HDMI增加特殊分辨率

1、修改文件,打开调试模式,得到 EDID 信息后,记得关闭

diff --git a/kernel/drivers/video/fbmon.c b/kernel/drivers/video/fbmon.c
index 6103fa6…ce9b11e 100755
— a/kernel/drivers/video/fbmon.c
+++ b/kernel/drivers/video/fbmon.c
@@ -43,7 +43,8 @@

  • EDID parser
    */

-#undef DEBUG /* define this for verbose EDID parsing output /
+//#undef DEBUG /
define this for verbose EDID parsing output */
+#define DEBUG

#ifdef DEBUG
#define DPRINTK(fmt, args…) printk(fmt,## args)

=======================================
[    1.131925] Display Information (EDID)
[    1.131936] ========================================
[    1.131946]    EDID Version 1.3
[    1.131956]    Manufacturer: ADA
[    1.131965]    Model: 4
[    1.131973]    Serial#: 1
[    1.131983]    Year: 2007 Week 1
[    1.131992]    Display Characteristics:
[    1.132002]       Monitor Operating Limits:    Detailed Timings
[    1.132020]       50 MHz 1024 1064 1112 1152 600 613 616 645 -HSync -VSync

[    1.132042]    Supported VESA Modes
[    1.132054]       Manufacturer's mask: 0
[    1.132063]    Standard Timings
[    1.132074] Extrapolated
[    1.132086]            H: 43-43KHz V: 67-67Hz DCLK: 50MHz
[    1.132095]       Digital Display Input
      Sync: 
[    1.132112]       Max H-size in cm: 15
[    1.132123]       Max V-size in cm: 10
[    1.132132]       Gamma: 1.0
[    1.132146]       DPMS: Active no, Suspend no, Standby no
[    1.132156]       RGB Color Display
[    1.132164]       Chroma
[    1.132173]          RedX:     0.000 RedY:     0.000
[    1.132185]          GreenX:   0.000 GreenY:   0.000
[    1.132197] usb20_host: version 3.10a 21-DEC-2012
[    1.132208]          BlueX:    0.000 BlueY:    0.000
[    1.132219]          WhiteX:   0.000 WhiteY:   0.000
[    1.132230]       First DETAILED Timing is preferred
[    1.132241]    Detailed Timings
[    1.132251]       50 MHz 1024 1064 1112 1152 600 613 616 645 -HSync -VSync

[    1.132272]    Supported VESA Modes
[    1.132281]       Manufacturer's mask: 0
[    1.132290]    Standard Timings
[    1.132299] ========================================
[    1.132315] rockchip-hdmiv2 ff980000.hdmi: warning: no CEA video mode parsed from EDID !!!!

Detailed Timings 是主要的 LCD 参数,Supported VESA Modes 是 LCD 支持的分辨率。

通过源码查看各参数的含义:

路径:kernel/drivers/video/fbmon.c

DPRINTK("      %d MHz ",  PIXEL_CLOCK/1000000);
DPRINTK("%d %d %d %d ", H_ACTIVE, H_ACTIVE + H_SYNC_OFFSET, H_ACTIVE + H_SYNC_OFFSET + H_SYNC_WIDTH, H_ACTIVE + H_BLANKING);
DPRINTK("%d %d %d %d ", V_ACTIVE, V_ACTIVE + V_SYNC_OFFSET, V_ACTIVE + V_SYNC_OFFSET + V_SYNC_WIDTH, V_ACTIVE + V_BLANKING);
DPRINTK("%sHSync %sVSync\n\n", (HSYNC_POSITIVE) ? "+" : "-", (VSYNC_POSITIVE) ? "+" : "-");

由此可以得到 LCD 的各参数:
50 MHz 1024 1064 1112 1152 600 613 616 645 -HSync -VSync

50M = PIXEL_CLOCK = pixclock
1024= H_ACTIVE = xres
1064= H_ACTIVE + H_SYNC_OFFSET = xres + h_fp = 1024+ 40 ///????
1112= H_ACTIVE + H_SYNC_OFFSET + H_SYNC_WIDTH = xres + h_fp + h_pw = 1024+40 + 48
1152= H_ACTIVE + H_BLANKING = xres + h_bp + h_fp + h_pw =  1024 +  40 + 40+48
600 = V_ACTIVE = yres
613 = V_ACTIVE + V_SYNC_OFFSET = yres + v_fp = 600 + 13
616= V_ACTIVE + V_SYNC_OFFSET + V_SYNC_WIDTH = yres + v_fp + v_pw = 600 + 13 + 3
645= V_ACTIVE + V_BLANKING = yres + v_bp + v_fp + v_pw = 600 + 28 + 13 + 4
+HSync = HSYNC_POSITIVE
+VSync = VSYNC_POSITIVE

===>
timing0: timing0 {
clock-frequency = <40000000>;
hactive = <1024>;
vactive = <600>;
hback-porch = <40>;
hfront-porch = <48>;
vback-porch = <28>;
vfront-porch = <13>;
hsync-len = <40>;
vsync-len = <4>;
hsync-active = <0>;
vsync-active = <0>;
de-active = <0>;
pixelclk-active = <0>;//1

			swap-rb = <0>;
			swap-rg = <0>;
			swap-gb = <0>;
                 	};

3、在枚举中增加此分辨率,枚举值为 108,并修改默认分辨率
/* name refresh xres yres pixclock h_bp h_fp v_bp v_fp h_pw v_pw polariry PorI flag vic 2ndvic pixelrepeat interface */
diff --git a/kernel/drivers/video/rockchip/hdmi/rockchip-hdmi.h b/kernel/drivers/video/rockchip/hdmi/rockchip-hdmi.h
index b5475e4…f31f5b9 100755
— a/kernel/drivers/video/rockchip/hdmi/rockchip-hdmi.h
+++ b/kernel/drivers/video/rockchip/hdmi/rockchip-hdmi.h
@@ -129,6 +129,7 @@ enum hdmi_video_infomation_code {
HDMI_3840X2160P_30HZ_4_3, /105/
HDMI_3840X2160P_50HZ_4_3,
HDMI_3840X2160P_60HZ_4_3,

  • HDMI_1024X600P_60HZ, /108/
    };

/* HDMI Extended Resolution */
@@ -474,7 +475,7 @@ struct hdmi {
#define HDMI_AUTO_CONFIG false

/* HDMI default vide mode */
-#define HDMI_VIDEO_DEFAULT_MODE HDMI_1920X1080P_60HZ//HDMI_1280X720P_60HZ
+#define HDMI_VIDEO_DEFAULT_MODE HDMI_800X600P_60HZ//HDMI_1920X1080P_60HZ//HDMI_1280X720P_60HZ
/HDMI_1920X1080P_60HZ/
#define HDMI_VIDEO_DEFAULT_COLORMODE HDMI_COLOR_AUTO
#define HDMI_VIDEO_DEFAULT_COLORDEPTH 8

4、将屏参数据添加到数组 static const struct hdmi_video_timing hdmi_mode[] 中

/* name refresh xres yres pixclock h_bp h_fp v_bp v_fp h_pw v_pw polariry PorI flag vic 2ndvic pixelrepeat interface /
/
名称 刷新频率 行像素 列像素 像素时钟 水平后沿 水平前沿 垂直后沿 垂直前沿 行同步脉宽 列同步脉宽 极性 扫描方式 标志 枚举值 第二枚举值 像素重复 接口*/
diff --git a/kernel/drivers/video/rockchip/hdmi/rockchip-hdmi-lcdc.c b/kernel/drivers/video/rockchip/hdmi/rockchip-hdmi-lcdc.c
index 63a5cfb…0f920c2 100755
— a/kernel/drivers/video/rockchip/hdmi/rockchip-hdmi-lcdc.c
+++ b/kernel/drivers/video/rockchip/hdmi/rockchip-hdmi-lcdc.c
@@ -7,6 +7,7 @@ static const struct hdmi_video_timing hdmi_mode[] = {
{ { “720x576i@50Hz”, 50, 720, 576, 27000000, 69, 12, 19, 2, 63, 3, 0, 1, 0 }, 21, HDMI_720X576I_50HZ_16_9, 2, OUT_P888},
{ { “720x480p@60Hz”, 60, 720, 480, 27000000, 60, 16, 30, 9, 62, 6, 0, 0, 0 }, 2, HDMI_720X480P_60HZ_16_9, 1, OUT_P888},
{ { “720x576p@50Hz”, 50, 720, 576, 27000000, 68, 12, 39, 5, 64, 5, 0, 0, 0 }, 17, HDMI_720X576P_50HZ_16_9, 1, OUT_P888},
+{ { “1024X600p@60Hz”, 60, 1024, 600, 40000000, 128, 88, 72, 8, 88, 10, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 0, 0 }, 102, 0, 1, OUT_P888},
{ { “1280x720p@24Hz”, 24, 1280, 720, 59400000, 220, 1760, 20, 5, 40, 5, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 0, 0}, 60, HDMI_1280X720P_24HZ_4_3, 1, OUT_P888},
{ { “1280x720p@25Hz”, 25, 1280, 720, 74250000, 220, 2420, 20, 5, 40, 5, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 0, 0}, 61, HDMI_1280X720P_25HZ_4_3, 1, OUT_P888},
{ { “1280x720p@30Hz”, 30, 1280, 720, 74250000, 220, 1760, 20, 5, 40, 5, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 0, 0}, 62, HDMI_1280X720P_30HZ_4_3, 1, OUT_P888},
polariry:水平同步高电平有效和垂直同步高电平有效

PorI:0 为不是隔行扫描。定义文件路径:/kernel/include/uapi/linux/fb.h

flag:不知道什么意思

vic:在分辨率枚举中的编号,本次添加的为 108

5、此时 HDMI 可以正常输入 1024x600 的分辨率,但是实际显示可能有问题。

根据显示器的 EDID 修改 dts 中加载的屏参文件,修改值与添加到 HDMI 数组中的相同。

diff --git a/kernel/arch/arm/boot/dts/lcd-800x600.dtsi b/kernel/arch/arm/boot/dts/lcd-800x600.dtsi
index c0baf15…733a157 100755
— a/kernel/arch/arm/boot/dts/lcd-800x600.dtsi
+++ b/kernel/arch/arm/boot/dts/lcd-800x600.dtsi
@@ -15,12 +15,12 @@
clock-frequency = <40000000>;

  •                           hactive = <1920>;
    
  •                           vactive = <1080>; 
    
  •                           hback-porch = <126>;
    
  •                           hfront-porch = <120>;
    
  •                           vback-porch = <10>;
    
  •                           vfront-porch = <10>;
    
  •                           hsync-len = <10>;
    
  •                           vsync-len = <8>;
    
  •                           hactive = <1024>;
    
  •                           vactive = <600>; 
    
  •                           hback-porch = <128>;
    
  •                           hfront-porch = <88>;
    
  •                           vback-porch = <23>;
    
  •                           vfront-porch = <1>;
    
  •                           hsync-len = <128>;
    
  •                           vsync-len = <4>;
                              hsync-active = <0>;  
                              vsync-active = <0>;
                              de-active = <0>;
    

6、编译烧录,HDMI 显示正常,确认当前分辨率可以在设置 -> HDMI ->分辨率设置中查看,也可以通过指令查看。

$ cat /sys/class/display/HDMI/mode

在dts中写分辨率 发现 图标变了。。

你可能感兴趣的:(Android5.1,rk3288,hdmi)