RK628D

RK628D是瑞芯微全新推出的视频桥接芯片,支持丰富的显示接口,支持高分辨率大屏产品转换需求,RK628 分为 Display 通路和 HDMI IN 通路。628-for-all驱动用来移植。

For-All 版本驱动一样也分为Display 通路和 HDMI IN 通路,Display 通路的驱动于drivers/misc/rk628/下,HDMI IN 通路的驱动于drivers/media/i2c/rk628/下。

官方文档也有详细的文档,在 /Common/DISPLAY/RK628/ 目录下可以参考。

输入接口支持:HDMI、RGB、BT.1120

输出接口支持:HDMI、GVI、Dual LVDS、Dual MIPI、MIPI-CSI、RGB、BT.1120

以下是一个使用HDMI 转换成LVDS 的设备树配置。

设备树配置

这是属于HDMI IN 通路的配置。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88

&backlight {
pwms = <&pwm1 0 25000 0>;
// enable-gpios = <&gpio1 RK_PD3 GPIO_ACTIVE_HIGH>;
pinctrl-0 = <&pwm1m0_pins>;
default-brightness-level = <200>;
status = "okay";
};

&i2c3 {
//clock-frequency = <400>;
clock-frequency = <100000>;
i2c-scl-rising-time-ns = <140>;
i2c-scl-falling-time-ns = <30>;
status = "okay";

rk628: rk628@50 {
compatible = "rockchip,rk628";
reg = <0x50>;
reset-gpios = <&gpio1 RK_PB1 GPIO_ACTIVE_HIGH>;
panel-backlight = <&backlight>;
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_odd_even_pixels";

status = "okay";

};

display-timings {
src-timing {

clock-frequency = <145000000>;
hactive = <1920>;
vactive = <1200>;
hback-porch = <48>;
hfront-porch = <160>;
vback-porch = <3>;
vfront-porch = <35>;
hsync-len = <32>;
vsync-len = <4>;
hsync-active = <0>;
vsync-active = <0>;
de-active = <1>;
pixelclk-active = <1>;
};
dst-timing {

clock-frequency = <145000000>;
hactive = <1920>;
vactive = <1200>;
hback-porch = <12>;//<16>;
hfront-porch = <30>;//<26>;
vback-porch = <20>;//<24>;
vfront-porch = <10>;//<8>;
hsync-len = <12>;
vsync-len = <5>;//<3>;
hsync-active = <0>;
vsync-active = <0>;
de-active = <0>;
pixelclk-active = <0>;
};
};


};

};

设备树介绍:
rk628,hdmi-in : 该节点表示该节点是HDMI IN 通路。
rk628-lvds : 该节点表示该节点是LVDS 接口。
bus-format : 该节点表示LVDS 接口的格式。6位或者8位。
link-type : 该节点表示LVDS 接口的链接方式。单屏双屏双向链接或者单屏双向链接。
display-timings:该节点表示LVDS 接口的显示参数。
src-timing :该节点表示LVDS 接口的源参数。
dst-timing :该节点表示LVDS 接口的目标参数。

驱动代码

  • 修改点

drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
根据不同现象,跟踪代码修改。
修改输入分辨率

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
struct edid *edid;
struct drm_display_mode *mode;
- const u8 def_modes[6] = {4, 16, 31, 19, 17, 2};
+ const u8 def_modes[6] = {108, 4, 16, 31, 19, 17};
struct drm_display_info *info = &connector->display_info;
struct hdr_static_metadata *metedata =
&connector->display_info.hdmi.hdr_panel_metadata;
@@ -2627,6 +2627,7 @@ static int dw_hdmi_connector_get_modes(struct
drm_connector *connector)
return 0;
edid = drm_get_edid(connector, hdmi->ddc);
+ edid = NULL;
if (edid) {
dev_dbg(hdmi->dev, "got edid: width[%d] x height[%d]\n",
edid->width_cm, edid->height_cm);
@@ -2641,8 +2642,6 @@ static int dw_hdmi_connector_get_modes(struct
drm_connector *connector)
drm_mode_connector_update_hdr_property(connector, metedata);
kfree(edid);
} else {
+ hdmi->sink_is_hdmi = true;
+ hdmi->sink_has_audio = true;
for (i = 0; i < sizeof(def_modes); i++) {
mode = drm_display_mode_from_vic_index(connector,
def_modes,

drivers/gpu/drm/drm_edid.c
增加1080p@60hz 模式

1
2
3
4
5
6
7
8
9
10
11
12
= {
4104, 4400, 0, 2160, 2168, 2178, 2250, 0,
DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
.vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27,
},
+ /* 108 - 1080x1920p@60Hz */
+ { DRM_MODE("1080x1920", DRM_MODE_TYPE_DRIVER, 148500, 1080, 1120,
+ 1140, 1220, 0, 1920, 1940, 1950, 1970, 0,
+ DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+ .vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9,
},
};