This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DM8148 pcm timeslot set

Hi Pavel,

AS we know,the default setting of timeslots in the DM8148 kernel is 2.But I want to set the timeslots to 16.

Do you tell me where need to be modified?I only know maybe there are many places to be changed.

BR

Bob 

  • Bob,

    bob lee said:
    AS we know,the default setting of timeslots in the DM8148 kernel is 2

    Can you point me to the place/file where you found this? Note that according to the DM814x McASP TRM, time slots of 2 is for I2S:

    16.1.6.1.2 Inter-Integrated Sound (I2S) Format
    The inter-integrated sound (I2S) format is used extensively in audio interfaces. The TDM transfer mode of the McASP supports the I2S format when configured to 2 slots per frame.


    See also if the below e2e thread would be in help:

    http://e2e.ti.com/support/arm/sitara_arm/f/791/t/316302.aspx

    BR
    Pavel

  • Hi Pavel,

    I find the code in the board-evm8148.c as below.

    static struct snd_platform_data ti8148_evm_snd_data = {
     .tx_dma_offset = 0x46800000,
     .rx_dma_offset = 0x46800000,
     .op_mode = DAVINCI_MCASP_IIS_MODE,
     .num_serializer = ARRAY_SIZE(ti8148_iis_serializer_direction),
     .tdm_slots = 2,
     .serial_dir = ti8148_iis_serializer_direction,
     .asp_chan_q = EVENTQ_2,
     .version = MCASP_VERSION_2,
     .txnumevt = 1,
     .rxnumevt = 1,
    };

    Is the code also for I2S? If so , would you tell me how to set the  timeslots to 16 for I2S?

    Thank you very much.

    BR

    Bob

  • Hi Bob,

    Yes, I think this code is for I2S.

    bob lee said:
    .op_mode = DAVINCI_MCASP_IIS_MODE,

    arch/arm/plat-omap/include/plat/asp.h

    #define DAVINCI_MCASP_IIS_MODE    0 /* Driver code needs to change modified */
    #define DAVINCI_MCASP_DIT_MODE    1

    When DAVINCI_MCASP_IIS_MODE is used, we have invoked the davinci_hw_param() function, which deal with the value set in .tdm_slots:

    sound/soc/davinci/davinci-mcasp.c

    static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
                        struct snd_pcm_hw_params *params,
                        struct snd_soc_dai *cpu_dai)
    {

    if (dev->op_mode == DAVINCI_MCASP_DIT_MODE)
            davinci_hw_dit_param(dev);
        else
            davinci_hw_param(dev, substream->stream);
    }

    dev->tdm_slots = pdata->tdm_slots;

    static void davinci_hw_param(struct davinci_audio_dev *dev, int stream)
    {

    active_slots = (dev->tdm_slots > 31) ? 32 : dev->tdm_slots;

    if ((dev->tdm_slots >= 2) || (dev->tdm_slots <= 32))
                mcasp_mod_bits(dev->base + DAVINCI_MCASP_TXFMCTL_REG,
                        FSXMOD(dev->tdm_slots), FSXMOD(0x1FF));
            else
                printk(KERN_ERR "playback tdm slot %d not supported\n",
                    dev->tdm_slots);

    if ((dev->tdm_slots >= 2) || (dev->tdm_slots <= 32))
                mcasp_mod_bits(dev->base + DAVINCI_MCASP_RXFMCTL_REG,
                        FSRMOD(dev->tdm_slots), FSRMOD(0x1FF));
            else
                printk(KERN_ERR "capture tdm slot %d not supported\n",
                    dev->tdm_slots);

    }

    See also the below e2e threads:

    http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/716/t/192708.aspx

    http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/717/t/282973.aspx

    http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/716/t/254728.aspx

    BR
    Pavel

  • Hi Pavel,

    Another question,If I want to use 16 channels,How to set?

    Till now ,I have setted the timeslots to 16,and I want to send data through 16 channels.

    BR

    Bob

  • Bob,

    bob lee said:

    Another question,If I want to use 16 channels,How to set?

    Till now ,I have setted the timeslots to 16,and I want to send data through 16 channels.

    I have found several places where these 16 channels should/can be set:

    1. In the ALSA application

    http://processors.wiki.ti.com/index.php/TI81XX_Audio_Driver_User_Guide#FAQ

    Modify the number of channel specified in the code to enable multi-channel capture bases on input given.

    /* Set number of channels */
     if ((err = snd_pcm_hw_params_set_channels(capture_handle, hw_params, <Number of channels>)) < 0) {
       fprintf (stderr, "cannot set channel count (%s)\n", snd_strerror (err));
       exit (1);
     }

    The example is with 2 channels:


    http://processors.wiki.ti.com/index.php/TI81XX_Audio_Driver_User_Guide#A_minimal_record_application

    /* Set number of channels */
    if ((err = snd_pcm_hw_params_set_channels(capture_handle, hw_params, 2)) < 0) {
    fprintf (stderr, "cannot set channel count (%s)\n", snd_strerror (err));
    exit (1);
    }

    2. linux-kernel/sound/soc/davinci/davinci-pcm.c - set by default with 2 channels for both capture/playback

    pcm_hardware_playback .channels_max = 2,

    pcm_hardware_capture .channels_max = 2

    3. linux-kernel/sound/soc/codecs/tlv320aic3x.c - codec driver for TI EVM, set by default with 2 channels for both capture/playback

    .playback .channels_max = 2

    .capture .channels_max = 2

    4. linux-kernel/sound/soc/davinci/davinci-mcasp.c - platform driver, set by default with 2 channels for both capture/playback

    .playback .channels_max     = 2

    .capture .channels_max     = 2

    See also if the below e2e thread will be in help:

    http://e2e.ti.com/support/embedded/linux/f/354/t/148881.aspx

    BR
    Pavel

  • Hi Pavel,

    According to your post,I have setted the channels to 16.

    Thank you .

    BR

    Bob