I try all sorts of ways, wm8960 never get sound output. The debugging process is as follows:
First, turn on the Power enable foot:
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);
}
The serial port prints the following error message:
wm8962 0-001a:failed to get supply ' SPKVDD1 ':-19
wm8962 0-001a:failed to request supplies: 19
wm8962 0-001a:asoc:failed to probe codecwm8962.0-001a:-19
asoc:failed toinstantiate Card Wm8962-audio:-19
Initializehdmi-audio failed. Load Hdmi-video first!
ALSA Device List:
No soundcards found.
Put Imx6q_init_audio (), and move a few lines, the above error is gone. However, the following error occurred:
wm8962 0-001a:device is not a WM8962, ID 0!=6243
wm8962 0-001a:asoc:failed to probe codecwm8962.0-001a:-22
asoc:failed toinstantiate Card wm8962-audio:-22
Change the wm8962.c below sound/soc/codec/to wm8960.c (modify kconfig and makefile).
Wm8960_i2c_probe is not called. The reasons are:
. Driver = {
. Name = "wm8960",
and
I2c_board_info ("wm8962", 0x1a),
. Platform_data =&wm8962_config_data,
},
The Linux driver is based on name and is called if it matches.
After registering the SND_SOC_REGISTER_CODEC, codec's probe is not called.
The reason is that the following Snd_dai_driver name must be consistent to invoke.
static struct Snd_soc_dai_driver Wm8960_dai = {
. Name = "wm8960",
Static Structsnd_soc_dai_link imx_dai[] = {
{
. Name = "HiFi",
. Stream_name = "HiFi",
. Codec_dai_name = "wm8960",
After the call is displayed:
wm8960 0-001a:wm8960 probed success!
wm8960 0-001a:failed to add Routehpoutl->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
[Email protected] ~ $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
[Email protected] ~$
The problem is that the/dev/below does not add devices and cannot use/DEV/PCM.
[Email protected]/usr/bin$ aplay-l
Null
Discard all samples (playback) or Generatezero samples (capture)
[Email protected]/usr/bin$ aplay-l
List ofplayback Hardware Devices * * * * *
Card 0:wm8960audio [Wm8960-audio], device 0:hifi wm8960-0 []
Subdevices:1/1
Subdevice #0: Subdevice #0
[Email protected]/usr/bin$
Now it's time to try Alsa if the driver is really available. The answer is to use it.
To see if the sound card exists:
[Email protected] ~ $cat/proc/asound/cards
0 [Wm8960audio]: Wm8960-audio-wm8960-audio
Wm8960-audio
The ALSA driver has its own driver in the/dev/snd/directory.
[Email protected] ~$ ls/dev/snd/
ControlC0 pcmc0d0c pcmc0d0p Timer
Http://www.alsa-project.org/main/index.php/Download above download ALSA tester including alsa-lib,alsa-utils.
Compilation:./gitcompile CC=ARM-LINUX-GCC--host=arm-linux
Now that the evolution to configure has been temporarily downloaded from the Web, I'm a little out.
Compiling alsa-utils is always difficult. Download Alsaplayer again.
./configure--host=arm-linux CC=ARM-LINUX-GCC--disable-oggvorbis
Then make.
Compared with the wm8960.c/wm8962.c,imx-wm8960.c/imx-wm8962.c, the difference is actually very big.
http://bbs.21ic.com/forum.php?mod=viewthread&tid=869393, you can download imx-wm8960.c from this link address.
Reconfigure the Linux kernel, device/DEV/DSP and/dev/mixer out, which are the requirements of the OSS interface.
[Email protected]/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]
Fmtsample_rate: [22050] (HZ), 22khz
Fmtbytes_p_second: [88200]
Fmtblocks_align: [4]
Fmtsample_length: [16]
Chunk Type: [Data]
Chunk Length: [424600]
<--------------------------------------------------------------------
Plug pcm:rateconversion PCM (44100, Sformat=s16_le)
Converter:linear-interpolation
Protocol version:10002
It 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:directstream Mixing PCM
It 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 card0 ' Wm8960-audio ' device 0 subdevice 0
It 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
[Email protected]/test/audio$ aplay test.wav
Playing WAVE ' test.wav ': Signed-bit Little Endian, rate 22050 Hz, Stereo
Aborted by signalinterrupt ...
[Email protected]/test/audio$
There is still no sound output!!
Changed a 44khz acquisition rate of WAV file, still no sound output!
[Email protected]/test/audio$ aplay xihuanni.wav
Playing WAVE ' xihuanni.wav ': Signed-bit Little Endian, rate 44100 Hz, Stereo
Aborted by signalinterrupt ...
Check again for the Pin MUX config, which is correct. But there is no audio output!
If you are using imx-wm8962.c directly, there are many error messages, as follows:
[Email protected]/test/audio$ aplay xihuanni.wav
WM8960 pll:unsupported n=3
Failed to STARTFLL:-22
Failed to SETSYSCLK:-22
Asoc:machinehw_params failed
Failed to SETSYSCLK:-22
ALSA libpcm_direct.c:980: (snd1_pfailed to set SYSCLK: 22
Cm_direct_initialize_slave) Unable to install HW params
ALSA libpcm_dmix.c:1030: (snd_pcm_dmix_open) Unable to initialize slave
Aplay:main:660:audio Open Error:invalid argument
So, to use imx-wm8962.c to modify the words, there is a bit of trouble, not very easy.
Online to find a person to communicate, he used is Imx-wm8960.module, is compiled out. O
Ifneq ($ (wildcardsound/soc/imx/imx-wm8960.c),)
snd-soc-imx-wm8960-objs:= imx-wm8960.c
Else
snd-soc-imx-wm8960-objs:= Imx-wm8960.module
endif
After I modify this, the run causes crash.
Register wm8960 i²c Driver success!
Unable to Handlekernel 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)
First verify the I²c, the oscilloscope display output, and measured the device addr is also 0x1a.
Alsamixer configuration is also all pull high, exit after re-entry, is also right, can be saved and read out.
I2S data is still not there, and the line is measured against ground resistance, and there is no short circuit.
Carefully check the Linux code, no i2s part, should be changed to SSI.
SSI has two, one is in Driver/mxc/ssi.c, this is the previous.
Now it's sound/soc/imx/imx-ssi.c.
Imx6q_add_imx_ssi (1,&mx6_sabresd_ssi_pdata); Register as platform device.
Add a sentence to print:
Imx_ssi_probesuccessfully. Prove that the probe was called.
[Email protected]/test/audio$ aplay xihuanni.wav
Snd_pcm_dmix_open ()
SND1_PCM_HW_OPEN_FD ()
Snd_pcm_plug_open ()
Playing WAVE ' xihuanni.wav ': Signed-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
Then hangs, the SSI interface has no output and should be mixer configured incorrectly.
The
Finally finds out why the wm8960 was not properly initialized.
in imx-wm8960.c
static int imx_hifi_hw_params (struct snd_pcm_substream *substream,
struct SND_PCM_HW_ Params *params) function added:
...
Wm8960_vendor_set (Codec_dai);
...
/* Based on the result of dump */
void Wm8960_vendor_set (struct Snd_soc_dai *codec_dai)
{
struct SND_SOC _codec *codec = codec_dai->codec;
Snd_soc_write (codec, 0x19, 0xc0);/* Power1, ok*/
Snd_soc_write (codec, 0x1a, 0x199);/* Power2, ok*/
Snd_soc_write (codec, 0x31, 0xf7); /* classd1:enable L&r, OK */
Snd_soc_write (codec, 0x33, 0x11b);/* Classd3:volume max, OK */
Snd_soc_wri Te (codec, 0x28, 0x179); /* OK */
Snd_soc_write (codec, 0x29, 0x179);/* OK */
Snd_soc_write (codec, 0x22, 0x100);/* DAC to mixer, OK */snd_soc_write (codec, 0x25, 0x100); /* DAC to mixer, OK */
Snd_soc_write (codec, 0x2f, 0x0c);/* Left & Right output mixer Enable, OK */
SND_SOC_ Write (codec, 0x05, 0x00); /* OK */
}
Imx6solo wm8960 always has no sound output