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.

TLV320AIC3106: using "snd_soc_component_write" from an application

Part Number: TLV320AIC3106

Tool/software:

since the 3106 codec driver doesn't have support for the DMIC or the page 1 filter parameters i need to be able to access registers directly. i was told in another post i can use "snd_soc_component_write" to access those registers.

I have been googling for a couple of hours and i can't get a clear answer on how to use this. i see the prototype for it so it seems obvious until you realize that you have to get:

struct snd_soc_component * component

and when i looked for how you are supposed to get "component" it looks like it is neatly a part of the dai structure.

dai->component

great. so how do you get the dai structure? that's where i got hung up. i see it passed as a parameter in routines most of the time so i'm guessing as a part of the driver it is readily available. however, for an application i am not sure how to obtain the dai handle. 

i could rally use some guidance as far as: am i going about this the right way? how do i get the dai handle? do i not need the dai handle and there is a more direct route to get the component? should i give up and just use ioctl on the i2c bus?

help.

  • Hi,

    I am working on looking into this for you. I assume you are on Linux? I will get back tomorrow about the dai handle.

    In the meantime, I wrote up some basic I2C commands to send to a different codec via Linux command line/Python the other day, I'll paste it here in case it helps:

    i2cdetect 2 // displays the available I2C device addresses on bus 2, your bus may vary so you can try different values until you get some addresses in the readout. The AIC3254 device address is 0x30, as specified in the datasheet. Change device address as specified in the AIC3106 datasheet.

    i2cset 2 0x30 0x00 0x00 // on bus 2, device address 0x30, select register 0 and set 0 (this sets the page to 0)

    i2cset 2 0x30 0x04 0x04 // on bus 2, address 0x30, register 4, set value 00000100 

    Let me know if you are not using Linux or if you have any more questions.

    Best,
    Mir Jeffres

  • Hi,

    I recommend you to use the same dai structure as the Linux driver; https://www.ti.com/tool/TLV320AIC31XX-DRIVERS

    You can add a default setting array after reset.

    Regards

    Kevin

  • i am using linux, it is an embedded linux project

    the driver, again, would appear to access the DAI as a param in the routine. i do not see where the DAI is obtained

  • It looks like the main structure could be in soc-topology.h in include/sound. In the public API section, there is a structure called "snd_soc_tplg_ops" with the DAI initialization loading the DAI into snd_soc_component and DAI link. This starts in line 132 here: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/include/sound/soc-topology.h

    You should be able to use the same component as all the other snd_soc_component_write calls in the main driver if you are able to edit the driver on your device. 

    Let me know if you need more help.

    Best,
    Mir

  • i'm not writing a driver i am doing this inside my application. 

    or are you saying i can call:

    int (*dai_load)(struct snd_soc_component *, int index,
    struct snd_soc_dai_driver *dai_drv,
    struct snd_soc_tplg_pcm *pcm, struct snd_soc_dai *dai);

    and it will give me access to the DAI?

  • Unfortunately we don't have direct support with using Linux drivers right now, but you can definitely try that. I can search the TI Linux drivers repo pretty easily if you want some more specific function calls, but current apps engineers on the team do not have experience writing applications that utilize the Linux drivers. Let me know if you need more help with specific functions, or if that dai_load function doesn't work I can look for more instances where dai is called in the code as an example for you.

    Best,
    Mir

  • so i'm not writing or changing the driver i am just trying to use "snd_soc_component_write" in a non-driver application.

    i don't see how dai_load will help me as it requires, as a parameter, the exact item i am trying to get via the DAI: snd_soc_component 

    i'm guessing that even with the help of people in this forum i can't get to where i want to so it must be fairly hard to accomplish or reserved only for driver code and not user application code. i'm just going to use I2C IOCTL access and hope that works without any issues

  • Sounds good. Sorry I cannot help more with application development. Let me know if you need I2C help.

    Best,
    Mir