您尚未登录。

楼主 # 2021-07-07 16:20:02

WM_CH
会员
注册时间: 2018-08-18
已发帖子: 38
积分: 83

rk1126驱动tlv320aic3104没有mclk时钟

如题,经过测量,bclk和lrck是有信号的
但是sdi和mclk上边没有信号。
驱动使用的是1126的SDK里面自带的驱动:kernel-4.19\sound\soc\codecs\tlv320aic3x.c
tlv320aic3x.rar

下边是我的设备树配置:

/{
        sound0: sound@0 {
                compatible = "simple-audio-card";
                simple-audio-card,name = "v2v,codec-aic3104";
                simple-audio-card,widgets =
                        "Line", "Line Out",
                        "Line", "Line In";
                simple-audio-card,routing =
                        "Line Out",     "LLOUT",
                        "Line Out",     "RLOUT",
                        "MIC2L",        "Line In",
                        "MIC2R",        "Line In";
                simple-audio-card,format = "i2s";
                simple-audio-card,mclk-fs = <256>;
                //simple-audio-card,bitclock-master = <&sound0_master>;
                //simple-audio-card,frame-master = <&sound0_master>;
                //simple-audio-card,bitclock-inversion;

                simple-audio-card,cpu {
                        sound-dai = <&i2s0_8ch>;
                };

                simple-audio-card,codec {
                        sound-dai = <&tlv320aic3104>;
                };
        };
};

&i2c2 {
        clock-frequency = <400000>;
        status = "okay";

        tlv320aic3104: tlv320aic3104@18{
                #sound-dai-cells = <0>;
                compatible = "ti,tlv320aic3104";
                reg = <0x18>;

                status = "okay";
                reset-gpios = <&gpio2 RK_PB1 GPIO_ACTIVE_LOW>;

                AVDD-supply = <&vcc_3v3>;
                IOVDD-supply = <&vcc_3v3>;
                DRVDD-supply = <&vcc_3v3>;
                DVDD-supply = <&vcc_1v8>;

                //感觉这个时钟有问题。
                clocks = <&cru HCLK_I2S0>;
                clock-names = "mclk";
        };
};

另外其中引用到的一个节点i2s0_8ch的定义是:

/ {
	i2s0_8ch: i2s@ff800000 {
		compatible = "rockchip,rv1126-i2s-tdm";
		reg = <0xff800000 0x1000>;
		interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
		clocks = <&cru MCLK_I2S0_TX>, <&cru MCLK_I2S0_RX>, <&cru HCLK_I2S0>;
		clock-names = "mclk_tx", "mclk_rx", "hclk";
		dmas = <&dmac 20>, <&dmac 19>;
		dma-names = "tx", "rx";
		resets = <&cru SRST_I2S0_TX_M>, <&cru SRST_I2S0_RX_M>;
		reset-names = "tx-m", "rx-m";
		rockchip,cru = <&cru>;
		rockchip,grf = <&grf>;
		pinctrl-names = "default";
		pinctrl-0 = <&i2s0m0_sclk_tx
			     &i2s0m0_sclk_rx
			     &i2s0m0_lrck_tx
			     &i2s0m0_lrck_rx
			     &i2s0m0_sdi0
			     &i2s0m0_sdo0
			     &i2s0m0_sdo1_sdi3
			     &i2s0m0_sdo2_sdi2
			     &i2s0m0_sdo3_sdi1>;
		status = "disabled";
	};
};

&i2s0_8ch {
	status = "okay";
	#sound-dai-cells = <0>;
	rockchip,clk-trcm = <1>;
	rockchip,i2s-rx-route = <3 1 2 0>;
	pinctrl-names = "default";
	pinctrl-0 = <&i2s0m0_sclk_tx
		     &i2s0m0_lrck_tx
		     &i2s0m0_sdo0
		     &i2s0m0_sdo1_sdi3>;
};

我们板子上使用的rv1126的引脚是:
i2s0_sclk_tx_m0
i2s0_mclk_m0
i2s0_lrck_tx_m0
i2s0_sdo0_m0
i2s0_sdi0_m0

录音测试 arecord -D hw:0,0 -f cd -d 10 test.wav
发现录不到任何东西,mclk和sdi上边没有电平变化,bclk和lrclk有变化。



通过阅读内核自带的驱动程序,发现里面并没有处理mclk相关的代码,甚至都没有获取时钟的代码。。。
实在不知如何是好,求助大家,谢谢了。




.

最近编辑记录 WM_CH (2021-07-07 16:35:59)

离线

楼主 #2 2021-07-07 16:42:47

WM_CH
会员
注册时间: 2018-08-18
已发帖子: 38
积分: 83

Re: rk1126驱动tlv320aic3104没有mclk时钟

哇酷小二 说:

播放语音mclk有时钟吗?

刚刚试了一下,播放的时候也没有mclk,但是sdo是有波形的。执行命令时,耳机能听到一个爆炸声,但是没有正常的声音出来。
所以我感觉我sdi那个引脚应该也没有设置正确。。。

最近编辑记录 WM_CH (2021-07-07 16:44:34)

离线

楼主 #4 2021-07-07 17:15:08

WM_CH
会员
注册时间: 2018-08-18
已发帖子: 38
积分: 83

Re: rk1126驱动tlv320aic3104没有mclk时钟

哇酷小二 说:

i2s有主从之分,如果rk做从机,他不提供mclk,而是由声卡提供mclk,鉴于你听到了爆炸音,看下是不是声卡做主机了?

不知道怎么配置主从方式:(

这是网上一个tlv320aic3104的设备树例子。。。
https://e2echina.ti.com/support/audio/f/audio-forum/197512/am5728-tlv320aic3104/613969#613969

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn