One of our customer is struggling to get the ADAU1977 driver register with no error in the kernel.
After adding some print traces into the driver code, it seems the error comes from the driver complaining that the configuration is missing the dai_name which could be the cpu_dai_name and /or codec_dai_name. In the ADI wiki page for the ADAU1977 it shows this snippet of code (fixed MCLK shown):
But there’s no device tree equivalent given. If I want set .cpu_dai_name and/or .codec_dai_name using the device tree method, how it should be done? I don’t want to hardcode the driver ,hence using the device tree method..
Can someone help?
Regards
Rajeev
Our wiki pages are a bit outdated.
Updating them would be a good idea, but there aren't enough resources to update them.
But luckily, for a DT example, the raspberry pi repo has one:
https://github.com/raspberrypi/linux/blob/rpi-4.9.y/arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts
This is for I2C, but similar could be done for SPI.
A documentation for this driver specifically [for device-trees]:
https://github.com/analogdevicesinc/linux/blob/master/Documentation/devicetree/bindings/sound/adi%2Cadau1977.txt
When using devicetrees, I don't think you need to do more than what's specified in the doc.
The rest should be handled by the ALSA framework (I mean .codec_dai_name .cpu_dai_name, etc).
Comments from the customer:
Reply to post above: I was already aware of what was mentioned in the reply and I really thought that it should have been straight forward to get the device tree working without changing anything in the simple_card driver but that’s what I had to do. The driver registered but there’s still something missing to be usable from an ALSA compatible application (like pulseaudio, for example)
Follow-up comment: the adau1977 driver is working fine. There’s another driver, called simple_card, that needs to be added is to bind the adau1977 driver and the ALSA framework in the kernel so we can use the adau1977 codec.
Hi Luc,
Simple_card is a generic platform driver used to specify connection between codec (ADAU1979 in our case) and CPU dai.
Please take a look at the following example for minimal configuration using simple card:
codec_supply: fixedregulator@0 { compatible = "regulator-fixed"; regulator-name = "AVDD"; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; }; i2c@41600000 { compatible = "...; ... #size-cells = <0>; #address-cells = <1>; adau1977: adau1977@11 { compatible = "adi,adau1977"; reg = <0x11>; reset-gpios = <&gpio 5 0>; AVDD-supply = <&codec_supply>; }; }; adau_sound { compatible = "simple-audio-card"; simple-audio-card,name = "Card Name"; simple-audio-card,widgets = "Line", "Analog In1", "Line", "Analog In2", "Line", "Analog In3", "Line", "Analog In4"; simple-audio-card,routing = "AIN1", "Analog In1", "AIN2", "Analog In2", "AIN3", "Analog In3", "AIN4", "Analog In4"; simple-audio-card,dai-link@0 { format = "i2s"; cpu { sound-dai = <&axi_i2s_0>; frame-master; bitclock-master; }; codec { sound-dai = <&adau1977>; }; }; };
We did not include simple_card example in our wiki because is just a generic example to get it started.
Users with more complex configurations are not satisfied by the possibilities offered by simple_card and write their own custom platform driver.
Regards,
Bogdan