<acronym id="s8ci2"><small id="s8ci2"></small></acronym>
<rt id="s8ci2"></rt><rt id="s8ci2"><optgroup id="s8ci2"></optgroup></rt>
<acronym id="s8ci2"></acronym>
<acronym id="s8ci2"><center id="s8ci2"></center></acronym>
0
  • 聊天消息
  • 系統消息
  • 評論與回復
登錄后你可以
  • 下載海量資料
  • 學習在線課程
  • 觀看技術視頻
  • 寫文章/發帖/加入社區
會員中心
創作中心

完善資料讓更多小伙伴認識你,還能領取20積分哦,立即完善>

3天內不再提示

Firefly-RK3399--LCD介紹

firefly ? 來源:firefly ? 作者:firefly ? 2019-11-22 10:17 ? 次閱讀
LCD使用
簡介

Firefly-RK3399開發板外置了兩個LCD屏接口,一個是EDP,一個是MIPI,接口對應板子上的位置如下圖:

Config配置

Android7.1配置MIPI屏為例,Firefly-RK3399默認的配置文件kernel/arch/arm64/configs/firefly_defconfig已經把LCD相關的配置設置好了,如果自己做了修改,請注意把以下配置加上:

CONFIG_LCD_MIPI=y CONFIG_MIPI_DSI=y CONFIG_RK32_MIPI_DSI=y
DTS配置
引腳配置

EDP屏

Firefly-RK3399的SDK有EDP DSI的DTS文件:kernel/arch/arm64/boot/dts/rockchip/rk3399-firefly-edp.dts,從該文件中我們可以看到以下語句:

/ { model = "Firefly-RK3399 Board edp (Android)"; compatible = "rockchip,android", "rockchip,rk3399-firefly-edp", "rockchip,rk3399"; edp_panel: edp-panel { compatible = "lg,lp079qx1-sp0v"; bus-format = <MEDIA_BUS_FMT_RGB666_1X18>; backlight = <&backlight>; ports { panel_in_edp: endpoint { remote-endpoint = <&edp_out_panel>; }; }; power_ctr: power_ctr { rockchip,debug = <0>; lcd_en: lcd-en { gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>; pinctrl-names = "default"; pinctrl-0 = <&lcd_panel_enable>; rockchip,delay = <20>; }; lcd_rst: lcd-rst { gpios = <&gpio4 29 GPIO_ACTIVE_HIGH>; pinctrl-names = "default"; pinctrl-0 = <&lcd_panel_reset>; rockchip,delay = <20>; }; }; }; test-power { status = "okay"; }; }; ... &pinctrl { lcd-panel { lcd_panel_reset: lcd-panel-reset { rockchip,pins = <4 29 RK_FUNC_GPIO &pcfg_pull_up>; }; lcd_panel_enable: lcd-panel-enable { rockchip,pins = <1 1 RK_FUNC_GPIO &pcfg_pull_up>; }; }; };

這里定義了LCD的電源控制引腳:

lcd_en:(GPIO1_A1)GPIO_ACTIVE_HIGH lcd_rst:(GPIO4_D5)GPIO_ACTIVE_HIGH

都是高電平有效。

MIPI屏

Firefly-RK3399的SDK有MIPI DSI的DTS文件:kernel/arch/arm64/boot/dts/rockchip/rk3399-firefly-mipi.dts,從該文件中我們可以看到以下語句:

/ { model = "Firefly-RK3399 Board mipi (Android)"; compatible = "rockchip,android", "rockchip,rk3399-firefly-mipi", "rockchip,rk3399"; test-power { status = "okay"; }; }; &dsi { status = "okay"; dsi_panel: panel { compatible ="simple-panel-dsi"; reg = <0>; backlight = <&backlight>; dsi,flags = <(MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST /*| MIPI_DSI_MODE_VIDEO_SYNC_PULSE*/)>; dsi,format = <MIPI_DSI_FMT_RGB888>; bus-format = <MEDIA_BUS_FMT_RGB666_1X18>; dsi,lanes = <4>; ... power_ctr: power_ctr { rockchip,debug = <1>; lcd_en: lcd-en { gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>; pinctrl-names = "default"; pinctrl-0 = <&lcd_panel_enable>; rockchip,delay = <10>; }; lcd_rst: lcd-rst { gpios = <&gpio4 29 GPIO_ACTIVE_HIGH>; pinctrl-names = "default"; pinctrl-0 = <&lcd_panel_reset>; rockchip,delay = <6>; }; }; ... &pinctrl { lcd-panel { lcd_panel_reset: lcd-panel-reset { rockchip,pins = <4 29 RK_FUNC_GPIO &pcfg_pull_up>; }; lcd_panel_enable: lcd-panel-enable { rockchip,pins = <1 1 RK_FUNC_GPIO &pcfg_pull_up>; }; }; };

這里定義了LCD的電源控制引腳:

lcd_en:(GPIO1_A1)GPIO_ACTIVE_HIGH lcd_en:(GPIO4_D5)GPIO_ACTIVE_HIGH

都是高電平有效。

配置背光

在DTS文件:kernel/arch/arm64/boot/dts/rockchip/rk3399-firefly-core.dtsi中配置了背光信息,如下:

/ { compatible = "rockchip,rk3399-firefly-core", "rockchip,rk3399"; backlight: backlight { status = "disabled"; compatible = "pwm-backlight"; pwms = <&pwm0 0 25000 0>; brightness-levels = < 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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255>; default-brightness-level = <200>; };

pwms屬性:配置PWM,范例里面默認使用pwm0,25000ns是周期(40 KHz)。EDP屏可直接使用該DTS文件,而MIPI屏使用的pwm輸出是pwm1。在kernel/arch/arm64/boot/dts/rockchip/rk3399-firefly-mipi.dts中可以看到以下語句:

&backlight{ status = "okay"; pwms = <&pwm1 0 25000 0>; }

因此使用時需修改DTS文件。

brightness-levels屬性:配置背光亮度數組,最大值為255,配置暗區和亮區,并把亮區數組做255的比例調節。比如范例中暗區是255-221,亮區是220-0。 default-brightness-level屬性:開機時默認背光亮度,范圍為0-255。 具體請參考kernel中的說明文檔:kernel/Documentation/devicetree/bindings/leds/backlight/pwm-backlight.txt

配置顯示時序

EDP屏

  • kernel 把 Timing 寫在 panel-simple.c 中, 直接以短字符串匹配 在drivers/gpu/drm/panel/panel-simple.c文件中有以下語句:

static const struct drm_display_mode lg_lp079qx1_sp0v_mode = { .clock = 200000, .hdisplay = 1536, .hsync_start = 1536 + 12, .hsync_end = 1536 + 12 + 16, .htotal = 1536 + 12 + 16 + 48, .vdisplay = 2048, .vsync_start = 2048 + 8, .vsync_end = 2048 + 8 + 4, .vtotal = 2048 + 8 + 4 + 8, .vrefresh = 60, .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC, }; static const struct panel_desc lg_lp097qx1_spa1 = { .modes = &lg_lp097qx1_spa1_mode, .num_modes = 1, .size = { .width = 320, .height = 187, }, }; ... ... static const struct of_device_id platform_of_match[] = { { .compatible = "simple-panel", .data = NULL, },{ }, { .compatible = "lg,lp079qx1-sp0v", .data = &lg_lp079qx1_sp0v, }, { }, { /* sentinel */ } };

MODULE_DEVICE_TABLE(of, platform_of_match); 時序的參數在結構體lg_lp079qx1_sp0v_mode中配置。

  • U-boot

把 Timing 寫在 rockchip_panel.c 中, 直接以短字符串匹配 在drivers/video/rockchip_panel.c文件中有以下語句:

static const struct drm_display_mode lg_lp079qx1_sp0v_mode = { .clock = 200000, .hdisplay = 1536, .hsync_start = 1536 + 12, .hsync_end = 1536 + 12 + 16, .htotal = 1536 + 12 + 16 + 48, .vdisplay = 2048, .vsync_start = 2048 + 8, .vsync_end = 2048 + 8 + 4, .vtotal = 2048 + 8 + 4 + 8, .vrefresh = 60, .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC, }; static const struct rockchip_panel g_panel[] = { { .compatible = "lg,lp079qx1-sp0v", .mode = &lg_lp079qx1_sp0v_mode, }, { .compatible = "auo,b125han03", .mode = &auo_b125han03_mode, }, };

時序的參數在結構體lg_lp079qx1_sp0v_mode中配置。

MIPI屏

與EDP屏不同,MIPI屏的 Timing 寫在DTS文件中,在kernel/arch/arm64/boot/dts/rockchip/rk3399-firefly-mipi.dts中可以看到以下語句:

disp_timings: display-timings { native-mode = <&timing0>; timing0: timing0 { clock-frequency = <80000000>; hactive = <768>; vactive = <1024>; hsync-len = <20>; //20, 50 hback-porch = <130>; //50, 56 hfront-porch = <150>;//50, 30 vsync-len = <40>; vback-porch = <130>; vfront-porch = <136>; hsync-active = <0>; vsync-active = <0>; de-active = <0>; pixelclk-active = <0>; }; } }
  • Kernel

在kernel/drivers/gpu/drm/panel/panel-simple.c中可以看到在初始化函數panel_simple_probe中初始化了獲取時序的函數。

static int panel_simple_probe(struct device *dev, const struct panel_desc *desc){ ··· panel->base.funcs = &panel_simple_funcs; ··· }

該函數的在kernel/drivers/gpu/drm/panel/panel-simple.c中也有定義:

static int panel_simple_get_timings(struct drm_panel *panel,unsigned int num_timings,struct display_timing *timings) { struct panel_simple *p = to_panel_simple(panel); unsigned int i; if (!p->desc) return 0; if (p->desc->num_timings < num_timings) num_timings = p->desc->num_timings; if (timings) for (i = 0; i < num_timings; i++) timings[i] = p->desc->timings[i]; return p->desc->num_timings; }

時序屬性參考下圖:

Init Code
MIPI屏

mipi屏上完電后需要發送初始化指令才能使之工作。

  • Dts

可以在kernel/arch/arm64/boot/dts/rockchip/rk3399-firefly-mipi.dts中可以看到mipi的初始化指令列表:

&dsi { status = "okay"; ... panel-init-sequence = [ 05 20 01 29 05 96 01 11 ]; panel-exit-sequence = [ 05 05 01 28 05 78 01 10 ]; ... };

命令格式以及說明可參考以下附件:

Rockchip DRM Panel Porting Guide.pdf

  • kernel

發送指令可以看到在kernel/drivers/gpu/drm/panel/panel-simple.c文件中的操作:

static int panel_simple_enable(struct drm_panel *panel) { struct panel_simple *p = to_panel_simple(panel); int err; if (p->enabled) return 0; DBG("enter\n"); if (p->on_cmds) { err = panel_simple_dsi_send_cmds(p, p->on_cmds); if (err) dev_err(p->dev, "failed to send on cmds\n"); } if (p->desc && p->desc->delay.enable) { DBG("p->desc->delay.enable=%d\n", p->desc->delay.enable); msleep(p->desc->delay.enable); } if (p->backlight) { DBG("open backlight\n"); p->backlight->props.power = FB_BLANK_UNBLANK; backlight_update_status(p->backlight); } p->enabled = true; return 0; }
  • U-boot

發送指令可以看到在u-boot/drivers/video/rockchip-dw-mipi-dsi.c文件中的操作:

static int rockchip_dw_mipi_dsi_enable(struct display_state *state) { struct connector_state *conn_state = &state->conn_state; struct crtc_state *crtc_state = &state->crtc_state; const struct rockchip_connector *connector = conn_state->connector; const struct dw_mipi_dsi_plat_data *pdata = connector->data; struct dw_mipi_dsi *dsi = conn_state->private; u32 val; DBG("enter\n"); dw_mipi_dsi_set_mode(dsi, DW_MIPI_DSI_VID_MODE); dsi_write(dsi, DSI_MODE_CFG, ENABLE_CMD_MODE); dw_mipi_dsi_set_mode(dsi, DW_MIPI_DSI_VID_MODE); if (!pdata->has_vop_sel) return 0; if (pdata->grf_switch_reg) { if (crtc_state->crtc_id) val = pdata->dsi0_en_bit | (pdata->dsi0_en_bit << 16); else val = pdata->dsi0_en_bit << 16; writel(val, RKIO_GRF_PHYS + pdata->grf_switch_reg); } debug("vop %s output to dsi0\n", (crtc_state->crtc_id) ? "LIT" : "BIG"); //rockchip_dw_mipi_dsi_read_allregs(dsi); return 0; }

聲明:本文內容及配圖由入駐作者撰寫或者入駐合作網站授權轉載。文章觀點僅代表作者本人,不代表電子發燒友網立場。文章及其配圖僅供工程師學習之用,如有內容侵權或者其他違規問題,請聯系本站處理。 舉報投訴
  • 嵌入式主板
    +關注

    關注

    7

    文章

    6066

    瀏覽量

    34690
  • 安卓
    +關注

    關注

    5

    文章

    2094

    瀏覽量

    55377
  • 可制造性設計

    關注

    10

    文章

    2063

    瀏覽量

    15319
  • Firefly
    +關注

    關注

    2

    文章

    537

    瀏覽量

    6793
  • 華秋DFM
    +關注

    關注

    20

    文章

    3486

    瀏覽量

    3978
收藏 人收藏

    評論

    相關推薦

    Firefly RK3399試用體驗】+linux環境下給RK3399燒入linux

    `首先感謝論壇給我這個使用的機會,去年這塊板子剛出來的時候就被他強大的性能所吸引,剛好在開發雙目視覺的項目,需要一個快能直接開啟兩個攝像頭的板子,firefly的這塊RK3399無疑是最適合不過的了
    發表于 08-26 11:06

    請問firefly rk3399如何設置靜態IP?

    請問firefly rk3399如何設置靜態IP?
    發表于 03-08 06:38

    如何對Firefly-RK3399進行編譯呢

    如何對Firefly-RK3399進行編譯呢?
    發表于 03-08 07:16

    Firefly-RK3399板卡上電默認啟動Android系統

      一、簡介  Firefly-RK3399Firefly最新發布的新一代頂級開源平臺,采用了瑞芯微的六核(雙核A72+四核A53)處理器——RK3399?! 《?、開箱  Firefly
    發表于 06-21 10:05

    RK3399-firefly開發板原理圖

    RK3399-firefly開發板原理圖
    發表于 09-16 09:35 ?289次下載

    Firefly-RK3399--接口介紹

    Firefly-RK3399 提供了豐富的接口,主要包括:電源接口,
    的頭像 發表于 11-19 15:25 ?3364次閱讀
    <b class='flag-5'>Firefly-RK3399</b>--接口<b class='flag-5'>介紹</b>

    Firefly-RK3399--FAQs簡介

    Firefly-RK3399 的 HDMI 能自動識別顯示的分辨率。
    的頭像 發表于 11-19 15:27 ?2813次閱讀
    <b class='flag-5'>Firefly-RK3399</b>--FAQs簡介

    Firefly-RK3399--PWM介紹

    Firefly-RK3399 開發板上有 4 路 PWM 輸出,分別為 PWM0 ~ PWM3,4路 PWM 分別使用在eDP背光、MIPI背光、VDDLOG供電、紅外IR。 本章主要描述如何配置 PWM。
    的頭像 發表于 11-22 10:08 ?5171次閱讀
    <b class='flag-5'>Firefly-RK3399</b>--PWM<b class='flag-5'>介紹</b>

    Firefly-RK3399開發板

    Firefly-RK3399 開發板分別帶有兩個MIPI,一個DVP攝像頭接口,MIPI支持最高4K拍照,并支持 1080P 30fps以上視頻錄制。此外,開發板還支持 USB 攝像頭。
    的頭像 發表于 11-23 09:34 ?4379次閱讀
    <b class='flag-5'>Firefly-RK3399</b>開發板

    Firefly-RK3399--LED 介紹

    標準的 Linux 專門為 LED 設備定義了 LED 子系統。 在 Firefly-RK3399 開發板中的兩個 LED 均以設備的形式被定義。
    的頭像 發表于 11-22 10:13 ?3198次閱讀
    <b class='flag-5'>Firefly-RK3399</b>--LED <b class='flag-5'>介紹</b>

    Firefly-RK3399--IR程序 使用

    Firefly-RK3399 開發板上使用紅外收發傳感器 IR (在 mic 接口和喇叭接口之間)實現遙控功能,在IR接口處接上紅外接收器。本文主要描述在開發板上如何配置紅外遙控器。
    的頭像 發表于 11-22 10:24 ?1723次閱讀
    <b class='flag-5'>Firefly-RK3399</b>--IR程序 使用

    Firefly-RK3399--I2C開發板介紹

    Firefly-RK3399開發板上有 9 個片上 I2C 控制器,各個 I2C 的使用情況
    的頭像 發表于 11-22 10:43 ?2201次閱讀
    <b class='flag-5'>Firefly-RK3399</b>--I2C開發板<b class='flag-5'>介紹</b>

    Firefly-RK3399--ADC開發板介紹

    Firefly-RK3399開發板上的 AD 接口有兩種,分別為:溫度傳感器 (Temperature Sensor)、逐次逼近ADC (Successive Approximation Register)。
    的頭像 發表于 11-22 10:34 ?1892次閱讀
    <b class='flag-5'>Firefly-RK3399</b>--ADC開發板<b class='flag-5'>介紹</b>

    Firefly-RK3399開發板介紹

    Firefly-RK3399有靈活的啟動方式。一般情況下,除非硬件損壞,Firefly-RK3399開發板是不會變磚的。
    的頭像 發表于 11-23 11:30 ?3046次閱讀
    <b class='flag-5'>Firefly-RK3399</b>開發板<b class='flag-5'>介紹</b>

    如何對RK3399開發板做一些基礎的配置

    最近在小黃魚入手了一個RK3399的開發板,RK的芯片我也是第一次使用。FireFly配套提供了完善的教程,可以在他們的WIKI上找到。上面有的內容就不在本文敘述了,大家可以參考教程https://wiki.t-
    的頭像 發表于 10-10 14:58 ?1530次閱讀
    亚洲欧美日韩精品久久_久久精品AⅤ无码中文_日本中文字幕有码在线播放_亚洲视频高清不卡在线观看
    <acronym id="s8ci2"><small id="s8ci2"></small></acronym>
    <rt id="s8ci2"></rt><rt id="s8ci2"><optgroup id="s8ci2"></optgroup></rt>
    <acronym id="s8ci2"></acronym>
    <acronym id="s8ci2"><center id="s8ci2"></center></acronym>