How to match dtoverlay machine driver with ADAU1781 linux driver RPi

Hi, I'm trying to set up the ADAU1781 as an I2S audio codec with the Raspberry Pi, providing audio input and output via the GPIO. To do this I am aware I need a machine driver as well as the linux driver included with the 1781. I have done some research and found that hardware peripheral setup is controlled on the Pi by device tree, which can be modified by device tree overlays. Further research showed that some analog devices products are already supported in this way: linux/adau1977-adc-overlay.dts at rpi-4.4.y · raspberrypi/linux · GitHub

Are there any additional steps I need to take to ensure the dtoverlay machine driver and the ADAU1781 linux driver provide proper support for the codec, or is it enough to have the linux driver installed and the dtoverlay machine driver being activated through /boot/config.txt?

Here is additional documentation on how dtoverlays work: Device Trees, overlays and parameters - Raspberry Pi Documentation

  • Hi,

    Due to the very nature of the platform this is unfortunately not plug and play. The audio CODEC is only part of the complete audio solution (the sound card), the other parts are the I2S host controller as well as the so called audio fabric, which are things like speakers, microphones, headphone jacks and so on.

    ADI provides the audio CODEC driver for some of its audio CODECs and supports those drivers. The driver for the I2S host controller is often provided by a 3rd party like the host controller vendor or a OEM that manufactured the board with the host controller on it.

    Bringing these components together as well as defining the fabric is your part. How this is done is highly platform specific, which is why we do not have a generic solution available, but only examples for some selected platforms. You need to figure out what is the best approach for your particular platform.

    For the RPI devicetree overlays the best approach. I'm not too familiar with the specifics of DT overlays on the RPI though, so I can only be of little help when it comes to questions there. You might be able to get more conclusive answers in a RPI forum.

    As for the machine driver I'd recommend to use the simple-audio-card driver. This is a simple driver with limited functionality, but is often sufficient enough for simple use cases and I think it will work in your case.

    As an example have a look at this devicetree snippet, this is for the ADAU1761 (which is similar to the ADAU1781) on a different platform. But I think it gives a nice example what needs to be done. You need to define the endpoints for the DAI link as well as the DAI link configuration (which side is clock master, etc...) and you also need to setup the widgets and routes for your fabric which define the speakers etc. For more detailed information please have a look at Linux/Documentation/devicetree/bindings/sound/simple-card.txt. Be aware that the snippet above is not a overlay and might need some adoptions to be able to be usable in an overlay.

    - Lars

  • Wait, does that mean I need both a dtoverlay and a machine driver? My understanding was that the dtoverlay acted as the machine driver.

    Also can you resend the link of the devicetree snippet? Link is not working on my side.

  • Also how do I install the device drivers. There are only links the .c and .h files (and not even all together, they are linked individually). Do I have to download them individually and move them somewhere in my file system or is there an easier way?