uboot的设备驱动在probe之后才会执行rk_board_late_init,所以能显示充电图片。
uboot配置开启功能
详细跳转:config
SDK的.BoardConfig.mk文件开启fragment
# Uboot defconfig fragment
export RK_UBOOT_DEFCONFIG_FRAGMENT=rv1106-lcd.config
设备树
由于uboot配置文件配置了,使用内核的设备树。这是RK平台的特性,FIT启用后支持这么玩。
CONFIG_USING_KERNEL_DTB_V2=y
由于设备树中RGB节点,需要匹配内核以及uboot的SPI初始化功能。
compatible = "lh,lh24030c50", "simple-panel";
| 顺序 | 尝试匹配 | 结果 |
|---|---|---|
| 1st | U-Boot 搜 lh24030c50 | ✅ 命中我们的驱动 |
| 2nd | simple-panel | 不再尝试,已被第一个拿走 |
-
rockchip_panel驱动(匹配simple-panel)根本看不到这个节点。 -
Kernel 侧同理:
lh,lh24030c50是 SPI 驱动(不匹配根节点下的 panel),跳过→ 回退到simple-panel,命中panel-simple。
驱动代码
-
代码:跳转
-
Kconfig
路径:/u-boot/drivers/video/drm/Kconfig
config DRM_PANEL_LH24030C50 bool "LH24030C50 (ST7789V) 240x320 RGB panel" depends on DRM_ROCKCHIP help Say Y to enable support for the LH24030C50 / ST7789V-based 240x320 RGB LCD panel. This driver uses GPIO bitbang SPI for panel initialization and parallel RGB for display data. -
Makefile
路径:/u-boot/drivers/video/drm/Makefile
obj-$(CONFIG_DRM_PANEL_LH24030C50) += panel-lh24030c50.o
编译错误修改
1. rockchip_post_csc.c → 第 7 行加了一行 #include <common.h>
这文件原本缺这个头文件。编译时 rockchip_post_csc.h → edid.h → i2c.h 会用到 uchar 类型,而 uchar 在 <common.h> 里定义。不加就编译报错。