I am using Buildroot to build an embedded Linux (2.6.39.2) system for the NXP LPC3250 microcontroller.
Right now, I'm trying to get ALSA/ASoC up and running, but I'm having some issues with getting the modules to work together. (I think!)
Some important background:
The board I am testing with is the Embedded Artists 3250 V2 development board. V2 is different from V1 in that it does not have an LCD screen, but does include an I2S audio codec: The NXP UDA1380. Board support for EA3250 V1 is included in the LPCLinux version of the kernel. There is also a different development board, called Phytec 3250, which contains the same UDA1380 codec chip. The LPCLinux distribution also has support for the Phytec board, along with the audio codec chip. From what I have discerned, the Phytec 3250 board has the UDA1380 codec on I2C address 0x18. On my EA3250 V2 board, the audio codec is located at I2C address 0x1a. (I have verified the chip is powered up, and I can communicate to it by using the I2C-tools package. It responds to i2cdetect and I can read registers from the chip correctly using i2cget.)
Modifying the source:
I needed to edit the Phytec 3250 driver files to change the address of the codec chip. I edited this section of lpc3xxx-uda1380.c:
static struct snd_soc_dai_link phy3250_uda1380_dai[] = {
{
.name = "uda1380",
.stream_name = "UDA1380 Duplex",
#if defined(CONFIG_SND_LPC32XX_USEI2S1)
.cpu_dai_name = "lpc3xxx-i2s1",
#else
.cpu_dai_name = "lpc3xxx-i2s0",
#endif
.codec_dai_name = "uda1380-hifi",
.init = phy3250_uda1380_init,
.platform_name = "lpc3xxx-audio.0",
//EDIT// .codec_name = "uda1380-codec.0-0018", //EDIT//
.codec_name = "uda1380-codec.0-001a",
.ops = &phy3250_uda1380_ops,
},
};
After I made this change, I went ahead and built the system again and everything compiled OK. After booting into the system, I have the following modules (in addition to the standard core modules) in /lib/modules/2.6.39.2/kernel/sound
:
./soc/codecs: snd-soc-uda1380.ko <-- ASoC codec driver
./soc/lpc3xxx: snd-soc-lpc3xxx-i2s.ko <-- ASoC DAI
snd-soc-lpc3xxx-uda1380.ko <-- ASoC machine driver
snd-soc-lpc3xxx.ko <-- ASoC platform driver
Now, how do I actually bind all this stuff together?
Just inserting the modules with modprobe
doesn't actually give the device to ALSA/ASoC. I am unable to detect the soundcard. Does this mean I must now make a new device called uda1380-codec
at address 0x1a and bind it to a driver? I have tried doing the following:
echo uda1380-codec 0x01a > /sys/bus/i2c/devices/i2c-0/new_device
and received:
i2c i2c-0: new_device: Instantiated device uda1380-codec at 0x1a
Then I try to bind a driver to the device:
echo 0x1a > /sys/bus/i2c/drivers/uda1380-codec/bind
and received:
sh: write error: No such device
I get this error for everything I try! I have a feeling I am not creating the device correctly, and then I'm not sure how to bind it to the correct driver.
Nota Bene:
I was playing with this last night and was somehow able to get ASoC to wake up and at least probe for the card. I was playing with different bindings, I guess. It was late and hard to remember my steps, but I was able to at least get the following error somehow:
uda1380-codec 0-001a: asoc: failed to probe CODEC uda1380-codec.0-001a: -22
asoc: failed to instantiate card LPC32XX: -22
I have been unable to recreate this error!
Edit:
I've confirmed my modified code is being compiled, so the driver should be talking to the correct address now. After manually loading the modules, the output of lsmod
is:
Module Size Used by Not tainted
snd_soc_lpc3xxx_uda1380 2087 0
snd_soc_lpc3xxx 3089 0
snd_soc_lpc3xxx_i2s 4089 1
snd_soc_uda1380 10865 0
snd_soc_core 51549 4 snd_soc_lpc3xxx_uda1380,snd_soc_lpc3xxx,snd_soc_lpc3xxx_i2s,snd_soc_uda1380
snd_pcm 52098 2 snd_soc_lpc3xxx,snd_soc_core
snd_timer 15590 1 snd_pcm
snd_page_alloc 3021 1 snd_pcm
snd 37286 3 snd_soc_core,snd_pcm,snd_timer
Does this look right?
And my device table:
# Audio stuff
/dev/audio c 666 0 29 14 4 - - -
#/dev/audio1 c 666 0 29 14 20 - - -
/dev/dsp c 666 0 29 14 3 - - -
#/dev/dsp1 c 666 0 29 14 19 - - -
#/dev/sndstat c 666 0 29 14 6 - - -
/dev/mixer c 666 0 29 14 0 - - -
/dev/snd d 755 0 29 - - - - -
/dev/snd/controlC0 c 666 0 29 116 0 - - -
/dev/snd/pcmC0D0c c 666 0 29 116 24 - - -
/dev/snd/pcmC0D0p c 666 0 29 116 16 - - -
/dev/snd/seq c 666 0 29 116 1 - - -
/dev/snd/timer c 666 0 29 116 33 - - -
alsa-devel
list (where you will be told that 2.6.39 is horribly outdated, and that the board vendor is responsible for support).alsa-devel
and nobody responded. (That I can tell - I hate mail-lists, they are the worst to read through.) Now my mailbox is full of ALSA crap and I still have no help. Here I go again, on my own...