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.

Machine driver for TLV320AIC3100 codec

Other Parts Discussed in Thread: TLV320AIC3100, TLV320AIC34

Hi all,

i am using TLV320AIC3100 codec for our Allwinner processor.

i did machine driver code but registration of codec failed in soc_bind_dai_link.

telling CODEC DAI tlv320aic3x-hifi  and codec dai name  not registered.


i think i am missing codec configuration in my machine driver.

/* Digital audio interface glue - connects codec <--> CPU */
static struct snd_soc_dai_link rx51_dai[] = {
        {
                .name           = "TLV320AIC34",
                .stream_name    = "AIC34",
                .cpu_dai_name   = "sun7i-i2s.0",
                .codec_dai_name = "tlv320aic3x-hifi",
                .init           = rx51_aic34_init,
                .platform_name  = "sun7i-i2s-pcm-audio.0",
                .codec_name     = "tlv320aic23-codec.2-001a",
                //.dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_NF |
                //         SND_SOC_DAIFMT_CBM_CFM,
                .ops = &rx51_ops,
        },
};

/* Audio card */
static struct snd_soc_card rx51_sound_card = {
        .name = "RX-51",
        .owner = THIS_MODULE,
        .dai_link = &rx51_dai,
        .num_links = 1,
        //.num_rtd = 1,
        //.aux_dev = rx51_aux_dev,
        //.num_aux_devs = ARRAY_SIZE(rx51_aux_dev),
        //.codec_conf = rx51_codec_conf,
        //.num_configs = ARRAY_SIZE(rx51_codec_conf),
};

How to decide codec_name because the extension is different in different example(tlv320aic23-codec.2-001a).


Did i missing any thing?.


i checked my external codec with i2ctools which is working fine.

Regards

Punith

  • Hi, Punith,

    You can find info about our drivers on this post: http://e2e.ti.com/support/data_converters/audio_converters/f/64/t/266169.aspx

    unfortunatrly, due to the many different variables involved, we are not able to provide further assistance.

    d2

  • Hi all,

    I able to find the problem, it is because probe function of tlv320aic3x.c is not calling.
    so i am not able register it and also there is no board specific file under arch/arm/ to assign i2c probe manually.
    like

    vim ./arch/arm/mach-s3c64xx/mach-

    crag6410-module.c
    static struct i2c_board_info mxc_i2c0_board_info[] __initdata = {
        {
                I2C_BOARD_INFO("sgtl5000", 0x14),
        },
    };

    So how can i make probe of my external codec.
    Your help will be greatly appreciable.

    Regards
    Punith
  • Hi, Punith,

    I'm glad you found the area causing the problem.

    As I mentioned before, we are unfortunately not able to provide support debugging these types of issues.

    Sometimes other members of the community chime in with their experience. Guys?

    -d2

  •  Hi Guys.

    Here i did same thing but directly in codec driver ,

    vim sound/soc/codec/tlv320aic3x.c

    /* added by punith */
    static struct i2c_board_info __initdata aic3x_i2c_board_info[] = {
            {
                    .type = "tlv320aic3x",
                    .addr = 0x18,
                    //.platform_data = &axp_pdata,
                    //.irq = pmu_irq_id,
            },
    };

    static int __init aic3x_modinit(void)
    {
            int ret = 0;
            ret = i2c_add_driver(&aic3x_i2c_driver);
            printk("%s puneet\n",__func__);

            /* addedd by punith*/
            i2c_register_board_info(2, aic3x_i2c_board_info,
                            ARRAY_SIZE(aic3x_i2c_board_info));

            if (ret != 0) {
                    printk(KERN_ERR "Failed to register TLV320AIC3x I2C driver: %d\n",
                           ret);
            }
            return ret;
    }

    But not yet able to probe the codec.
    My codec in bus /dev/i2c-2 and address is 0x18. so i passed codec_name=tlv320aic3x-codec.2-0018

    Do you any idea, kindly tell me

    Regards
    Punith

  • Hi All,

    Finaly i able to probe external codec from machine driver but probing failed at

    [    9.586716] tlv320aic3x-codec 2-0018: Failed to get supply 'IOVDD': -517
    [    9.598903] tlv320aic3x-codec 2-0018: Failed to request supplies: -517
    [    9.613160] tlv320aic3x-codec 2-0018: asoc: failed to probe CODEC tlv320aic3x-codec.2-0018: -517

    Is it because of  i am not getting any audio MCLK,BLCK,AND WCLK.
    Your help will be greatly appreciable.
    Regards

    Punith

  • Hi all,


    Here i not getting how to create 4 regulators IOVDD,DVDD,AVDD,DRVDD.

    For IOVDD=AVDD=3.3V and DVDD=1.8V but what will be voltage for DRVDD=? for chip set TLV320AIC3100.

    Here will be link for my schematics of A20 board , KIndly tell how can pass get these 4 regulators.

    https://groups.google.com/forum/#!topic/linux-sunxi/t44VY2-cOMo

    Kindly tell me.

    Regards

    Punith

  • Hi,

    since i am getting all voltages in hardware ,i comment all regulator function in tlv320aic3x.c.

    Then sound card is created , but audio is not playing , here my dmesg log.

    aic3x_set_dai_fmt puneet
    aic3x_set_dai_sysclk puneet aic3x->sysclk=22579200
    aic3x_hw_params puneet
    play:sun7i_i2sdma.c::func:sun7i_pcm_hw_params(line:262)
    aic3x_set_bias_level puneet bias level=1
    aic3x_set_power puneet power=1
    aic3x_set_bias_level puneet bias level=2
    aic3x_set_bias_level puneet bias level=3
    aic3x_mute puneet mute=0
    play DMA_OP_STOP:sun7i-i2sdma.c::func:sun7i_pcm_hw_free(line:383)
    aic3x_mute puneet mute=1

    Is it because of commenting regulator function?.

    Kindly help me, your help will be greatly appreciable.

    Regards

    Punith

  • Hi All,


    Once i did some changes in my machine driver , i am able to play audio in my board.

    This one i can see in my console and by using log but not able to hear form HPLOUT and HPROUT pin.

    Once i probe while playing audio ,

    mclk=11MHZ

    blck=wclk=2.8MHZ

    and able to get signals also in dout pin and din pin  which is of frequency 2.8MHZ.

    Is it because of not proper  mapping of  audio route in machine driver or something else.

    In my board we are taking only HPLOUT and HPROUT form TI codec and remaining pins are not connected .

    Here  i am attaching log once i play audio through codec,

    Log:

    puneet sun7i_pcm_open
    puneet rx51_hw_params
    puneet sun7i_i2s_set_sysclk  i2s_pcm_select=1  freq=22579200
    aic3x_set_dai_fmt puneet
    puneet sun7i_i2s_set_fmt
    puneet sun7i_i2s_set_clkdiv i2s_select=1 sample_rate=44100
    sun7i_i2s_set_clkdiv, line:625, slot_index:0
    sun7i_i2s_set_clkdiv, line:626, slot_width:16
    sun7i_i2s_set_clkdiv, line:627, i2s_select:1
    sun7i_i2s_set_clkdiv, line:628, frame_width:1
    sun7i_i2s_set_clkdiv, line:629, sign_extend:0
    sun7i_i2s_set_clkdiv, line:630, tx_data_mode:0
    sun7i_i2s_set_clkdiv, line:631, rx_data_mode:0
    sun7i_i2s_set_clkdiv, line:632, msb_lsb_first:0
    sun7i_i2s_set_clkdiv, line:633, pcm_sync_period:256
    sun7i_i2s_set_clkdiv, line:634, word_select_size:32
    sun7i_i2s_set_clkdiv, line:635, over_sample_rate:256
    sun7i_i2s_set_clkdiv, line:636, sample_resolution:16
    aic3x_set_dai_sysclk puneet aic3x->sysclk=19200000
    aic3x_hw_params puneet
    puneet sun7i_i2s_hw_params
    puneet sun7i_pcm_hw_params
    play:sun7i_i2sdma.c::func:sun7i_pcm_hw_params(line:267)
    puneet sun7i_pcm_prepare
    puneet sun7i_pcm_enqueue
    aic3x_set_bias_level puneet bias level=1
    aic3x_set_power puneet power=1
    aic3x_set_bias_level puneet bias level=2
    aic3x_set_bias_level puneet bias level=3
    aic3x_mute puneet mute=0
    puneet sun7i_pcm_trigger
    puneet sun7i_i2s_trigger
    puneet sun7i_snd_txctrl_i2s
    puneet sun7i_pcm_pointer
    puneet sun7i_audio_play_buffdone
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_enqueue
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_pointer
    puneet sun7i_audio_play_buffdone
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_enqueue
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_pointer
    puneet sun7i_audio_play_buffdone
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_enqueue
    puneet sun7i_audio_play_buffdone
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_enqueue
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_pointer
    puneet sun7i_audio_play_buffdone
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_enqueue
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_pointer
    puneet sun7i_audio_play_buffdone
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_enqueue
    puneet sun7i_audio_play_buffdone
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_enqueue
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_pointer
    puneet sun7i_audio_play_buffdone
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_enqueue
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_pointer
    puneet sun7i_audio_play_buffdone
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_enqueue
    puneet sun7i_audio_play_buffdone
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_enqueue
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_pointer
    puneet sun7i_audio_play_buffdone
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_enqueue
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_pointer
    puneet sun7i_audio_play_buffdone
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_enqueue
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_pointer
    puneet sun7i_audio_play_buffdone
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_enqueue
    puneet sun7i_audio_play_buffdone
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_enqueue
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_pointer
    puneet sun7i_audio_play_buffdone
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_enqueue
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_pointer
    puneet sun7i_audio_play_buffdone
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_enqueue
    puneet sun7i_audio_play_buffdone
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_enqueue
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_pointer
    puneet sun7i_audio_play_buffdone
    puneet sun7i_pcm_pointer
    puneet sun7i_pcm_enqueue
    puneet sun7i_pcm_trigger
    puneet sun7i_i2s_trigger
    puneet sun7i_snd_txctrl_i2s
    puneet sun7i_pcm_hw_free
    play DMA_OP_STOP:sun7i-i2sdma.c::func:sun7i_pcm_hw_free(line:389)
    puneet sun7i_pcm_hw_free
    aic3x_mute puneet mute=1
    puneet sun7i_pcm_close

    Kindly tell me why i am not getting any audio through HPR and HPL out pins.

    Regards

    Punith

  • Hi TI guys,

    For TLV320AIC3100 chip set which driver i need to use?.

    Is it ok the commenting all regulator function in codec driver since i have all voltages in Hardware(for olny testing)?.

    Regards

    Punith

  • Hi All,

    Here my actual register output. I think if go though this , it will be easy to point out the problem.
    Here i am attaching my all register programmed value and machine driver code and schematic of codec.

    Once i play mp3 file through codec sound card i am getting 1.46V on HPL and HPR line and going to 0v once i stop audio but not getting any audio signals.

    The value of MCLK=11MHZ BLCK=5.8MHZ and WCLK=58KHZ and getting signals in DIN pin also.

    In our case  all clocks are coming from processor we are not any crystal oscillator to generate the clock.

    Your help will be greatly appreciable.

    Regards

    Punith

  •  

    Hi All,


    Finally i am able to do some improvement in my codec , now i am able to generate beep (exactly 2khz by programming beep registers) .but still i am not able to get any audio in HPL and HPR line.

    In my case codec is slave and cpu is master. here is my clock configuration

    MCLK=5.6448MHZ

    BCLK=1.411MHZ(for 16 bit ws)

    WCLK=44.1KHZ.

    I tested the data in from cpu to codec by playing the wav file which contains only 'A5' data. feels DataIN is ok.

    here i am attaching my logic analyser output and register dump of codec chip set.

    If anyone have idea  kindly suggest me.


    Regards

    Punith

    ti3100_registers.zip