Linux核心驅動載入順序

來源:互聯網
上載者:User

 

【問題】
背光碟機動初始化先於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()
...
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.