Register Alsa ASOC wm8782 driver

Hello people, i’m trying to interface the Wolfson wm8782 ADC with my BB Black.
My first approach was modify the file davinci-evm.c, so the kernel will load the wm8782 driver instead of the tdax998 (used for hdmi).
The first problem that i’m facing is that i dont know exactly where apply these changes, so far i see two options:

here:

`

case MACHINE_VERSION_3:
evm_dai.name = “NXP TDA HDMI Chip”;
evm_dai.stream_name = “HDMI”;
evm_dai.codec_dai_name = “wm8782-hifi”;
evm_dai.init = evm_tda998x_init;

`

or here:

`

static struct snd_soc_dai_link da830_evm_dai = {
.name = “wm8782”,
.stream_name = “Capture”,
.cpu_dai_name = “davinci-mcasp.0”,
.codec_dai_name = “wm8782-hifi”,
.codec_name = “wm8782-codec.0-0018”,
.platform_name = “davinci-mcasp.0”,
.init = evm_aic3x_init,
.ops = &evm_ops,

`

I think that the code in the first option only gets executed when the dtbo file “cape-boneblack-hdmi” is loaded (is this correct?),
but neither of these options seems to work…

The only “solution” that i came up with was replacing the code of the tda998x.c with the code of wm8782.c driver, but i don’t
think this is the right way…

The files that i think would do the trick are: davinci-evm.c, wm8782.c and board-am3517evm.c but, obvioulsy, i’m not sure of this…
I’m also trying to document all these steps so anyone can interface an adc/dac to the BBB.

Any help will be appreciated,
Thanks in advance!

Hello people, i'm trying to interface the Wolfson wm8782 ADC with my BB
Black.
My first approach was modify the file davinci-evm.c, so the kernel will
load the wm8782 driver instead of the tdax998 (used for hdmi).
The first problem that i'm facing is that i dont know exactly where apply
these changes, so far i see two options:

here:

case MACHINE_VERSION_3:
evm_dai.name = "NXP TDA HDMI Chip";
evm_dai.stream_name = "HDMI";
evm_dai.codec_dai_name = "wm8782-hifi";
evm_dai.init = evm_tda998x_init;

or here:

static struct snd_soc_dai_link da830_evm_dai = {
.name = "wm8782",
.stream_name = "Capture",
.cpu_dai_name = "davinci-mcasp.0",
.codec_dai_name = "wm8782-hifi",
.codec_name = "wm8782-codec.0-0018",
.platform_name = "davinci-mcasp.0",
.init = evm_aic3x_init,
.ops = &evm_ops,

This portion is for a different platform - notice the struct name is
'da830_evm_dai'.

If it's just the codec change then setting the right codec_name and
ensuring the appropriate driver
is compiled in should have been sufficient.

I think that the code in the first option only gets executed when the dtbo

file "cape-boneblack-hdmi" is loaded (is this correct?),
but neither of these options seems to work...

The only "solution" that i came up with was replacing the code of the
tda998x.c with the code of wm8782.c driver, but i don't
think this is the right way...

Yeah it's not :slight_smile:

The files that i think would do the trick are: *davinci-evm.c*, *wm8782.c*and
*board-am3517evm.c* but, obvioulsy, i'm not sure of this...

The board file (board-am3517evm.c) is for yet another platform which is not
relevant here.
You should be looking at the device tree files now.

I *think* the codec driver won't need any change. You might have to make
some changes in davinci-evm.c though.
The last time i checked there were patches on the ALSA mailing list to have
most of the configuration coming via appropriate DT-bindings. I don't know
what kernel you are running but hopefully the above is enough for you to
start
looking around.

Thanks Vaibhav for answering,
So the files that i should edit are davinci-evm.c (platform driver?) and wm8782.c (codec driver), right?

I have a few questions :slight_smile:

What snd_soc_dai_link structure should i edit?
(I choosed the da830_dai_link because that was the snd_soc_card struct loaded when the BB Audio cape was inserted, but which one should i edit?)
I also tried to write a new davinci-evm.c based on this file (from a kernel source for the raspberry pi), here is the code:

`

/*

  • ASoC Driver.