What are the types of device drivers in Linux?
Short answer: The classic three are character drivers (byte-stream access through /dev nodes with open, read, write, ioctl, mmap), block drivers (random-access, fixed-size blocks through the block layer: eMMC, NVMe, SD) and network drivers (packet interfaces such as eth0 registered as net_device, with no /dev node). In practice most drivers plug into a subsystem framework (input, IIO, ALSA, V4L2, DRM, GPIO, regulator, power supply, hwmon, PWM, watchdog...) that provides the user-space interface for them.
| Type | Interface | Examples |
|---|---|---|
| Character | /dev/xxx, file operations |
serial ports (tty), /dev/mem, custom FPGA interfaces |
| Block | /dev/mmcblk0, /dev/nvme0n1, via filesystems |
eMMC, SD, NVMe, virtio-blk |
| Network | sockets, ip link |
Ethernet MACs, Wi-Fi, CAN (SocketCAN) |
| Subsystem-based | the subsystem's standard API | input (/dev/input/event*), IIO sensors (/sys/bus/iio), ALSA, V4L2 (/dev/video*), DRM (/dev/dri/*) |
Why use subsystems: user-space tools work unchanged (a touchscreen driver using input works with every GUI; an IIO sensor works with iio_readdev), and the subsystem handles buffering, locking, sysfs and power management.
Another classification: by bus (platform, I2C, SPI, PCI, USB) — the bus decides how the driver is matched and how it talks to the device; the subsystem decides what interface it offers. An I2C temperature sensor is "an I2C client driver registered with hwmon or IIO".