新增panel-lh24030c50.c文件

配置makefile

  • 路径:/kernel/drivers/gpu/drm/panel/Makefile

  • 新增一行

    obj-$(CONFIG_DRM_PANEL_LH24030C50) += panel-lh24030c50.o
    
    • 当内核配置系统检测到 CONFIG_DRM_PANEL_LH24030C50 被赋值为 y(内建)或 m(模块)时,该行会生效。
    • .c 文件编译为对应的 .o 目标文件,并最终链接进内核镜像(y)或生成独立的 .ko 内核模块文件(m)。

配置Kconfig

  • 路径:/kernel/drivers/gpu/drm/panel/Kconfig

  • 新增

    config DRM_PANEL_LH24030C50
    	tristate "LH24030C50 RGB panel"
    	depends on OF && SPI
    	depends on BACKLIGHT_CLASS_DEVICE
    	help
    	  Say Y here if you want to enable support for the LH24030C50
    	  RGB panel module driven by an ST7789V-compatible controller.
    
    • tristate:表示该选项支持三种状态——Y(内建)、M(模块)、N(不编译)。对应Makefile中的 obj-*
    • depends on OF && SPI依赖约束。只有启用了设备树(OF)和SPI总线支持时,该选项才会出现在菜单中。这防止了非硬件平台误选,也保证了编译时能引用到SPI子系统的头文件和符号。
    • depends on BACKLIGHT_CLASS_DEVICE:强制依赖背光类设备。因为面板需要背光调节功能,若内核未开启背光支持,该驱动编译会因找不到 struct backlight_device 等定义而失败。
    • help:给开发者或用户看的说明文本,描述该驱动适用的硬件型号。

内核配置

开启内核配置

kernel_defconfig

CONFIG_DRM_PANEL_LH24030C50=y #与上面makefile中的 CONFIG_DRM_PANEL_LH24030C50 一致
# CONFIG_DRM_PANEL_SIMPLE=y 如果用设备树用simple-panel
CONFIG_BACKLIGHT_CLASS_DEVICE=y
CONFIG_BACKLIGHT_GPIO=y

关闭内核配置

#CONFIG_FB_TFT=y
#CONFIG_DRM_PANEL_SITRONIX_ST7789V=y
#CONFIG_FB_TFT_ST7735R=y
#CONFIG_FB_TFT_ST7789V=y

频率过高

rv1106g-luckfox-pico-pro-max.dts

/**********CRU**********/
&cru {
	assigned-clocks = <&cru 3>;
	assigned-clock-rates = <216000000>;
};

aa_rv1106-lcd.dtsi

&vop {
	assigned-clocks = <&cru 201>;
	assigned-clock-parents = <&cru 3>;
	status = "okay";
};
timing0: panel-timing {
	clock-frequency = <7000000>;
	hactive = <240>;
	vactive = <320>;
	hfront-porch = <1>;
	hback-porch = <20>;
	hsync-len = <10>;
	vfront-porch = <8>;
	vback-porch = <2>;
	vsync-len = <6>;
	hsync-active = <0>;
	vsync-active = <0>;
	de-active = <1>;
	pixelclk-active = <0>;
};

rv1106-luckfox-pico-pro-max-ipc.dtsi

注释
/*****************************PINCTRL********************************/
// SPI
// &spi0 {
// 	pinctrl-0 = <&spi0m0_clk &spi0m0_miso &spi0m0_mosi &spi0m0_cs0>;
// 	#address-cells = <1>;
// 	#size-cells = <0>;
// 	spidev@0 {
// 	compatible = "rockchip,spidev";
// 		spi-max-frequency = <50000000>;
// 		reg = <0>;
// 	};

// 	fbtft@0 {
// 		compatible = "sitronix,st7789v";
// 		reg = <0>;
// 		spi-max-frequency = <20000000>;
// 		fps = <30>;
// 		buswidth = <8>;
// 		debug = <0x7>;
// 		led-gpios = <&gpio2 RK_PB0 GPIO_ACTIVE_HIGH>;//BL
// 		dc-gpios = <&gpio2 RK_PB1 GPIO_ACTIVE_HIGH>;//DC
// 		reset-gpios = <&gpio1 RK_PC3 GPIO_ACTIVE_LOW>;//RES
// 	};
// };