Platform Driver and Device Tree Binding¶
A platform driver is commonly used for devices that are not discoverable by a hardware enumeration bus. On embedded Linux systems, the Device Tree describes the hardware, and the kernel matches Device Tree nodes to platform drivers through the compatible property.
Binding Flow¶
Device Tree node
compatible = "myvendor,mygpio-led"
↓
of_device_id table
↓
platform_driver
↓
probe()
Key Names¶
| Name | Role |
|---|---|
| Device Tree node name | Human-readable hardware node name |
| Device Tree label | Internal DTS reference label |
compatible |
Driver matching key |
| Driver name | Kernel-side driver identity |
/dev/<name> |
User-space device node created by the driver |
GPIO Resource Mapping¶
Modern GPIO drivers should request GPIOs by function name, not by global GPIO number.
This maps to the Device Tree property:
Common Pitfalls¶
Warning
The Device Tree node name does not decide which driver is used. The compatible string does.
Warning
The name passed to devm_gpiod_get(dev, "xxx", ...) maps to the Device Tree property xxx-gpios.