本文主要是介绍RK3288 android5.1 HDMI的使用与调试方法 -- (二),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
上篇文章[RK3288][Android7.1] HDMI的使用与调试方法 – (一)讲到RK平台主要采用 FB 和 DRM 两种显示框架。与此相对应, HDMI 也有两套驱动。
FB:
LINUX 3.10 内核主要采用传统的 FB 框架, HDMI 驱动的路径为:
kernel/drivers/video/rockchip/hdmi/
DRM:
DRM全称是 Direct Rendering Manager 是 DRI ( Direct Rendering Infrastructure ) 框架的一个
组件。LINUX 4.4/4.19 内核采用 DRM框架, HDMI 驱动的路径为:
kernel/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
kernel/drivers/gpu/drm/bridge/synopsys/
RK3288_Android5.1内核为3.10,采用的FB框架,本文分析下FB框架下hdmi相关功能调试。
1.HDMI 软件功能配置
1.1 使能HDMI
&hdmi {status = "okay";
};
1.2 使能 CEC
在板级 dts 文件的 hdmi 节点里添加 rockchip,cec_enable = <1> ,例如:
&hdmi {status = "okay";rockchip,cec_enable = <1>;
};
1.3 Android 配置 HDMI 默认分辨率
如果没有在 setting 中手动设置 HDMI 分辨率的情况下,HDMI 使用的默认分辨率设置方法如下:
在dts文件的hdmi节点里添加 rockchip,defaultmode = < alue > , < value > 值仅限于 CEA
MODE(即有对应 VIC 值的分辨率)。
可以在kernel/drivers/video/rockchip/hdmi/rockchiphdmi.h
的 hdmi_video_infomation_code
中查到不同分辨率对应的值,例如,设置默认分辨率为720P60Hz 输出:
&hdmi {status = "okay";rockchip,defaultmode = <4>;
};
HDMI 在开机时使用的分辨率按照以下优先级:
- 在 Android 平台,若上次开机用户在 setting 中手动切换过分辨率且未曾恢复出厂设置或重新烧写固件,则 HDMI开机使用的分辨率为用户选择的分辨率。
- 若用户未曾手动设置过分辨率,且开机 HDMI 成功读取 EDID,则选用 EDID 中的与 rockchip,defaultmode 的值对应的分辨率。
- 若 EDID 中不存在 rockchip,defaultmode 对应的分辨率,则选择 EDID 中最大的分辨率。
- 若读取 EDID 失败,则直接使用 rockchip,defaultmode 对应的分辨率。
- 若在 dts 中未配置 rockchip,defaultmode ,则默认使用
kernel/drivers/video/rockchip/hdmi/rockchip-hdmi.h
中的宏HDMI_VIDEO_DEFAULT_MODE 对应的分辨率。
1.4 新增分辨率
以 800X1280p@60Hz为例:
- 打开EDID 信息(开机日志可看到,调试好后记得关闭)
diff --git a/kernel/drivers/video/fbmon.c b/kernel/drivers/video/fbmon.c
index 6103fa6fb5..ce9b11e063 100644
--- 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)
打印出 EDID 信息如下:
Detailed Timings 是主要的 LCD 参数,Supported VESA Modes 是 LCD 支持的分辨率。
75M = PIXEL_CLOCK = pixclock
800 = H_ACTIVE = xres
832 = H_ACTIVE + H_SYNC_OFFSET = xres + h_fp = 800 + 32
912 = H_ACTIVE + H_SYNC_OFFSET + H_SYNC_WIDTH = xres + h_fp + h_pw = 800 + 32 + 90
960 = H_ACTIVE + H_BLANKING = xres + h_bp + h_fp + h_pw = 800 + 32 + 48 + 90
1280 = V_ACTIVE = yres
1283 = V_ACTIVE + V_SYNC_OFFSET = yres + v_fp = 1280 + 3
1289 = V_ACTIVE + V_SYNC_OFFSET + V_SYNC_WIDTH = yres + v_fp + v_pw = 1280 + 3 + 6
1303 = V_ACTIVE + V_BLANKING = yres + v_bp + v_fp + v_pw = 1280 + 3 + 14 + 6
+HSync = HSYNC_POSITIVE
+VSync = VSYNC_POSITIVE
- 在枚举中增加此分辨率,枚举值为 108,并修改默认分辨率:
diff --git a/kernel/drivers/video/rockchip/hdmi/rockchip-hdmi.h b/kernel/drivers/video/rockchip/hdmi/rockchip-hdmi.h
index 78c7091eb1..a9a466b65c 100644
--- 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_800X1280P_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_1280X720P_60HZ
+#define HDMI_VIDEO_DEFAULT_MODE HDMI_800X1280P_60HZ/*HDMI_1920X1080P_60HZ*/#define HDMI_VIDEO_DEFAULT_COLORMODE HDMI_COLOR_AUTO#define HDMI_VIDEO_DEFAULT_COLORDEPTH 8
- 将屏参数据添加到数组const struct hdmi_video_timing hdmi_mode [ ]中:
diff --git a/kernel/drivers/video/rockchip/hdmi/rockchip-hdmi-lcdc.c b/kernel/drivers/video/rockchip/hdmi/rockchip-hdmi-lcdc.c
index 63a5cfb005..7122de782a 100644
--- 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},
+ { { "800X1280p@60Hz", 60, 800, 1280, 75000000, 32, 80, 3, 6, 48, 14, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 0, 0 }, 108, 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},
具体各项参数如下释义:
- 根据显示器的 EDID 修改 dts 中加载的屏参文件,修改值与添加到 HDMI 数组中的相同。
diff --git a/kernel/arch/arm/boot/dts/lcd-b101ew05.dtsi b/kernel/arch/arm/boot/dts/lcd-b101ew05.dtsi
index 0ff9dd9a0e..29ca6eb3f4 100644
--- a/kernel/arch/arm/boot/dts/lcd-b101ew05.dtsi
+++ b/kernel/arch/arm/boot/dts/lcd-b101ew05.dtsi
@@ -12,15 +12,15 @@lvds-format = <LVDS_8BIT_1>;out-face = <OUT_P888>;color-mode = <COLOR_RGB>;
- clock-frequency = <148000000>;//71000000
- hactive = <1920>;//1280
- vactive = <1080>;//800
- hback-porch = <262>;//100
- hfront-porch = <50>;//18
- vback-porch = <8>;//8
+ clock-frequency = <75000000>;//71000000
+ hactive = <800>;//1280
+ vactive = <1280>;//800
+ hback-porch = <32>;//100
+ hfront-porch = <80>;//18
+ vback-porch = <3>;//8vfront-porch = <6>;//6
- hsync-len = <10>;
- vsync-len = <2>;
+ hsync-len = <48>;
+ vsync-len = <14>;hsync-active = <0>;vsync-active = <0>;de-active = <0>;
- 开机时有一段可能会显示花屏或者彩屏,可直接关闭掉u-boot阶段的logo,这样开始后直接进入Android动画阶段,显示正常。
diff --git a/kernel/arch/arm/boot/dts/rk3288-tb.dts b/kernel/arch/arm/boot/dts/rk3288-tb.dts
index 078200f654..a6fcb70f06 100755
--- a/kernel/arch/arm/boot/dts/rk3288-tb.dts
+++ b/kernel/arch/arm/boot/dts/rk3288-tb.dts
@@ -941,7 +941,7 @@&fb {rockchip,disp-mode = <DUAL>;
- rockchip,uboot-logo-on = <1>;
+ rockchip,uboot-logo-on = <0>;};
2. 常用调试方法
2.1 查看当前分辨率
cat /sys/class/display/HDMI/mode
2.2 切换分辨率
举例如下:
1080P60:
echo 1920x1080p-60 > /sys/class/display/HDMI/mode 1
720P60:
echo 1280x720p-60 > /sys/class/display/HDMI/mode 1
2.3 查看 HDMI 连接状态
# 1 表示 HDMI 已连接, 0 表示 HDMI 已断开
cat /sys/class/display/HDMI/connect
2.4 查看 HDMI 使能状态
# 1 表示 HDMI 已使能, 0 表示 HDMI 已关闭
cat /sys/class/display/HDMI/enable
2.5 设置 HDMI 使能
# value 可取 0 或 1,0 表示关闭,1 表示开启
echo <value> > /sys/class/display/HDMI/enable
这篇关于RK3288 android5.1 HDMI的使用与调试方法 -- (二)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!