|
发表于 2019-8-7 16:21:22
浏览:140384
|
回复:62
打印
只看该作者
[复制链接]
楼主
本帖最后由 风在摇曳风铃 于 2019-8-13 14:02 编辑
屏尺寸:15inch
分辨率:1024x768
接口:单八LVDS
由于rk3399没有原生LVDS接口,需要用到toshiba_tc358775芯片mipi2lvds,因此配置屏参需要在两部分配置,一部分是配置mipi的初始化指令,一部分是配置lvds的参数。
一.由于要用到mipi接口,所以先要在menuconfig里打开mipi。
(1)-> Device Drivers
| -> Graphics support
| -> Rockchip Misc Video drive
| -> LCD Panel Select (rk mipi dsi lcd)
(2)-> Device Drivers
| -> Graphics support
| -> Rockchip Misc Video driver
| -> RockChip display transmitter support
RK32 RGB to DisplayPort transmitter support
Rockchip MIPI DSI support
配置完上面的驱动保存后,打开.config文件,如果文件里面有如下3条数据,说明配置成功。
CONFIG_LCD_MIPI=y
CONFIG_MIPI_DSI=y
CONFIG_RK32_MIPI_DSI=y
还有个驱动需要勾选上
-> Device Drivers
| -> Graphics support
| -> Display Panels ---><*> support for simple panel
不管是edp,还是mipi,在rk3399里面都要用到这个panel-simple驱动
二.设备树配置
1.由于要用到MIPI_DSI_MODE_VIDEO等宏定义,所以设备树里先添加头文件
#include <dt-bindings/display/drm_mipi_dsi.h>
2.绑定vop
&dsi_in_vopl {
status = "okay";
};
&dsi_in_vopb {
status = "disabled";
};
rk3399有两路vop,vopb支持到4k,vopl支持到2k,由于lvds的4k屏很少(目前为止我还没接触过),所以这里我把lvds绑定到vopl上,hdmi的4k屏比较常见,可以绑定到vopb上。
3.在pinctrl 节点上添加en脚和reset脚
两个脚的GPIO号需要自行查看自己的原理图来确定
&pinctrl {
/*add lcd panel by louhn*/
lcd-panel {
lcd_panel_reset: lcd-panel-reset {
rockchip,pins = <4 29 RK_FUNC_GPIO &pcfg_pull_down>;
};
lcd_panel_pwr_en: lcd-panel-pwr-en {
rockchip,pins = <4 30 RK_FUNC_GPIO &pcfg_pull_down>;
};
};
4.添加dsi节点
先附上我的dsi配置:
&dsi {
enable-gpios = <&gpio4 30 GPIO_ACTIVE_HIGH>;
reset-gpios = <&gpio4 29 GPIO_ACTIVE_LOW>;
status = "okay";
rockchip,lane-rate = <891>;
panel@0 {
compatible ="simple-panel-dsi";
reg = <0>;
backlight = <&backlight>;
dsi,flags = <(MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_EOT_PACKET)>;
dsi,format = <MIPI_DSI_FMT_RGB888>;
bus-format = <MEDIA_BUS_FMT_RGB888_1X24>;
dsi,lanes = <4>;
panel-init-sequence = [
29 00 06 3C 01 08 00 06 00
29 00 06 14 01 05 00 00 00
29 00 06 64 01 12 00 00 00
29 00 06 68 01 12 00 00 00
29 00 06 6C 01 12 00 00 00
29 00 06 70 01 12 00 00 00
29 00 06 34 01 1F 00 00 00
29 00 06 10 02 1F 00 00 00
29 00 06 04 01 01 00 00 00
29 00 06 04 02 01 00 00 00
29 00 06 50 04 20 01 F0 03
29 00 06 54 04 88 00 A0 00
29 00 06 58 04 00 04 58 00
29 00 06 5C 04 06 00 1D 00
29 00 06 60 04 00 03 03 00
29 00 06 64 04 01 00 00 00
29 01 06 A0 04 06 80 44 00
29 00 06 A0 04 06 80 04 00
29 00 06 04 05 04 00 00 00
29 00 06 80 04 00 01 02 03
29 00 06 84 04 04 07 05 08
29 00 06 88 04 09 0A 0E 0F
29 00 06 8C 04 0B 0C 0D 10
29 00 06 90 04 16 17 11 12
29 00 06 94 04 13 14 15 1B
29 00 06 98 04 18 19 1A 06
29 78 06 9C 04 61 02 00 00
];
panel-exit-sequence = [
05 05 01 28
05 78 01 10
];
display-timings {
native-mode = <&timing_15inch>;
timing0: timing0 {
hactive = <1024>;
vactive = <768>;
hback-porch = <160>;
hfront-porch = <24>;
vback-porch = <29>;
vfront-porch = <3>;
hsync-len = <136>;
vsync-len = <6>;
hsync-active = <0>;
vsync-active = <0>;
de-active = <0>;
pixelclk-active = <0>;
};
};
};
};
dsi节点分析
1.enable和reset的gpio脚:按照前面pinctrl里面配置的写
2.rockchip,lane-rate:
先在附上我调试的屏的屏参(在2楼)
dsi时钟计算公式:dsi_hs_clk = ((h_active + hfp + hbp + h_sync) * (v_active + vfp + vbp + v_sync) * fps * bpp) / lane_number
即:dsi_hs_clk = 1344x806x60x24/4 = 390M
而实际的dsi clk会比设定的要小100左右,所以这里填写490比较合理,但是当我设置rockchip,lane-rate = <490>时,发现屏幕显示不正常,测量了下dsi的clock引脚的频率,发现没有达到390M。而瑞芯微官方文档里有这么一句话:
MIPI_DSI_HS_CLK 是各个 LANE 传输时的速率(ddr 双边沿),最小值 80Mbps, | 最大 1Gbps,默认是 1Gbps,这个也基本上不用改,除非板子布线有问题,跑不了 | 1Gbps 的。 | 因此这里直接写rockchip,lane-rate = <1000>,应该也没问题。
3.,flags,format。flags照抄就行,瑞芯微已经设置好了会去自动匹配对应的flags,format根据屏幕来选择,如果是24位就用MIPI_DSI_FMT_RGB888,18为就用MIPI_DSI_FMT_RGB666
3.panel-init-sequence:mipi 的初始化指令是通过TC358764_5_774_5XBG_DSI-LVDS_Tv11p_nm.xls的excel工具导出的,该工具只要在对应地方输入屏参,配置完后就能导出对应的指令。(3楼附上我配好的对应的我调试的屏的excel表,供参考)
4.panel-exit-sequence这个是标准的退出指令,默认照抄就行,不用改。
5.display-timings:配置一些屏参,也没啥好说的。
|
|