簡體   English   中英

為 Linux 驅動程序添加設備數據結構和注冊

[英]Adding device data structures and registration for Linux driver

我正在添加一個陀螺儀/加速度驅動程序 (Invensense MPU3050), 我的 kernel (LPC Linux) 上可用。 我使用 LTIB 來構建映像和 rootfs。

我設法添加了所有文件,並且驅動程序可用並且可以完美編譯。 現在我需要在“board-generic.c”文件( README )的 i2c_board_info_structure 中添加一個 mpu3050_platform_data 結構,然后在同一個“board-generic.c”文件中添加一些行來注冊它。

問題是,我找不到這個/這些文件/s。 他們的名字是否取決於 linux 分布? 相同的信息是否寫在其他地方?

您需要將此添加到支持您正在使用的 tegra 板的文件中。 在當前的 3.0-rc3 kernel(我檢查的最后一個標簽)中,我看到了這些 tegra 板文件(在 arch/arm/mach-tegra 中):

  • 板和諧.c
  • 板-paz00.c
  • 板-seaboard.c
  • 板-trimslice.c

這些文件為給定的 tegra 板配置 static 器件。 然后,您的配置文件會選擇構建哪些配置文件。 以下是相應的配置選項(來自 arch/arm/mach-tegra/Kconfig):

comment "Tegra board type"

config MACH_HARMONY
       bool "Harmony board"
       select MACH_HAS_SND_SOC_TEGRA_WM8903
       help
         Support for nVidia Harmony development platform

config MACH_KAEN
       bool "Kaen board"
       select MACH_SEABOARD
       select MACH_HAS_SND_SOC_TEGRA_WM8903
       help
         Support for the Kaen version of Seaboard

config MACH_PAZ00
       bool "Paz00 board"
       help
         Support for the Toshiba AC100/Dynabook AZ netbook

config MACH_SEABOARD
       bool "Seaboard board"
       select MACH_HAS_SND_SOC_TEGRA_WM8903
       help
         Support for nVidia Seaboard development platform. It will
     also be included for some of the derivative boards that
     have large similarities with the seaboard design.

config MACH_TRIMSLICE
       bool "TrimSlice board"
       select TEGRA_PCI
       help
         Support for CompuLab TrimSlice platform

config MACH_WARIO
       bool "Wario board"
       select MACH_SEABOARD
       help
         Support for the Wario version of Seaboard

您的構建系統 (LTIB) 肯定定義了這些配置宏之一(例如 CONFIG_MACH_HARMONY)。 查看您的配置文件,查看啟用了哪個,然后在相應的 board-xxx.c 文件中添加您的 i2c 設備的聲明。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM