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.

TLV320ADC5140: Configuring and testing tlv320adc5140 on renesas rzg2h, kernel-5.10.158

Part Number: TLV320ADC5140

Hi Ti Team,

We are using TLV320adc5140 audio codec chip with renesas rzg2h-processor , the kernel we are using is 5.10.158 And the below is my dts entries,enabled tlv3210adcx140 driver in the kenel.

When we try to probe the code it is giving below error:

2.401668] optee: probe of firmware:optee failed with error -22
[ 2.408348] SMET inside ...1
[ 2.409141] renesas_sdhi_internal_dmac ee140000.mmc: mmc2 base at 0x00000000ee140000, max clock rate 200 MHz
[ 2.411252] SMET inside ...2
[ 2.411428] renesas_sdhi_internal_dmac ee160000.mmc: mmc0 base at 0x00000000ee160000, max clock rate 200 MHz
[ 2.433888] SMET inside ...3
[ 2.436818] SMET inside ...4
[ 2.439783] SMET inside ...5
[ 2.442986] asoc-simple-card: probe of sound failed with error -22
[ 2.451535] rcar_sound ec500000.sound: probed:

My dtsi entri is:

tlv320adc5140_snd: sound {
compatible = "simple-audio-card";
simple-audio-card,format = "i2s";
simple-audio-card,bitclock-master = <&cpu_dai>;
simple-audio-card,frame-master = <&cpu_dai>;

simple-audio-card,widgets = "Microphone", "Mic";

simple-audio-card,audio-routing =
"MIC1P", "Mic",
"MIC1M", "Mic",
"MIC2P", "Mic",
"MIC2M", "Mic",
"MIC3P", "Mic",
"MIC3M", "Mic",
"MIC4P", "Mic",
"MIC4M", "Mic";

mclk-fs = <256>;
cpu_dai: simple-audio-card,cpu {
sound-dai = <&sound_pins1>;
clock-names = "mclk";
};

codec_dai: codec {
sound-dai = <&tlv320adc5140>;
clocks = <&clk_ext_audio_codec>;
// clocks = <&audio_mclock>;
clock-names = "mclk";
};
};

&i2c0 {
pinctrl-0 = <&i2c0_pins>;
pinctrl-names = "default";
clock-frequency = <100000>;
status = "okay";
#if 1
// #address-cells = <1>;
// #size-cells = <0>;
tlv320adc5140: tlv320adc5140@4c {
#sound-dai-cells = <0>;
compatible = "ti,tlv320adc5140";
reg = <0x4c>;
/* Digital Mics */

// ti,use-internal-areg; /*Regulator with AVDD at 3.3V. If not defined then the internal regulator is enabled */
ti,mic-bias-source = <6>; /* 0 - Mic bias is set to VREF */
ti,pdm-edge-select = <1 1 1 1>;
ti,gpio-config = <0 0>;
ti,gpi-config = <4 5 6 7>;
ti,gpo-config-1 = <4 1>;
ti,gpo-config-2 = <4 1>;
ti,gpo-config-3 = <4 1>;
ti,gpo-config-4 = <4 1>;
ti,slot-mapping = <0 1 2 3>;
ti,asi-tx-driver = <0>;

reset-gpios = <&gpio6 11 GPIO_ACTIVE_HIGH>;
};
port@0 {
tlv320adc5140_endpoint: endpoint {
remote-endpoint = <&rsnd_endpoint3>;
};
};
#endif

};

sound_pins1: sound {
groups = "ssi78_ctrl", "ssi7_data";/* G6_17, G6_18, G6_19 */
function = "ssi";
};

Please guide us how do i go about configuring and getting tlv320adc5140 working on linux-5.10.158

Thanks and regards,

Nagaraja

  • Hi here is the more info:

    [ 4.394299] SMET inside ...1
    [ 4.416088] SMET inside adcx140_i2c_probe 1093/n
    [ 4.416092] SMET inside ...2
    [ 4.423668] SMET inside adcx140_i2c_probe 1101/n
    [ 4.423707] SMET inside ...3
    [ 4.431288] SMET inside adcx140_i2c_probe 1110/n
    [ 4.431290] SMET inside ...4
    [ 4.438868] SMET inside adcx140_i2c_probe 1124/n
    [ 4.438920] SMET inside ...5
    [ 4.445005] mmc2: new high speed SDIO card at address 0001
    [ 4.446501] SMET inside adcx140_i2c_probe 1136/n
    [ 4.452303] asoc-simple-card: probe of sound failed with error -22
    [ 4.465061] rcar_sound ec500000.sound: probed

    AND:

    root@hihope-rzg2h:~# cat /sys/kernel/debug/asoc/dais
    ec500000.sound
    tlv320adcx140-codec
    i2s-hifi
    snd-soc-dummy-dai
    root@hihope-rzg2h:~#
    root@hihope-rzg2h:~#

    Thanks and regards,

    Nagaraja

  • Hi Nagaraja

    I wonder whether TLV320ADC5140 is master or not?

    Has the codec_probe in TLV320ADC5140 has been called?

    Kindly run following command to check whether TLV320ADC5140 was registered successfully.

    # ls /dev/snd

    # cat /proc/asound/pcm

    # cat /proc/asound/cards

    Kindly share above log with me.

  • Hi Shenghao Ding,

    Thanks and reply, Yes I have made TLV320ADC5140 as a master:

    The code_probe is called and is giving below kernel dump :

    [    2.912009] ------------[ cut here ]------------
    [    2.912490] renesas_sdhi_internal_dmac ee100000.mmc: Got CD GPIO
    [    2.916642] WARNING: CPU: 3 PID: 263 at sound/soc/codecs/tlv320adcx140.c:918 adcx140_codec_probe+0x34/0x5c0
    [    2.916649] Modules linked in:
    [    2.935447] CPU: 3 PID: 263 Comm: kworker/3:2 Not tainted 5.10.158-cip22-yocto-standard #1
    [    2.943707] Hardware name: HopeRun HiHope RZ/G2H with sub board (DT)
    [    2.950065] Workqueue: events deferred_probe_work_func
    [    2.955203] pstate: 60000005 (nZCv daif -PAN -UAO -TCO BTYPE=--)
    [    2.961206] pc : adcx140_codec_probe+0x34/0x5c0
    [    2.965734] lr : snd_soc_component_probe+0x28/0x78
    [    2.970519] sp : ffff800012103960
    [    2.972725] renesas_sdhi_internal_dmac ee100000.mmc: mmc1 base at 0x00000000ee100000, max clock rate 200 MHz
    [    2.973829] x29: ffff800012103960 x28: 0000000000000000
    [    2.988974] x27: 0000000000000000 x26: ffff0004c1c2f080
    [    2.994284] x25: 0000000000000000 x24: ffff0004c1a44940
    [    2.999593] x23: ffff0004c1c44880 x22: ffff0004c1a41480
    [    3.004903] x21: ffff800010ef2ad8 x20: ffff0004c1a44880
    [    3.010212] x19: 0000000000000000 x18: 0000000000000001
    [    3.015521] x17: 0000000000000000 x16: 0000000000000000
    [    3.020830] x15: 0000000000000001 x14: 0000000000000000
    [    3.026138] x13: 0000000000000000 x12: 0000000000000000
    [    3.031447] x11: 0000000000000000 x10: 0000000000000000
    [    3.036756] x9 : 0000000000000000 x8 : 0000000000000000
    [    3.042065] x7 : 0000000000000000 x6 : ffff0004c1c44a80
    [    3.045369] mmc1: new ultra high speed SDR104 SDXC card at address 59b4
    [    3.047374] x5 : ffff0004c1cc0818 x4 : 00000000ffffffff
    [    3.054665] mmcblk1: mmc1:59b4 SD64G 59.4 GiB
    [    3.059303] x3 : ffff0004c1c44ab8 x2 : ffff800010909ab8
    [    3.059307] x1 : 0000000000000000 x0 : ffff0004c15f6820
    [    3.059312] Call trace:
    [    3.059321]  adcx140_codec_probe+0x34/0x5c0
    [    3.066291]  mmcblk1: p1 p2
    [    3.069074]  snd_soc_component_probe+0x28/0x78
    [    3.069080]  soc_probe_component+0x1e4/0x390
    [    3.069087]  snd_soc_bind_card+0x43c/0x960
    [    3.096589]  snd_soc_register_card+0xf4/0x110
    [    3.100943]  devm_snd_soc_register_card+0x44/0xa0
    [    3.105643]  asoc_simple_probe+0x1a0/0x340
    [    3.109735]  platform_drv_probe+0x54/0xa8
    [    3.113741]  really_probe+0xec/0x3c8
    [    3.117313]  driver_probe_device+0x58/0xb8
    [    3.121405]  __device_attach_driver+0xb8/0xe0
    [    3.125758]  bus_for_each_drv+0x7c/0xd0
    [    3.129590]  __device_attach+0xec/0x180
    [    3.133422]  device_initial_probe+0x14/0x20
    [    3.137601]  bus_probe_device+0x9c/0xa8
    [    3.141433]  deferred_probe_work_func+0x88/0xc0
    [    3.145964]  process_one_work+0x1e8/0x360
    [    3.149969]  worker_thread+0x210/0x480
    [    3.153716]  kthread+0x154/0x158
    [    3.156942]  ret_from_fork+0x10/0x34
    [    3.160514] ---[ end trace 55d4d807423887dd ]---
    [    3.165154]  SMET inside adcx140_codec_probe 919/n
    [    3.165160]  SMET inside adcx140_codec_probe 928/n
    [    3.169960]  SMET inside adcx140_codec_probe 932/n
    [    3.174753]  SMET inside adcx140_codec_probe 940/n
    [    3.380579]  SMET inside adcx140_codec_probe 956/n
    [    3.486147]  SMET inside adcx140_codec_probe 978/n
    [    3.492124]  SMET inside adcx140_codec_probe 1004/n
    [    3.499716]  SMET inside adcx140_codec_probe 1029/n
    [    3.510557] cfg80211: Loading compiled-in X.509 certificates for regulatory database
    [    3.525358] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
    [    3.532770] ALSA device list:
    [    3.535739]   #0: rcar_sound
    [    3.539874] EXT4-fs (mmcblk1p2): mounting ext3 file system using the ext4 subsystem.

    =======================================================================

    root@hihope-rzg2h:~# arecord -l
    **** List of CAPTURE Hardware Devices ****
    card 0: rcarsound [rcar_sound], device 0: rsnd-dai.0-tlv320adcx140-codec tlv320adcx140-codec-0 []
      Subdevices: 1/1
      Subdevice #0: subdevice #0


    root@hihope-rzg2h:~# ls /dev/snd
    by-path  controlC0  pcmC0D0c  timer


    root@hihope-rzg2h:~# cat /proc/asound/pcm
    00-00: rsnd-dai.0-tlv320adcx140-codec tlv320adcx140-codec-0 :  : capture 1


    root@hihope-rzg2h:~# cat /proc/asound/card
    card0/ cards  
    root@hihope-rzg2h:~# cat /proc/asound/cards
     0 [rcarsound      ]: rcar_sound - rcar_sound
                          rcar_sound.

    I am using the below command but the recordded file is empty:

    arecord -D plughw:0,0 -r44100 -f S16_LE -c 1 -d 25 reccord700.wav

    Please help us what am I missing here.

    Thanks and regards,

    Nagaraja

  • Hi Guy

    I suggest you using this code. lpaa-android-drivers/pcmdevice-linux-driver - Unnamed repository; edit this file 'description' to name the repository.

    Here is the example to how to integrate the pcmdevice driver and set the master on adc3140, similar to adc5140.

    TLV320ADC3140: Configuration and Kernel Errors - Audio forum - Audio - TI E2E support forums

    Good luck.

  • Hi ,

     We configured   TLV320adc5140 as master and RZG2H as slave and used .

    We are using below pin configuration  .

    sound_pins1: sound {
                    groups = "ssi78_ctrl", "ssi7_data";/* G6_17, G6_18, G6_19 */
                    function = "ssi";
            };

    and using:

    capture = ssi7;

     Now are able to record a file and file size is growing.

    =============================================

    root@hihope-rzg2h:~# arecord -D plughw:0,0 -r44100 -f S16_LE -c 1 -d 15 reccord704.wav  &                                                                                                                  
    [1] 616
    Recording WAVE 'reccord704.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono


    root@hihope-rzg2h:~# ls -l reccord704.wav
    -rw-r--r-- 1 root root 651308 Sep 20 10:46 reccord704.wav


    root@hihope-rzg2h:~# ls -l reccord704.wav
    -rw-r--r-- 1 root root 847916 Sep 20 10:46 reccord704.wav


    root@hihope-rzg2h:~# i2cdump -y -f 0 0x4c
    No size specified (using byte-data access)
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
    00: 00 00 81 00 00 05 00 40 00 00 00 00 01 02 03 04    ..?..?.@....????
    10: 05 06 07 86 48 f8 10 10 04 20 02 08 00 00 02 40    ????H???? ??..?@
    20: f0 a0 41 41 41 41 00 00 00 00 00 45 67 00 00 00    ??AAAA.....Eg...
    30: 00 00 00 ff 00 00 c0 00 80 00 00 00 00 00 c9 80    ......?.?.....??
    40: 00 00 00 c9 80 00 00 00 c9 80 00 00 00 c9 80 00    ...??...??...??.
    50: 00 00 c9 80 00 00 00 c9 80 00 00 00 c9 80 00 00    ..??...??...??..
    60: 00 c9 80 00 00 00 00 00 00 00 00 01 40 7b 00 00    .??........?@{..
    70: e7 00 00 00 00 00 00 c0 00 00 ff 00 ff 8c 69 00    ?......?.....?i.
    80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    [1]+  Done                    arecord -D plughw:0,0 -r44100 -f S16_LE -c 1 -d 15 reccord704.wav

    We are getting BCLK=12MHz and FSYNC=48kHz.

    But we are not getting the data signal when we probes the data line 6_19 which is dataline;

    Please guide us what am i missing here.

    Thanks and regards,
    Nagaraja

  • Hi Guy,

    Have you use pcmdevice driver instead of you current driver?

  • Hi,

    With above configuration we are not able set the resgister value from the driver,by seeting register value like below:

    //      { ADCX140_MST_CFG0, 0x02 },
            { ADCX140_MST_CFG0, 0x86 },

    //{ ADCX140_IN_CH_EN, 0xf0 },
            { ADCX140_IN_CH_EN, 0xff },
    //      { ADCX140_ASI_OUT_CH_EN, 0x00 },
            { ADCX140_ASI_OUT_CH_EN, 0xff },

    but we managed to set the reg value using the below command, after login.

    i2cset -y -f 0 0x4c 0x13 0x86

    i2cset -y -f 0 0x4c 0x73 0xff

    i2cset -y -f 0 0x4c 0x74 0xff

    And are able to recording using the below command, But when play back the recordded file, the  valume is  very very low.

    arecord -D plughw:0,0 -r 44100 -f S16_LE -c 1 -d 15 reccord704.wav

    What could be wrong with my dtsi setting why It is not taking the register value changes from the driver, Please guide us how do i test

    all four analog mic separatly and how to increase the valume.

    Can you please suggest us the workaround please.

    Thanks and regards,

    Nagaraja

  • Hi Guy

    We weeks ago, I suggested you using this code. lpaa-android-drivers/pcmdevice-linux-driver - Unnamed repository; edit this file 'description' to name the repository.

    Here is the example to how to integrate the pcmdevice driver and set the master on adc3140, similar to adc5140.

    TLV320ADC3140: Configuration and Kernel Errors - Audio forum - Audio - TI E2E support forums

    Good luck.