no sound devices on babbage board with linux-image-2.6.31-100-imx51

Bug #420447 reported by Oliver Grawert on 2009-08-28
26
This bug affects 2 people
Affects Status Importance Assigned to Milestone
linux-fsl-imx51 (Ubuntu)
High
Amit Kucheria
Karmic
High
Amit Kucheria

Bug Description

with the current version of the imx51 kernel there are no sound devices in the desktop install at all

ProblemType: Bug
Architecture: armel
Date: Fri Aug 28 10:46:10 2009
DistroRelease: Ubuntu 9.10
LiveMediaBuild: Ubuntu 9.10 "Karmic Koala" - Alpha armel+imx51 (20090828.2)
Package: linux-image-2.6.31-100-imx51 2.6.31-100.7
ProcEnviron:
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.31-100.7-imx51
SourcePackage: linux-fsl-imx51
Uname: Linux 2.6.31-100-imx51 armv7l

Oliver Grawert (ogra) wrote :
Changed in linux-fsl-imx51 (Ubuntu):
importance: Undecided → High
milestone: none → karmic-alpha-6
Oliver Grawert (ogra) wrote :

seems in the freescale binary kernel (2.6.28) the board uses the sgtl5000 driver (dmesg excerpt):

Advanced Linux Sound Architecture Driver Version 1.0.18rc3.
ASoC version 0.13.2
sgtl5000-i2c 1-000a: SGTL5000 revision 17
DMA Sound Buffers Allocated:UseIram=1 buf->addr=1ffef000 buf->area=de8a8000 size=24576
DMA Sound Buffers Allocated:UseIram=1 buf->addr=ac068000 buf->area=fbef4000 size=24576
asoc: SGTL5000 <-> imx-ssi-3 mapping ok
ALSA device list:
  #0: imx-3stack (SGTL5000)

with the following options set in the config:

CONFIG_SOUND=y
CONFIG_SOUND_OSS_CORE=y
CONFIG_SND=y
CONFIG_SND_TIMER=y
CONFIG_SND_PCM=y
# CONFIG_SND_SEQUENCER is not set
CONFIG_SND_OSSEMUL=y
CONFIG_SND_MIXER_OSS=y
CONFIG_SND_PCM_OSS=y
CONFIG_SND_PCM_OSS_PLUGINS=y
# CONFIG_SND_DYNAMIC_MINORS is not set
CONFIG_SND_SUPPORT_OLD_API=y
CONFIG_SND_VERBOSE_PROCFS=y
# CONFIG_SND_VERBOSE_PRINTK is not set
# CONFIG_SND_DEBUG is not set
CONFIG_SND_DRIVERS=y
# CONFIG_SND_DUMMY is not set
# CONFIG_SND_MTPAV is not set
# CONFIG_SND_SERIAL_U16550 is not set
# CONFIG_SND_MPU401 is not set
CONFIG_SND_ARM=y
CONFIG_SND_MXC_SPDIF=m
CONFIG_SND_SPI=y
CONFIG_SND_USB=y
# CONFIG_SND_USB_AUDIO is not set
# CONFIG_SND_USB_CAIAQ is not set
CONFIG_SND_SOC=y
CONFIG_SND_MXC_SOC=y
CONFIG_SND_MXC_SOC_SSI=y
CONFIG_SND_MXC_SOC_IRAM=y
CONFIG_SND_SOC_IMX_3STACK_SGTL5000=y
# CONFIG_SND_SOC_IMX_3STACK_AK4647 is not set
# CONFIG_SND_SOC_IMX_3STACK_WM8580 is not set
# CONFIG_SND_SOC_ALL_CODECS is not set
CONFIG_SND_SOC_SGTL5000=y
# CONFIG_SOUND_PRIME is not set

trying to build it as builtin or module in the current 2.6.30 kernel for imx51 results in the following error message when trying to compile the codecs for SGTL5000:

  CC [M] sound/soc/codecs/sgtl5000.o
/home/ogra/linux-fsl-imx51-2.6.31/sound/soc/codecs/sgtl5000.c: In function 'sgtl5000_init':
/home/ogra/linux-fsl-imx51-2.6.31/sound/soc/codecs/sgtl5000.c:978: error: implicit declaration of function 'snd_soc_register_card'
make[6]: *** [sound/soc/codecs/sgtl5000.o] Error 1

Oliver Grawert (ogra) on 2009-09-01
Changed in linux-fsl-imx51 (Ubuntu Karmic):
assignee: nobody → Amit Kucheria (amitk)
Paul Larson (pwlars) on 2009-09-01
Changed in linux-fsl-imx51 (Ubuntu Karmic):
status: New → Triaged
Amit Kucheria (amitk) on 2009-09-08
Changed in linux-fsl-imx51 (Ubuntu Karmic):
importance: High → Medium
Loïc Minier (lool) wrote :

Freescale indicated over email that this "looks like a compile error" once we get to the point where the board boots with the audio driver we should start seeing I2C errors.

The console should then have lots of boot error like these:
i2c-adapter i2c-1: Bus Arbitration lost
i2c-adapter i2c-1: Could not grab Bus ownership
sgtl5000_hw_read: read reg error : Reg 0x0e

and ALSA will have read errors reading from sgtl5000 register 0.

It seems we aren't that far yet though

Matt Sealey (mwsealey) wrote :

We have this working at Genesi. We will be submitting patches to SGTL and the iMX audio support in the next week.

Oliver Grawert (ogra) wrote :

could you attache them here too ? that would be very helpful :)

Matt Sealey (mwsealey) wrote :

Once we've finished testing, we have to make sure it works on all the Lange revisions *and* a bunch of Babbages.. personally I just have a 5.1 (1.0), 5.1 (1.1), 5.2 (the famous Engadget one) and a Babbage 2.1 (or maybe it's a 2.0 I can never tell the difference..)

Loïc Minier (lool) wrote :

Babbage 2.5 has iron feet while 2.0 has plastic ones.

Oliver Grawert (ogra) on 2009-09-18
Changed in linux-fsl-imx51 (Ubuntu Karmic):
milestone: karmic-alpha-6 → ubuntu-9.10-beta
Steve Langasek (vorlon) on 2009-10-01
Changed in linux-fsl-imx51 (Ubuntu Karmic):
milestone: ubuntu-9.10-beta → ubuntu-9.10

BTW try adding these to the top of module_init in
imx-3stack-sgtl5000.c (line ~745 or so)

        snd_soc_register_platform(&imx_soc_platform);
        snd_soc_register_dai(&sgtl5000_dai);
        snd_soc_register_dai(&imx_ssi_dai);

It is completely the wrong place to do it (although in Linux there is
never a right place) but it should get sound to work.

Confirmed I have a 2.0, it has plastic feet.

On Wed, Sep 16, 2009 at 9:51 AM, Loïc Minier <email address hidden> wrote:
> Babbage 2.5 has iron feet while 2.0 has plastic ones.
>
> --
> no sound devices on babbage board with linux-image-2.6.31-100-imx51
> https://bugs.launchpad.net/bugs/420447
> You received this bug notification because you are a direct subscriber
> of the bug.
>

--
Matt Sealey <email address hidden>
Product Development Analyst, Genesi USA, Inc.

Andy Whitcroft (apw) wrote :

this bug is holding up testing for all audio bugs, and so I am pushing this up to a Hgh severity bug.

Changed in linux-fsl-imx51 (Ubuntu Karmic):
importance: Medium → High
Alan Tull (r80115) wrote :

What kind of boot messages do you get when ALSA starts up?

Alan Tull (r80115) wrote :

Some boards have I2C errors when a DVI monitor is plugged in. This can prevent register access to the sgtl5000 audio codec when the audio driver is initializing. The symptom is that you will see in the boot messages some I2C errors and a message that it has not successfully id'd the sgtl5000.

The workaround is to take two resistors off the board (this is OK for babbage 2.0 and 2.5): R284 and R287. They are located on the top side of the board about 1cm from the DVI connector on either side of U33.

This will cut the I2C connection to the DVI connection so that it will not be able to read the EDID. So specifying the video mode in the kernel command line is necessary if you are not already doing so, i.e. "video=mxcfb:1024x768-16@60".

Matt Sealey (mwsealey) wrote :

Part of the problem is the 2.6.31 ALSA SoC subsystem changed vs. 2.6.28 (Jaunty, Freescale BSP) and it's not a "straight port". A little more work has to be done by the driver in init. The 3 lines I posted should fix it to the point that if you DO have an i2c bug on your board, you can see it (otherwise, the codec driver is not initialized and nothing tries to access i2c for the SGTL5000 anyway :)

Alan, doesn't the kernel default back to a mode like that if no EDID can be found? If it doesn't then this is a really quite serious flaw in the mxcfb_ipuv3 driver. Which reminds me, the VGA driver got considerably worse in the last few patches, but this is a different bug entirely.

Alan Tull (r80115) wrote :

I checked. I was wrong about the command line. It will default to 1024x768. Sorry for the static.

Alan Tull (r80115) wrote :

I'm attaching two patches to give you what we have of the audio port.
These patches apply cleanly to your fsl-imx51 branch.
Playback and record work.

There is an issue with your regulator stuff that breaks things somewhat.
You will see a boot error that occurs when imx-3stack-sgtl5000.c calls regulator_get. That's
something that needs to get fixed in your regulator stuff. Audio functionality will be broken until this is fixed as the audio does not completely initialize.

There is another issue with a loud pop happening when boot up occurs.
This is because the 'Line In Jack' widget is on all the time. I'm
working on fixing this. As is, audio works, but will never completely
power down, so it becomes an issue with power consumption also.

Alan Tull (r80115) wrote :

Just to be completely clear about the regulator issue, I have attached a patch. This is not a solution so I named it something that no normal human would consider merging and pushing. This patch puts #if 0 around the regulator initialization part if imx-3stack-sgtl5000's probe so that the audio driver can finish initializing. This is just for demonstration and debug purposes so please don't push it. The real solution is in the regulator code.

Matt Sealey (mwsealey) wrote :

We fixed something like this by adding consumer supplies in the pmic driver in arch/arm/mach-mx51/mx51_board_pmic_blah.c to the relevant regulator blocks.. I'm going to thoroughly test this audio patch and we'll see if the whole bundle makes everything work nicely. Prepping a Lange release once we work out the problems with flickering displays and uninitialized VGA.. this may be a similar issue to the DVI i2c thing but we have not had any audio problems except stuttering and low performance during heavy system access.

Alan Tull (r80115) wrote :

I'm attaching another patch that allows the audio codec to power down when not in use.
The problem was that Line In was always enabled, so always powered up.

Loïc Minier (lool) wrote :

It's very likely that if we don't pull off the resistors mentioned in this bug we won't get any audio, at least in some configs (especially various DVI screens might affect it).

Oliver Grawert (ogra) wrote :

the kernel package at http://kernel.ubuntu.com/~bradf/linux-image-2.6.31-102-imx51_2.6.31-102.10_armel.deb includes the patches from the comments 15, 16, 17 and 19 ...
while i hear a silent "plopp" sound during boot which indicates there is something being powered up, i still end up with:

ogra@babbage2:~$ cat /proc/asound/cards
--- no soundcards ---

ogra@babbage2:~$ mplayer -ao oss /usr/share/sounds/ubuntu/stereo/desktop-login.ogg
...
[AO OSS] audio_setup: Can't open audio device /dev/dsp: No such file or directory
...

i observe the same behavior with or without DVI monitor attached.

it seems that all sound modules are loaded properly:
ogra@babbage2:~$ lsmod|grep snd
snd_soc_sgtl5000 13416 0
snd_soc_core 51816 1 snd_soc_sgtl5000
snd_pcm_oss 41372 0
snd_mixer_oss 17820 1 snd_pcm_oss
snd_pcm 76768 3 snd_soc_sgtl5000,snd_soc_core,snd_pcm_oss
snd_seq_dummy 2968 0
snd_seq_oss 30848 0
snd_seq_midi 6976 0
snd_rawmidi 23168 1 snd_seq_midi
snd_seq_midi_event 7296 2 snd_seq_oss,snd_seq_midi
snd_seq 53292 6 snd_seq_dummy,snd_seq_oss,snd_seq_midi,snd_seq_midi_event
snd_timer 22940 2 snd_pcm,snd_seq
snd_seq_device 7828 5 snd_seq_dummy,snd_seq_oss,snd_seq_midi,snd_rawmidi,snd_seq
snd 59328 9 snd_soc_core,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_seq_oss,snd_rawmidi,snd_seq,snd_timer,snd_seq_device
soundcore 7900 1 snd
snd_page_alloc 7672 1 snd_pcm

Oliver Grawert (ogra) wrote :
Alan Tull (r80115) wrote :

I didn't see any ALSA messages in your boot log so it isn't initializing fully. A section of my bootlog is below. Have you tried it with the sound driver built in? All my testing is using the imx51_defconfig that is in your kernel tree, so the audio is built in, not as modules.

I tested with on babbage 2.5 fsl rootfs (not ubuntu) and the audio is coming up and functioning.

boot messages:
Advanced Linux Sound Architecture Driver Version 1.0.20.
sgtl5000-i2c 1-000a: SGTL5000 revision 17
DMA Sound Buffers Allocated:UseIram=1 buf->addr=1ffef000 buf->area=de8a8000 size=24576
DMA Sound Buffers Allocated:UseIram=1 buf->addr=ac260000 buf->area=fbe03000 size=24576
asoc: SGTL5000 <-> imx-ssi-3 mapping ok
mmc0: new high speed SDHC card at address 8fe4
mmcblk0: mmc0:8fe4 SU08G 7.40 GiB
 mmcblk0: p1 p2
ALSA device list:
  #0: imx-3stack (SGTL5000)

Alan Tull (r80115) wrote :

Could you please attach your defconfig?

Oliver Grawert (ogra) wrote :
Alan Tull (r80115) wrote :

Thanks.

My guess: two types of problems at this point: the changes to how the rootfs handles audio and issues with the audio driver as a module. I'll debug the audio driver module problems.

For now, I recommend you try building the driver into the rootfs so that you can debug the rootfs issues. I will not likely have much input on that.

Matt Sealey (mwsealey) wrote :

We had the same audio-as-a-module issues with the MPC5200B AC97 driver - when built in to the kernel it worked much more reliably than when loaded as a module (nobody ever knew why and then Jon Smirl wrote a new driver anyway for ASoC).

BTW I was wondering if it'd be a too intrusive change to rename the audio driver from imx-3stack to imx-ssi-sgtl5000 or so - better reflecting the fact that this is an interface between an imx-ssi port (which is available on many imx chips) and the sgtl5000 codec (which is implemented on more boards with an imx than just 3stack - Babbage and Lange at the very least)?

Alan Tull (r80115) wrote :

Debugging using fsl rootfs, I see the audio work as a module just fine. I get these messages when it loads:

root@freescale ~$ modprobe -V snd-soc-imx-3stack-sgtl5000
sgtl5000-i2c 1-000a: SGTL5000 revision 17
DMA Sound Buffers Allocated:UseIram=1 buf->addr=1ffef000 buf->area=de9a0000 size=24576
DMA Sound Buffers Allocated:UseIram=1 buf->addr=ac468000 buf->area=fbe08000 size=24576
asoc: SGTL5000 <-> imx-ssi-3 mapping ok

Check using 'lsmod' to make sure all the modules got loaded:

root@freescale ~$ lsmod
Module Size Used by
snd_soc_imx_3stack_sgtl5000 8320 0
snd_soc_imx 6600 1 snd_soc_imx_3stack_sgtl5000
snd_soc_imx_ssi 6288 1 snd_soc_imx_3stack_sgtl5000
snd_soc_sgtl5000 13356 1 snd_soc_imx_3stack_sgtl5000
snd_soc_core 48040 3 snd_soc_imx_3stack_sgtl5000,snd_soc_imx,snd_soc_sgtl5000
snd_pcm 78545 3 snd_soc_imx,snd_soc_sgtl5000,snd_soc_core
snd_page_alloc 7588 1 snd_pcm
snd_timer 22332 1 snd_pcm
snd 55188 4 snd_soc_imx_3stack_sgtl5000,snd_soc_core,snd_pcm,snd_timer
soundcore 8168 1 snd

So I suggest that you do 'lsmod' to make sure all the modules got loaded. If they did, then it is rootfs issues.

Paul Larson (pwlars) wrote :

After manually loading snd_soc_imx_3stack_sgtl5000, I see the card show up:
$ cat /proc/asound/cards
 0 [imx3stack ]: SGTL5000 - imx-3stack
                      imx-3stack (SGTL5000)

If I open the sound preferences and select the various desktop sound effects to preview them, I even hear the previous (I should also mention that my DVI monitor is also connected, no problem there). I've also managed to get a .oga file from examples to play from totem, however I'm only hearing sound from one speaker.

Alan Tull (r80115) wrote :

Regarding the rename, I am sympathetic and the case you are making for it is sound (pardon the pun). I just don't have the time. Keep in mind that it is one platform for you (imx-3stack-sgtl5000) but for me it is seven (sgtl5000, ak4647, ak5702, etc). Also if I rename all those file, it makes it harder to diff between 2.6.28 and 2.6.31.

Alan Tull (r80115) wrote :

Are you plugged into the right jack?

If you are used to the Babbage1 board, it's easy to plug the headphone into the wrong jack. The headset and headphone jacks swapped somewhere between BBG1 and BBG2.5. They weren't even labeled on BBG1, but they're labeled on BBG2.5 (in tiny, tiny print).

The jack closer to the corner of the board (marked HDPHONE) is for stereo headphones.
The jack next to it is for a headset with one channel of audio and a mic (HDSET).

Regarding DVI monitors, I strongly that recommend everybody remove those two resistors (#11) even if sound seems to be working. The real problem is that some I2C reads/writes will fail, so you could get sound that is *mostly* working.

Brad Figg (brad-figg) wrote :

I've put another kernel package at:
    http://kernel.ubuntu.com/~bradf/linux-image-2.6.31-102-imx51_2.6.31-102.10~lp420447bjf1_armel.deb

This contains all the patches from comments 15, 16, 17 and 19. It also has the SGTL5000 driver builtin. My experience with this kernel is:

1. The audio control in the notification area seems to be fully functional.
2. I don't get any audio output. I'm testing my selecting different sound effects in the Sound Preferences dialog.
3. I went to the hardware tab and changed the device profile from "Analog Stereo Duplex" to "Analog Stereo Output".
4. I can now hear the different sound effects.
5. I changed the device profile back to "Analog Stereo Duplex" and can still here the sound effects.

I'm also attaching my dmesg text.

Brad Figg (brad-figg) wrote :
Oliver Grawert (ogra) wrote :

brad: confirming your kernel build works fine for me :)

/dev/sndstat as well as /pro/asound/cards now have devices listed
/dev/snd/ is populated with devices (sadly as with the most other mxc devices we have they dont expose the right properties to udev which is nowadays essential to do, we need to work with freescale on this in lucid)

i hear system sounds and can play internet radio in rhythmbox and play oggs in totem, my DVI monitor does not seem to have any influence and pulse seems to work fine (no crackling, no choppy sounds no massive system load).

Alan Tull (r80115) wrote :

What changes are needed to expose the right properties to udev?

Paul Larson (pwlars) wrote :

Ah, I see. I did have it plugged into the wrong jack. The labels were "hdset" and "hdphone" so it seemed a little ambiguous to me. Looks like it has to be plugged into "hdphone" and I now have sound out of both speakers.

Brad Figg (brad-figg) wrote :

Please note that I have committed the patches mentioned in these bug comments. I am well aware that the patch in comment #17 is not the right way to handle the problem however I'm willing to do what I have to do for right now.

Changed in linux-fsl-imx51 (Ubuntu Karmic):
status: Triaged → Fix Committed
Oliver Grawert (ogra) wrote :

linux-fsl-imx51 (2.6.31-104.12) karmic; urgency=low

  [ Alan Tull ]

  * SAUCE: IMX51: A hack which allows the sound driver to initialize.

...

  [ Brad Figg ]

  * CONFIG: IMX51: change SGTL5000 driver to be builtin instead of a
    module.

...

  [ Upstream Kernel Changes ]

  * ENGR00107785 sgtl5000: adc power savings
  * sgtl5000 audio: more porting to 2.6.31
  * sgtl5000: add line in function

...

Date: Fri, 09 Oct 2009 14:50:27 +0100

Changed in linux-fsl-imx51 (Ubuntu Karmic):
status: Fix Committed → Fix Released
tags: added: iso-testing
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers