Platform drivers and DTs
Platform drivers also work with DTs. It is the recommended way to deal with platform devices nowadays, and there is no need to touch board files anymore, or even to recompile the kernel when a device's property changes. If you remember, in the previous chapter we discussed OF match style, which is a matching mechanism based on DTs. Let's see in the following section how it works.
OF match style
OF match style is the first matching mechanism performed by the platform core in order to match devices with their drivers. It uses a device tree's compatible
property to match the device entry in of_match_table
, which is a field of the struct driver
substructure. Each device node has a compatible
property, which is a string or a list of strings. Any platform driver that declares one of the strings listed in the compatible
property will trigger a match and will see its probe
function executed.
A DT match entry is described in the kernel as an instance of the struct of_device_id...