[alsa-devel] New SoC layer codec registration problem
I'm trying to implement new SoC codec in linux-next-20101025 kernel.
Part of the code: --- #if defined(CONFIG_SPI_MASTER) static int __devinit cs4271_spi_probe(struct spi_device *spi) { struct cs4271_private *cs4271; int ret;
cs4271 = kzalloc(sizeof *cs4271, GFP_KERNEL); if (!cs4271) return -ENOMEM;
spi_set_drvdata(spi, cs4271); cs4271->control_data = spi; cs4271->bus_type = SND_SOC_SPI;
ret = snd_soc_register_codec(&spi->dev, &soc_codec_dev_cs4271, &cs4271_dai, 1); if (ret < 0) kfree(cs4271); return ret; }
static int __devexit cs4271_spi_remove(struct spi_device *spi) { snd_soc_unregister_codec(&spi->dev); kfree(spi_get_drvdata(spi)); return 0; }
static struct spi_driver cs4271_spi_driver = { .driver = { .name = "cs4271-codec", .owner = THIS_MODULE, }, .probe = cs4271_spi_probe, .remove = __devexit_p(cs4271_spi_remove), }; #endif /* defined(CONFIG_SPI_MASTER) */ ---
So, codec name I expect is "cs4271-codec", but codec registered with name "spi0.0"
Here is boot log: --- Jan 1 00:00:04 miniCio user.debug kernel: cs4271-codec spi0.0: codec register spi0.0 Jan 1 00:00:04 miniCio user.debug kernel: cs4271-codec spi0.0: dai register spi0.0 #1 Jan 1 00:00:04 miniCio user.debug kernel: Registered DAI 'cs4271-hifi' Jan 1 00:00:04 miniCio user.debug kernel: Registered codec 'spi0.0' Jan 1 00:00:04 miniCio user.info kernel: Codec driver for CS4271 registered Jan 1 00:00:04 miniCio user.debug kernel: ep93xx-pcm-audio ep93xx-pcm-audio: platform register ep93xx-pcm-audio Jan 1 00:00:04 miniCio user.debug kernel: Registered platform 'ep93xx-pcm-audio' Jan 1 00:00:04 miniCio user.debug kernel: ep93xx-i2s ep93xx-i2s: dai register ep93xx-i2s Jan 1 00:00:04 miniCio user.debug kernel: Registered DAI 'ep93xx-i2s' Jan 1 00:00:04 miniCio user.debug kernel: soc-audio soc-audio: binding CS4271 at idx 0 Jan 1 00:00:04 miniCio user.debug kernel: soc-audio soc-audio: CODEC cs4271-codec not registered Jan 1 00:00:04 miniCio user.debug kernel: soc-audio soc-audio: Registered card 'EDB93XX' Jan 1 00:00:04 miniCio user.info kernel: EDB93xx Machine ALSA Driver Jan 1 00:00:04 miniCio user.info kernel: ALSA device list: Jan 1 00:00:04 miniCio user.info kernel: No soundcards found. ---
What am I doing wrong?
Alexander.
On Thu, Oct 28, 2010 at 4:12 AM, Alexander subaparts@yandex.ru wrote:
I'm trying to implement new SoC codec in linux-next-20101025 kernel.
Part of the code:
#if defined(CONFIG_SPI_MASTER) static int __devinit cs4271_spi_probe(struct spi_device *spi) { struct cs4271_private *cs4271; int ret;
cs4271 = kzalloc(sizeof *cs4271, GFP_KERNEL); if (!cs4271) return -ENOMEM;
spi_set_drvdata(spi, cs4271); cs4271->control_data = spi; cs4271->bus_type = SND_SOC_SPI;
ret = snd_soc_register_codec(&spi->dev, &soc_codec_dev_cs4271, &cs4271_dai, 1);
Sorry for this maybe I am wrong but shouldn't this bee with {}
if (ret < 0) { kfree(cs4271); return ret;
} Thanks
Victor Rodriguez
}
static int __devexit cs4271_spi_remove(struct spi_device *spi) { snd_soc_unregister_codec(&spi->dev); kfree(spi_get_drvdata(spi)); return 0; }
static struct spi_driver cs4271_spi_driver = { .driver = { .name = "cs4271-codec", .owner = THIS_MODULE, }, .probe = cs4271_spi_probe, .remove = __devexit_p(cs4271_spi_remove), };
#endif /* defined(CONFIG_SPI_MASTER) */
So, codec name I expect is "cs4271-codec", but codec registered with name "spi0.0"
Here is boot log:
Jan 1 00:00:04 miniCio user.debug kernel: cs4271-codec spi0.0: codec register spi0.0 Jan 1 00:00:04 miniCio user.debug kernel: cs4271-codec spi0.0: dai register spi0.0 #1 Jan 1 00:00:04 miniCio user.debug kernel: Registered DAI 'cs4271-hifi' Jan 1 00:00:04 miniCio user.debug kernel: Registered codec 'spi0.0' Jan 1 00:00:04 miniCio user.info kernel: Codec driver for CS4271 registered Jan 1 00:00:04 miniCio user.debug kernel: ep93xx-pcm-audio ep93xx-pcm-audio: platform register ep93xx-pcm-audio Jan 1 00:00:04 miniCio user.debug kernel: Registered platform 'ep93xx-pcm-audio' Jan 1 00:00:04 miniCio user.debug kernel: ep93xx-i2s ep93xx-i2s: dai register ep93xx-i2s Jan 1 00:00:04 miniCio user.debug kernel: Registered DAI 'ep93xx-i2s' Jan 1 00:00:04 miniCio user.debug kernel: soc-audio soc-audio: binding CS4271 at idx 0 Jan 1 00:00:04 miniCio user.debug kernel: soc-audio soc-audio: CODEC cs4271-codec not registered Jan 1 00:00:04 miniCio user.debug kernel: soc-audio soc-audio: Registered card 'EDB93XX' Jan 1 00:00:04 miniCio user.info kernel: EDB93xx Machine ALSA Driver Jan 1 00:00:04 miniCio user.info kernel: ALSA device list: Jan 1 00:00:04 miniCio user.info kernel: No soundcards found.
What am I doing wrong?
Alexander.
Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
On Thu, 2010-10-28 at 09:07 -0500, Victor Rodriguez wrote:
O ret = snd_soc_register_codec(&spi->dev, &soc_codec_dev_cs4271,
&cs4271_dai, 1);
Sorry for this maybe I am wrong but shouldn't this bee with {}
if (ret < 0) { kfree(cs4271); return ret;
}
Thanks
Victor Rodriguez
Oh, no, this part is correct, I'm sure. The question is why fmt_single_name() picks up "spi0.0" instead of "cs4271-codec", I've added some debug output. And this function relies on dev_name() instead of dev->driver->name, this works in 2 of 3 cases (where one string equals another): --- Jan 1 00:00:04 miniCio user.debug kernel: cs4271-codec spi0.0: codec register spi0.0 Jan 1 00:00:04 miniCio user.info kernel: dev_name=spi0.0 Jan 1 00:00:04 miniCio user.info kernel: dev->driver->name=cs4271-codec Jan 1 00:00:04 miniCio user.debug kernel: cs4271-codec spi0.0: dai register spi0.0 #1 Jan 1 00:00:04 miniCio user.debug kernel: Registered DAI 'cs4271-hifi' Jan 1 00:00:04 miniCio user.debug kernel: Registered codec 'spi0.0' Jan 1 00:00:04 miniCio user.info kernel: Codec driver for CS4271 registered Jan 1 00:00:04 miniCio user.debug kernel: ep93xx-pcm-audio ep93xx-pcm-audio: platform register ep93xx-pcm-audio Jan 1 00:00:04 miniCio user.info kernel: dev_name=ep93xx-pcm-audio Jan 1 00:00:04 miniCio user.info kernel: dev->driver->name=ep93xx-pcm-audio Jan 1 00:00:04 miniCio user.debug kernel: Registered platform 'ep93xx-pcm-audio' Jan 1 00:00:04 miniCio user.debug kernel: ep93xx-i2s ep93xx-i2s: dai register ep93xx-i2s Jan 1 00:00:04 miniCio user.info kernel: dev_name=ep93xx-i2s Jan 1 00:00:04 miniCio user.info kernel: dev->driver->name=ep93xx-i2s Jan 1 00:00:04 miniCio user.debug kernel: Registered DAI 'ep93xx-i2s' Jan 1 00:00:04 miniCio user.debug kernel: soc-audio soc-audio: binding CS4271 at idx 0 Jan 1 00:00:04 miniCio user.debug kernel: soc-audio soc-audio: CODEC cs4271-codec not registered Jan 1 00:00:04 miniCio user.debug kernel: soc-audio soc-audio: Registered card 'EDB93XX' Jan 1 00:00:04 miniCio user.info kernel: EDB93xx Machine ALSA Driver Jan 1 00:00:04 miniCio user.info kernel: ALSA device list: Jan 1 00:00:04 miniCio user.info kernel: No soundcards found. ---
On Thu, Oct 28, 2010 at 07:51:50PM +0400, Alexander wrote:
Please remember to always CC maintainers, messages sent only to the mailing list are likely to get dropped on the floor.
Oh, no, this part is correct, I'm sure. The question is why fmt_single_name() picks up "spi0.0" instead of "cs4271-codec", I've added some debug output. And this function relies
We identify devices based on something unique per device so that if you have more than one device of the same type in a system the stack can tell them apart.
Hello!
On Thu, 2010-10-28 at 19:33 +0100, Mark Brown wrote:
The question is why fmt_single_name() picks up "spi0.0" instead of "cs4271-codec", I've added some debug output. And this function relies
We identify devices based on something unique per device so that if you have more than one device of the same type in a system the stack can tell them apart.
My machine driver contains the following structures:
--- static struct snd_soc_dai_link edb93xx_dai = { .name = "CS4271", .stream_name = "CS4271 HiFi", .platform_name = "ep93xx-pcm-audio", .cpu_dai_name = "ep93xx-i2s", .codec_name = "cs4271-codec", .codec_dai_name = "cs4271-hifi", .ops = &edb93xx_ops, };
static struct snd_soc_card snd_soc_edb93xx = { .name = "EDB93XX", .dai_link = &edb93xx_dai, .num_links = 1, }; ---
And all other machine SoC drivers contain similar... If instead I'll write .codec_name = "spi0.0",
it will be strange... However it can work...
Alexander.
participants (3)
-
Alexander
-
Mark Brown
-
Victor Rodriguez