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:M_READ:2221:读取错误:输入/输出错误

Guru**** 2466550 points
Other Parts Discussed in Thread: TLV320AIC3106

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/audio-group/audio/f/audio-forum/1256520/tlv320aic3106-m_read-2221-read-error-input-output-error

器件型号:TLV320AIC3106

大家好,音频论坛,我想分享 我的问题,当我把设备树和内核从 Linux 4.14移动到5.15。

我将 am335xx 作为基础并使用  TLV320AIC3106编解码器。 之前我使用的 Yocto dunfall 与内核4.14没有 任何问题与这些设备树配置。

/{
...
    regulators {
    	compatible = "simple-bus";
    
    	vcc3v3: fixedregulator@1 {
    		compatible = "regulator-fixed";
    		regulator-name = "vcc3v3";
    		regulator-min-microvolt = <3300000>;
    		regulator-max-microvolt = <3300000>;
    	};
    };
    sound {
    	compatible = "ti,da830-evm-audio";
    	ti,model = "AM335x-EVM";
    	ti,audio-codec = <&audio_codec>;
    	ti,mcasp-controller = <&mcasp0>;
    	ti,codec-clock-rate = <12000000>;
    	ti,audio-routing =
    		"LINE1L",               "Line In",
    		"LINE2L",               "Line In",
    		"LINE1R",               "Line In",
    		"LINE2R",               "Line In";
    	clocks = <&mcasp0_fck>;
    	clock-names = "mclk";
    };
};

&i2c0 {
	audio_codec: tlv320aic3106@18 {
		compatible = "ti,tlv320aic3106";
		reg = <0x18>;
		ai3x-micbias-vg = <0x0>;
		status = "okay";
	};
};

&am33xx_pinmux {
	audio_pins: pinmux_audio {
		pinctrl-single,pins = <
			AM33XX_IOPAD(0x9AC, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* mcasp0_ahclkx.mcasp0_ahclkx */
			AM33XX_IOPAD(0x990, PIN_INPUT_PULLDOWN | MUX_MODE0)  /* mcasp0_aclkx.mcasp0_aclkx */
			AM33XX_IOPAD(0x994, PIN_INPUT_PULLDOWN | MUX_MODE0)  /* mcasp0_fsx.mcasp0_fsx */
			AM33XX_IOPAD(0x998, PIN_INPUT_PULLDOWN | MUX_MODE0)  /* mcasp0_axr0.mcasp0_axr0 */
			AM33XX_IOPAD(0x9A8, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* mcasp0_axr1.mcasp0_axr1 */
		>;
	};
};

&mcasp0 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&audio_pins>;

	op-mode = <0>;	/* MCASP_ISS_MODE */
	tdm-slots = <2>;
	serial-dir = <
		2 1 0 0
	>;
	tx-num-evt = <2>;
	rx-num-evt = <2>;
};
...
我可以使用播放来捕获声音、  
# aplay -vvv -C -D hw:0,0 -r 16000 -f S16_LE -c 2 /tmp/a.wav

Recording WAVE '/tmp/a.wav' : Signed 16 bit Little Endian, Rate 16000 Hz, Stereo
Hardware PCM card 0 'AM335x-EVM' device 0 subdevice 0
Its setup is:
  stream       : CAPTURE
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 2
  rate         : 16000
  exact rate   : 16000 (16000/1)
  msbits       : 16
  buffer_size  : 8000
  period_size  : 2000
  period_time  : 125000
  tstamp_mode  : NONE
  tstamp_type  : MONOTONIC
  period_step  : 1
  avail_min    : 2000
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 8000
  silence_threshold: 0
  silence_size : 0
  boundary     : 2097152000
  appl_ptr     : 0
  hw_ptr       : 0
Max peak (4000 samples): 0x000000d0 #                    0%
Max peak (4000 samples): 0x000000f1 #                    0%
Max peak (4000 samples): 0x000000d4 #                    0%
Max peak (4000 samples): 0x000000d6 #                    0%
Max peak (4000 samples): 0x000000db #                    0%
Max peak (4000 samples): 0x000000d2 #                    0%
Max peak (4000 samples): 0x0000017d #                    1%
Max peak (4000 samples): 0x0000013e #                    0%
Max peak (4000 samples): 0x00000154 #                    1%
Max peak (4000 samples): 0x00000149 #                    1%
Max peak (4000 samples): 0x00000160 #                    1%





lsmod:


~# lsmod
Module                  Size  Used by
cn                     16384  1
snd_soc_evm            16384  1
snd_soc_davinci_mcasp    24576  2
snd_soc_tlv320aic3x    49152  1
snd_soc_edma           16384  1 snd_soc_davinci_mcasp
snd_soc_omap           16384  1 snd_soc_davinci_mcasp
snd_soc_core          118784  5 snd_soc_davinci_mcasp,snd_soc_edma,snd_soc_evm,snd_soc_omap,snd_soc_tlv320aic3x
snd_pcm_dmaengine      16384  2 snd_soc_omap,snd_soc_core
snd_pcm                81920  6 snd_soc_davinci_mcasp,snd_pcm_dmaengine,snd_soc_omap,snd_soc_core,snd_soc_tlv320aic3x
snd_timer              28672  1 snd_pcm
snd                    49152  4 snd_timer,snd_soc_core,snd_pcm
soundcore              16384  1 snd
cpufreq_dt             16384  0
cryptodev              45056  0

当我们尝试使用最新的简单音频卡驱动程序时、情况就发生了变化。

\ {
	regulators {
		compatible = "simple-bus";

		vcc3v3: fixedregulator@1 {
			compatible = "regulator-fixed";
			regulator-name = "vcc3v3";
			regulator-min-microvolt = <3300000>;
			regulator-max-microvolt = <3300000>;
		};
	};

	sound {
		compatible = "simple-audio-card";
		simple-audio-card,name = "snd-ddi";
		simple-audio-card,widgets =
			"Line", "Line In";
		simple-audio-card,routing =
					"LINE1L", "Line In",
					"LINE2L", "Line In",
					"LINE1R", "Line In",
					"LINE2R", "Line In";
		simple-audio-card,format = "i2s";
		simple-audio-card,bitclock-master = <&sound_codec>;
		simple-audio-card,frame-master = <&sound_codec>;
		simple-audio-card,mclk-fs = <32>;

		sound_cpu: simple-audio-card,cpu {
			sound-dai = <&mcasp0>;
		};

		sound_codec: simple-audio-card,codec {
			sound-dai = <&tlv320aic3106>;
			clocks = <&mcasp0_fck>;
		};
	};
};

&i2c0 {
	tlv320aic3106: tlv320aic3106@18 {
		#sound-dai-cells = <0>;
		compatible = "ti,tlv320aic3106";
		reg = <0x18>;
		status = "okay";

		/* Regulators */
		AVDD-supply = <&vcc3v3>;
		IOVDD-supply = <&vcc3v3>;
		DRVDD-supply = <&vcc3v3>;
		DVDD-supply = <&vdig1_reg>;
	};
};

&vdig1_reg {
	regulator-boot-on;
	regulator-always-on;
};

&mcasp0 {
	#sound-dai-cells = <0>;
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&mcasp0_pins>;

	op-mode = <0>;	/* MCASP_ISS_MODE */
	tdm-slots = <2>;
	serial-dir = <
		2 1 0 0
	>;
	tx-num-evt = <2>;
	rx-num-evt = <2>;
};
 对于该 DTS、我始终会收到 PCM_Read 错误、  
~# lsmod

Module                  Size  Used by
snd_soc_simple_card    16384  1
snd_soc_simple_card_utils    20480  1 snd_soc_simple_card
snd_soc_davinci_mcasp    28672  2
snd_soc_ti_udma        16384  1 snd_soc_davinci_mcasp
snd_soc_ti_edma        16384  1 snd_soc_davinci_mcasp
snd_soc_ti_sdma        16384  1 snd_soc_davinci_mcasp
snd_soc_tlv320aic3x_i2c    16384  1
snd_soc_tlv320aic3x    53248  1 snd_soc_tlv320aic3x_i2c
snd_soc_core          147456  7 snd_soc_davinci_mcasp,snd_soc_simple_card_utils,snd_soc_ti_sdma,snd_soc_ti_edma,snd_soc_tlv320aic3x,snd_soc_ti_udma,snd_soc_simple_card
snd_pcm_dmaengine      16384  1 snd_soc_core
snd_pcm                94208  5 snd_soc_davinci_mcasp,snd_pcm_dmaengine,snd_soc_core,snd_soc_tlv320aic3x
snd_timer              28672  1 snd_pcm
snd                    57344  4 snd_timer,snd_soc_core,snd_pcm
soundcore              16384  1 snd
cfg80211              307200  0
cpufreq_dt             16384  0



~# aplay -vvv -C -D hw:0,0 -r 16000 -f S16_LE -c 2 /tmp/a.wav
Recording WAVE '/tmp/a.wav' : Signed 16 bit Little Endian, Rate 16000 Hz, Stereo
Hardware PCM card 0 'snd-ddi' device 0 subdevice 0
Its setup is:
  stream       : CAPTURE
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 2
  rate         : 16000
  exact rate   : 16000 (16000/1)
  msbits       : 16
  buffer_size  : 8000
  period_size  : 2000
  period_time  : 125000
  tstamp_mode  : NONE
  tstamp_type  : MONOTONIC
  period_step  : 1
  avail_min    : 2000
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 8000
  silence_threshold: 0
  silence_size : 0
  boundary     : 2097152000
  appl_ptr     : 0
  hw_ptr       : 0
arecord: pcm_read:2221: read error: Input/output error

您有什么建议来调查和解决问题? 我在这里用作参考: https://git.phytec.de/linux-mainline/tree/arch/arm/boot/dts/am335x-wega.dtsi?h=v5.15.82-phy

我们欢迎每一个答案、非常感谢

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    请在记录期间使用示波器测量 I2S clk (bk/ws clk)。 然后发布 clk 波形。 谢谢。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    大家好、 、我进行了测量。

    我已经意识到、只有旧器件树中有时钟节拍。 新实现始终为0。

    old_wclk:

    old_mlck:  

    OLD_BCLK:  

    新_MCLK:

    新_MCLK:

    我使用相同的时钟、但不明白为什么它没有被驱动。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    在对时钟定义进行 phytec 反馈后、我做了一些修改、现在我可以录制一些声音、但我对其正确性不自信。 应如何选择 MCLK-FS 值?

    sound {
    		compatible = "simple-audio-card";
    		simple-audio-card,name = "snd-ddi";
    		simple-audio-card,widgets =
    			"Line", "Line In";
    		simple-audio-card,routing =
    					"LINE1L", "Line In",
    					"LINE2L", "Line In",
    					"LINE1R", "Line In",
    					"LINE2R", "Line In";
    		simple-audio-card,format = "i2s";
    		simple-audio-card,bitclock-master = <&sound_cpu>;
    		simple-audio-card,frame-master = <&sound_cpu>;
    		simple-audio-card,mclk-fs = <512>;
    
    		sound_cpu: simple-audio-card,cpu {
    			sound-dai = <&mcasp0>;
    		};
    
    		sound_codec: simple-audio-card,codec {
    			sound-dai = <&tlv320aic3106>;
    		};
    	};

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!  

    对于此线程中布置的 DTS 设置、 似乎 McASP0已设为主控、请 咨询 am335xx 团队。 谢谢。