Post Go back to editing

Daisy Chaining two AD1938 codecs - ALSA System on Chip driver

Hi there,

we are trying to extend our audio system by daisy chaining two AD1938 audio codecs. From the datasheet I got the information that both codecs are configured equally (512 fs DACs / 256 fs ADCs / single line TDM mode). So, of course, both codecs appear as one codec to the platform DAI. I think it should work, if both codecs are configured equally in series via regmap in the codec driver. For example:

static int ad193x_hw_params(...){

   ...

   regmap_update_bits(ad193x_0->regmap, AD193X_PLL_CLK_CTRL0, AD193X_PLL_INPUT_MASK, master_rate);

   regmap_update_bits(ad193x_1->regmap, AD193X_PLL_CLK_CTRL0, AD193X_PLL_INPUT_MASK, master_rate);

   ...

}

Does anybody know, how to pass two regmap configs to the driver, so that I can configure both codecs in the same way? Or any other idea how to get two daisy chained codecs working with ALSA?

Thanks!

Parents
  • Hi,

    I found a way to register auxiliary devices in ASoC core. There is an extra property "aux_dev" in snd_soc_card structure for these applications. The connections of the codecs and the DSP (BeagleBone Green) are like this:

    - clock signals are connected as described in the circuit sketch

    - DAC TDM signal from DSP <-> DSDATA1 of "master" codec

    - DSDATA2 of "master" codec <-> DSDATA2 of "aux" codec

    - ADC TDM signal to DSP <-> ASDATA1 of "master" codec

    - ASDATA2 of "master" codec <-> ASDATA1 of "aux" codec

    - ASDATA2 of "aux" codec <-> GND

    The registers settings of the codecs are both like this:

    [ 477.090537] ad193x spi32766.0: AD193X register 0: 0x5
    [ 477.090685] ad193x spi32766.0: AD193X register 1: 0x0
    [ 477.090815] ad193x spi32766.0: AD193X register 2: 0x40
    [ 477.090946] ad193x spi32766.0: AD193X register 3: 0x3e //0x03 for aux codec (lbclk and lrclk slave (DACs))
    [ 477.091077] ad193x spi32766.0: AD193X register 4: 0x18
    [ 477.091208] ad193x spi32766.0: AD193X register 5: 0x0
    [ 477.091337] ad193x spi32766.0: AD193X register 6: 0x0
    [ 477.091465] ad193x spi32766.0: AD193X register 7: 0x0
    [ 477.091594] ad193x spi32766.0: AD193X register 8: 0x0
    [ 477.091724] ad193x spi32766.0: AD193X register 9: 0x0
    [ 477.091855] ad193x spi32766.0: AD193X register 10: 0x0
    [ 477.091986] ad193x spi32766.0: AD193X register 11: 0x0
    [ 477.092115] ad193x spi32766.0: AD193X register 12: 0x0
    [ 477.092245] ad193x spi32766.0: AD193X register 13: 0x0
    [ 477.092374] ad193x spi32766.0: AD193X register 14: 0x1
    [ 477.092503] ad193x spi32766.0: AD193X register 15: 0x23
    [ 477.093773] ad193x spi32766.0: AD193X register 16: 0x7c //0x34 for aux codec (lbclk and lrclk slave (ADCs))

    When I test the DAC outputs sequentially the master codec will correctly output the test signal (sine) from audio channel 9 to channel 15, but nothing happens with the aux codec. When I swap the DAC connections like this:

    - DAC TDM signal from DSP <-> DSDATA1 of "aux" codec

    - DSDATA2 of "aux" codec <-> DSDATA2 of "master" codec

    the sine test signal is available from channel 1 to channel 8 on "master" codec. So the hardware connections should be fine, but I don't get any output from the aux codec. Does the aux codec need a different configuration or anything else?

    Thanks a lot!

Reply
  • Hi,

    I found a way to register auxiliary devices in ASoC core. There is an extra property "aux_dev" in snd_soc_card structure for these applications. The connections of the codecs and the DSP (BeagleBone Green) are like this:

    - clock signals are connected as described in the circuit sketch

    - DAC TDM signal from DSP <-> DSDATA1 of "master" codec

    - DSDATA2 of "master" codec <-> DSDATA2 of "aux" codec

    - ADC TDM signal to DSP <-> ASDATA1 of "master" codec

    - ASDATA2 of "master" codec <-> ASDATA1 of "aux" codec

    - ASDATA2 of "aux" codec <-> GND

    The registers settings of the codecs are both like this:

    [ 477.090537] ad193x spi32766.0: AD193X register 0: 0x5
    [ 477.090685] ad193x spi32766.0: AD193X register 1: 0x0
    [ 477.090815] ad193x spi32766.0: AD193X register 2: 0x40
    [ 477.090946] ad193x spi32766.0: AD193X register 3: 0x3e //0x03 for aux codec (lbclk and lrclk slave (DACs))
    [ 477.091077] ad193x spi32766.0: AD193X register 4: 0x18
    [ 477.091208] ad193x spi32766.0: AD193X register 5: 0x0
    [ 477.091337] ad193x spi32766.0: AD193X register 6: 0x0
    [ 477.091465] ad193x spi32766.0: AD193X register 7: 0x0
    [ 477.091594] ad193x spi32766.0: AD193X register 8: 0x0
    [ 477.091724] ad193x spi32766.0: AD193X register 9: 0x0
    [ 477.091855] ad193x spi32766.0: AD193X register 10: 0x0
    [ 477.091986] ad193x spi32766.0: AD193X register 11: 0x0
    [ 477.092115] ad193x spi32766.0: AD193X register 12: 0x0
    [ 477.092245] ad193x spi32766.0: AD193X register 13: 0x0
    [ 477.092374] ad193x spi32766.0: AD193X register 14: 0x1
    [ 477.092503] ad193x spi32766.0: AD193X register 15: 0x23
    [ 477.093773] ad193x spi32766.0: AD193X register 16: 0x7c //0x34 for aux codec (lbclk and lrclk slave (ADCs))

    When I test the DAC outputs sequentially the master codec will correctly output the test signal (sine) from audio channel 9 to channel 15, but nothing happens with the aux codec. When I swap the DAC connections like this:

    - DAC TDM signal from DSP <-> DSDATA1 of "aux" codec

    - DSDATA2 of "aux" codec <-> DSDATA2 of "master" codec

    the sine test signal is available from channel 1 to channel 8 on "master" codec. So the hardware connections should be fine, but I don't get any output from the aux codec. Does the aux codec need a different configuration or anything else?

    Thanks a lot!

Children
No Data