RK628是一款多功能视频桥接芯片,支持多种显示接口的转换。本文基于RK3568平台,分享使用RK628桥接芯片实现RGB信号转换为HDMI输出的适配过程。
IDO-SOM3568-V2采用 Rockchip 新一代 64 位处理器 RK3568(四核A55, 主频高达 2.0GHz, 22nm 工艺),集成双核心架构 GPU 以及高效能 NPU;最大支持 8GB 内存;内置独立的 NPU,32Bit位宽LPDDR4/LPDDR4x,频率最高可达1600MHz,支持全链路ECC ,支持Android 11,Ubuntu , Debian,OpenHamoney,麒麟OS等多种系统。
产品规格书:IDO-SOM3568-V2(金手指) 产品手册
硬件连接
RK628与RK3568的硬件连接,主要有以下几点:
-
24MHz时钟:给RK628提供时钟信号;
-
I2C:用于RK3568与RK628之间的控制通信;
-
I2S:用于音频信号传输;
-
RGB:给RK628显示信号源;
-
其它GPIO:控制供电和复位。
添加驱动
本文调试使用的是RK的rk628-for-all v21驱动。将驱动补丁文件添加至 kernel/drivers/misc/rk628/ 目录。
在原有的驱动文件中添加
kernel/drivers/misc/Kconfig
source "drivers/misc/rk628/Kconfig"
kernel/drivers/misc/Makefile
obj-y += rk628/
添加设备树配置
dts配置分显示和音频两部分,显示部分在i2c中添加rk628节点,并将其与rgb绑定;音频部分使用i2s通信,新增一路simple-audio-card。
/ {
rk628_hdmi_sound: rk628-hdmi-sound {
compatible = "simple-audio-card";
simple-audio-card,format = "i2s";
simple-audio-card,name = "rk628-hdmi-sound";
status = "okay";
simple-audio-card,cpu {
sound-dai = <&i2s1_8ch>;
};
simple-audio-card,codec {
sound-dai = <&rk628>;
};
};
};
&i2s1_8ch {
status = "okay";
rockchip,clk-trcm = <1>;
pinctrl-names = "default";
pinctrl-0 = <&i2s1m1_sclktx
&i2s1m1_lrcktx
&i2s1m1_sdo0>;
};
&i2c1 {
status = "okay";
clock-frequency = <400000>;
rk628: rk628@50 {
compatible = "rockchip,rk628";
reg = <0x50>;
pinctrl-names = "default";
interrupt-parent = <&gpio1>;
interrupts = <RK_PB0 IRQ_TYPE_LEVEL_HIGH>;
enable-gpios = <&gpio3 RK_PD5 GPIO_ACTIVE_HIGH>;
reset-gpios = <&gpio3 RK_PC4 GPIO_ACTIVE_LOW>;
pinctrl-0 = <&refclk_pins>;
assigned-clocks = <&pmucru CLK_WIFI>;
assigned-clock-rates = <24000000>;
clocks = <&pmucru CLK_WIFI>;
clock-names = "soc_24M";
#sound-dai-cells = <0>;
rk628,rgb-in;
rk628,hdmi-out;
mode-sync-pol=<0>;
status = "okay";
port {
rgb_in_hdmi: endpoint {
remote-endpoint = <&rgb_out_hdmi>;
};
};
};
};
&rgb {
status = "okay";
ports {
port@1 {
reg = <1>;
rgb_out_hdmi: endpoint {
remote-endpoint = <&rgb_in_hdmi>;
};
};
};
};
&rgb_in_vp2 {
status = "okay";
};
&route_rgb {
status = "okay";
connect = <&vp2_out_rgb>;
};
&pinctrl {
refclk {
/omit-if-no-ref/
refclk_pins: refclk-pins {
rockchip,pins =
/* refclk_ou */
<0 RK_PA0 1 &pcfg_pull_none>;
};
};
}
运行测试
修改驱动编译,更新内核后;插入HDMI显示器,正常的情况下可以成功显示
查看显示参数
cat /sys/kernel/debug/dri/0/summary
声卡注册情况如下,可通过播放音乐来测试HDMI是否有声音输出
问题排查
-
确认供电和复位时序是否正常
-
测量软件24MHz时钟信号是否正常输出