TechTalk: Device trees and the onboard EEPROM
When the Raspberry Pi foundation created the HAT specification, they did something clever: A HAT can have on onboard EEPROM that identifies it and should allow automatic configuration of the card. Seems pretty cool. However, in real world, there are some issues that make fully-automated configuration not as easy as you think.
There are 2 things that make it a bit more complicated.
Device trees and EEPROM
The HAT EEPROM basically contains 2 things: Some textual description of the hardware (e.g. vendor, name, serial number) and a so-called device-tree overlay. The device tree overlay is not a driver, but basically a description of the hardware. The idea is that the Linux kernel can use this information to select the correct driver and initialize it. As the hardware should not change, it should work with every Linux version, even if they are newer than the hardware.
The problem: The hardware definition is not a pure hardware definition, but also contains information on “virtual” hardware. One thing specifically for HiFiBerry sound cards is the clock hardware. Many of our boards use some onboard clock generators that needs to be “connected” to the sound card. This is also part of the overlay. Small problem: The structure of this connection has been changed in 2021 in the Linux kernel. This also means that the device tree description has to be changed. You could reprogram the EEPROM with the new data. However, there is no way to do this in a way it will work with all kernel versions. If you write the new device tree to the EEPROM, it won’t work with older Linux kernels and vice versa.
Therefore, it’s often best to disable the use of the onboard EEPROM and configure the overlay directly in /boot/config.txt. Have a look at our configuration guide.
The onboard sound
One issue that’s specific to our sound cards: Even if the card is configured correctly, on many distributions, the onboard sound is still active. With multiple active sound cards on the system and no additional configuration, most applications will simply use the onboard sound and not the HiFiBerry sound card. Therefore, we generally recommend to disable it. This is also shown in our configuration guide.
January 13, 2023