cpu芯片是imx8mm,codec芯片是wm8960,android版本是nxp_imx-p9.0.0_2.2.0,cpu为从,codec芯片为主设备,能够播放音乐,不能录音。
1. 设备树配置如下:
sound {
compatible = "fsl,imx6ul-evk-wm8960",
"fsl,imx-audio-wm8960";
model = "wm8960-audio";
cpu-dai = <&sai3>;
audio-codec = <&codec>;
codec-master;
gpr = <&gpr 4 0x100000 0x100000>;
hp-det = <2 0>;
hp-det-gpios = <&gpio4 0 0>;
mic-det-gpios = <&gpio4 0 0>;
audio-routing =
"Headphone Jack", "HP_L",
"Headphone Jack", "HP_R",
"Ext Spk", "SPK_LP",
"Ext Spk", "SPK_LN",
"Ext Spk", "SPK_RP",
"Ext Spk", "SPK_RN",
"LINPUT2", "Mic Jack",
"LINPUT3", "Mic Jack",
"RINPUT1", "Main MIC",
"RINPUT2", "Main MIC",
"Mic Jack", "MICB",
"Main MIC", "MICB",
"CPU-Playback", "ASRC-Playback",
"Playback", "CPU-Playback",
"ASRC-Capture", "CPU-Capture",
"CPU-Capture", "Capture";
};
};
codec: wm8960@1a {
compatible = "wlf,wm8960";
reg = <0x1a>;
clocks = <&clk IMX8MM_CLK_SAI3_ROOT>;
clock-names = "mclk";
wlf,shared-lrclk;
};
&sai3 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai3>;
assigned-clocks = <&clk IMX8MM_CLK_SAI3>;
assigned-clock-parents = <&clk IMX8MM_AUDIO_PLL1_OUT>;
assigned-clock-rates = <24576000>;
status = "okay";
};
pinctrl_sai3: sai3grp {
fsl,pins = <
MX8MM_IOMUXC_SAI3_RXFS_SAI3_RX_SYNC 0xd6
MX8MM_IOMUXC_SAI3_TXFS_SAI3_TX_SYNC 0xd6
MX8MM_IOMUXC_SAI3_TXC_SAI3_TX_BCLK 0xd6
MX8MM_IOMUXC_SAI3_MCLK_SAI3_MCLK 0xd6
MX8MM_IOMUXC_SAI3_TXD_SAI3_TX_DATA0 0xd6
MX8MM_IOMUXC_SAI3_RXD_SAI5_RX_DATA0 0xd6
>;
};
pinctrl_sai3_hp_det_b: sai3_hp_det_grp {
fsl,pins = <
MX8MM_IOMUXC_SAI1_RXFS_GPIO4_IO0 0x16
>;
};
2. 没有修改imx-wm8960.c、wm8960.c、fsl_sai.c的代码。
3. LINPUT1作为main mic的输入端。
4. 录音时寄存器值如下:
[ 127.991755] reg=0x000 val=0x1bc
[ 127.995640] reg=0x001 val=0x1bc
[ 127.998813] reg=0x002 val=0x178
[ 128.002111] reg=0x003 val=0x178
[ 128.005476] reg=0x004 val=0x121
[ 128.009389] reg=0x005 val=0x008
[ 128.012584] reg=0x006 val=0x000
[ 128.015766] reg=0x007 val=0x042
[ 128.018912] reg=0x008 val=0x1cd
[ 128.022127] reg=0x009 val=0x040
[ 128.025343] reg=0x00a val=0x1e6
[ 128.028520] reg=0x00b val=0x1e6
[ 128.031674] reg=0x00c val=0x1e6
[ 128.034816] reg=0x00d val=0x1e6
[ 128.037999] reg=0x00e val=0x1e6
[ 128.041164] reg=0x00f val=0x1e6
[ 128.044339] reg=0x010 val=0x000
[ 128.047533] reg=0x011 val=0x1fb
[ 128.050686] reg=0x012 val=0x100
[ 128.053868] reg=0x013 val=0x032
[ 128.057045] reg=0x014 val=0x000
[ 128.060202] reg=0x015 val=0x1e6
[ 128.063355] reg=0x016 val=0x1e6
[ 128.066497] reg=0x017 val=0x1c3
[ 128.069737] reg=0x018 val=0x044
[ 128.072934] reg=0x019 val=0x0ee
[ 128.076127] reg=0x01a val=0x001
[ 128.079293] reg=0x01b val=0x000
[ 128.082501] reg=0x01c val=0x008
[ 128.085673] reg=0x01d val=0x000
[ 128.088827] reg=0x01e val=0x000
[ 128.092079] reg=0x01f val=0x000
[ 128.095251] reg=0x020 val=0x108
[ 128.098393] reg=0x021 val=0x100
[ 128.101576] reg=0x022 val=0x150
[ 128.104745] reg=0x023 val=0x150
[ 128.107976] reg=0x024 val=0x150
[ 128.111148] reg=0x025 val=0x150
[ 128.114291] reg=0x026 val=0x000
[ 128.117468] reg=0x027 val=0x000
[ 128.120622] reg=0x028 val=0x178
[ 128.123780] reg=0x029 val=0x178
[ 128.126922] reg=0x02a val=0x040
[ 128.130141] reg=0x02b val=0x000
[ 128.133305] reg=0x02c val=0x000
[ 128.136475] reg=0x02d val=0x050
[ 128.139654] reg=0x02e val=0x050
[ 128.142804] reg=0x02f val=0x030
[ 128.145989] reg=0x030 val=0x03a
[ 128.149167] reg=0x031 val=0x037
[ 128.152342] reg=0x032 val=0x037
[ 128.155505] reg=0x033 val=0x080
[ 128.158646] reg=0x034 val=0x027
[ 128.161861] reg=0x035 val=0x059
[ 128.165138] reg=0x036 val=0x099
[ 128.168328] reg=0x037 val=0x09a
5. 通过示波器测量,当录音时,LINPUT1有模拟信号的输入,并且MCLK为24.576MHZ,BCLK为1.412MHZ,ADCLRC为44.1KHZ。
6.通过tinycap test.wav -T 50录音,没有报错,但是播放test.wav时却没有声音,
Capturing sample: 2 ch, 44100 hz, 16 bit
7. 看kernel log,没有报错。