Re: ALSA sound driver for Nokia 770 and DSP programming

2008-09-29 Thread Stefan Kost
hi,
Robert Schuster schrieb:
 Hi,
 
 Siarhei Siamashka schrieb:
 Recently I have been trying to make it running and seems like we have a very
 good chance to have it working nicely. It is also interesting, that the
 linux-omap guys seem to be developing a new driver [3] for AIC23 which may
 eventually become a better alternative.
 Very nice!
 
 I will try your patch in mamona which IMO provides the most easy way to
 test those things out. Mamona is based on OpenEmbedded and every other
 distribution made from it bases its sound core on ALSA not gstreamer ...

Its not entierly true. Sound core is based on a proprietary dsp interface.
N800/810 has alsa/gstreamer/esd support. On fremantle/omap3 have fixed that
problem, as there is real alsa + gstreamer/pulseaudio/esounds for higher level
stuff.

Stefan

 
 It is good that a new driver is in development, however I have doubts
 that we will be able to run 2.6.27+ on the N770 soon ;).
 
 Is the AIC23 also in the N8x0 devices?
 
 Regards
 Robert
 
 
 
 
 
 ___
 maemo-developers mailing list
 maemo-developers@maemo.org
 https://lists.maemo.org/mailman/listinfo/maemo-developers

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: ALSA sound driver for Nokia 770 and DSP programming

2008-09-27 Thread Neil Jerram
2008/9/27 Siarhei Siamashka [EMAIL PROTECTED]:

 That's great, feedback is very much welcome. Though bugreports can wait until
 I roll out the next revision of the patch ;)

Well then I will also say that I think your progress on this is great,
and that I enjoy reading your emails, even if I have nothing to
contribute to them.

I have two 770s, and this work will help them to be more useful for longer.

I love it when you write that something is difficult and needs more
work... then I just know that you will have done it about a day later!

Best wishes,
 Neil
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: ALSA sound driver for Nokia 770 and DSP programming

2008-09-26 Thread Robert Schuster
Hi,

Siarhei Siamashka schrieb:
 Recently I have been trying to make it running and seems like we have a very
 good chance to have it working nicely. It is also interesting, that the
 linux-omap guys seem to be developing a new driver [3] for AIC23 which may
 eventually become a better alternative.
Very nice!

I will try your patch in mamona which IMO provides the most easy way to
test those things out. Mamona is based on OpenEmbedded and every other
distribution made from it bases its sound core on ALSA not gstreamer ...

It is good that a new driver is in development, however I have doubts
that we will be able to run 2.6.27+ on the N770 soon ;).

Is the AIC23 also in the N8x0 devices?

Regards
Robert



signature.asc
Description: OpenPGP digital signature
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


RE: ALSA sound driver for Nokia 770 and DSP programming

2008-09-26 Thread Simon Pickering
 
  Recently I have been trying to make it running and seems 
  like we have a very
  good chance to have it working nicely. It is also 
  interesting, that the
  linux-omap guys seem to be developing a new driver [3] for 
  AIC23 which may
  eventually become a better alternative.
  Very nice!

Good stuff Siarhei :)

Have you built a replacement DSP-kernel yet?

 I will try your patch in mamona which IMO provides the most 
 easy way to
 test those things out. Mamona is based on OpenEmbedded and every other
 distribution made from it bases its sound core on ALSA not 
 gstreamer ...

Sounds like a useful test-bed.

 It is good that a new driver is in development, however I have doubts
 that we will be able to run 2.6.27+ on the N770 soon ;).
 
 Is the AIC23 also in the N8x0 devices?

From the N810 datasheet, it looks like it contains a TVL320AIC33NIZQER, or
in shorter form a TVL320AIC33:
http://focus.ti.com/docs/prod/folders/print/tlv320aic33.html

I seem to remember there being something different in the N800, anyone got
the datasheet handy for the N800?

Cheers,


Simon

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: ALSA sound driver for Nokia 770 and DSP programming

2008-09-26 Thread Siarhei Siamashka
On Friday 26 September 2008, Simon Pickering wrote:
   Recently I have been trying to make it running and seems
   like we have a very
   good chance to have it working nicely. It is also
   interesting, that the
   linux-omap guys seem to be developing a new driver [3] for
   AIC23 which may
   eventually become a better alternative.
   Very nice!

 Good stuff Siarhei :)

 Have you built a replacement DSP-kernel yet?

Yes, sure. You can easily build DSP kernel and demo_console DSP task from
the sources in dspgw-3.3-dsp.tar.bz2

All that is need to done is to run 'make' in 'tokliBIOS' (*), 'tinkernel' and 
'apps/demo_mod' subdirectories. You will get 'tinkernel.out' and 
'demo_console.o' binary files which are DSP kernel and DSP task respectively.
After that, have a look into dspgw-3.3-dynamic-demo-omap1.tar.bz2 archive for
the target directory layout and README file with the instructions how to test
it. Of course you can replace 'tinkernel.out' and 'demo_console.o' with the
files that you have compiled yourself. ARM side binaries also need to be
recompiled before you can run them (they were compiled for OABI and will
not run out of the box), but that's a minor issue. Only 'dsp_dld' compilation
may cause problems because it needs a more up to date version of flex than the
one that is part of OS2006 SDK.

(*) Actually you need to apply a patch to 'tokliBIOScfg.tcf' if you want to
use the generated 'tokliBIOScfg.cmd' instead of tinkernelcfg.cmd'. That was
actually the hardest part.

Now it is possible to experiment with configuring DSP kernel by changing
.tcf file and enabling different kernel features. Documentation which explains
its syntax is available in free DSP toolchain.

So DSP programming for 770 and other OMAP1 based devices should be perfectly
fine. But I can't say the same for N8x0 at the moment, because free DSP
toolchain from TI does not support compilation of DSP kernel for OMAP2
according to dspgateway documentation.

-- 
Best regards,
Siarhei Siamashka
--- dspgw-3.3-dsp.orig/tokliBIOS/tokliBIOScfg.tcf	2005-06-09 07:28:21.0 +0300
+++ dspgw-3.3-dsp/tokliBIOS/tokliBIOScfg.tcf	2008-09-27 03:00:40.0 +0300
@@ -47,6 +47,10 @@
 bios.MEM.MALLOCSEG = prog.get(DARAM);
 bios.MEM.BIOSOBJSEG = prog.get(DARAM);
 
+var extmem = bios.MEM.create(EXTMEM);
+extmem.base = 0x14000;
+extmem.len = 0x1000;
+extmem.createHeap = false;
 
 /*
  * CLK
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: ALSA sound driver for Nokia 770 and DSP programming

2008-09-26 Thread Siarhei Siamashka
On Friday 26 September 2008, Robert Schuster wrote:
 Hi,

 Siarhei Siamashka schrieb:
  Recently I have been trying to make it running and seems like we have a
  very good chance to have it working nicely. It is also interesting, that
  the linux-omap guys seem to be developing a new driver [3] for AIC23
  which may eventually become a better alternative.

 Very nice!

 I will try your patch in mamona which IMO provides the most easy way to
 test those things out. 

That's great, feedback is very much welcome. Though bugreports can wait until
I roll out the next revision of the patch ;)

 Mamona is based on OpenEmbedded and every other 
 distribution made from it bases its sound core on ALSA not gstreamer ...

Somehow I also like this approach better ...

 It is good that a new driver is in development, however I have doubts
 that we will be able to run 2.6.27+ on the N770 soon ;).

Sure, upgrading the kernel may end up in fixing one problem, but introducing a
lot more of them instead :) But we could try to backport the new driver to
2.6.16 once it is ready.

 Is the AIC23 also in the N8x0 devices?

In addition to the information already provided by Simon, I can recommend to
search linux-omap and alsa-devel mailing lists.

-- 
Best regards,
Siarhei Siamashka
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


ALSA sound driver for Nokia 770 and DSP programming

2008-09-25 Thread Siarhei Siamashka
Hi,

As has been discovered long ago [1] but eventually forgotten, Nokia 770 has
AIC23 audio hardware [2] which can be used not only from DSP side, but
from ARM as well. Moreover, OS2006 kernel sources even contain an ARM driver
for it, but this driver is disabled (that's understandable as the driver is
not in a very good shape and has quite a number of bugs).

Recently I have been trying to make it running and seems like we have a very
good chance to have it working nicely. It is also interesting, that the
linux-omap guys seem to be developing a new driver [3] for AIC23 which may
eventually become a better alternative.

Kernel patch is attached. It enables AIC32 driver, adds a hack to
power on/off code so that audio codec is permanently powered on (power 
on/off code is not reliable and needs to be reworked). Also it fixes a 
problem with audio stuttering on video playback in mplayer (the driver
had broken position reporting which is critical for proper audio/video
synchronization).

Here is some usage instruction (beware that standard disclaimer applies: 
you can use this patch at your own risk, this code is quite untested. If it
somehow manages to fry your device, you have been warned and I'm not
responsible for any breakages):

1. Disable esd daemon and DSP stuff in order to move it out of the way
(temporarily rename '/usr/bin/esd' and '/usr/sbin/dsp_dld' to something else)
2. Apply the attached patch to OS2006 kernel, compile and flash it to the
device
3. Compile and install alsa userspace library, I used alsa-lib-1.0.11.tar.bz2
4. Put attached 'asound.conf' into '/etc' directory on the device, it enables
dmix plugin for audio mixing and resampling
5. Compile and try some applications which use ALSA, I tested 'aplay' 
and 'mplayer'

The driver is semi-usable now, but a lot still needs to be done:
* proper power management to avoid excessive battery drain
* audio volume control
* switch between speaker/headphone
* audio quality is a bit crappy now, this needs to be fixed
* maybe some more fixes for bugs that are yet to be discovered...

DMA code is quite suspicious (especially the way it does channels linking) and
might be responsible for audio quality issues. Also sofware mixing/resampling
code in dmix plugin can benefit from ARM optimizations.


Now regarding why we may want it. Once if we get a good, low latency, fully
functional and reliable ALSA sound driver running on ARM, it gives maemo 
community a nice possibility to scrap all the proprietary DSP binaries. This
provides us with a new and shiny 252MHz C55x DSP core ready to be used by
something else :)

Free linux DSP toolchain from TI [4] supports generation of both DSP kernel
and DSP tasks for OMAP1 based devices which is sufficient for DSP development.
The toolchain license was supposed to permit open source development (with
noncommercial restriction), though the license text itself is a bit
questionable [5].

With DSP avalable for use and having no need to spend efforts on ensuring
compatibility and peaceful coexistence with proprietary binary codecs (free
and proprietary code does not mix well), it should be possible to turn 
Nokia 770 into quite a powerful media player.


1. http://lists.maemo.org/pipermail/maemo-developers/2006-June/022231.html
2. http://focus.ti.com/docs/prod/folders/print/tlv320aic23b.html
3. http://thread.gmane.org/gmane.linux.ports.arm.omap/11700/focus=11709
4. 
https://www-a.ti.com/downloads/sds_support/targetcontent/LinuxDspTools/index.html
5. http://www.gossamer-threads.com/lists/maemo/developers/30611

-- 
Best regards,
Siarhei Siamashka
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 3862a77..90f113a 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -33,6 +33,8 @@
 #include asm/arch/aic23.h
 #include asm/arch/gpio.h
 #include asm/arch/lcd_mipid.h
+#include asm/arch/mcbsp.h
+#include asm/arch/omap-alsa.h
 
 extern void nokia770_ts_init(void);
 extern void nokia770_mmc_init(void);
@@ -67,6 +69,42 @@ static int nokia770_keymap[] = {
 	0
 };
 
+#define DEFAULT_BITPERSAMPLE 16
+
+static struct omap_mcbsp_reg_cfg mcbsp_regs = {
+.spcr2 = FREE | FRST | GRST | XRST | XINTM(3),
+.spcr1 = RINTM(3) | RRST,
+.rcr2 = RPHASE | RFRLEN2(OMAP_MCBSP_WORD_8) |
+RWDLEN2(OMAP_MCBSP_WORD_16) | RDATDLY(0),
+.rcr1 = RFRLEN1(OMAP_MCBSP_WORD_8) | RWDLEN1(OMAP_MCBSP_WORD_16),
+.xcr2 = XPHASE | XFRLEN2(OMAP_MCBSP_WORD_8) |
+XWDLEN2(OMAP_MCBSP_WORD_16) | XDATDLY(0) | XFIG,
+.xcr1 = XFRLEN1(OMAP_MCBSP_WORD_8) | XWDLEN1(OMAP_MCBSP_WORD_16),
+.srgr1 = FWID(DEFAULT_BITPERSAMPLE - 1),
+.srgr2 = GSYNC | CLKSP | FSGM | FPER(DEFAULT_BITPERSAMPLE * 2 - 1),
+/*.pcr0 = FSXM | FSRM | CLKXM | CLKRM | CLKXP | CLKRP,*/ /* mcbsp: master */
+.pcr0 = CLKXP | CLKRP,  /* mcbsp: slave */
+};
+
+static struct omap_alsa_codec_config alsa_config = {
+.name   = Nokia770 AIC23,
+.mcbsp_regs_alsa= 

Re: ALSA sound driver for Nokia 770 and DSP programming

2008-09-25 Thread Felipe Contreras
On Thu, Sep 25, 2008 at 10:07 PM, Siarhei Siamashka
[EMAIL PROTECTED] wrote:
 Hi,

 As has been discovered long ago [1] but eventually forgotten, Nokia 770 has
 AIC23 audio hardware [2] which can be used not only from DSP side, but
 from ARM as well. Moreover, OS2006 kernel sources even contain an ARM driver
 for it, but this driver is disabled (that's understandable as the driver is
 not in a very good shape and has quite a number of bugs).

 Recently I have been trying to make it running and seems like we have a very
 good chance to have it working nicely. It is also interesting, that the
 linux-omap guys seem to be developing a new driver [3] for AIC23 which may
 eventually become a better alternative.

 Kernel patch is attached. It enables AIC32 driver, adds a hack to
 power on/off code so that audio codec is permanently powered on (power
 on/off code is not reliable and needs to be reworked). Also it fixes a
 problem with audio stuttering on video playback in mplayer (the driver
 had broken position reporting which is critical for proper audio/video
 synchronization).

 Here is some usage instruction (beware that standard disclaimer applies:
 you can use this patch at your own risk, this code is quite untested. If it
 somehow manages to fry your device, you have been warned and I'm not
 responsible for any breakages):

 1. Disable esd daemon and DSP stuff in order to move it out of the way
 (temporarily rename '/usr/bin/esd' and '/usr/sbin/dsp_dld' to something else)
 2. Apply the attached patch to OS2006 kernel, compile and flash it to the
 device
 3. Compile and install alsa userspace library, I used alsa-lib-1.0.11.tar.bz2
 4. Put attached 'asound.conf' into '/etc' directory on the device, it enables
 dmix plugin for audio mixing and resampling
 5. Compile and try some applications which use ALSA, I tested 'aplay'
 and 'mplayer'

 The driver is semi-usable now, but a lot still needs to be done:
 * proper power management to avoid excessive battery drain
 * audio volume control
 * switch between speaker/headphone
 * audio quality is a bit crappy now, this needs to be fixed
 * maybe some more fixes for bugs that are yet to be discovered...

 DMA code is quite suspicious (especially the way it does channels linking) and
 might be responsible for audio quality issues. Also sofware mixing/resampling
 code in dmix plugin can benefit from ARM optimizations.


 Now regarding why we may want it. Once if we get a good, low latency, fully
 functional and reliable ALSA sound driver running on ARM, it gives maemo
 community a nice possibility to scrap all the proprietary DSP binaries. This
 provides us with a new and shiny 252MHz C55x DSP core ready to be used by
 something else :)

 Free linux DSP toolchain from TI [4] supports generation of both DSP kernel
 and DSP tasks for OMAP1 based devices which is sufficient for DSP development.
 The toolchain license was supposed to permit open source development (with
 noncommercial restriction), though the license text itself is a bit
 questionable [5].

 With DSP avalable for use and having no need to spend efforts on ensuring
 compatibility and peaceful coexistence with proprietary binary codecs (free
 and proprietary code does not mix well), it should be possible to turn
 Nokia 770 into quite a powerful media player.

Great stuff!

Do you plan to use the dsp-gateway or dsp-bridge?

-- 
Felipe Contreras
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: ALSA sound driver for Nokia 770 and DSP programming

2008-09-25 Thread Siarhei Siamashka
On Thursday 25 September 2008, Felipe Contreras wrote:
 On Thu, Sep 25, 2008 at 10:07 PM, Siarhei Siamashka
[...]
  Now regarding why we may want it. Once if we get a good, low latency,
  fully functional and reliable ALSA sound driver running on ARM, it gives
  maemo community a nice possibility to scrap all the proprietary DSP
  binaries. This provides us with a new and shiny 252MHz C55x DSP core
  ready to be used by something else :)
 
  Free linux DSP toolchain from TI [4] supports generation of both DSP
  kernel and DSP tasks for OMAP1 based devices which is sufficient for DSP
  development. The toolchain license was supposed to permit open source
  development (with noncommercial restriction), though the license text
  itself is a bit questionable [5].
 
  With DSP avalable for use and having no need to spend efforts on ensuring
  compatibility and peaceful coexistence with proprietary binary codecs
  (free and proprietary code does not mix well), it should be possible to
  turn Nokia 770 into quite a powerful media player.

 Great stuff!

 Do you plan to use the dsp-gateway or dsp-bridge?

Now as you mentioned that, it indeed makes sense to consider other
alternatives if they exist. Do you have any links to the information about 
dspgateway vs. dspbridge comparison (features/performance/reliability)?

Using dspgateway has a clear advantage that it is already included in the 
kernel. And dspgateway is more or less ok, though patching it a bit in order
to improve performance will be required.

-- 
Best regards,
Siarhei Siamashka
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: ALSA sound driver for Nokia 770 and DSP programming

2008-09-25 Thread Felipe Contreras
On Fri, Sep 26, 2008 at 12:06 AM, Siarhei Siamashka
[EMAIL PROTECTED] wrote:
 On Thursday 25 September 2008, Felipe Contreras wrote:
 On Thu, Sep 25, 2008 at 10:07 PM, Siarhei Siamashka
 [...]
  Now regarding why we may want it. Once if we get a good, low latency,
  fully functional and reliable ALSA sound driver running on ARM, it gives
  maemo community a nice possibility to scrap all the proprietary DSP
  binaries. This provides us with a new and shiny 252MHz C55x DSP core
  ready to be used by something else :)
 
  Free linux DSP toolchain from TI [4] supports generation of both DSP
  kernel and DSP tasks for OMAP1 based devices which is sufficient for DSP
  development. The toolchain license was supposed to permit open source
  development (with noncommercial restriction), though the license text
  itself is a bit questionable [5].
 
  With DSP avalable for use and having no need to spend efforts on ensuring
  compatibility and peaceful coexistence with proprietary binary codecs
  (free and proprietary code does not mix well), it should be possible to
  turn Nokia 770 into quite a powerful media player.

 Great stuff!

 Do you plan to use the dsp-gateway or dsp-bridge?

 Now as you mentioned that, it indeed makes sense to consider other
 alternatives if they exist. Do you have any links to the information about
 dspgateway vs. dspbridge comparison (features/performance/reliability)?

 Using dspgateway has a clear advantage that it is already included in the
 kernel. And dspgateway is more or less ok, though patching it a bit in order
 to improve performance will be required.

Not really, but I've been thinking that a comparison would be useful.
Perhaps some dummy DSP nodes and clients to test them on both would
help. I have one for the dsp-bridge, but not dsp-gateway.


-- 
Felipe Contreras
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers