马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
1.方案概述此方案使用HD-8MMN-CORE的核心板搭配TI公司的芯片SN65DSI86转换芯片实现。 SN65DSI86作为一款MIPI DSI转eDP的芯片,支持双通道DSI输入,最大四通道显示输出,最大支持4K@60fps输出,WUXGA 1080P。本方案中将采用单通道DSI输入,双通道DP输出到1080p的屏幕。 HD8MMN-CORE系列工业级核心板基于NXP(Freescale) i.MX8MM系列Cortex-A53高性能处理器设计,支持硬件加密,支持摄像头接口、USB3.0接口、HDMI/MIPI、PCIe、千兆以太网接口、多路串口等,适用于快速开发一系列最具创新性的应用,如多媒体应用、人机界面、工业4.0、车载终端以及边缘计算设备等。
2.硬件原理图注:硬件修改REFCLK上需要贴上27M的晶振,TEST2引脚需要通过4.7K电阻上拉到1.8V. 3软件实现3.1软件介绍内核版本:Linux5.10; SN65DSI86驱动:drivers/gpu/drm/bridge/ti-sn65dsi86.c Panel驱动:drivers/gpu/drm/panel/panel-simple.c
3.2驱动移植内核配置,需要打开如下两项 CONFIG_DRM_TI_SN65DSI86=yCONFIG_DRM_PANEL_SIMPLE=y
1)设备树配置/ { osc_27m: clock-osc-27m { compatible = "fixed-clock"; #clock-cells = <span data-raw-text-1715131244818="<0" data-textnode-index-1715131244818="41" data-index-1715131244818="736" data-index-len-1715131244818="736" class="character" style="box-sizing: border-box; max-width: 100%; display: inline-block; text-indent: initial;">>; clock-frequency = <span data-raw-text-1715131244818="<27000000" data-textnode-index-1715131244818="45" data-index-1715131244818="781" data-index-len-1715131244818="781" class="character" style="box-sizing: border-box; max-width: 100%; display: inline-block; text-indent: initial;">>; clock-output-names = "osc_27m"; };
lcd_backlight: lcd_backlight { compatible = "pwm-backlight"; pwms = <span data-raw-text-1715131244818="<&pwm1 0 100000" data-textnode-index-1715131244818="63" data-index-1715131244818="961" data-index-len-1715131244818="961" class="character" style="box-sizing: border-box; max-width: 100%; display: inline-block; text-indent: initial;">>; status = "okay";
brightness-levels = <span data-raw-text-1715131244818="< 0 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 89 90 91 92 93 94 95 96 97 98 99 100" data-textnode-index-1715131244818="109" data-index-1715131244818="1694" data-index-len-1715131244818="1694" class="character" style="box-sizing: border-box; max-width: 100%; display: inline-block; text-indent: initial;">>; enable-gpios = <span data-raw-text-1715131244818="<&gpio1 1 GPIO_ACTIVE_HIGH" data-textnode-index-1715131244818="113" data-index-1715131244818="1753" data-index-len-1715131244818="1753" class="character" style="box-sizing: border-box; max-width: 100%; display: inline-block; text-indent: initial;">>; default-brightness-level = <span data-raw-text-1715131244818="<80" data-textnode-index-1715131244818="117" data-index-1715131244818="1801" data-index-len-1715131244818="1801" class="character" style="box-sizing: border-box; max-width: 100%; display: inline-block; text-indent: initial;">>; }; panel { compatible = "test,test-edp-1080p"; //设置自己的屏幕匹配参数组 backlight = <span data-raw-text-1715131244818="<&lcd_backlight" data-textnode-index-1715131244818="131" data-index-1715131244818="1944" data-index-len-1715131244818="1944" class="character" style="box-sizing: border-box; max-width: 100%; display: inline-block; text-indent: initial;">>; no-hpd;
port { panel1_in: endpoint { remote-endpoint = <span data-raw-text-1715131244818="<&sn65_out" data-textnode-index-1715131244818="145" data-index-1715131244818="2096" data-index-len-1715131244818="2096" class="character" style="box-sizing: border-box; max-width: 100%; display: inline-block; text-indent: initial;">>; }; }; };};&pwm1 { pinctrl-names = "default"; pinctrl-0 = <span data-raw-text-1715131244818="<&pinctrl_pwm1" data-textnode-index-1715131244818="163" data-index-1715131244818="2229" data-index-len-1715131244818="2229" class="character" style="box-sizing: border-box; max-width: 100%; display: inline-block; text-indent: initial;">>; status = "okay";};
&i2c4 { clock-frequency = <span data-raw-text-1715131244818="<400000" data-textnode-index-1715131244818="175" data-index-1715131244818="2297" data-index-len-1715131244818="2297" class="character" style="box-sizing: border-box; max-width: 100%; display: inline-block; text-indent: initial;">>; pinctrl-names = "default"; pinctrl-0 = <span data-raw-text-1715131244818="<&pinctrl_i2c4" data-textnode-index-1715131244818="183" data-index-1715131244818="2367" data-index-len-1715131244818="2367" class="character" style="box-sizing: border-box; max-width: 100%; display: inline-block; text-indent: initial;">>; status = "okay"; sn65dsi86@2d { ……. clock-names = "refclk"; //默认名字 //SN65DSI86仅支持12 MHz, 19.2 MHz, 26 MHz, 27 MHz or 38.4 MHz. clocks = <span data-raw-text-1715131244818="<&osc_27m" data-textnode-index-1715131244818="205" data-index-1715131244818="2591" data-index-len-1715131244818="2591" class="character" style="box-sizing: border-box; max-width: 100%; display: inline-block; text-indent: initial;">>;
…… port@1 { reg = <span data-raw-text-1715131244818="<1" data-textnode-index-1715131244818="215" data-index-1715131244818="2682" data-index-len-1715131244818="2682" class="character" style="box-sizing: border-box; max-width: 100%; display: inline-block; text-indent: initial;">>; sn65_out: endpoint { //data-lanes = <span data-raw-text-1715131244818="<0 1 2 3" data-textnode-index-1715131244818="223" data-index-1715131244818="2799" data-index-len-1715131244818="2799" class="character" style="box-sizing: border-box; max-width: 100%; display: inline-block; text-indent: initial;">>; //根据eDP屏的通道数设置,这里为2通道 data-lanes = <span data-raw-text-1715131244818="<0 1" data-textnode-index-1715131244818="229" data-index-1715131244818="2897" data-index-len-1715131244818="2897" class="character" style="box-sizing: border-box; max-width: 100%; display: inline-block; text-indent: initial;">>; ……
2)驱动修改添加显示屏的显示参数到驱动中,修改drivers/gpu/drm/panel/panel-simple.c:
tatic const struct display_timing test_edp_1080p_timing = { .pixelclock = { 153000000, 153000000, 153000000 }, .hactive = { 1920, 1920, 1920 }, .hfront_porch = { 100, 100, 100 }, ….. .bus_format = MEDIA_BUS_FMT_RGB666_1X18, .connector_type = DRM_MODE_CONNECTOR_eDP, };static const struct of_device_id platform_of_match[] = { { .compatible = "test,test-edp-1080p", .data = &test_edp_1080p, },
修改sn65dsi86驱动以适应我们的板卡,修改drivers/gpu/drm/bridge/ti-sn65dsi86.c,修改DSI正确的模式,防止找不到注册的panel出现报错“couldnotfindanypanelnode”,开机过程中打印1次是正常的,SN65DSI86的驱动找不到Panel会被多次调用,直到找到panel为止。 static int ti_sn_bridge_attach(struct drm_bridge *bridge,enum drm_bridge_attach_flags flags){... //dsi-" data-textnode-index-1715131244818="302" data-index-1715131244818="3752" data-index-len-1715131244818="3752" class="character" style="box-sizing: border-box; max-width: 100%; display: inline-block; text-indent: initial;">>mode_flags = MIPI_DSI_MODE_VIDEO; dsi-" data-textnode-index-1715131244818="303" data-index-1715131244818="3798" data-index-len-1715131244818="3798" class="character" style="box-sizing: border-box; max-width: 100%; display: inline-block; text-indent: initial;">>mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE | MIPI_DSI_MODE_EOT_PACKET | MIPI_DSI_MODE_VIDEO_HSE;
3)调试报错在调试过程中碰到“Linktrainingfailed,linkisoff”的报错,是因为SN65DSI86默认只支持ASSR模式的eDP屏幕,对于不支持ASSR模式的eDP屏,硬件上则需要将TEST2引脚拉高到1.8V,且修改相关寄存器将芯片从ASSR模式变为支持标准的DP模式,修改如下:
#define SN_ENH_FRAME_REG 0x5A#define ASSR_CONTROL BIT(0)...
static int ti_sn_link_training(struct ti_sn_bridge *pdata, int dp_rate_idx,const char **last_err_str) { unsigned int val;int ret;int i;
/* set dp clk frequency value */ regmap_update_bits(pdata-" data-textnode-index-1715131244818="342" data-index-1715131244818="4421" data-index-len-1715131244818="4421" class="character" style="box-sizing: border-box; max-width: 100%; display: inline-block; text-indent: initial;">>regmap, SN_DATARATE_CONFIG_REG, DP_DATARATE_MASK, DP_DATARATE(dp_rate_idx));
regmap_write(pdata-" data-textnode-index-1715131244818="344" data-index-1715131244818="4551" data-index-len-1715131244818="4551" class="character" style="box-sizing: border-box; max-width: 100%; display: inline-block; text-indent: initial;">>regmap, 0xff, 0x07); regmap_write(pdata-" data-textnode-index-1715131244818="349" data-index-1715131244818="4599" data-index-len-1715131244818="4599" class="character" style="box-sizing: border-box; max-width: 100%; display: inline-block; text-indent: initial;">>regmap, 0x16, 0x01); regmap_write(pdata-" data-textnode-index-1715131244818="354" data-index-1715131244818="4647" data-index-len-1715131244818="4647" class="character" style="box-sizing: border-box; max-width: 100%; display: inline-block; text-indent: initial;">>regmap, 0xff, 0x00);/* For DisplayPort, use the standard DP scrambler seed. */ regmap_update_bits(pdata-" data-textnode-index-1715131244818="360" data-index-1715131244818="4759" data-index-len-1715131244818="4759" class="character" style="box-sizing: border-box; max-width: 100%; display: inline-block; text-indent: initial;">>regmap, SN_ENH_FRAME_REG,ASSR_CONTROL, 0);/* enable DP PLL */ regmap_write(pdata-" data-textnode-index-1715131244818="364" data-index-1715131244818="4848" data-index-len-1715131244818="4848" class="character" style="box-sizing: border-box; max-width: 100%; display: inline-block; text-indent: initial;">>regmap, SN_PLL_ENABLE_REG, 1);...
如果未接eDP屏幕会出现如下报错:
[ 2.299284] ti_sn65dsi86 3-002d: [drm:ti_sn_bridge_enable] ERROR Can't read lane count (-6); assuming 4 [ 2.765851] ti_sn65dsi86 3-002d: [drm:ti_sn_bridge_enable] ERROR Can't read eDP rev (-6), assuming 1.1
|