AnsweredAssumed Answered

Problems creating ALSA soundcard using BF537 Stamp configuration

Question asked by skstrobel on Feb 27, 2013
Latest reply on Feb 28, 2013 by skstrobel

While trying to figure out why I don't get an ALSA sound card for my custom board, I decided to go back to a configuration tested by the Analog Devices folks, then look for differences.  I haven't been able to get the BF537 Stamp configuration to set up sound cards either.  I would be very grateful if someone could point out what I am missing or tell me that there is a bug and I need to update something. 

 

When I say I can't set up soundcards, I mean that "modprobe snd-<drivername>" returns errors ("Failed to register card" and "requests probe deferral") and "cat /proc/asound/cards" says "--- no soundcards ---".  I tried several configurations starting with what I really wanted and working backwards to more standard configurations that I figured had been tested and had to work (but I couldn't get to).  Those configurations are:

 

  * Custom buildroot config, FDPIC, with AD193x driver on bitbanged SPI

  * BF537 Stamp config, FDPIC, with AD193x driver

  * BF537 Stamp config, FDPIC, with AD1836 driver

  * BF537 Stamp config, FDPIC, with AD73311 (the default) driver

  * BF537 Stamp config,  flat, with AD73311 (the default) driver

 

I am using the 2012R2-RC5 buildroot release, with the prebuilt toolchains and default uClibc libraries (not full).  I am using the FDPIC BF537 Stamp buildroot configuration so I can use ALSA <http://ez.analog.com/message/56760#56760> (except for the final configuration I tested which uses the flat toolchain).  I loaded and ran the initramfs image on my custom hardware, which is very similar to the BF537 Stamp (although the SPI connections for the sound chip are different).  Do any of the sound drivers check that they are able to communicate with the hardware codec and refuse to create an ALSA soundcard if that test fails?  I have been assuming that they would create the soundcard and just fail to work, but please correct me if that is wrong.

 

To test each configuration, I extracted a clean copy the distribution tar file, configured it (details below), built, loaded the uImage onto my hardware, and tested.  The specific steps I used are shown below in reverse order (most standard first)...

 

----------------------------------------------------------------

--- BF537 Stamp config,  flat, with AD73311 (the default) driver

----------------------------------------------------------------

 

tar xjf dist/uClinux_2012R2/blackfin-buildroot-2012R2-RC5.tar.bz2

cd blackfin-buildroot

make bf537-stamp_defconfig

make linux-menuconfig     # turn off CONFIG_RTC_CLASS, not supported on my hardware

make

 

# Load uImage and boot it...

 

root:/> cat lib/modules/3.5.7-ADI-2012R2/modules.dep | grep 73311

kernel/sound/soc/codecs/snd-soc-ad73311.ko: kernel/sound/soc/snd-soc-core.ko kernel/sound/core/snd-pcm.ko kernel/sound/core/snd-page-alloc.ko kernel/sound/core/snd-timer.ko kernel/drivers/base/regmap/regmap-i2c.ko kernel/drivers/i2c/i2c-core.ko kernel/sound/core/snd.ko kernel/sound/soundcore.ko kernel/drivers/base/regmap/regmap-spi.ko

kernel/sound/soc/blackfin/snd-ad73311.ko: kernel/sound/soc/snd-soc-core.ko kernel/sound/core/snd-pcm.ko kernel/sound/core/snd-page-alloc.ko kernel/sound/core/snd-timer.ko kernel/drivers/base/regmap/regmap-i2c.ko kernel/drivers/i2c/i2c-core.ko kernel/sound/core/snd.ko kernel/sound/soundcore.ko kernel/drivers/base/regmap/regmap-spi.ko

 

root:/> cat /proc/asound/cards

cat: can't open '/proc/asound/cards': No such file or directory

 

root:/> modprobe snd-ad73311

bfin-snd-ad73311 bfin-snd-ad73311.1: Failed to register card

platform bfin-snd-ad73311.1: Driver bfin-snd-ad73311 requests probe deferral

 

root:/> cat /proc/asound/cards

--- no soundcards ---

 

----------------------------------------------------------------

--- BF537 Stamp config, FDPIC, with AD73311 (the default) driver

----------------------------------------------------------------

 

# Same as above but using FDPIC configuration

make bf537-stamp-fdpic_defconfig

 

# All other results identical

 

----------------------------------------------------------------

--- BF537 Stamp config, FDPIC, with AD1836 driver

----------------------------------------------------------------

 

As above but with a few more configuration changes when run

"make linux-menuconfig":

  * turn off CONFIG_RTC_CLASS, not supported on my hardware

  * turn off CONFIG_SND_BF5XX_SOC_AD73311

  * turn on CONFIG_SND_BF5XX_TDM (as module)

  * turn on CONFIG_SND_BF5XX_SOC_AD1836 (as module)

 

Results are very similar to those obtained with the AD73311 driver.

 

----------------------------------------------------------------

--- BF537 Stamp config, FDPIC, with AD193x driver

----------------------------------------------------------------

 

Exactly as above, but with the AD193x driver (the one I want to use) rather than AD1836 driver (which I was just using for comparison).

 

I got an additional "should use snd_soc_register_card()" error message when running modprobe:

 

root:/> modprobe snd-ad193x

soc-audio soc-audio: ASoC machine bfin-ad193x should use snd_soc_register_card()

soc-audio soc-audio: Failed to register card

platform soc-audio: Driver soc-audio requests probe deferral

 

Comparing the AD1836 and AD193x drivers, I see that the latter doesn't call snd_soc_register_card().  So even once I find out why I can't get the AD73311 and AD1836 drivers to create sound cards, I might still have trouble with the AD193x driver because of that.  It looks like the AD1836 driver was recently changed <http://www.mail-archive.com/linux-kernel-commits@blackfin.uclinux.org/msg09608.html//www.mail-archive.com/linux-kernel-commits@blackfin.uclinux.org/msg09608.html>;  should I also be checking git for an updated version of the ad193x driver, or should the one included with 2012R2-RC5 work?

 

--- More details about this build configuration:

 

# Extract the distribution tar file: 

tar xjf dist/uClinux_2012R2/blackfin-buildroot-2012R2-RC5.tar.bz2

 

# Configure for the target and build

cd blackfin-buildroot

make bf537-stamp-fdpic_defconfig

make linux-menuconfig     # turn off CONFIG_RTC_CLASS, not supported on my hardware

                          # turn off CONFIG_SND_BF5XX_SOC_AD73311

                          # turn on CONFIG_SND_BF5XX_TDM (as module)

                          # turn on CONFIG_SND_BF5XX_SOC_AD193X (as module)

make

 

# Load uImage using U-Boot and run it, then:

 

root:/> cat lib/modules/3.5.7-ADI-2012R2/modules.dep | grep 193x

kernel/sound/soc/codecs/snd-soc-ad193x.ko: kernel/sound/soc/snd-soc-core.ko kernel/sound/core/snd-pcm.ko kernel/sound/co

re/snd-page-alloc.ko kernel/sound/core/snd-timer.ko kernel/sound/core/snd.ko kernel/sound/soundcore.ko kernel/drivers/ba

se/regmap/regmap-i2c.ko kernel/drivers/base/regmap/regmap-spi.ko kernel/drivers/i2c/i2c-core.ko

kernel/sound/soc/blackfin/snd-ad193x.ko: kernel/sound/soc/snd-soc-core.ko kernel/sound/core/snd-pcm.ko kernel/sound/core

/snd-page-alloc.ko kernel/sound/core/snd-timer.ko kernel/drivers/base/regmap/regmap-i2c.ko kernel/drivers/i2c/i2c-core.k

o kernel/sound/core/snd.ko kernel/sound/soundcore.ko kernel/drivers/base/regmap/regmap-spi.ko

root:/> cat /proc/asound/cards

cat: can't open '/proc/asound/cards': No such file or directory

root:/> modprobe snd-ad193x

soc-audio soc-audio: ASoC machine bfin-ad193x should use snd_soc_register_card()

soc-audio soc-audio: Failed to register card

platform soc-audio: Driver soc-audio requests probe deferral

root:/> cat /proc/asound/cards

--- no soundcards ---

 

----------------------------------------------------------------

--- Building in drivers rather than using modules

----------------------------------------------------------------

 

I tried building the drivers into the kernel rather than using modules.  I built in CONFIG_SOUND, CONFIG_SND (ALSA), CONFIG_SND_SOC, CONFIG_SND_BF5XX_TDM but not CONFIG_SND_BF5XX_SOC_AD1836 (it is available only as a module).  The build then failed with:

 

.../linux/linux-kernel/sound/soc/soc-io.c:130: undefined reference to `regmap_init_i2c'

 

I was able to work around that error by turning off I2C support, but if I had other I2C devices, that wouldn't have been an option.  So I think there is something wrong with the conditional compilation tests of the config options, "#if defined(CONFIG_REGMAP_I2C) || defined(CONFIG_REGMAP_I2C_MODULE)".

 

When booting the image, it printed an ALSA message on startup that is not there when using modules, but the overall results are similar:

 

...

bfin_wdt: initialized: timeout=20 sec (nowayout=0)

TCP: cubic registered

NET: Registered protocol family 17

ALSA device list:

  No soundcards found.

dma_alloc_init: dma_page @ 0x029fb000 - 256 pages at 0x03f00000

...


root:/> cat /proc/asound/cards

--- no soundcards ---

 

root:/> modprobe snd-ad1836

bfin-snd-ad1836 bfin-snd-ad1836: Failed to register card

platform bfin-snd-ad1836: Driver bfin-snd-ad1836 requests probe deferral

 

----------------------------------------------------------------

--- Final notes

----------------------------------------------------------------

 

It bothers me somewhat that the description for the CONFIG_SND_BF5XX_TDM option, "SoC I2S(TDM mode) Audio for the ADI BF5xx chip" has "I2S" in it, when the configuration I want to use is SPI and TDM, no I2S involved.  I assume that the I2S is just a misleading title and not an actual requirement for using that driver;  please correct me if I am wrong.

 

I would greatly appreciate any help getting this to work, or even confirming that building driver X for the Stamp creates a soundcard for someone else.  Thanks.

 

Steve

Outcomes