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.

TLV320AIC3111: I2C lock within linux driver

Part Number: TLV320AIC3111

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.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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";
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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).

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

After bootup, accessing I2C is blocked.  Running alsamixer will load the program but throw the error:

Fullscreen
1
tlv320aic31xx-codec 2-0018: ASoC: error at soc_component_read_no_lock on tlv320aic31xx-codec.2-0018 for register: [0x000000a1] -16
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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?

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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 ................
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Can run the i2cdump over and over again and get consistent results with no errors.  Maybe there's a way to trace the lock?