【問題】
背光碟機動初始化先於LCD驅動初始化,導致LCD驅動初始化時出現閃屏的現象。
【解決過程】
1 mach-xxx.c中platform devices列表如下
/* platform devices */
static struct platform_device *athena_evt_platform_devices[] __initdata = {
//&xxx_led_device,
&xxx_rtc_device,
&xxx_uart0_device,
&xxx_uart1_device,
&xxx_uart2_device,
&xxx_uart3_device,
&xxx_nand_device,
&xxx_i2c_device,
&xxx_lcd_device,
&xxxpwm_backlight_device,
...
};
LCD(xxx_lcd_device)裝置先於PWM(xxxpwm_backlight_device)裝置。
可見驅動的初始化順序並不是和這個表定義的順序始終保持一致的。(記得PM操作 - resume/suspend的順序
是和這個表的順序保持一致的)
2 懷疑和編譯順序有關
Z:\kernel\drivers\video\Makefile:背光碟機動(backlight/)的編譯限於LCD驅動(xxxfb.o)的編譯
obj-$(CONFIG_VT) += console/
obj-$(CONFIG_LOGO) += logo/
obj-y += backlight/ display/
...
obj-$(CONFIG_FB_xxx) += xxxfb.o ak_logo.o
obj-$(CONFIG_FB_AK88) += ak88-fb/
這樣編譯產生的System.map中的順序為:
906 c001f540 t __initcall_pwm_backlight_init6
907 c001f544 t __initcall_display_class_init6
908 c001f548 t __initcall_xxxfb_init6
Makefile更改為:
obj-$(CONFIG_VT) += console/
obj-$(CONFIG_LOGO) += logo/
obj-y += display/
...
obj-$(CONFIG_FB_xxx) += xxxfb.o ak_logo.o
obj-$(CONFIG_FB_AK88) += ak88-fb/
obj-y += backlight/
這樣編譯產生的System.map中的順序為:
905 c001f53c t __initcall_display_class_init6
906 c001f540 t __initcall_xxxfb_init6
907 c001f544 t __initcall_genericbl_init6
908 c001f548 t __initcall_pwm_backlight_init6
載入運行:
xxxpwm_backlight_device的probe就會在xxx_lcd_device的probe之後執行,即LCD初始化先於PWM的初始化。
【結論】
同一層級的初始化是和編譯順序有關的,並不是和裝置列表一致。
調整驅動載入順序還可以通過使用不同層級的初始化,例如:
subsys_initcall()
module_init()
late_initcall()
...