-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
The introduction of the Pi 4, built around the BCM2711 SoC, has caused a split in our code base; for the first time, some overlays won't work on all (can't even be applied) - on all Pis. Some of these failures come under the general heading of "don't do that", e.g. trying to use uart5
on a 3B+, but for others it is clear that something different needs to happen on each platform - a change of implementation, fewer parameters, etc.
There is therefore a need for a method of tailoring an overlay to multiple platforms with differing hardware. Supporting them all in a single .dtbo
file would require heavy use of hidden ("dormant") fragments and a switch to an on-demand symbol resolution mechanism so that a missing symbol that isn't needed doesn't cause a failure. A simpler solution is to add a facility to map an overlay name to one of several implementation files depending on the current platform.
For the purposes of this discussion, <overlay>
is the name of an overlay, where <overlay>.dtbo
is the name of the default implementation file. The first plan was to use an overlay-specific proxy file as a matchmaker for several implementing .dtbo
files - <overlay>.ovl
, say. It would contain a list of mappings from platform names to overlay file names - a textual format would probably suffice. The absence of a platform from a .ovl
means the overlay isn't supported on that platform. The absence of a <overlay>.ovl
file would indicate that all platforms should use the common default implementation. The advantage of this scheme is that each overlay remains self contained, but it does require an extra file test/load for each overlay, something which is particularly slow when network booting.
Instead, I favour the addition of a single map file that gets loaded once at start of day. It can be written in .dts
format with a node per overlay:
/ {
vc4-kms-v3d {
bcm2711 = "vc4-kms-v3d-pi4";
bcm2835;
};
};
Notes:
- The platform names are compatible strings (minus the vendor prefix for brevity).
- A platform name with no value (an empty property) indicates that the default overlay file (
vc4-kms-v3d.dtbo
in this case) should be used. - As with the previous plan, this only exceptions need to be listed - the absence of a node for an overlay means that the default file should be used.
Once the map has been compiled, use is straightforward - locate the node for an overlay and, if found, retrieve the property with the current platform name.
Although simple, this mechanism allows some nice extensions in the event that the platform property doesn't exist:
/ {
vc4-kms-v3d {
bcm2711 = "vc4-kms-v3d-pi4";
bcm2835;
};
pi3-disable-bt {
renamed = "disable-bt";
};
lirc-rpi {
deprecated = "See gpio-ir";
};
};
- The
renamed
property indicates the new name of the overlay (which should be largely compatible with the original), but also logs a warning about the rename. - The
deprecated
property contains a brief explanatory error message which will be logged after the common "Overlay is deprecated."
As with previous RFCs, I welcome constructive feedback, but plan to press ahead with implementation in the meantime.
Finally, a plug for the updated Device Tree documentation (which this RFC is about to render out-of-date again).