AnsweredAssumed Answered

Adding an ALSA device (AD73311 audio codec) to uClinux

Question asked by romulocmendes.ufc on Dec 23, 2011
Latest reply on Dec 26, 2011 by romulocmendes.ufc

We are having problems with adding an ALSA device to uClinux. The audio codec is AD73311, uClinux dist 2011R1-RC3 and toolchain 2011R1-RC4. The hardware we are using is a customized board.

 

The AD73311 is working properly. We tested it using sport_test application and it works good. The sport_test application uses SPORT driver for direct raw access instead of ALSA.

 

Here is the configuration menu (Device Drivers > Sound Card Support > Advanced Linux Sound Architecture > ALSA for SoC audio support)

 

--- ALSA for SoC audio support
[ ]   Support LZO compression for register caches
<*>   SoC I2S Audio for the ADI BF5xx chip
< >     SoC SSM2602 Audio support for BF52x ezkit
< >     Support for the EVAL-ADAU1701MINIZ board on Blackfin eval boards
< >     Support for the EVAL-ADAU1373 board on Blackfin eval boards
< >     Support for the EVAL-ADAU1X61 board on Blackfin eval boards
< >     Support for the EVAL-ADAU1X81 boards on Blackfin eval boards
< >     Support for the EVAL-ADAV80X boards on Blackfin eval boards
<*>     SoC AD73311 Audio support for Blackfin
(7)       PF pin for AD73311L Chip Select
< >   SoC I2S(TDM mode) Audio for the ADI BF5xx chip                                            
< >   SoC AC97 Audio for the ADI BF5xx chip                                                            
(1)   Set a SPORT for Sound chip               
< >   Support for the EVAL-ADAV80X boards on Blackfin eval boards
<*>   SoC AD73311 Audio support for Blackfin
< >   SoC AD74111 Audio support for Blackfin
< >   SoC I2S(TDM mode) Audio for the ADI BF5xx chip
< >   SoC AC97 Audio for the ADI BF5xx chip
(1)   Set a SPORT for Sound chip
< >   Build all ASoC CODEC drivers

 

As you can see above, the AD73311 audio codec is connected to ADSP-BF518 through SPORT1 and the SPORT_ENABLE signal is routed to pin PF7.

 

Here is the code for AD73311 resource alocation on the board specific file located on /linux-2.6.x/arch/blackfin/mach-bf518/boards:

 

#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) || \
    defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE) || \
    defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)

 

#define SPORT_REQ(x) \
    [x] = {P_SPORT##x##_TFS, P_SPORT##x##_DTPRI, P_SPORT##x##_TSCLK, \
        P_SPORT##x##_RFS, P_SPORT##x##_DRPRI, P_SPORT##x##_RSCLK, 0}

 

static const u16 bfin_snd_pin[][7] = {
    SPORT_REQ(0),
    SPORT_REQ(1),
};

 

static struct bfin_snd_platform_data bfin_snd_data[] = {
    {
        .pin_req = &bfin_snd_pin[0][0],
    },
    {
        .pin_req = &bfin_snd_pin[1][0],
    },
};

 

#define BFIN_SND_RES(x) \
    [x] = { \
        { \
            .start = SPORT##x##_TCR1, \
            .end = SPORT##x##_TCR1, \
            .flags = IORESOURCE_MEM \
        }, \
        { \
            .start = CH_SPORT##x##_RX, \
            .end = CH_SPORT##x##_RX, \
            .flags = IORESOURCE_DMA, \
        }, \
        { \
            .start = CH_SPORT##x##_TX, \
            .end = CH_SPORT##x##_TX, \
            .flags = IORESOURCE_DMA, \
        }, \
        { \
            .start = IRQ_SPORT##x##_ERROR, \
            .end = IRQ_SPORT##x##_ERROR, \
            .flags = IORESOURCE_IRQ, \
        } \
    }

 

static struct resource bfin_snd_resources[][4] = {
    BFIN_SND_RES(0),
    BFIN_SND_RES(1),
};
#endif

 

#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
static struct platform_device bfin_i2s_pcm = {
    .name = "bfin-i2s-pcm-audio",
    .id = -1,
};
#endif

 

#if defined(CONFIG_SND_BF5XX_SOC_AD73311) || defined(CONFIG_SND_BF5XX_SOC_AD73311_MODULE)
static const unsigned ad73311_gpio[] = {
    GPIO_PF7,
};

 

static struct platform_device bfin_ad73311_machine = {
    .name = "bfin-snd-ad73311",
    .id = 1,
    .dev = {
        .platform_data = (void *)ad73311_gpio,
    },
};
#endif

 

#if defined(CONFIG_SND_SOC_AD73311) || defined(CONFIG_SND_SOC_AD73311_MODULE)
static struct platform_device bfin_ad73311_codec_device = {
    .name = "ad73311",
    .id = -1,
};
#endif

 

#if defined(CONFIG_SND_BF5XX_SOC_I2S) || defined(CONFIG_SND_BF5XX_SOC_I2S_MODULE)
static struct platform_device bfin_i2s = {
    .name = "bfin-i2s",
    .id = CONFIG_SND_BF5XX_SPORT_NUM,
    .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),
    .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],
    .dev = {
        .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],
    },
};
#endif

 

The "make" is successful, but some hardware trace messages are showed during the uClinux initialization. These messages are listed below. After that, the initialization is concluded and the uClinux works good, but no ALSA device is listed.

 

Hardware Trace:
   0 Target : <0x0013d048> { _dump_stack + 0x0 }
     Source : <0x0000562e> { _peripheral_request + 0x242 } CALL pcrel
   1 Target : <0x00005620> { _peripheral_request + 0x234 }
     Source : <0x00005526> { _peripheral_request + 0x13a } IF !CC JUMP pcrel
   2 Target : <0x00005522> { _peripheral_request + 0x136 }
     Source : <0xffa0168c> { _strcmp + 0x14 } RTS
   3 Target : <0xffa0168a> { _strcmp + 0x12 }
     Source : <0xffa01682> { _strcmp + 0xa } IF !CC JUMP pcrel
   4 Target : <0xffa01678> { _strcmp + 0x0 }
     Source : <0x0000522a> { _cmp_label + 0x1a } JUMP.L
   5 Target : <0x00005210> { _cmp_label + 0x0 }
     Source : <0x0000551e> { _peripheral_request + 0x132 } JUMP.L
   6 Target : <0x00005514> { _peripheral_request + 0x128 }
     Source : <0x0000545e> { _peripheral_request + 0x72 } IF !CC JUMP pcrel
   7 Target : <0x00005410> { _peripheral_request + 0x24 }
     Source : <0x0000540a> { _peripheral_request + 0x1e } IF CC JUMP pcrel
   8 Target : <0x00005406> { _peripheral_request + 0x1a }
     Source : <0x000053f8> { _peripheral_request + 0xc } IF CC JUMP pcrel
   9 Target : <0x000053ec> { _peripheral_request + 0x0 }
     Source : <0x0000569c> { _peripheral_request_list + 0x28 } JUMP.L
  10 Target : <0x0000568a> { _peripheral_request_list + 0x16 }
     Source : <0x000056a2> { _peripheral_request_list + 0x2e } IF !CC JUMP pcrel (BP)
  11 Target : <0x000056a0> { _peripheral_request_list + 0x2c }
     Source : <0x00005404> { _peripheral_request + 0x18 } RTS
  12 Target : <0x000053fc> { _peripheral_request + 0x10 }
     Source : <0x000055ba> { _peripheral_request + 0x1ce } JUMP.S
  13 Target : <0x000055b8> { _peripheral_request + 0x1cc }
     Source : <0x000050ba> { _set_label + 0x2e } RTS
  14 Target : <0x000050ae> { _set_label + 0x22 }
     Source : <0xffa01708> { _strncpy + 0x40 } RTS
  15 Target : <0xffa01702> { _strncpy + 0x3a }
     Source : <0xffa016ea> { _strncpy + 0x22 } IF CC JUMP pcrel
Stack info:
SP: [0x0101be08] <0x0101be08> /* kernel dynamic memory */
FP: (0x0101bf90)
Memory from 0x0101be00 to 0101c000
0101be00: 0101be08  0101be30 [0000bda6] 00005632  001a3118  00008023  0007db72  00d64514
0101be20: 0000ff00  00000000  00d65700  00000003  001a311c  0107dbea  0000ffff  ffc00900
0101be40: 000056a0  0013f8ac  00000005  00000001  00000001  001838e0  0013f8ac  00000010
0101be60: 00000000  001bf29c  00000000  000e3f08  001b5368  00000008  00000004  00d65740
0101be80: 0101be9c  00000001  01053244  00000000  00000000  001b5370  00000006  00000000
0101bea0: 0013cca2  001b5370  001b07c4  001bf29c  001b5368  0101bf28  001bf29c  00000000
0101bec0: 00000000  01031010  0001e146  0000000c <000adaf8> 001b53a4  0101bf28  00000000
0101bee0: 01007aa8  00000000  0013e09c  000adc30  001b5370  001bf29c  00d46e40  001b53a4
0101bf00: 000adbcc  001bf29c  00d46e40 <000acfa8> 000adbcc  001bf29c  00000000  00000021
0101bf20: 00d507e0  00090440  01030bf8  010371b0  000ad872  001bd9c0  00000000  00000000
0101bf40: 00000000  000ad4ea  000ad524  001bd9c0  000adbcc  000ad542  0018356c  0105d550
0101bf60: 00000000  00182260  0017496c  000ae092  001bf29c  001df044  001d6214  00000000
0101bf80: 00000000  00000000  001d6190  001a3008 (00000000)<000010ea> 001a3008  001df044
0101bfa0: 001d6214  00000000  00000000  001b0000  00035a74  001b7894  001dede8  0000009e
0101bfc0: 001c6620  001deff8  001df044  00000000  00000000  00000000  00000000  00000000
0101bfe0: 00000000  00000000 <000014f6> 00000000  00000000  00000000  ffffffff  00000006
Return addresses in stack:
    address : <0x000adaf8> { _driver_probe_device + 0x6c }
    address : <0x000acfa8> { _bus_for_each_dev + 0x3c }
   frame  1 : <0x000010ea> { _do_one_initcall + 0x22 }
    address : <0x000014f6> { _kernel_thread_helper + 0x6 }
peripheral_request: Peripheral 35 function 0 is already reserved by bfin-spi !
bfin-i2s bfin-i2s.1: requesting Peripherals failed
ALSA device list:
  No soundcards found.

 

Our intention is to use Linphone application, where the ALSA device is an AD73311 audio codec.

 

We expected to have AD73311 on ALSA devices list, but this list is empty. Please, can you help us?

 

Thank you.

 

Rômulo Mendes

Outcomes