Skip to contentSkip to conversation

AC97 audio broken on SAM9263EK?

DISCUSSION Bill Gatliff 3 participants 15 messages Feb 24, 2010 – Jun 3, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Guys:

It looks like AC97 support for the SAM9263EK isn't in the current mainline kernel. Or am I just missing something?

More specifically, it looks like the "atmel_ac97c" driver found in sound/atmel/ac97c.c is what I need, based on my look at at91_add_device_ac97(). But I see this in sound/atmel/Kconfig:

config SND_ATMEL_AC97C
tristate "Atmel AC97 Controller (AC97C) driver" select SND_PCM
select SND_AC97_CODEC
depends on DW_DMAC && AVR32

And I see this in sound/atmel/Makefile:

snd-atmel-abdac-objs := abdac.o
snd-atmel-ac97c-objs := ac97c.o

obj-$(CONFIG_SND_ATMEL_ABDAC) += snd-atmel-abdac.o
obj-$(CONFIG_SND_ATMEL_AC97C) += snd-atmel-ac97c.o

In other words, the driver isn't built unless I'm on an AVR32 platform and I have a DesignWare DMAC. Neither of those describe the AT91SAM9263EK.

Has anyone tested AC97 audio on the SAM9263EK lately? Has it ever worked?

Thanks!

Signature · 4 lines
Bill Gatliff
Embedded systems training and consulting
http://billgatliff.com
bgat at billgatliff.com
#1 lore raw

Hi Bill,

I have been working on the sam9263 AC97 driver. I have sent a patch to
the alsa mailing list but it has not being integrated yet (as far as I know...)(http://mailman.alsa-project.org/pipermail/alsa-devel/2010-February/025119.html).

I have tested it and it worked, but I have recently made some changes so the atmel ac97.c driver could support full duplex mode.

So I will submit a new patch by the end of the day/week, and I will copy it to you if you are interested.

Regards,
Sedji Gaaouaou
Le 2/24/2010 8:06 PM, Bill Gatliff a ?crit :

Quoted 32 lines

Guys:

It looks like AC97 support for the SAM9263EK isn't in the current mainline kernel. Or am I just missing something?

More specifically, it looks like the "atmel_ac97c" driver found in sound/atmel/ac97c.c is what I need, based on my look at at91_add_device_ac97(). But I see this in sound/atmel/Kconfig:

config SND_ATMEL_AC97C
tristate "Atmel AC97 Controller (AC97C) driver" select SND_PCM
select SND_AC97_CODEC
depends on DW_DMAC&& AVR32

And I see this in sound/atmel/Makefile:

snd-atmel-abdac-objs := abdac.o
snd-atmel-ac97c-objs := ac97c.o

obj-$(CONFIG_SND_ATMEL_ABDAC) += snd-atmel-abdac.o
obj-$(CONFIG_SND_ATMEL_AC97C) += snd-atmel-ac97c.o

In other words, the driver isn't built unless I'm on an AVR32 platform and I have a DesignWare DMAC. Neither of those describe the AT91SAM9263EK.

Has anyone tested AC97 audio on the SAM9263EK lately? Has it ever worked?

Thanks!

#2 lore raw
Quoted 7 lines · Sedji Gaouaou

Hi Bill,

I have been working on the sam9263 AC97 driver. I have sent a patch to
the alsa mailing list but it has not being integrated yet (as far as I know...)(http://mailman.alsa-project.org/pipermail/alsa-devel/2010-February/025119.html).

Quoted 5 lines

I have tested it and it worked, but I have recently made some changes so the atmel ac97.c driver could support full duplex mode.

So I will submit a new patch by the end of the day/week, and I will copy it to you if you are interested.

Please do! I'll also take a look at your submitted driver, and see how it works for me.

Thanks!

b.g.

Signature · 4 lines
Bill Gatliff
Embedded systems training and consulting
http://billgatliff.com
bgat at billgatliff.com
#3 lore raw

Hi Bill,

Here is the patch for the ac97 support on AT91:

http://mailman.alsa-project.org/pipermail/alsa-devel/2010-February/025629.html

Here is the patch for the full duplex support:

http://mailman.alsa-project.org/pipermail/alsa-devel/2010-February/025628.html

Best Regards,
Sedji Gaouaou

Le 2/25/2010 1:46 PM, Bill Gatliff a ?crit :

Quoted 23 lines
Quoted 7 lines · Sedji Gaouaou

Hi Bill,

I have been working on the sam9263 AC97 driver. I have sent a patch to
the alsa mailing list but it has not being integrated yet (as far as I know...)(http://mailman.alsa-project.org/pipermail/alsa-devel/2010-February/025119.html).

Quoted 5 lines

I have tested it and it worked, but I have recently made some changes so the atmel ac97.c driver could support full duplex mode.

So I will submit a new patch by the end of the day/week, and I will copy it to you if you are interested.

Please do! I'll also take a look at your submitted driver, and see how it works for me.

Thanks!

b.g.

#4 lore raw
Quoted 11 lines · Sedji Gaouaou

Hi Bill,

Here is the patch for the ac97 support on AT91:

http://mailman.alsa-project.org/pipermail/alsa-devel/2010-February/025629.html

Here is the patch for the full duplex support:

http://mailman.alsa-project.org/pipermail/alsa-devel/2010-February/025628.html

Hmm. I applied both patches to 2.6.33-rc5. There were two local variables "err" and "ptcr" that weren't defined, which I corrected. And then there was this:

CC sound/atmel/ac97c.o
sound/atmel/ac97c.c: In function ?atmel_ac97c_capture_trigger?:
sound/atmel/ac97c.c:545: warning: unused variable ?casr? sound/atmel/ac97c.c: In function ?atmel_ac97c_pcm_new?:
sound/atmel/ac97c.c:743: error: ?at91_ac97_pcm_defs? undeclared (first use in this function)
sound/atmel/ac97c.c:743: error: (Each undeclared identifier is reported only once
sound/atmel/ac97c.c:743: error: for each function it appears in.) sound/atmel/ac97c.c:743: warning: type defaults to ?int? in declaration of ?type name?
sound/atmel/ac97c.c:743: warning: type defaults to ?int? in declaration of ?type name?
sound/atmel/ac97c.c:743: error: negative width in bit-field ?<anonymous>? make[2]: *** [sound/atmel/ac97c.o] Error 1

b.g.

Signature · 4 lines
Bill Gatliff
Embedded systems training and consulting
http://billgatliff.com
bgat at billgatliff.com
#5 lore raw

Hi,

Sorry my mistake, could you please try this one:
http://mailman.alsa-project.org/pipermail/alsa-devel/2010-March/025709.html

Regards,
Sedji

Le 2/28/2010 4:23 AM, Bill Gatliff a ?crit :

Quoted 36 lines
Quoted 11 lines · Sedji Gaouaou

Hi Bill,

Here is the patch for the ac97 support on AT91:

http://mailman.alsa-project.org/pipermail/alsa-devel/2010-February/025629.html

Here is the patch for the full duplex support:

http://mailman.alsa-project.org/pipermail/alsa-devel/2010-February/025628.html

Hmm. I applied both patches to 2.6.33-rc5. There were two local variables "err" and "ptcr" that weren't defined, which I corrected. And then there was this:

CC sound/atmel/ac97c.o
sound/atmel/ac97c.c: In function ?atmel_ac97c_capture_trigger?:
sound/atmel/ac97c.c:545: warning: unused variable ?casr? sound/atmel/ac97c.c: In function ?atmel_ac97c_pcm_new?:
sound/atmel/ac97c.c:743: error: ?at91_ac97_pcm_defs? undeclared (first use in this function)
sound/atmel/ac97c.c:743: error: (Each undeclared identifier is reported only once
sound/atmel/ac97c.c:743: error: for each function it appears in.) sound/atmel/ac97c.c:743: warning: type defaults to ?int? in declaration of ?type name?
sound/atmel/ac97c.c:743: warning: type defaults to ?int? in declaration of ?type name?
sound/atmel/ac97c.c:743: error: negative width in bit-field ?<anonymous>? make[2]: *** [sound/atmel/ac97c.o] Error 1

b.g.

#6 lore raw
Quoted 1 line

http://mailman.alsa-project.org/pipermail/alsa-devel/2010-March/025709.html

I tried your patch, but mpg123 says:

Playing MPEG stream 1 of 1: 05_Tabor_Romance.mp3 ...
Title:                                   Artist:
Comment:                                 Album:
Year:                                    Genre:  Other

MPEG 1.0 layer III, 128 kbit/s, 44100 Hz stereo [audio.c:532] error: Error in writing audio (Input/output error?)! [mpg123.c:557] error: Deep trouble! Cannot flush to my output anymore!

I'm using kernel 2.6.33 on the at91sam9g45-ek. For sound I use patches 0039 and 0044 from ftp://ftp.linux4sam.org/devel/linux/2630_lnx4sam_patchset-tmp_20090828.tgz. With these I get proper sound from my head phones.

Regards,
Yegor

#7 lore raw

Hi Yegor,

Le 3/9/2010 3:11 PM, Yegor Yefremov a ?crit :

Quoted 12 lines
Quoted 1 line

http://mailman.alsa-project.org/pipermail/alsa-devel/2010-March/025709.html

I tried your patch, but mpg123 says:

Playing MPEG stream 1 of 1: 05_Tabor_Romance.mp3 ...
Title:                                   Artist:
Comment:                                 Album:
Year:                                    Genre:  Other

MPEG 1.0 layer III, 128 kbit/s, 44100 Hz stereo [audio.c:532] error: Error in writing audio (Input/output error?)! [mpg123.c:557] error: Deep trouble! Cannot flush to my output anymore!

Quoted 6 lines

I'm using kernel 2.6.33 on the at91sam9g45-ek. For sound I use patches 0039 and 0044 from ftp://ftp.linux4sam.org/devel/linux/2630_lnx4sam_patchset-tmp_20090828.tgz. With these I get proper sound from my head phones.

Regards,
Yegor

I never tried with mpg123. But I just diff the 2 sets of patches, and the only difference I can see is that the one on linux4sam doesn't handle full duplex, whereas the one I posted on the alsa mailing does...

Yoy can find enclosed both files, may I ask you to test with both? If it fails then I guess there is something wrong with the way the full duplex is done(even though I have tested it on my board...)

Regards,
Sedji

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ac97c_linux4sam.c
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100309/f3483e6b/attachment-0002.c>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ac97c_alsa.c
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100309/f3483e6b/attachment-0003.c>

#8 lore raw

Hi Sedji,

Quoted 22 lines · Sedji Gaouaou

Le 3/9/2010 3:11 PM, Yegor Yefremov a ?crit :

Quoted 13 lines
Quoted 2 lines

http://mailman.alsa-project.org/pipermail/alsa-devel/2010-March/025709.html

I tried your patch, but mpg123 says:

Playing MPEG stream 1 of 1: 05_Tabor_Romance.mp3 ...
Title:                                   Artist:
Comment:                                 Album:
Year:                                    Genre:  Other

MPEG 1.0 layer III, 128 kbit/s, 44100 Hz stereo [audio.c:532] error: Error in writing audio (Input/output error?)! [mpg123.c:557] error: Deep trouble! Cannot flush to my output anymore!

Quoted 8 lines

I'm using kernel 2.6.33 on the at91sam9g45-ek. For sound I use patches 0039 and 0044 from ftp://ftp.linux4sam.org/devel/linux/2630_lnx4sam_patchset-tmp_20090828.tgz. With these I get proper sound from my head phones.

Regards,
Yegor

Quoted 7 lines

I never tried with mpg123. But I just diff the 2 sets of patches, and the only difference I can see is that the one on linux4sam doesn't handle full duplex, whereas the one I posted on the alsa mailing does...

Yoy can find enclosed both files, may I ask you to test with both? If it fails then I guess there is something wrong with the way the full duplex is done(even though I have tested it on my board...)

I tried both files and the one really working is ac97c_alsa.c. As far as I understand it is combination of both patches for at91 support and full duplex?

I've tried the following applications under Debian 5.0:

mpg123
vlc
mplayer
amarok

Regards,
Yegor

#9 lore raw

Hi,

Quoted 5 lines

I tried both files and the one really working is ac97c_alsa.c. As far as I understand it is combination of both patches for at91 support and full duplex?

I've tried the following applications under Debian 5.0:

Quoted 8 lines

mpg123
vlc
mplayer
amarok

Regards,
Yegor

ac97c_alsa.c is the result of the 2 patches I have send to the alsa mailing list
(http://mailman.alsa-project.org/pipermail/alsa-devel/2010-March/025709.html
and
http://mailman.alsa-project.org/pipermail/alsa-devel/2010-February/025628.html).
It indeed adds support for AT91(1/2) and full duplex(2/2).But is is strange that if you only apply only the first patch you encounter errors...

On my side I have only tested these patches with mplayer and aplay. Plus to test the full duplex I have done like this:
"arecord -d 10 -f cd -t wav test.wav & mplayer my_file.mp3"

Regards,
Sedji

#10 lore raw
Quoted 23 lines
Quoted 6 lines

I tried both files and the one really working is ac97c_alsa.c. As far as I understand it is combination of both patches for at91 support and full duplex?

I've tried the following applications under Debian 5.0:

Quoted 8 lines

mpg123
vlc
mplayer
amarok

Regards,
Yegor

ac97c_alsa.c is the result of the 2 patches I have send to the alsa mailing list
(http://mailman.alsa-project.org/pipermail/alsa-devel/2010-March/025709.html
and
http://mailman.alsa-project.org/pipermail/alsa-devel/2010-February/025628.html).
It indeed adds support for AT91(1/2) and full duplex(2/2).But is is strange that if you only apply only the first patch you encounter errors...

Quoted 3 lines

On my side I have only tested these patches with mplayer and aplay. Plus to test the full duplex I have done like this:
"arecord -d 10 -f cd -t wav test.wav & mplayer my_file.mp3"

When do you think the driver could hit the mainline kernel? Till 2.6.35 open window?

Best regards,
Yegor

#11 lore raw

Hi,

Quoted 6 lines

When do you think the driver could hit the mainline kernel? Till 2.6.35 open window?

Best regards,
Yegor

It has been acked, but I don't know when it will be in the mainline kernel.

Regards,
Sedji

#12 lore raw

Hi,

Quoted 4 lines
Quoted 2 lines

When do you think the driver could hit the mainline kernel? Till 2.6.35 open window?

It has been acked, but I don't know when it will be in the mainline kernel.

have just tested 2.6.35-rc1 with mainline ac97 driver and found this issue. During playback I see following output on the console:

...
atmel_ac97c atmel_ac97c.0: channel A event
atmel_ac97c atmel_ac97c.0: channel A event
atmel_ac97c atmel_ac97c.0: channel A event
...

If I see it right these, lines come from sound/atmel/ac97c.c->atmel_ac97c_interrupt():

dev_info(&chip->pdev->dev, "channel A event%s%s%s%s%s%s\n",

                                casr & AC97C_CSR_OVRUN   ? " OVRUN"   : "",
                                casr & AC97C_CSR_RXRDY   ? " RXRDY"   : "",
                                casr & AC97C_CSR_UNRUN   ? " UNRUN"   : "",
                                casr & AC97C_CSR_TXEMPTY ? " TXEMPTY" : "",
                                casr & AC97C_CSR_TXRDY   ? " TXRDY"   : "",
                                !casr                    ? " NONE"    : "");

It is necessary to output this message in normal mode or is it a debug message?

Regards,
Yegor

#13 lore raw

Hi Yegor,

It is an error indeed, it should be a debug message.

Regards,
Sedji

Le 6/1/2010 3:39 PM, Yegor Yefremov a ?crit :

Quoted 32 lines

Hi,

Quoted 4 lines
Quoted 2 lines

When do you think the driver could hit the mainline kernel? Till 2.6.35 open window?

It has been acked, but I don't know when it will be in the mainline kernel.

have just tested 2.6.35-rc1 with mainline ac97 driver and found this issue. During playback I see following output on the console:

...
atmel_ac97c atmel_ac97c.0: channel A event
atmel_ac97c atmel_ac97c.0: channel A event
atmel_ac97c atmel_ac97c.0: channel A event
...

If I see it right these, lines come from sound/atmel/ac97c.c->atmel_ac97c_interrupt():

dev_info(&chip->pdev->dev, "channel A event%s%s%s%s%s%s\n",

                                 casr&  AC97C_CSR_OVRUN   ? " OVRUN"   : "",
                                 casr&  AC97C_CSR_RXRDY   ? " RXRDY"   : "",
                                 casr&  AC97C_CSR_UNRUN   ? " UNRUN"   : "",
                                 casr&  AC97C_CSR_TXEMPTY ? " TXEMPTY" : "",
                                 casr&  AC97C_CSR_TXRDY   ? " TXRDY"   : "",
                                 !casr                    ? " NONE"    : "");

It is necessary to output this message in normal mode or is it a debug message?

Regards,
Yegor

#14 lore raw

Hi Sedji,

Quoted 1 line

It is an error indeed, it should be a debug message.

here is a patch:

atmel: set "channel A event" output to debug

sound/atmel/ac97c.c +1 -1
Index: b/sound/atmel/ac97c.c
===================================================================
@@ -657,7 +657,7 @@
 	if (sr & AC97C_SR_CAEVT) {
 		struct snd_pcm_runtime *runtime;
 		int offset, next_period, block_size;
-		dev_info(&chip->pdev->dev, "channel A event%s%s%s%s%s%s\n",
+		dev_dbg(&chip->pdev->dev, "channel A event%s%s%s%s%s%s\n",
 				casr & AC97C_CSR_OVRUN   ? " OVRUN"   : "",
 				casr & AC97C_CSR_RXRDY   ? " RXRDY"   : "",
 				casr & AC97C_CSR_UNRUN   ? " UNRUN"   : "",