Other Parts Discussed in Thread: ADC3140EVM-PDK,
Hello everybody,
I've tried for some time now to use the TLV320ADC3140 with the Raspberry Pi using the Linux Kernel driver. I am using the ADC3140EVM-PDK evaluation module (https://www.ti.com/tool/ADC3140EVM-PDK) wired up to a Raspberry Pi 4. I've read several resources including a post here in the audio forum: https://e2e.ti.com/support/audio-group/audio/f/audio-forum/1044970/tlv320adc5140-device-tree-on-raspberry-pi
The tlv320adcx140 kernel module is compiled on the device and configured via a device tree overlay:
/dts-v1/; /plugin/; / { compatible = "brcm,bcm2837", "brcm,bcm2836", "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; fragment@0 { target = <&i2s_clk_consumer>; __overlay__ { status = "okay"; }; }; fragment@1 { target = <&i2c1>; __overlay__ { #address-cells = <1>; #size-cells = <0>; status = "okay"; ti_codec: tlv320adc3140@4c { compatible = "ti,tlv320adc3140"; reg = <0x4c>; #sound-dai-cells = <0>; ti,mic-bias-source = <0>; ti,gpi-config = <0 0 0 0>; ti,gpio-config = <2 2>; ti,gpo-config-1 = <0 0>; ti,gpo-config-2 = <0 0>; reset-gpios = <&gpio 4 0>; }; }; }; fragment@2 { target = <&sound>; __overlay__ { compatible = "simple-audio-card"; i2s-controller = <&i2s_clk_consumer>; status = "okay"; simple-audio-card,name = "TI"; simple-audio-card,format = "i2s"; simple-audio-card,bitclock-master = <&codec_dai>; simple-audio-card,frame-master = <&codec_dai>; cpu_dai: simple-audio-card,cpu { sound-dai = <&i2s_clk_consumer>; dai-tdm-slot-num = <2>; dai-tdm-slot-width = <32>; }; codec_dai: simple-audio-card,codec { sound-dai = <&ti_codec>; }; }; }; };
When I boot the system the module most of the time seems to be loaded correctly, probing works and the ALSA interface is available. However from time to time, and especially whenever starting recordings, strange things start to happen. On a regular basis I get these errors writing registers via I2C:
[ 4.229373] tlv320adcx140-codec 1-004c: ASoC: error at snd_soc_component_update_bits on tlv320adcx140-codec.1-004c for register: [0x00000007] -5 [ 4.229600] tlv320adcx140-codec 1-004c: ASoC: error at snd_soc_component_update_bits on tlv320adcx140-codec.1-004c for register: [0x00000013] -5
In the following the kernel oopses and the device cannot be used anymore:
[ 4.229836] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000018
[ 4.229853] Mem abort info:
[ 4.229856] ESR = 0x0000000096000005
[ 4.229861] EC = 0x25: DABT (current EL), IL = 32 bits
[ 4.229866] SET = 0, FnV = 0
[ 4.229871] EA = 0, S1PTW = 0
[ 4.229875] FSC = 0x05: level 1 translation fault
[ 4.229879] Data abort info:
[ 4.229883] ISV = 0, ISS = 0x00000005
[ 4.229887] CM = 0, WnR = 0
[ 4.229891] user pgtable: 4k pages, 39-bit VAs, pgdp=0000000041fcc000
[ 4.229897] [0000000000000018] pgd=0000000000000000, p4d=0000000000000000, pud=0000000000000000
[ 4.229912] Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP
[ 4.229920] Modules linked in: tlv320adcx140(O) binfmt_misc regmap_i2c hci_uart snd_soc_simple_card snd_soc_simple_card_utils brcmfmac btbcm snd_soc_bcm2835_i2s bluetooth rpivid_hevc(C) brcmutil snd_soc_core bcm2835_codec(C) bcm2835_v4l2(C) raspberrypi_hwmon bcm2835_isp(C) bcm2835_mmal_vchiq(C) v4l2_mem2mem videobuf2_dma_contig videobuf2_vmalloc snd_compress videobuf2_memops snd_bcm2835(C) snd_pcm_dmaengine videobuf2_v4l2 snd_pcm videobuf2_common ecdh_generic ecc snd_timer libaes videodev mc snd raspberrypi_gpiomem vc_sm_cma(C) nvmem_rmem uio_pdrv_genirq uio batman_adv bridge stp llc cfg80211 rfkill i2c_dev drm dm_mod drm_panel_orientation_quirks backlight fuse ip_tables x_tables ipv6 i2c_bcm2835
[ 4.230035] CPU: 1 PID: 9 Comm: kworker/u8:0 Tainted: G C O 6.1.0-rpi8-rpi-v8 #1 Debian 1:6.1.73-1+rpt1
[ 4.230045] Hardware name: Raspberry Pi 4 Model B Rev 1.5 (DT)
[ 4.230050] Workqueue: events_unbound deferred_probe_work_func
[ 4.230065] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 4.230072] pc : adcx140_pwr_ctrl+0x8c/0xfc [tlv320adcx140]
[ 4.230092] lr : adcx140_pwr_ctrl+0x84/0xfc [tlv320adcx140]
[ 4.230103] sp : ffffffc00806b990
[ 4.230107] x29: ffffffc00806b990 x28: 0000000000000000 x27: ffffff8042b88080
[ 4.230118] x26: ffffffeb4ff34000 x25: 0000000000000001 x24: 0000000000000080
[ 4.230127] x23: ffffff80440d1d80 x22: 0000000000000001 x21: 0000000000000000
[ 4.230136] x20: 00000000000000e0 x19: ffffff80440d1d80 x18: 00000000fffffffd
[ 4.230145] x17: 0000000000000000 x16: ffffffeb793fad10 x15: ffffffc00806b590
[ 4.230154] x14: 0000000000000001 x13: 2930347830202c62 x12: 3778302865746972
[ 4.230163] x11: 775f70616d676572 x10: 0000000000001a30 x9 : ffffffeb78fb37fc
[ 4.230172] x8 : ffffff8040271a90 x7 : 0000000000000000 x6 : 000000000e3ec98d
[ 4.230181] x5 : 0040001000000020 x4 : 0000000000000000 x3 : 00000000fffffffb
[ 4.230190] x2 : 0000000000000000 x1 : ffffff8040270000 x0 : 00000000fffffffb
[ 4.230200] Call trace:
[ 4.230205] adcx140_pwr_ctrl+0x8c/0xfc [tlv320adcx140]
[ 4.230217] adcx140_set_dai_fmt+0x210/0x22c [tlv320adcx140]
[ 4.230228] snd_soc_dai_set_fmt+0x34/0xa0 [snd_soc_core]
[ 4.230311] snd_soc_runtime_set_dai_fmt+0x5c/0x150 [snd_soc_core]
[ 4.230356] snd_soc_bind_card+0x638/0xb80 [snd_soc_core]
[ 4.230399] snd_soc_register_card+0xf8/0x110 [snd_soc_core]
[ 4.230444] devm_snd_soc_register_card+0x54/0xb0 [snd_soc_core]
[ 4.230488] asoc_simple_probe+0x20c/0x3bc [snd_soc_simple_card]
[ 4.230499] platform_probe+0x70/0xcc
[ 4.230508] really_probe+0xc4/0x2e0
[ 4.230514] __driver_probe_device+0x80/0x120
[ 4.230520] driver_probe_device+0xe0/0x164
[ 4.230526] __device_attach_driver+0xc0/0x13c
[ 4.230532] bus_for_each_drv+0x84/0xe0
[ 4.230541] __device_attach+0xa4/0x1a0
[ 4.230546] device_initial_probe+0x1c/0x2c
[ 4.230552] bus_probe_device+0xa4/0xb0
[ 4.230557] deferred_probe_work_func+0x90/0xd0
[ 4.230563] process_one_work+0x200/0x474
[ 4.230572] worker_thread+0x74/0x43c
[ 4.230579] kthread+0x110/0x114
[ 4.230586] ret_from_fork+0x10/0x20
[ 4.230595] Code: 531a6442 9400025a 2a0003e3 34000140 (f9400ea0)
[ 4.230602] ---[ end trace 0000000000000000 ]---
I am wondering what I'm doing wrong or whether there is some error in the kernel module code or some configuration error.
It would be great, If someone could help here or share a success story using the chip family and the Raspberry Pi SBC.
Thanks
Jonas