6.2.5.2.2. 软件框图¶
在软件 SDK 中,显示引擎,显示接口与 LCD 的关系是 1 X N X N。 一个显示引擎需要对接多个显示接口,一个显示接口又要适配多款 LCD,其数据链路是不确定的。
 
DE 和 DI 在显示框架上属于同级模块,都是 display subsystem 中的 component,使用 struct platform_driver 来表示。
struct platform_driver {
    const char *name;
    int component_type;
    int (*probe)(void);
    void (*remove)(void);
    union {
        struct di_funcs *di_funcs;
        struct de_funcs *de_funcs;
    };
};
注解
MIPI-DBI 是软件虚拟出来的 device,为 MIPI-DBI 协议提供支持。MIPI-DBI 协议包括 3 种类型:
- Type A: Motorola 6800 
- Type B: Intel 8080 
- Type C: SPI 
目前 Artinchip 平台仅支持 Type B 和 Type C
LCD panel 使用 struct aic_panel 来表示。严格来说,panel component 不算一个 driver,只是一些屏参数和回调函数的结合。
struct aic_panel {
    const char *name;
    struct aic_panel_funcs *funcs;
    struct aic_panel_callbacks callbacks;
    const struct display_timing *timings;
    union {
        struct panel_rgb  *rgb;
        struct panel_lvds *lvds;
        struct panel_dsi  *dsi;
        struct panel_dbi  *dbi;
    };
    int connector_type;
};
- struct aic_panel_funcs *funcs;由 panel 提供,供 fb 调用的回调
- struct aic_panel_callbacks callbacks;由 DE/DI 提供,供 panel 调用的回调
在 panel 提供的 struct aic_panel_funcs 中, 会调用 DE/DI 提供的 struct aic_panel_callbacks。
callbacks 的设计是为了满足 DE、DI、panel 三个硬件模块的初始化时序,包含先后顺序、延迟大小等。时序约束主要来自 panel 侧。
6.2.5.2.3. 初始化流程¶
在 menuconfig 中使能 LVDS 显示接口和 simple panel 后,显示驱动的初始化过程如下:
 
6.2.5.2.3.1. DE 和 DI 匹配¶
DI 在 menuconfig 配置时进行选择,三个显示接口只能使能一个。DE, DI 的 driver 会被存放在一个指针数组中。
static struct platform_driver *drivers[] = {
#ifdef AIC_DISP_DE_DRV
    &artinchip_de_driver,
#endif
#ifdef AIC_DISP_RGB
    &artinchip_rgb_driver,
#endif
#ifdef AIC_DISP_LVDS
    &artinchip_lvds_driver,
#endif
#ifdef AIC_DISP_MIPI_DSI
    &artinchip_dsi_driver
#endif
#ifdef AIC_DISP_MIPI_DBI
    &artinchip_dbi_driver
#endif
};
通过 component_type 来适配 menuconfig 指定的 driver。
6.2.5.2.3.2. panel 的匹配¶
panel_com.c 维护了一个 panel 的指针数组。
static struct aic_panel *panels[] = {
#ifdef AIC_DISP_RGB
    &aic_panel_rgb,
#endif
#ifdef AIC_DISP_LVDS
    &aic_panel_lvds,
#endif
#ifdef AIC_PANEL_DSI_XM91080
    &dsi_xm91080,
#endif
};
通过 struct aic_panel *aic_find_panel(u32 connector_type) 即可获取一个跟显示接口匹配的 LCD panel。
在 menuconfig 中选择 panel 时,只能使能其中一个。
panel_simple.c 为不需要初始化命令的 LCD 提供 panel,例如:常用的 prgb, lvds 屏幕。
