[alsa-devel] dev_* output functions and ASoC codecs

Mike Frysinger vapier.adi at gmail.com
Tue Oct 6 02:18:03 CEST 2009

am i doing something wrong or are the dev_* output functions kind of
useless with ASoC codecs ?  it seems like the error output is prefixed
by the generic "soc-audio" but no info related to the exact codec is

as an example, the typical behavior is for the machine driver to call
platform_device_alloc("soc-audio", -1).  this struct device is then
passed down to the relevant subsystem driver register/probe
(i2c/spi/etc...) to the codec driver.  these functions typically then
set the snd_soc_codec's dev member to the allocated platform device.
which means the snd_soc_codec's name member isnt included in decoding.
 so now any dev_* output in the codec driver looks like:
soc-audio soc-audio: some message

if there are multiple codecs, things obviously fall apart quickly.
the question is how to address this.  werent there snd_* output funcs
before ?  or are those now deprecated/dead ?  or perhaps we should
encourage people to stop doing platform_device_alloc("soc-audio") and
start doing platform_device_alloc(snd_soc_card.name) ?

also, there seems to be a semi-common bug in the codec/machine drivers
where they dont actually initialize the dev member.  perhaps it's time
to upgrade the snd_soc_register_codec() check from a KERN_WARNING to a
BUG_ON() ?  clearly the current warning isnt getting its message
through ...

More information about the Alsa-devel mailing list