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.
Tool/software:
Hi,
We have a TLV320AIC3111 connected to an imx8MP. There are no other IC's connected to this bus.
The issue is that for some reason we can't get reliable communication over I2C when using the TI kernel driver. Looking for assistance to perhaps look over the device tree and settings to see if we've missed something.
The only modifications to tlv320aic31xx.c have been some debug printing statements, and the addition of some timing (added entries to aic31xx_divs[]).
Below is some info to get started:
-------
Here is the device tree. Linux kernel is based on 6.6.3.
sound-tlv320aic3111 { compatible = "simple-audio-card"; simple-audio-card,name = "sound-tlv320aic3111"; simple-audio-card,format = "i2s"; simple-audio-card,bitclock-master = <&codec_dai>; simple-audio-card,frame-master = <&codec_dai>; simple-audio-card,mclk-fs = <256>; simple-audio-card,widgets = "Headphone", "Headphone Jack", "Microphone", "Microphone Jack", "Speaker", "Speaker"; simple-audio-card,routing = "MIC1LP", "Microphone Jack", "MIC1RP", "Microphone Jack", "MIC1LP", "MICBIAS", "MIC1RP", "MICBIAS", "Headphone Jack", "HPL", "Headphone Jack", "HPR", "Speaker", "SPL", "Speaker", "SPR"; codec_dai: simple-audio-card,codec { sound-dai = <&tlv320aic3111>; clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI3_MCLK1>; }; simple-audio-card,cpu { sound-dai = <&sai3>; }; }; &i2c3 { clock-frequency = <400000>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_i2c3>; status = "okay"; tlv320aic3111: audio-codec@18 { #sound-dai-cells = <0>; compatible = "ti,tlv320aic3111"; reg = <0x18>; ai31xx-micbias-vg = <MICBIAS_AVDDV>; reset-gpios = <&gpio4 29 GPIO_ACTIVE_LOW>; AVDD-supply = <&buck4>; HPVDD-supply = <&buck4>; SPRVDD-supply = <®_vsys>; SPLVDD-supply = <®_vsys>; IOVDD-supply = <&buck5>; DVDD-supply = <&buck5>; }; };
Here is a kernel log on bootup. We can confirm on a logic analyzer that the I2C transactions before the error message are correct.
Also the reset pin during kernel bootup is high - low (>1uS) - high. This occurs well after power supplies are stable (many seconds).
Jun 21 02:51:23 simple_dai_link_of:323: asoc-simple-card sound-tlv320aic3111: link_of (/sound-tlv320aic3111) Jun 21 02:51:23 aic31xx_i2c_probe:1672: tlv320aic31xx-codec 2-0018: ## aic31xx_i2c_probe: tlv320aic3111 codec_type = 6 Jun 21 02:51:23 regcache_init:194: tlv320aic31xx-codec 2-0018: Initializing rbtree cache Jun 21 02:51:23 simple_dai_link_of:323: asoc-simple-card sound-tlv320aic3111: link_of (/sound-tlv320aic3111) Jun 21 02:51:23 No soundcards found. Jun 21 02:51:23 simple_dai_link_of:323: asoc-simple-card sound-tlv320aic3111: link_of (/sound-tlv320aic3111) Jun 21 02:51:24 simple_dai_link_of:323: asoc-simple-card sound-tlv320aic3111: link_of (/sound-tlv320aic3111) Jun 21 02:51:28 simple_dai_link_of:323: asoc-simple-card sound-tlv320aic3111: link_of (/sound-tlv320aic3111) Jun 21 02:51:28 simple_dai_link_of:323: asoc-simple-card sound-tlv320aic3111: link_of (/sound-tlv320aic3111) Jun 21 02:51:28 regcache_init:194: fsl-easrc 30c90000.easrc: Initializing rbtree cache Jun 21 02:51:28 simple_dai_link_of:323: asoc-simple-card sound-tlv320aic3111: link_of (/sound-tlv320aic3111) Jun 21 02:51:28 regcache_init:194: fsl-sai 30c30000.sai: Initializing flat cache Jun 21 02:51:28 regcache_init:194: fsl,imx8mp-audio-xcvr 30cc0000.xcvr: Initializing flat cache Jun 21 02:51:28 regcache_init:194: fsl-aud2htx 30cb0000.aud2htx: Initializing rbtree cache Jun 21 02:51:28 simple_dai_link_of:323: asoc-simple-card sound-tlv320aic3111: link_of (/sound-tlv320aic3111) Jun 21 02:51:28 regcache_sync:369: fsl-sai 30c30000.sai: Syncing flat cache Jun 21 02:51:28 simple_dai_link_of:323: asoc-simple-card sound-tlv320aic3111: link_of (/sound-tlv320aic3111) Jun 21 02:51:28 aic31xx_codec_probe:1391: tlv320aic31xx-codec 2-0018: ## aic31xx_codec_probe Jun 21 02:51:28 aic31xx_set_dai_sysclk:1176: tlv320aic31xx-codec 2-0018: ## aic31xx_set_dai_sysclk: clk_id = 0, freq = 12288000, dir = 0 Jun 21 02:51:28 aic31xx_set_dai_fmt:1094: tlv320aic31xx-codec 2-0018: ## aic31xx_set_dai_fmt: fmt = 0x1001 Jun 21 02:51:28 aic31xx_set_bias_level:1341: tlv320aic31xx-codec 2-0018: ## aic31xx_set_bias_level: 0 -> 1 Jun 21 02:51:28 aic31xx_power_on:1287: tlv320aic31xx-codec 2-0018: Power on Jun 21 02:51:28 aic31xx_reset:1233: tlv320aic31xx-codec 2-0018: aic31xx_reset start Jun 21 02:51:28 aic31xx_reset:1239: tlv320aic31xx-codec 2-0018: aic31xx_reset by gpio Jun 21 02:51:28 aic31xx_power_on:1307: tlv320aic31xx-codec 2-0018: After reset: 0 Jun 21 02:51:28 regcache_sync:369: tlv320aic31xx-codec 2-0018: Syncing rbtree cache Jun 21 02:51:28 regcache_sync_block_raw_flush:774: tlv320aic31xx-codec 2-0018: Writing 1 bytes for 1 registers from 0x1b-0x1b Jun 21 02:51:28 i2c_imx_xfer_common:1366: i2c i2c-2: <i2c_imx_xfer_common> transfer message: 0 Jun 21 02:51:28 i2c_imx_write:1188: i2c i2c-2: <i2c_imx_write> write slave address: addr=0x30 Jun 21 02:51:28 i2c_imx_trx_complete:629: i2c i2c-2: <i2c_imx_trx_complete> TRX complete Jun 21 02:51:28 i2c_imx_acked:641: i2c i2c-2: <i2c_imx_acked> ACK received Jun 21 02:51:28 i2c_imx_write:1199: i2c i2c-2: <i2c_imx_write> write data Jun 21 02:51:28 i2c_imx_write:1203: i2c i2c-2: <i2c_imx_write> write byte: B0=0x0 Jun 21 02:51:28 i2c_imx_trx_complete:629: i2c i2c-2: <i2c_imx_trx_complete> TRX complete Jun 21 02:51:28 i2c_imx_acked:641: i2c i2c-2: <i2c_imx_acked> ACK received Jun 21 02:51:28 i2c_imx_xfer_common:1357: i2c i2c-2: <i2c_imx_xfer_common> repeated start Jun 21 02:51:28 i2c_imx_xfer_common:1366: i2c i2c-2: <i2c_imx_xfer_common> transfer message: 1 Jun 21 02:51:28 i2c_imx_read:1226: i2c i2c-2: <i2c_imx_read> write slave address: addr=0x31 Jun 21 02:51:28 i2c_imx_trx_complete:629: i2c i2c-2: <i2c_imx_trx_complete> TRX complete Jun 21 02:51:28 i2c_imx_acked:641: i2c i2c-2: <i2c_imx_acked> ACK received Jun 21 02:51:28 i2c_imx_read:1239: i2c i2c-2: <i2c_imx_read> setup bus Jun 21 02:51:28 i2c_imx_read:1256: i2c i2c-2: <i2c_imx_read> read data Jun 21 02:51:28 i2c_imx_trx_complete:629: i2c i2c-2: <i2c_imx_trx_complete> TRX complete Jun 21 02:51:28 i2c_imx_read:1288: i2c i2c-2: <i2c_imx_read> clear MSTA Jun 21 02:51:28 i2c_imx_read:1320: i2c i2c-2: <i2c_imx_read> read byte: B0=0x0 Jun 21 02:51:28 i2c_imx_xfer_common:1404: i2c i2c-2: <i2c_imx_xfer_common> exit with: success msg: 2 Jun 21 02:51:28 i2c_imx_xfer_common:1366: i2c i2c-2: <i2c_imx_xfer_common> transfer message: 0 Jun 21 02:51:28 i2c_imx_write:1188: i2c i2c-2: <i2c_imx_write> write slave address: addr=0x30 Jun 21 02:51:28 i2c_imx_trx_complete:629: i2c i2c-2: <i2c_imx_trx_complete> TRX complete Jun 21 02:51:28 i2c_imx_acked:641: i2c i2c-2: <i2c_imx_acked> ACK received Jun 21 02:51:28 i2c_imx_write:1199: i2c i2c-2: <i2c_imx_write> write data Jun 21 02:51:28 i2c_imx_write:1203: i2c i2c-2: <i2c_imx_write> write byte: B0=0x1B Jun 21 02:51:28 i2c_imx_trx_complete:629: i2c i2c-2: <i2c_imx_trx_complete> TRX complete Jun 21 02:51:28 i2c_imx_acked:641: i2c i2c-2: <i2c_imx_acked> ACK received Jun 21 02:51:28 i2c_imx_write:1203: i2c i2c-2: <i2c_imx_write> write byte: B1=0xC Jun 21 02:51:28 i2c_imx_trx_complete:629: i2c i2c-2: <i2c_imx_trx_complete> TRX complete Jun 21 02:51:28 i2c_imx_acked:641: i2c i2c-2: <i2c_imx_acked> ACK received Jun 21 02:51:28 i2c_imx_xfer_common:1404: i2c i2c-2: <i2c_imx_xfer_common> exit with: success msg: 1 Jun 21 02:51:28 tlv320aic31xx-codec 2-0018: Failed to restore cache: -22 Jun 21 02:51:29 tlv320aic31xx-codec 2-0018: ASoC: error at snd_soc_component_update_bits on tlv320aic31xx-codec.2-0018 for register: [0x000000a1] -16 Jun 21 02:51:31 tlv320aic31xx-codec 2-0018: ASoC: error at snd_soc_component_update_bits on tlv320aic31xx-codec.2-0018 for register: [0x000000a1] -16
After bootup, accessing I2C is blocked. Running alsamixer will load the program but throw the error:
tlv320aic31xx-codec 2-0018: ASoC: error at soc_component_read_no_lock on tlv320aic31xx-codec.2-0018 for register: [0x000000a1] -16
However the registers from the codec can be read if you force it. Confirmed the transactions do occur on the physical hardware. They look like default values?
i2cdump -y -f 2 0x18 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 01 56 00 11 04 00 00 00 00 01 01 00 80 80 ..?V.??....??.?? 10: 08 00 01 01 80 80 04 00 00 00 01 0c 00 00 01 00 ?.?????...??..?. 20: 00 00 00 00 80 00 00 00 00 00 00 00 00 00 00 00 ....?........... 30: 00 00 00 02 32 12 03 02 02 11 10 00 01 04 00 14 ...?2??????.??.? 40: 0c 00 00 00 6f 38 00 00 00 00 00 ee 10 d8 7e e3 ?...o8.....???~? 50: 00 00 80 00 00 00 00 00 7f 00 00 00 00 00 00 00 ..?.....?....... 60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 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 ................
Can run the i2cdump over and over again and get consistent results with no errors. Maybe there's a way to trace the lock?
Hi Mark,
I apologize for the delay, I've reached out to the designated team to help support you here.
Regards,
Hi Mark.
The error is started from regcache_sync(aic31xx->regmap), I'm not sure what is its function, but I think maybe you can comment it out first.
Kevin
Hi Kevin,
I took your suggestion a bit further and disabled the cache by doing this:
.cache_type = REGCACHE_NONE,
Now there are significantly more errors which isn't surprising. They are all the same:
tlv320aic31xx-codec 2-0018: ASoC: error at soc_component_read_no_lock on tlv320aic31xx-codec.2-0018 for register: [0x0000003f] -16
Hi Mark,
pls write back the cache_type.