Edit online

Display 配置

Read time: 8 minute(s)
本节介绍显示子系统的以下类型的参数配置:
  • menuconfig 配置:LCD 外设或者改动频繁的显示参数。

  • disp_conf 头文件配置:显示接口宏定义参数。

    引入 disp_conf.h 头文件是为了避免 menuconfig 参数过多导致误改。

    disp_conf.h 中的参数可方便 PCB layout 走线,但配置有误会导致显示异常。推荐在硬件工程师的确认下,结合芯片用户手册进行修改。

Edit online

menuconfig 配置

Read time: 8 minute(s)
  1. Luban-Lite 根目录下执行 make linux-menuconfig,进入 kernel 的功能配置。
  2. 在 menuconfig 的功能配置界面,按如下选择,使能显示引擎驱动:
    Board options  --->
        [*] Using Display Engine (DE)
  3. 根据 LCD 外设类型,选择显示接口。仅支持使能一个显示接口。
    例如,选择 Display LVDS interface
    Display Parameter  --->
       select Display interface (Display LVDS interface)  --->
  4. 配置正确的 panel。menuconfig 仅显示当前已使能的显示接口所支持的 panel。
    Display Parameter  --->
       Display Panels  --->
    Luban-Lite SDK 不仅为 RGB/ LVDS 等标准接口提供通用的 panel 驱动 ArtInChip simple panel,也为部分屏驱 IC 提供专用的 panel 驱动。ArtInChip simple panel 支持 menuconfig 修改屏时序参数。
    Display Panels  --->
        ArtInChip Panel Drivers (ArtInChip simple panel)  --->
        display timing of simple panel  --->
  5. 在 menuconfig 配置界面,选择下列背光方式之一,并配置相关背光参数:
    • 选择 GPIO 方式控制背光:
      1. 使能 GPIO 控制背光。
        Display Parameter  --->
            panel backlight control (gpio)  --->
      2. 以字符串的形式指定 GPIO 引脚。背光 GPIO 引脚默认高电平有效。例如,设置背光 GPIO 引脚为 PE.19:
         (PE.19) panel backlight enable pin
                [ ] panel backlight enable pin low active
    • 选择 PWM 方式控制背光:
      1. 使能 PWM,选择 PWM 方式控制背光,配置 PWM 的通道和默认占空比 [0, 100]。
        Board options  --->
            [*] Using PWM3
      2. 配置 PWM-BACKLIGHT
        (pwm backlight channel) 3
        (default brightness level) 80
  6. 配置下列显示引擎参数:
    Display Parameter  --->
        select framebuffer format (argb8888)  --->
        [*] Support double framebuffer
        [*] Enable Display Dither
    • framebuffer format :framebuffer 的数据格式,默认 ARGB8888 32 位。

    • double framebuffer: 双 buffer 可避免屏幕撕裂,获得更好的显示效果。

    • Display Dither : 抖色,误差扩散,能让图像色彩渐变更平滑。

      Display Dither 生效条件:

      • 屏幕宽度小于显示引擎最大支持宽度,具体规格参考芯片手册。
      • framebuffer bpp (bits per pixel) 大于显示接口输出的 bpp,例如 framebuffer 为 24/32 位 RGB 数据,显示接口输出 16/18 位 RGB 数据。
  7. 选择下列显示接口之一,并配置对应的显示接口参数。
    • 选择 RGB 接口并配置 RGB 接口参数
      Display Parameter  --->
          select Display interface (Display RGB interface)  --->
          RGB interface options  --->
    • 选择 LVDS 接口并 配置 LVDS 接口参数
      Display Parameter  --->
          select Display interface (Display LVDS interface)  --->
          LVDS interface options  --->
    • 选择 MIPI-DSI 接口,ArtInChip 平台不支持 menuconfig 配置 MIPI-DSI 参数。建议在 panel 驱动中使用 hardcode 的形式进行配置。
    • 选择 MIPI-DBI 接口,ArtInChip 平台不支持 menuconfig 配置 MIPI-DBI 参数,建议在 panel 驱动中使用 hardcode 的形式进行配置。

配置 RGB 接口参数

配置下列 RGB 接口参数:
RGB interface options  --->
    rgb mode (PRGB)  --->
    interface format (PRGB 16 BIT LD)  --->
    data order (RGB)  --->
    clock phase select (0 degree)  --->
1. panel_rgb 节点参数描述

参数名称

描述

rgb-mode

设置 RGB 显示接口的输出模式,支持并行 RRGB 和串行 SRGB 两种模式。

interface-format

设置 RGB 显示接口的输出格式,
interface format 描述
RRGB 24 BIT RGB 24 位输出
RRGB 18 BIT LD RGB 18 位输出,丢弃低 6 个 pin
RRGB 18 BIT HD RGB 18 位输出,丢弃高 6 个 pin
RRGB 16 BIT LD RGB 16 位输出,丢弃低 8 个 pin
RRGB 16 BIT HD RGB 16 位输出,丢弃高 8 个 pin

data-order

RGB 数据的输出顺序,R/G/B 三组信号可按任意顺序输出。
R/G/B 分量输出顺序
data order 描述
RGB 数据输出顺序为 RGB
RBG 数据输出顺序为 RBG
BGR 数据输出顺序为 BGR
BRG 数据输出顺序为 BRG
GRB 数据输出顺序为 GRB
GBR 数据输出顺序为 GBR

clock-phase

Pixelclk 时钟相位选择,提供四种相位,允许时钟上升沿延后数据 0/90/180/270 度相位
  • 时钟相位有误,会导致图像存在斑点,在颜色渐变区域尤为明显。逐一尝试时钟相位,找出最佳效果

  • 时钟相位偏移 90 度,pixelclk 极性会发生翻转

data-mirror

RGB 数据组内大小端输出,高低位互换。默认输出低位到高位 0 - 7,使能后输出 7 - 0。

配置 LVDS 接口参数

配置下列 LVDS 显示接口参数:
LVDS interface options  --->
    lvds mode (vesa-24)  --->
    lvds link mode (single link 1)  --->
  • LVDS mode:LVDS 模式设置,默认输出为 vesa-24 模式
    2. LVDS 模式设置

    LVDS mode

    strings

    备注

    NS

    “vesa-24”

    默认值

    JEIDA 8 bit

    “jeida-24”

    -

    JEIDA 6 bit

    “jeida-18”

    -

  • LVDS Link mode:LVDS Link 设置,默认配置 Single Link1 ,单 Link 输出,Link1 通道。
    3. LVDS Link 模式设置

    LVDS Link mode

    strings

    备注

    单 Link 模式 0

    “single-link0”

    单 Link 输出,输出选择 Link0 通道

    单 Link 模式 1

    “single-link1”

    默认值。单 Link 输出,输出选择 Link1 通道

    单 Link 模式 2

    “double-screen”

    单 Link 输出,Link0 和 Link1 同时输出,驱动双屏同显

    双 Link 模式

    “dual-link”

    Dual Link 输出,奇偶像素同时输出

Edit online

disp_conf 头文件配置

Read time: 8 minute(s)

在显示驱动中,disp_conf.h 头文件用于配置显示接口的宏定义。引入 disp_conf.h 头文件是为了避免 menuconfig 参数过多导致误改。这部分参数可方便 PCB layout 走线,配置有误会导致显示异常。推荐在硬件工程师的确认下,结合芯片手册进行修改。

本节介绍了常见的 LVDSMIPI-DSI 参数及其配置。

LVDS 参数

/* lvds link swap enable, swap lvds link0 and link1 */
#define AIC_LVDS_LINK_SWAP_EN   0

/**
 * lvds channel output order
 *
 * works on both link0 and link1 (if exists)
 *
 * default D3 CK D2 D1 D0
 *          4  3  2  1  0
 */
#define AIC_LVDS_LINES      0x43210

/**
 * lvds channel polarities, works on both link0 and link1 (if exists)
 */
#define AIC_LVDS_POL        0x0

/**
 * lvds channel phy config, works on both link0 and link1 (if exists)
 */
#define AIC_LVDS_PHY        0xFA
4. LVDS 参数详细描述

参数名称

功能定义

备注

AIC_LVDS_SYNC_MODE_EN

LVDS 同步前端信号模式使能。

防止前端给到半帧数据时打开 LVDS 模块,出现显示异常,不推荐关闭。

AIC_LVDS_LINK_SWAP_EN

LVDS Link 互换使能,Link 0 通道与 Link 1 通道输出互换

默认值:禁用 (0)

AIC_LVDS_LINES

LVDS Link 通道内输出选择。

控制 LVDS Link 内部五个通道的差分信号输出,允许五对差分信号任意互换:
  • 默认值:0x43210
  • 五个通道:D3 CK D2 D1 D0。
  • 0x43210:缺省值,4 个 bit 表示一个通道。D3 通道输出 D3,CK 通道输出 CK,D2 通道输出 D2,D1 通道输出 D1,D0 通道输出 D0。
  • 0x01234:D3 通道输出 D0,CK 通道输出 D1,D2 通道输出 D2,D1 通道输出 CK,D0 通道输出 D3。

AIC_LVDS_POL

LVDS 通道极性控制

低 5 bit 分别控制 LVDS 五个通道差分信号的极性,通道默认顺序为 D3 CK D2 D1 D0:
  • 0x3 表示 D1 D0 通道极性反相
  • 0x8 表示 CK 通道反相

AIC_LVDS_POL 受 AIC_LVDS_LINES 影响,如果 CK 通道选择输出 D0,则该 bit 控制 D0 相位,0x8 表示 D0 反相。

AIC_LVDS_PHY

LVDS 物理层控制

对应芯片手册 LVDS_0_PHY_CTL 和 LVDS_1_PHY_CTL 寄存器的数值,结合芯片手册进行修改。

MIPI-DSI 参数

/* data line assignments */
#define LANE_ASSIGNMENTS 0x0123;

/* data line polarities */
#define LANE_POLARITIES  0b1111;

/* data clk inverse */
#define CLK_INVERSE      1
5. MIPI-DSI 参数详细描述

参数名称

功能定义

备注

LANE_ASSIGNMENTS

数据通道输出选择,方便 layout 走线

4 个 bit 表示一个通道。

  • 0x0123:默认值。
    • 数据通道 3 输出 DATA0
    • 数据通道 2 输出 DATA1
    • 数据通道 1 输出 DATA2
    • 数据通道 0 输出 DATA3
  • 0x3012
    • 数据通道 3 输出 DATA3
    • 数据通道 2 输出 DATA0
    • 数据通道 1 输出 DATA1
    • 数据通道 0 输出 DATA2
  • 0x01:如果是两个 lane,表示数据通道 1 输出 DATA0,数据通道 0 输出 DATA1。

LANE_POLARITIES

数据通道极性是否正负极取反

默认值:0b1111

二进制参数,1 个 bit 对应一个通道,与 LANE_ASSIGNMENTS 配置的通道顺序保持一致。

示例:LANE_ASSIGNMENTS = <0x3012>, LANE_POLARITIES = <0b1010>,表示 DATA3 和 DATA1 正负极取反。

CLK_INVERSE

CLK Lane 正负极取反

-