[alsa-devel] ASoC: Hooking a TI CODEC to a i.MX27 MCU

Stuart Longland redhatter at gentoo.org
Wed May 26 15:21:36 CEST 2010

On Tue, May 25, 2010 at 06:46:47PM +0200, gnutoo wrote:
> On Tue, 2010-05-25 at 12:26 +1000, Stuart Longland wrote:
> > If there's any interest, I can format that as a patch and submit it...
> I'm very interested...
> I've an I.MX31 and a tlv320aic3x
> I've tried to import your driver in our 2.6.30 tree
> ( http://gitorious.org/bug/bug-1x-linux-2-6-30/commits/bug1x-2.6.30 )
> and I have now the following issue:
> # modprobe bugsound
> No device for DAI tlv320aic3x
> bug1x_soc_init: hello...
> bug1x_soc_init: bug1x_snd_device = c79240c0
> bug1x_soc_init: calling platform_set_drvdata( c79240c0, bf07b66c)
> bug1x_soc_init: calling platform_device_add(c79240c0)
> bug1x_soc_init: platform_device_add(c79240c0) = 0
> bug1x_soc_init = 0 (success)
> I'll re-read the mails and try harder...
> Thanks a lot!!!!

Well, the "No device for DAI" message seems to be related to what's
registered for your board's I²C bus... e.g. I have in a file;
arch/arm/mach-mx2/mach-tx27.c (this isn't in tree yet; but I hope to
contribute it someday):

static struct i2c_board_info tx27_i2c0_devices[] __initdata = {
                I2C_BOARD_INFO("24c16", 0x50),
                .platform_data = &tx27_eeprom,
                .type = "24c16",
                I2C_BOARD_INFO("tlv320aic3204", 0x18),
                .type = "tlv320aic3204",
#if defined(CONFIG_RTC_DRV_DS1307) ||
                I2C_BOARD_INFO("ds1339", 0x68/*DS1339_CHIP_ID*/),
                .type = "ds1339",

That seems to help with getting the CODEC initialised and probed
correctly.  Likewise; similar is needed for the i.MX I²S bus, simply
having the driver in-kernel isn't enough:

in my board_init function:
        mxc_register_device(&imx_ssi_device0, &tx27_ssi_pdata[0]);
        /*mxc_register_device(&imx_ssi_device1, &tx27_ssi_pdata[1]);*/

Note the second one is commented out; I cannot seem to register both,
the second one always fails.  The tx27_ssi_pdata is straightforward:

static struct imx_ssi_platform_data tx27_ssi_pdata[] = {
        /* SSI1 */
                .flags                  = 0,
        /* SSI2 */
                .flags                  = 0,

I'm not sure if this is right; but it seems to work.  On this project,
my issue now is getting data out of the I²S bus.  The CODEC is
generating the bit clock and frame sync; I *think* I have AUDMUX set up
correctly -- HPCR1 is set to output receive data, frame sync & clock all
sourced from HPCR3; HPCR3 is set to receive data from HPCR1, and take
its frame sync & clock from the external port... I'll provide my debugfs
patch for audmux-v1.c and its output tomorrow.

At the moment, when I go to play audio; I see the CODEC being set up ...
but despite the clocks being present -- I see no audio data, and the DMA
transfer eventually times out with the message "playback write error
(DMA or IRQ trouble?)" after 10 seconds.  Would anyone know where I'd
look for that?  Is there something else needed in the configuration of
the SSI driver for this to work?

Thanks for the assistance thus far.
Stuart Longland (aka Redhatter, VK4MSL)      .'''.
Gentoo Linux/MIPS Cobalt and Docs Developer  '.'` :
. . . . . . . . . . . . . . . . . . . . . .   .'.'
http://dev.gentoo.org/~redhatter             :.'

I haven't lost my mind...
  ...it's backed up on a tape somewhere.

More information about the Alsa-devel mailing list