c - What is the difference between a Linux platform driver and normal device driver? -
i had thought platform driver normal device driver :
- platform driver devices on chip. , ,
normal device driver interfaced proccesor chip. before coming across 1 i2c driver.
but here, reading through multi function i2c driver defined platform driver. had gone through https://www.kernel.org/doc/documentation/driver-model/platform.txt. still not clear idea come conclusion on how define drivers, both onchip interfaced devices. went through link too.. http://meld.org/discussion/general-discussion/platform-driver-vs-ordinary-device-drivers
please explain.
your references lack definition of what platform device. there 1 on lwn. can learn page:
platform devices inherently not discoverable, i.e. hardware cannot "hey! i'm present!" software. typical examples i2c devices,
kernel/documentation/i2c/instantiating-devices
states:unlike pci or usb devices, i2c devices not enumerated @ hardware level (at run time). instead, software must know (at compile time) devices connected on each i2c bus segment. usb , pci not platform devices.
platform devices bound drivers by matching names,
- platform devices should registered early during system boot. because critical rest of system (platform) , drivers.
so basically, question "is platform device or standard device?" more question of bus uses. work particular platform device, have to:
- register platform driver manage device. should define unique name,
- register platform device, defining same name driver.
platform driver devices on chip.
not true (in theory, true in practice). i2c devices not onchip, platform devices because not discoverable. can think of onchip devices normal devices. example: integrated pci gpu chip on modern x86 processor. discoverable, not platform device.
normal device driver interfaced processor chip. before coming across 1 i2c driver.
not true. many normal devices interfaced processor, not through i2c bus. example: usb mouse.
[edit] in case, have drivers/usb/host/ohci-pnx4008.c
, usb host controller platform device (here usb host controller not discoverable, whereas usb devices, connect it, are). platform device registered board file (arch/arm/mach-pnx4008/core.c:pnx4008_init
). , within probe function, registers i2c device bus i2c_register_driver
. can infer usb host controller chipset talks to cpu through i2c bus.
why architecture? because on 1 hand, device can considered bare i2c device providing functionalities system. on other hand, usb host capable device. needs register usb stack (usb_create_hcd
). probing i2c insufficient. have documentation/i2c/instantiating-devices
.
Comments
Post a Comment