S3/V3s insmod sun4i-i2s.ko,i2s probe正常,
但是dai probe没有被执行
请问下,dai probe是什么时候触发的?
离线
pcm5102: pcm510x {
compatible = "ti,pcm5102a";
pcm510x,format = "i2s";
#sound-dai-cells = <0>;
};
sound_i2s {
compatible = "simple-audio-card";
simple-audio,name="s3-i2s";
simple-audio-card,format = "i2s";
simple-audio-card,mclk-fs = <256>;
simple-audio-card,routing = "Playback", "DAI0 Playback",
"DAI0 Capture", "Capture";
status = "okay";
simple-audio-card,cpu {
sound-dai = <&i2s0>;
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <32>;
};
simple-audio-card,codec {
sound-dai = <&pcm5102>;
};
};
最近编辑记录 powerpan (2020-11-22 22:03:47)
离线
i2s0: i2s@1c22000 {
#sound-dai-cells = <0>;
compatible = "allwinner,sun8i-h3-i2s";
reg = <0x01c22000 0x400>;
interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&ccu CLK_BUS_I2S0>, <&ccu CLK_I2S0>;
clock-names = "apb", "mod";
dmas = <&dma 3>, <&dma 3>;
resets = <&ccu RST_BUS_I2S0>;
pinctrl-names = "default";
pinctrl-0 = <&i2s0_pins>;
dma-names = "rx", "tx";
status = "disabled";
//status = "okay";
};
都加了,dai_probe死活没有调用
或者说我怎么查这个?
离线
sound/soc/sunxi/sun4i-i2s.c
static int sun4i_i2s_dai_probe(struct snd_soc_dai *dai)
{
}这个没有调用?
没有,百思不得其解,连时钟和i2s寄存器都没有初始化(可能是dai probe才初始化的)
https://www.kernel.org/doc/Documentation/devicetree/bindings/sound/simple-card.txt
从这里看dts应该是没错
另外sun4i-i2s.c代码测试过从 4.13开始到5.10都不行
最近编辑记录 powerpan (2020-11-23 15:25:39)
离线
最新进展了
[ 50.462795] asoc-simple-card sound_i2s: pcm5102a-hifi <-> 1c22000.i2s0 mapping ok
[ 85.650446] sun4i-i2s 1c22000.i2s0: Unsupported BCLK divider: -22
[ 85.659638] sun4i-i2s 1c22000.i2s0: ASoC: can't set 1c22000.i2s0 hw params: -22
aplay: set_params:1363: Unable to install hw params:
ACCESS: RW_INTERLEAVED
FORMAT: S16_LE
SUBFORMAT: STD
SAMPLE_BITS: 16
FRAME_BITS: 32
CHANNELS: 2
RATE: 44100
PERIOD_TIME: (125011 125012)
PERIOD_SIZE: 5513
PERIOD_BYTES: 22052
PERIODS: 4
BUFFER_TIME: (500045 500046)
BUFFER_SIZE: 22052
BUFFER_BYTES: 88208
TICK_TIME: 0
已经能够挂上了。剩下的问题可以跟踪了。
最近编辑记录 powerpan (2020-11-23 18:49:31)
离线
请教是怎么搞定的?
一个很愚蠢的失误。基本解决了
最近编辑记录 powerpan (2020-11-23 23:10:05)
离线
之前要从最新的kernel拷贝对应的代码:pinctrl-sun8i-v3s.c, sunxi-ng/ccu-sun8i-v3s.c 注意拷贝完成,如果有PGxx找不到,补充下(代码拷贝更改而已,不解释)
解决过程如下:(拷贝的代码记得是 5.10的 sun4i-i2s.c)
1. 开始没有看见dai_probe是因为没有加载simple-audio-card的ko,蠢死算了,后来跟踪代码发现的。跟踪代码还是si比较好,容易跟踪
2. 跟着就是各种坑了,上面dts的 simple-audio-card,routing 去掉,默认的就好了,否则出错。
3. MCLK设置有问题,理论上是应该 22576000的,结果是2256000了,导致 LRCK计算出来是 7.99导致上面设置出错,sun4i_i2s_get_bclk_div函数,改改
int div = (parent_rate+sampling_rate*word_size) / sampling_rate / word_size / channels;
4. 上面好了就可以用了,但是LRCK不对,因为DTS dai-tdm-slot-width = <32>; 这个没鬼用,要改 sun8i_i2s_set_chan_cfg函数
//lrck_period = params_physical_width(params);
lrck_period = 32;
好了,结束了。
数字音响的一些知识,可以关注下微信公众号:全数字化音响
最近编辑记录 powerpan (2020-11-24 11:46:40)
离线