电子说
RK628 分为 Display 通路和 HDMI IN 通路,SDK 版本 Display 通路基于DRM框架,HDMI IN 通路基于
V4L2框架。
RK628-For-All 版本驱动一样也分为Display 通路和 HDMI IN 通路,Display 通路的驱动于drivers/misc/rk628/
下,HDMI IN 通路的驱动于drivers/media/i2c/rk628/下。本文采用RK628-For-All 版本Display 通路:MISC
1.联系RK业务拿到最新的RK628-for-all版本代码 。
本文是基于RK628-for-all-v21版本。要移植RK628D_For_All的驱动代码。
采取手动打补丁的方式移植:因为自动打补丁会因为SDK版本差异,代码不一致导致报错。
2.rockchip_defconfig,Kconfig,Makefile配置
rockchip_defconfig配置 :关闭SDK系统自带的rk628d配置,开启rk628-for-all版本的配置:
CONFIG_DRM=y(系统默认是打开)
CONFIG_RK628_MISC=y
CONFIG_ROCKCHIP_THUNDER_BOOT_RK628=y
(下面两项在"kernel-5.10driversmisc
k628Kconfig"已经默认设置为y了,可以不用在rockchip_defconfig中再配置)
MISC配置如下 :
将rk628驱动添加进编译规则。
Kconfig配置 :添加 source "drivers/misc/rk628/Kconfig"
Kconfig路径 :"kernel-5.10driversmiscKconfig"
Makefile配置 :添加 obj-y += rk628/
Makefile路径 :"kernel-5.10driversmiscKconfig"
rk628-for-all版本驱动配置如下:
Kconfig配置 :添加 config RK628_MISC 和 config ROCKCHIP_THUNDER_BOOT_RK628说明
Kconfig路径 :"kernel-5.10driversmisc
k628Kconfig"
Makefile配置 :添加RK628_MISC驱动和obj-$(CONFIG_DRM) += rk628_hdmitx.o
Makefile路径 :"kernel-5.10driversmisc
k628Makefile"
3.驱动手动打补丁:
① 将rk628文件夹复制到"kernel-5.10driversmisc
k628"
② kernel-5.10driversgpu hdmi强制输出固定分辨率 绕过读edid流程
kernel-5.10\\drivers\\i2c 提前i2c设备的注册 以加快rk628的初始化
kernel-5.10\\drivers\\base 增加宏主要是为了实现regmap文件结点可以写628寄存器
kernel-5.10\\drivers\\pwm 提前pwm设备的注册 以加快rk628的初始化
kernel-5.10\\drivers\\video 提前backlight设备的注册 以加快rk628的初始化
注意: driversgpudrmridgesynopsysdw-hdmi-qp.c 此c文件的第一组分辨率改成你要固定的分辨率 1920*1080
&i2c6 {
//clock-frequency = < 400 >;
pinctrl-names = "default";
pinctrl-0 = < &i2c6m0_xfer >;
status = "okay";
rk628: rk628@50 {
compatible = "rockchip,rk628";
reg = < 0x50 >;
interrupt-parent = < &gpio4 >;
interrupts = < 22 IRQ_TYPE_LEVEL_HIGH >;
//pinctrl-names = "default";
//pinctrl-0 = < &rk628power >;
enable-gpios = < &gpio4 RK_PD5 GPIO_ACTIVE_HIGH >;
reset-gpios = < &gpio2 RK_PB6 GPIO_ACTIVE_LOW >;
//panel-enable-gpios = < &gpio2 RK_PC1 GPIO_ACTIVE_HIGH >;
panel-backlight = < &backlight_lvds >;
status = "okay";
rk628,hdmi-in;
rk628-lvds{
/* "jeida_18","vesa_24","vesa_18" */
bus-format = "vesa_24";
//bus-format = "jeida_18";
/* "dual_link_odd_even_pixels"
* "dual_link_even_odd_pixels"
* "dual_link_left_right_pixels"
* "dual_link_right_left_pixels"
*/
link-type = "dual_link_even_odd_pixels";
//link-type = "dual_link_odd_even_pixels";
status = "okay";
};
display-timings {
src-timing {
clock-frequency = < 148500000 >;
hactive = < 1920 >;
vactive = < 1080 >;
hback-porch = < 148 >;
hfront-porch = < 88 >;
vback-porch = < 6 >;
vfront-porch = < 4 >;
hsync-len = < 44 >;
vsync-len = < 5 >;
hsync-active = < 0 >;
vsync-active = < 0 >;
de-active = < 0 >;
pixelclk-active = < 0 >;
};
dst-timing {
clock-frequency = < 148500000 >;
hactive = < 1920 >;
vactive = < 1080 >;
hback-porch = < 148 >;
hfront-porch = < 88 >;
vback-porch = < 6 >;
vfront-porch = < 4 >;
hsync-len = < 44 >;
vsync-len = < 5 >;
hsync-active = < 0 >;
vsync-active = < 0 >;
de-active = < 0 >;
pixelclk-active = < 0 >;
};
};
};
};