Linux Buses/Devices/and Drivers

Reference Kernel Slides linux_device_model_2.ppt Linux Device Drivers, Third Edition
bus a channel between the processor and one or more devices. It is represented by struct bus_type.
Commonly it can be dynamically detected, like PCI, USB
It can be virtual or physical, All devices are connected to a bus
A bus can be plugged into another bus E.g., USB controller is usually a PCI device
platform bus a special bus which cannot be dynamically detected, like I2C, SPI, UART
Device At the lowest level, every device in a Linux system is represented by an instance of struct device
Platform Device devices are often not connected through a bus allowing enumeration, hotplugging,
and providing unique identifiers for devices
Device Drivers The device model tracks all of the drivers known to the system.
The main reason for this tracking is to enable the driver core to match up drivers with new devices.
It is represented by struct device_driver
It is used to represent kernel drivers that can handle specific devices When a device is registered that
can be handled by a particular driver, the probe function instantiates the driver for that particular device
framework allows the driver to expose the hardware features in a generic way.
class Higher-level view of a device that abstracts out low-level implementation details
Allows user space to work with devices based on what they do, rather than how they are interconnected
Almost all classes show up under /sys/class
/sys/class/net – network interfaces
/sys/class/input – input devices
/sys/class/tty – serial devices
udev Is a daemon process that scans for devices and dynamically creates the corresponding nodes in /dev/
Replaces devfs
Running in userspace
Firmware request_firmware/release_firmware

Note: Platform Device must be statically described in either