Linux 3.7 ALSA sound support for iMX233?

Started by guanx, January 19, 2013, 06:28:10 AM

Previous topic - Next topic

wigyori

Harald, one of the thing that's left in the todo list is to get uboot running and integrated for the imx233 boards. Once that's done, you'll be able to load in your custom DTB files at boot time without rebuilding the kernel.

sos


TrevorPage

Hello,

As a newbie to compiling Linux kernels (though not to programming in general) I would be most grateful for some assistance in making use of this imx23-audio fork on my OlinuXino-MAXI.

In short, my basic problem is that I have successfully created a working SD card using this kernel, but I am unable to see any audio devices when I use aplay -l or -L.

To expand on this a bit more, the instructions I followed are here:

http://www.jann.cc/2012/08/23/building_a_kernel_3_x_for_the_olinuxino_from_sources.html#getting-the-code

I used the https://github.com/koliqi/imx23-olinuxino repository in accordance with above, but instead of using the kernel source from git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git, instead I used https://github.com/ITserve/imx23-audio.

I went through the process of using menuconfig to configure the kernel closely in accordance with the above tutorial. What I did in addition to that was navigate through the sound card options and enabled support for the SOC imx23 audio.

The board now runs with the SD card and I'm able to use networking and so forth, but aplay and linphonec clearly show that no audio devices are present.

[root@alarm ~]# aplay -l                                                       
aplay: device_list:268: no soundcards found...   


[root@alarm ~]# aplay -L                                                       
null                                                                           
    Discard all samples (playback) or generate zero samples (capture) 



At this point in time I don't know if this is a problem with how I've compiled the kernel and built the SD card, or if it's a configuration of ALSA that's required.

Thanks,

Trev

TrevorPage

Ah - I now seem to have got further, having realised that I needed to use the imx23-audio.dts file, rather than imx23-olinuxino. This now seems to have resulted in the sound device being listed. Testing will continue.  :)

sos

Quote from: TrevorPage on September 13, 2013, 12:48:48 PM
Ah - I now seem to have got further, having realised that I needed to use the imx23-audio.dts file, rather than imx23-olinuxino. This now seems to have resulted in the sound device being listed. Testing will continue.  :)

Hi Trevor, I've been in the same boat as you.  What did you do to "use" the imx23-audio.dts file?

TrevorPage

#35
Hello sos,

Sorry - I admit my post could have been more helpful. I am thinking of doing a post or a blog at some point to document what I've learned from this.

So, using the instructions at http://www.jann.cc/2012/08/23/building_a_kernel_3_x_for_the_olinuxino_from_sources.html#getting-the-code, the two main changes are:

- Under the heading 'Get the kernel source', instead following the instruction to clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git into /kernel, instead I cloned into /kernel the imx233-audio repository (https://github.com/ITserve/imx23-audio.git). When following the rest of the instructions in the blog, keep in mind that where you see /linux-stable/, on your machine it is /imx23-audio/.

- Under the heading 'Join zImage and imx23-olinuxino.dtb into a new file zImage_dtb', what you want to do is use imx23-audio in place of imx23-olinuxino, e.g:

cat arch/arm/boot/zImage arch/arm/boot/dts/imx23-audio.dtb > arch/arm/boot/zImage_dtb


Disclaimer: Please keep in mind that this is all very new ground to me, and I'd appreciate input / corrections on anything I've said.

Sos, I'd be very glad to help you get this built if I can. It would be useful to keep a dialogue going in here.

I'm personally still experiencing trouble. I have audio working now, but my main goal of getting linphone working on this board has still not been achieved due to terrible audio break-up and debug reports like "ALSA lib pcm.c:7843:(snd_pcm_recover) overrun occurred" when a call is in progress. I'm in an awkward situation now where:

1. I can get the imx233-audio fork of the Linux kernel to compile and give me working audio on the board, and this gives me a recent version of the kernel which I can keep updated, with working pacman, etc. But I have the above problem with linphone.

2. I could use the version 2.x Linux kernel that Olimex supply on the 2GB SD card, but the whole separate headache with this version of Arch Linux ARM is that pacman cannot updated it (a well documented issue which is OTT here). So I see no simple way of getting Linphone and dependencies onto it.

3. I could use the latest version 3.x Linux kernel from the Arch Linux ARM site, but of course this has no audio driver.

sos

Ahh I see, well thats a useful bit of info thanks!

We're much in the same boat as you, we started with 2.6 official, but then found it doesn't have support for bluetooth.  Then we went for later builds and found I2C and audio broken.  Then we went for this 3.10 kernel in this thread and found I2C broken still, and the I2C patch made for 3.9.8 doesn't work on 3.10.

Finding it very hard to make any use out of this olimex stuff.

TrevorPage

I'm a happy bunny now, having solved the problem with Linphone (I just had to edit ~/.linphonerc to use just the PCM audio codecs, as otherwise the CPU apparently couldn't cope with the chosen codecs).

Audio out and line in seem to work fine.

A great thanks to the author of the imx233-audio fork. I honestly don't know how I'd have got my application working if it wasn't for that work having been done.

Not specifically on the topic of audio, but I wonder if Olimex plan to supply SD cards that have a later build of Arch Linux ARM on it, with full compatibility of all the onboard stuff? As mentioned previously, when using Olimex's SD card with the 2.x kernel, pacman simply can't be used to update the system at all; you end up having to deal with the well known Arch Linux issues described at https://www.archlinux.org/news/binaries-move-to-usrbin-requiring-update-intervention/ and various other places. For this reason I was never able to use pacman to install anything (much on it).

Evgeny Boger

Please note that the driver uses LRADC1 pin as mic bias output.
It might be helpful to allow users use LRADC0 instead of LRADC1 for this purpose in case LRADC1 is already used.


sound/soc/codecs/mxs-builtin-codec.c:

__raw_writel(BM_AUDIOIN_MICLINE_MIC_SELECT,
mxs_adc->ain_base + HW_AUDIOIN_MICLINE_SET);

This code is responsible for selecting LRADC1 as mic bias output.


Change to this one for selecting LRADC0 instead:

__raw_writel(BM_AUDIOIN_MICLINE_MIC_SELECT,
mxs_adc->ain_base + HW_AUDIOIN_MICLINE_CLR);



TrevorPage

#39
Can anyone suggest why my audio output (using this kernel) occasionally just goes dead (i.e. no audio output at all), with a reboot required to restore it?

At the moment I can't pinpoint what event happens for it to suddenly go quiet. I can usually perform several Linphone VOIP calls to the Olimex board, and then I'll find that the next call has no audio.

Running a utility like speaker-test will just appear to run as normal without giving any errors, but there's just no sound.

If I make a call to Linphone while it's in this state,  one thing that I do hear is a small click when the call ends. Similarly, terminating speaker-test while it's apparently in progress causes the small click. So it's like _something_ is happening.

I'd be extremely grateful for any suggestions on things to try, or ideas for things I should do to try to debug this. At present the audio suddenly going dead is a showstopper for me.

Edit 1: One observation is that speaker-test just stays stuck on "0 - Front left" when output is not working. When output is working, I see speaker-test printing that line together with a 'time per period' value cyclically.

atlaware

Can I ask if someone can upload a 3.x kernel raw image with audio and wifi support to somehow (wetransfer or gdrive)?

Good to compile, also good to dd a row file :)

Thank you!

KevinB

I am booting the latest filesystem from archlinuxarm.org whith this boot img bootlets.

https://drive.google.com/file/d/0B7PmAK6hZ3NZYjhhdDRIYUptVms/edit?usp=sharing

[root@alarm ~]# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: mxsbuiltinaudio [mxs-builtin-audio], device 0: MXS ADC/DAC mxs-builtin-codec-dai-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

[root@alarm ~]# uname -a
Linux alarm 3.10.0 #1 Mon Dec 30 00:20:51 MST 2013 armv5tejl GNU/Linux

TrevorPage

Just to give a further update on my situation, I have now had success by doing the following:

- Use latest Arch Linux ARM SD card image from http://archlinuxarm.org/platforms/armv5/olinuxino

- Then, following the advice of one of the notes on that page, I installed package linux-armv5 which replaced the default Olinuxino kernel with the mainline kernel.

Once that was done, it had support for the i.MX233 onboard audio as standard -- and it appears much more stable than my previous attempt when I compiled the kernel myself with that driver. I no longer have annoying problems with the audio driver suddenly going dead after a Linphone call had finished, or the kernel crashing. Actually, I have still seen the kernel crash on rare occasions which I suspect to be audio driver related, but making use of the watchdog timer solves that issue for me (see https://www.olimex.com/forum/index.php?topic=142.0).

I have no idea what the difference is between mainline kernel and 'default Olinuxino' kernel - maybe someone can enlighten me.


g.glowacki

Quote from: Grawp on March 13, 2014, 04:52:09 AM
Please try this on 3.13.5 kernel.

Hi,
I've a problem with mxs-builtin-audio: Almost every start of sound playback gives me a warning:
"DAC overflow detected". But after an hour of playing it hangs up with error:
"DAC underflow detected".
I copied Yours Driver into https://github.com/ITserve/imx23-audio and it works better, the overflow warning never appears, and it hangs after a few underflow warnings (not after the first one).
I attach my kernel .config file.
Have You ever made mxs-builtin-audio driver work for long time without mentioned errors? Do You hae any suggestions, so I can make it work fine?

.config -> https://drive.google.com/file/d/0ByL1cf6rr8JwT0tPYUpjRXUtaTQ/edit?usp=sharing