help: imx6solo wm8960始终没有声音输出

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

help: imx6solo wm8960始终没有声音输出

11,761 Views
yingcaitan
Contributor I

我尝试各种办法,wm8960始终不能得到声音输出。调试过程如下:

首先,打开电源使能脚:
 

       ret=gpio_request(SABRESD_CODEC_PWR_EN, "audio_pwr_en");

       if (!ret){

              printk("Turn on audio(wm8962) power!(1:enable)\n");

              gpio_direction_output(SABRESD_CODEC_PWR_EN, 1);         // 0:enable, 1:disable  

              gpio_free(SABRESD_CODEC_PWR_EN);

       }

串口打印如下出错信息:

wm8962 0-001a: Failed to get supply 'SPKVDD1': -19

wm8962 0-001a: Failed to request supplies: -19

wm8962 0-001a: asoc: failed to probe CODEC wm8962.0-001a: -19

asoc: failed to instantiate card wm8962-audio: -19

Initialize HDMI-audio failed. Load HDMI-video first!

ALSA device list:

  No soundcards found.

imx6q_init_audio();后移几行,上面的错误就没有了。但出现下面错误

wm8962 0-001a: Device is not a WM8962, ID 0 != 6243

wm8962 0-001a: asoc: failed to probe CODEC wm8962.0-001a: -22

asoc: failed to instantiate card wm8962-audio: -22

sound/soc/codec/下面的wm8962.c改用wm8960.c(修改KconfigMakefile)。

wm8960_i2c_probe不调用。原因是:

       .driver = {

              .name = "wm8960",

   {

              I2C_BOARD_INFO("wm8962", 0x1a),

              .platform_data = &wm8962_config_data,

       },

linux driver是根据name来匹配的,如果匹配就调用。

登记了snd_soc_register_codec后,codecprobe也不调用。

原因是下面这个snd_dai_drivername要一致才能调用。

static struct snd_soc_dai_driver wm8960_dai = {

       .name = "wm8960",

static struct snd_soc_dai_link imx_dai[] = {

       {

              .name = "HiFi",

              .stream_name = "HiFi",

              .codec_dai_name       = "wm8960",

调用后显示:

wm8960 0-001a: wm8960 probed success!

wm8960 0-001a: Failed to add route HPOUTL->Headphone Jack

asoc: wm8960 <-> imx-ssi.1 mapping ok

input: wm8960-audio DMIC as /devices/platform/soc-audio.5/sound/card0/input1

input: wm8960-audio Ext Spk as /devices/platform/soc-audio.5/sound/card0/input2

ALSA device list:

  #0: wm8960-audio

root@imx6solo ~$ find / -name *wm8960*

/sys/devices/platform/imx-wm8960.0

/sys/bus/platform/devices/imx-wm8960.0

/sys/bus/platform/drivers/imx-wm8960

/sys/bus/platform/drivers/imx-wm8960/imx-wm8960.0

/sys/bus/i2c/drivers/wm8960

/proc/asound/wm8960audio

root@imx6solo ~$

问题是/dev/下面并没有增加设备,无法使用/dev/pcm

root@imx6solo /usr/bin$ aplay -L                 

null

    Discard all samples (playback) or generate zero samples (capture)

root@imx6solo /usr/bin$ aplay -l

**** List of PLAYBACK Hardware Devices ****

card 0: wm8960audio [wm8960-audio], device 0: HiFi wm8960-0 []

  Subdevices: 1/1

  Subdevice #0: subdevice #0

root@imx6solo /usr/bin$

现在应该是试试ALSA驱动程序是不是真能用的时候了. 接者就是使用它.

查看声卡是否存在:

root@imx6solo ~$ cat /proc/asound/cards

0 [wm8960audio    ]: wm8960-audio - wm8960-audio

                      wm8960-audio

ALSA 驱动程序在 /dev/snd/ 目录下有自己的驱动程序。

root@imx6solo ~$ ls /dev/snd/

controlC0 pcmC0D0c   pcmC0D0p timer

http://www.alsa-project.org/main/index.php/Download上面下载alsa tester包括alsa-lib, alsa-utils

编译:./gitcompile CC=arm-linux-gcc --host=arm-linux

现在进化到configure都从网络上临时下载的地步了,我有点out了。

编译alsa-utils总是过不去。重新下载alsaplayer

./configure --host=arm-linux CC=arm-linux-gcc --disable-oggvorbis

然后make.

对比了wm8960.c/wm8962.c, imx-wm8960.c/imx-wm8962.c,差别其实非常大。

http://bbs.21ic.com/forum.php?mod=viewthread&tid=869393,从这个链接地址可以下载imx-wm8960.c

重新配置linux kernel,设备/dev/dsp/dev/mixer出来,这是OSS接口的要求。

root@imx6solo /test/audio$ ./wavplay test.wav

-------------------------------------------------------------------->

File Magic:         [RIFF]

File Length:        [424636]

File Type:          [WAVE]

Fmt Magic:          [fmt ]

Fmt Size:           [16]

Fmt Format:         [PCM]

Fmt Channels:       [2]

Fmt Sample_rate:    [22050](HZ)22khz

Fmt Bytes_p_second: [88200]

Fmt Blocks_align:   [4]

Fmt Sample_length:  [16]

Chunk Type:         [data]

Chunk Length:       [424600]

<--------------------------------------------------------------------

Plug PCM: Rate conversion PCM (44100, sformat=S16_LE)

Converter: linear-interpolation

Protocol version: 10002

Its setup is:

  stream : PLAYBACK

  access : RW_INTERLEAVED

  format : S16_LE

  subformat : STD

  channels : 2

  rate : 22050

  exact rate : 22050 (22050/1)

  msbits : 16

  buffer_size : 8192

  period_size : 256

  period_time : 11609

  tstamp_mode : NONE

  period_step : 1

  avail_min : 256

  period_event : 0

  start_threshold  : 1

  stop_threshold   : 8192

  silence_threshold: 0

  silence_size : 0

  boundary : 536870912

Slave: Direct Stream Mixing PCM

Its setup is:

  stream : PLAYBACK

  access : MMAP_INTERLEAVED

  format : S16_LE

  subformat : STD

  channels : 2

  rate : 44100         //44khz

  exact rate : 44100 (44100/1)

  msbits : 16

  buffer_size : 16384

  period_size : 512

  period_time : 11609

  tstamp_mode : NONE

  period_step : 1

  avail_min : 512

  period_event : 0

  start_threshold  : 2

  stop_threshold   : 16384

  silence_threshold: 0

  silence_size : 0

  boundary : 1073741824

Hardware PCM card 0 'wm8960-audio' device 0 subdevice 0

Its setup is:

  stream : PLAYBACK

  access : MMAP_INTERLEAVED

  format : S16_LE

  subformat : STD

  channels : 2

  rate : 44100         //44khz

  exact rate : 44100 (44100/1)

  msbits : 16

  buffer_size : 16384

  period_size : 512

  period_time : 11609

  tstamp_mode : ENABLE

  period_step : 1

  avail_min : 512

  period_event : 0

  start_threshold  : 1

  stop_threshold   : 1073741824

  silence_threshold: 0

  silence_size : 1073741824

  boundary : 1073741824

  appl_ptr : 0

  hw_ptr : 0

root@imx6solo /test/audio$ aplay test.wav

Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Stereo

Aborted by signal Interrupt...

root@imx6solo /test/audio$

仍然是没有声音输出!!

换了一个44khz采集率的wav文件,仍然没有声音输出!

root@imx6solo /test/audio$ aplay xihuanni.wav

Playing WAVE 'xihuanni.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo

Aborted by signal Interrupt...

再次检查了pin mux config,是正确的。但就是没有任何audio输出!

如果直接用imx-wm8962.c,则有许多出错信息,如下:

root@imx6solo /test/audio$ aplay xihuanni.wav

WM8960 PLL: Unsupported N=3

Failed to start FLL: -22

Failed to set SYSCLK: -22

asoc: machine hw_params failed

Failed to set SYSCLK: -22

ALSA lib pcm_direct.c:980:(snd1_pFailed to set SYSCLK: -22

cm_direct_initialize_slave) unable to install hw params

ALSA lib pcm_dmix.c:1030:(snd_pcm_dmix_open) unable to initialize slave

aplay: main:660: audio open error: Invalid argument

所以,要用imx-wm8962.c来修改的话,还有点麻烦,不会很容易。

网上找了一个人交流,他用的是imx-wm8960.module,就是编译出来的.o

ifneq ($(wildcard sound/soc/imx/imx-wm8960.c),)

snd-soc-imx-wm8960-objs := imx-wm8960.c

else

snd-soc-imx-wm8960-objs := imx-wm8960.module

endif

我这样修改后,运行导致crash

register wm8960 I2C driver success!

Unable to handle kernel paging request at virtual address f8f2fe18

pgd = 80004000

[f8f2fe18] *pgd=1bce9811, *pte=00000000, *ppte=00000000

Internal error: Oops: 807 [#1] PREEMPT

Modules linked in:

CPU: 0    Not tainted (3.0.101-2790-gc248ed7 #274)

 

Labels (1)
Tags (2)
0 Kudos
Reply
15 Replies

5,651 Views
Rita_Wang
NXP TechSupport
NXP TechSupport

Hi yingcai Tan,

Which version of BSP are you using?
Have a great day
Dan

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

5,651 Views
yingcaitan
Contributor I

L3.0.101_4.1.1_141016_source, cpu is imx6solo

0 Kudos
Reply

5,651 Views
yingcaitan
Contributor I

最新进展: 先验证了i2c,示波器显示有输出,并且测了看device addr也是0x1A

alsamixer配置也是全部拉高,退出后重新进入,也是对的,可以保存和读出。

i2s data仍然没有,数据线对地电阻也测了,并没有短路。

0 Kudos
Reply

5,651 Views
jimmychan
NXP TechSupport
NXP TechSupport

e.g. if you using AUD3 pins (TXC, TXFS, TXD, RXD...) , make sure the IOMUX setting properly in the your_board.c file.

Also, please check the AUD3 PAD setting is properly in the linux/arch/arm/plat-mxc/include/mach/iomux-mx6dl.h.

For example: if the PAD setting is NO_PAD_CTRL for the pins, please change it to MX6DL_ADU_PAD_CTRL.

#define MX6DL_PAD_CSI0_DAT5__AUDMUX_AUD3_TXD                                  \

        IOMUX_PAD(0x038C, 0x0078, 4, 0x0000, 0, NO_PAD_CTRL)

change to :

#define MX6DL_PAD_CSI0_DAT5__AUDMUX_AUD3_TXD                                  \

        IOMUX_PAD(0x038C, 0x0078, 4, 0x0000, 0, MX6DL_ADU_PAD_CTRL)

0 Kudos
Reply

5,651 Views
yingcaitan
Contributor I

I double checked, see below:

#define MX6DL_PAD_CSI0_DAT7__AUDMUX_AUD3_RXD                               \
  

IOMUX_PAD(0x0394, 0x0080, 4, 0x0000, 0, MX6DL_ADU_PAD_CTRL)

#define MX6DL_PAD_CSI0_DAT6__AUDMUX_AUD3_TXFS                              \
   IOMUX_PAD(0x0390, 0x007C, 4, 0x0000, 0, MX6DL_ADU_PAD_CTRL)
#define MX6DL_PAD_CSI0_DAT7__AUDMUX_AUD3_RXD                               \
   IOMUX_PAD(0x0394, 0x0080, 4, 0x0000, 0, MX6DL_ADU_PAD_CTRL)
#define MX6DL_PAD_CSI0_DAT6__AUDMUX_AUD3_TXFS                              \
   IOMUX_PAD(0x0390, 0x007C, 4, 0x0000, 0, MX6DL_ADU_PAD_CTRL)

Still no audio out.

More info:

root@imx6solo /test/audio$ aplay xihuanni.wav

snd_pcm_dmix_open()

imx_ssi_startup

snd1_pcm_hw_open_fd()

imx_ssi_set_dai_fmt,ret=0

*** sample_rate = 44100, bclk = 24000000, sysclk = 11289600

imx_ssi_hw_params

snd_imx_pcm_mmap,ret=0

imx_ssi_trigger,ret=0

snd_pcm_plug_open()

Playing WAVE 'xihuanni.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

snd_pcm_mmap_writei

Aborted by signal Interrupt...imx_ssi_trigger,ret=0

imx_ssi_shutdown

root@imx6solo /test/audio$

0 Kudos
Reply

5,651 Views
jimmychan
NXP TechSupport
NXP TechSupport

is there any signal output from the AUDMUX pins? could you show me the part of schematic how you connect the wm8960?

0 Kudos
Reply

5,651 Views
yingcaitan
Contributor I

pls check attachment.

在 2015-04-23 16:19:39,jimmychan <admin@community.freescale.com> 写道:

|

|

|

|

Re: help: imx6solo wm8960始终没有声音输出

reply from jimmychan in i.MX Community - View the full discussion

is there any signal output from the AUDMUX pins? could you show me the part of schematic how you connect the wm8960?

Did your question get answered? If so, say thanks by clicking Correct Answer in the community thread!

Reply to this message by replying to this email, or go to the message on Freescale Community

Start a new discussion in i.MX Community by email or at Freescale Community

Following Re: help: imx6solo wm8960始终没有声音输出 in these streams: Inbox

|

|

0 Kudos
Reply

5,651 Views
yingcaitan
Contributor I

我怀疑是软件原因:

static int imx_ssi_probe(struct platform_device *pdev)中,

       ret = snd_soc_register_dai(&pdev->dev, dai);

       if (ret) {

              dev_err(&pdev->dev, "register DAI failed\n");

              goto failed_register;

       }

而在static __devinit int wm8960_i2c_probe(struct i2c_client *i2c,

                                  const struct i2c_device_id *id)中,

       ret = snd_soc_register_codec(&i2c->dev,

                     &soc_codec_dev_wm8960, &wm8960_dai, 0);

Registered DAI 'wm8960-hifi'

Registered DAI 'imx-ssi.1'

设置audio参数时,imx_hifi_hw_params()中调用的是wm8960-hifiDAI驱动。

现在的问题是SSIimx_ssi_set_dai_sysclk()imx_ssi_set_dai_sysclk()都无法调用,我不知道这是否是SSIBCLK无信号的原因。

0 Kudos
Reply

5,651 Views
jimmychan
NXP TechSupport
NXP TechSupport

Please check if you are mapping the Speaker with dapm widget correctly. For example, in the imx_wm8962_init, there are Headphone and AMIC. And there are some codes are checking the hp_gpio which is the Headphone Detect gpio pin. But in your schematic, you don't use the headphone. So, please check your driver code, the speaker may not map correctly.

0 Kudos
Reply

5,651 Views
yingcaitan
Contributor I

I've masked the detect pin already. I put code here.

static int mxc_wm8962_init(void)

{

int rate;

clko = clk_get(NULL, "clko_clk");

if (IS_ERR(clko)) {

pr_err("can't get CLKO clock.\n");

return PTR_ERR(clko);

}

/* both audio codec and comera use CLKO clk*/

rate = clk_round_rate(clko, 24000000);

clk_set_rate(clko, rate);

wm8962_data.sysclk = rate;

return 0;

}

static struct mxc_audio_platform_data wm8962_data = {

.ssi_num = 1,

.src_port = 2,

.ext_port = 3,

// .hp_gpio = SABRESD_HEADPHONE_DET,

.hp_active_low = 1,

// .mic_gpio = SABRESD_MICROPHONE_DET,

.mic_active_low = 1,

.init = mxc_wm8962_init,

.clock_enable = wm8962_clk_enable,

};

在 2015-04-24 13:37:36,jimmychan <admin@community.freescale.com> 写道:

|

|

|

|

help: imx6solo wm8960始终没有声音输出

reply from jimmychan in i.MX Community - View the full discussion

Please check if you are mapping the Speaker with dapm widget correctly. For example, in the imx_wm8962_init, there are Headphone and AMIC. And there are some codes are checking the hp_gpio which is the Headphone Detect gpio pin. But in your schematic, you don't use the headphone. So, please check your driver code, the speaker may not map correctly.

Did your question get answered? If so, say thanks by clicking Correct Answer in the community thread!

Reply to this message by replying to this email, or go to the message on Freescale Community

Start a new discussion in i.MX Community by email or at Freescale Community

Following help: imx6solo wm8960始终没有声音输出 in these streams: Inbox

|

|

0 Kudos
Reply

5,651 Views
jimmychan
NXP TechSupport
NXP TechSupport

I mean in the sound/soc/imx/imx-wm8962.c , not the board-mx6q_sabresd.c.

You can find the "plat->hp_gpio" in the code.

and the "if (plat->hp_gpio != -1)"

So, if you comment out the hp_gpio in board-mx6q_sabresd.c, then hp_gpio become -1, that may be the problem.

0 Kudos
Reply

5,651 Views
yingcaitan
Contributor I

And could you kindly provide me imx-wm8960.c ? thanks.

在 2015-04-24 14:30:35,jimmychan <admin@community.freescale.com> 写道:

|

|

|

|

help: imx6solo wm8960始终没有声音输出

reply from jimmychan in i.MX Community - View the full discussion

I mean in the sound/soc/imx/imx-wm8962.c , not the board-mx6q_sabresd.c.

You can find the "plat->hp_gpio" in the code.

and the "if (plat->hp_gpio != -1)"

So, if you comment out the hp_gpio in board-mx6q_sabresd.c, then hp_gpio become -1, that may be the problem.

Did your question get answered? If so, say thanks by clicking Correct Answer in the community thread!

Reply to this message by replying to this email, or go to the message on Freescale Community

Start a new discussion in i.MX Community by email or at Freescale Community

Following help: imx6solo wm8960始终没有声音输出 in these streams: Inbox

|

|

0 Kudos
Reply

5,651 Views
jimmychan
NXP TechSupport
NXP TechSupport

sorry, I don't have imx-wm8960.c.

please check in your driver code, please try to add the widget and audio_map for the speaker. And enable the speaker in the imx_wm8960_init.

For reference,

how to set audio path routing

0 Kudos
Reply

5,651 Views
yingcaitan
Contributor I

But I use imx-wm8960.c which does not check plat->hp_gpio

在 2015-04-24 14:30:35,jimmychan <admin@community.freescale.com> 写道:

|

|

|

|

help: imx6solo wm8960始终没有声音输出

reply from jimmychan in i.MX Community - View the full discussion

I mean in the sound/soc/imx/imx-wm8962.c , not the board-mx6q_sabresd.c.

You can find the "plat->hp_gpio" in the code.

and the "if (plat->hp_gpio != -1)"

So, if you comment out the hp_gpio in board-mx6q_sabresd.c, then hp_gpio become -1, that may be the problem.

Did your question get answered? If so, say thanks by clicking Correct Answer in the community thread!

Reply to this message by replying to this email, or go to the message on Freescale Community

Start a new discussion in i.MX Community by email or at Freescale Community

Following help: imx6solo wm8960始终没有声音输出 in these streams: Inbox

|

|

0 Kudos
Reply

5,651 Views
jimmychan
NXP TechSupport
NXP TechSupport

Please check this:

https://community.freescale.com/message/332170#332170

please double check the IOMUX setting that is match with your own hardware design.

0 Kudos
Reply