Skip to content

移植-显示

本文档介绍 MIPI 屏的移植流程,包括设备树配置与基于 DRM 框架的 Panel 驱动适配(以 Yousee YX80040ACT 为例)。

设备树配置

配置文件:

text
layers/meta-qcom-hwe/recipes-kernel/linux/linux-qcom-custom/kernel-source/arch/arm64/boot/dts/qcom/qcm6490-idp.dts
dts
&mdss_dsi {                               // 高通 DSI 节点
    vdda-supply = <&vreg_l6b_1p2>;        // DSI power
    status = "okay";

    panel@0 {                             // LCD panel 节点
        compatible = "yousee,yx80040act"; // LCD driver
        reg = <0>;

        /* 3.3V panel power */
        power-gpios = <&tlmm 9 GPIO_ACTIVE_HIGH>;   // LCD power gpio
        /* Reset pin */
        reset-gpios = <&tlmm 8 GPIO_ACTIVE_LOW>;    // LCD reset gpio

        backlight = <&pm8350c_pwm_backlight>;       // 背光 PWM

        port {                             // DSI port
            panel0_in: endpoint {
                remote-endpoint = <&mdss_dsi0_out>;
            };
        };
    };
};

添加 Panel 驱动

内核配置

在以下配置文件中添加 driver 的 config:

text
layers/meta-qcom-hwe/recipes-kernel/linux/linux-qcom-custom/kernel-source/arch/arm64/configs/qcom_addons.config
kconfig
CONFIG_DRM_PANEL_YOUSEE_YX80040ACT=m

Kconfig

text
layers/meta-qcom-hwe/recipes-kernel/linux/linux-qcom-custom/kernel-source/drivers/gpu/drm/panel/Kconfig
kconfig
config DRM_PANEL_YOUSEE_YX80040ACT
	tristate "Yousee YX80040ACT panel driver"
	depends on OF
	depends on DRM_MIPI_DSI
	depends on BACKLIGHT_CLASS_DEVICE
	help
	  Say Y here if you want to enable support for the Yousee
	  YX80040ACT controller for 1200x1920 MIPI LCD panels

Makefile

text
layers/meta-qcom-hwe/recipes-kernel/linux/linux-qcom-custom/kernel-source/drivers/gpu/drm/panel/Makefile
makefile
obj-$(CONFIG_DRM_PANEL_YOUSEE_YX80040ACT) += panel-yousee-yx80040act.o

Panel 驱动实现

基于 DRM 框架的 Panel Driver:

text
layers/meta-qcom-hwe/recipes-kernel/linux/linux-qcom-custom/kernel-source/drivers/gpu/drm/panel/panel-yousee-yx80040act.c