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
  • 0
    •  Analog Employees 
    on Oct 10, 2016 5:02 PM over 4 years ago

    Hello henrix,

    Looking at your diagram you are close...

    For the AD1938 labeled as "Aux", you will be coming into the DSDATA1 pin. The DSDATA2 will be unused (left floating) on that part because it is the last DAC in the chain.

    Likewise, for the ADC data the part labeled as "AUX" will output its ADC data on ASDATA1. ASDATA2 pin should be grounded.

    For the part labeled as "Master" you are correct in your port usage.

    For your clocking scheme, This should work. The ADC will be running a TDM8 signal and the DACs will be running a TDM16 signal.

    I am not a Linux expert, I support the codec. I looked into the help files on the Wiki and came up with this. It looks like you can specify a bus number to differentiate between devices. The chip select is also given here. What I do not see is the usage. The init code example that is in the help file does not use a bus number. I will ask around and see if I can find an answer. I did search the Linux part of this forum and came up with nothing.

    Here is a snip of the help file:

    Declaring SPI slave devices

    Unlike PCI or USB devices, SPI devices are not enumerated at the hardware level. Instead, the software must know which devices are connected on each SPI bus segment, and what slave selects these devices are using. For this reason, the kernel code must instantiate SPI devices explicitly. The most common method is to declare the SPI devices by bus number.

    This method is appropriate when the SPI bus is a system bus, as in many embedded systems, wherein each SPI bus has a number which is known in advance. It is thus possible to pre-declare the SPI devices that inhabit this bus. This is done with an array of struct spi_board_info, which is registered by calling spi_register_board_info().

    For more information see: Documentation/spi/spi-summary

    21 Oct 2010 16:10 · Michael Hennerich

    You need to set the modalias of your SPI info according to your codec. Valid values are “ad1935” and “ad1937”, You'll also have to adjust bus_num and chip_select according to your board setup.

    static struct spi_board_info board_spi_board_info[] __initdata = {     [--snip--]     {          .modalias = "ad1936",          .max_speed_hz = 3125000,     /* max spi clock (SCK) speed in HZ */          .bus_num = 0,          .chip_select = 4, /* CS, change it for your board */          .mode = SPI_MODE_3,     },     [--snip--]};
Reply
  • 0
    •  Analog Employees 
    on Oct 10, 2016 5:02 PM over 4 years ago

    Hello henrix,

    Looking at your diagram you are close...

    For the AD1938 labeled as "Aux", you will be coming into the DSDATA1 pin. The DSDATA2 will be unused (left floating) on that part because it is the last DAC in the chain.

    Likewise, for the ADC data the part labeled as "AUX" will output its ADC data on ASDATA1. ASDATA2 pin should be grounded.

    For the part labeled as "Master" you are correct in your port usage.

    For your clocking scheme, This should work. The ADC will be running a TDM8 signal and the DACs will be running a TDM16 signal.

    I am not a Linux expert, I support the codec. I looked into the help files on the Wiki and came up with this. It looks like you can specify a bus number to differentiate between devices. The chip select is also given here. What I do not see is the usage. The init code example that is in the help file does not use a bus number. I will ask around and see if I can find an answer. I did search the Linux part of this forum and came up with nothing.

    Here is a snip of the help file:

    Declaring SPI slave devices

    Unlike PCI or USB devices, SPI devices are not enumerated at the hardware level. Instead, the software must know which devices are connected on each SPI bus segment, and what slave selects these devices are using. For this reason, the kernel code must instantiate SPI devices explicitly. The most common method is to declare the SPI devices by bus number.

    This method is appropriate when the SPI bus is a system bus, as in many embedded systems, wherein each SPI bus has a number which is known in advance. It is thus possible to pre-declare the SPI devices that inhabit this bus. This is done with an array of struct spi_board_info, which is registered by calling spi_register_board_info().

    For more information see: Documentation/spi/spi-summary

    21 Oct 2010 16:10 · Michael Hennerich

    You need to set the modalias of your SPI info according to your codec. Valid values are “ad1935” and “ad1937”, You'll also have to adjust bus_num and chip_select according to your board setup.

    static struct spi_board_info board_spi_board_info[] __initdata = {     [--snip--]     {          .modalias = "ad1936",          .max_speed_hz = 3125000,     /* max spi clock (SCK) speed in HZ */          .bus_num = 0,          .chip_select = 4, /* CS, change it for your board */          .mode = SPI_MODE_3,     },     [--snip--]};
Children
No Data