Re: Difference between misc and platform driver

773 views
Skip to first unread message

Anil Kumar Pugalia

unread,
Jun 8, 2011, 12:50:08 PM6/8/11
to inside...@googlegroups.com
One is to register miscellaneous device driver and the other for
platform device driver. As I understand, "platform" is typically used
for bus-oriented devices with their controllers embedded into the SOCs.
Whereas "misc" is typically used for general devices connected over I/O
lines.

Passion: http://profession.sarika-pugs.com


Basavaraj Dengi said the following on मंगलवार 07 जून 2011 08:19 अपराह्न:
> Hi,
>
> May be this is a kind of basic question, but I could not find a
> satisfactory answer till now.
>
> 1) Whats the differences between below API's ?
> misc_register()
> platform_driver_register()
>
> 2) When to misc_register over platform_driver_register ?
>
> thanks in advance
> basavaraj

srinidhi rao

unread,
Jun 9, 2011, 1:07:58 AM6/9/11
to inside...@googlegroups.com
Hi,
      A platfrom_driver will usually be part of a low level Board support package(for devices connected to main system bus). It supports dynamic probe (i.e. at kernel run time), suspend,resume,shutdown ops and by default it will not provide any support if any user space app has to access this driver. If any user space app has to do a read/write operation, then a separate sysfs entry has to be registered or MKDEV/device_create has to be done(same way as normal char driver).
 
     If there is any need for the platform_driver or i2C_driver to interact with user space, then within the platform_driver's probe function, another misc driver can be registered which will create a node in /dev/ with a particular major number (10) reserved for misc drivers. with this node, user space app can call open(),read() ioctl() API's. This removes all the complexities associated with sysfs/device_create/DEVICE_ATTR etc.
 
     Theoretically your driver is a platform_driver, but since it uses misc_driver to facilitate user space read/write calls, it should be classified as a misc driver and the driver code should be placed under /driver/misc folder.

     Likewise if you use a input_register_device() along with a platform driver, then it should be placed under /driver/input.
 
Thanks & Regards,
Srinidhi
Reply all
Reply to author
Forward
Message has been deleted
0 new messages