Re: [Alsa-devel] Emu10k1x driver

2004-05-16 Thread Takashi Iwai
At Sat, 15 May 2004 17:30:52 -0400,
Francisco Moraes wrote:
 
 Takashi Iwai wrote:
 
 Is your patch for kernel 2.6?
 
 
 
 to the latest ALSA cvs.
 you'd better to get the CVS tree (either via cvs or snapshot).
 it already incldues emu10k1x.c.
   
 
 I got it from there but your changes to add the module params don't 
 compile on my system (Red Hat Fedora Core 1 - 2.4.22-2188 kernel).

did you rebuild via cvscompile script?


 There is also a problem with mono streams, so the hw params need to 
 indicate that only stereo is supported.

that's fine.  many hardwares support only stereo indeed.

  Also, is there any advantage in 
 enabling both interrupts in the buffer (loop and half loop)?

yes, definitely.  (IIRC, it IS enabled?)
otherwise the app won't work proprely in most cases.
remember that the sound system is driven by interrupts.
an irq per buffer means that we have only one chance to update the
data in the accurate timinig.

  Also, how 
 important is the definition of period bytes? It seems it should be the 
 same as the buffer size.

no, it should be a half of the buffer size.

  Maybe you can just explain it to me how it 
 relates to the total buffer size being used.

the buffer size is the total size of the memory space you callocate.
when the amount of processed PCM data becomes to the period size, an
irq is issued.  in the case of emu10k1x, hence, period size is ALWAYS
buffer size / 2 (as long as half-interrupt bit is set).


Takashi


---
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562alloc_id=6184op=click
___
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel


Re: [Alsa-devel] Emu10k1x driver

2004-05-15 Thread Takashi Iwai
At Sat, 15 May 2004 01:30:51 GMT,
[EMAIL PROTECTED] wrote:
 
 
 the attached patch includes some fixes by me for the latest cvs, and
 changes the periods to 2.  i'll apply it to cvs now.
 
 Is your patch for kernel 2.6?

to the latest ALSA cvs.
you'd better to get the CVS tree (either via cvs or snapshot).
it already incldues emu10k1x.c.


Takashi


---
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562alloc_id=6184op=click
___
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel


Re: [Alsa-devel] Emu10k1x driver

2004-05-15 Thread Francisco Moraes
Takashi Iwai wrote:
Is your patch for kernel 2.6?
   

to the latest ALSA cvs.
you'd better to get the CVS tree (either via cvs or snapshot).
it already incldues emu10k1x.c.
 

I got it from there but your changes to add the module params don't 
compile on my system (Red Hat Fedora Core 1 - 2.4.22-2188 kernel).

There is also a problem with mono streams, so the hw params need to 
indicate that only stereo is supported. Also, is there any advantage in 
enabling both interrupts in the buffer (loop and half loop)? Also, how 
important is the definition of period bytes? It seems it should be the 
same as the buffer size. Maybe you can just explain it to me how it 
relates to the total buffer size being used.

Regards,
Francisco
---
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562alloc_id=6184op=click
___
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel


Re: [Alsa-devel] Emu10k1x driver

2004-05-14 Thread Takashi Iwai
At Fri, 14 May 2004 11:50:50 GMT,
[EMAIL PROTECTED] wrote:
 
 Here's a revised version of the driver. I found a bug in the
 previous version, not sure why it was working, maybe because I had my
 printk's in it. 
 
 I've also revised the indentation and now supports the 3 PCM
 streams, even though I seem to only be able to hear the first two when
 the mixer is set correctly. 

thanks, the code looks nicer.

i noticed that you set the irq mask IPR_CH_0_LOOP|IPR_CH_0_HALF_LOOP.
does it mean that the chip generates interrupts twice per buffer?
if yes, what we need is to limit the number of periods to 2.


the attached patch includes some fixes by me for the latest cvs, and
changes the periods to 2.  i'll apply it to cvs now.


Takashi
Index: alsa-driver/pci/Kconfig
===
RCS file: /suse/tiwai/cvs/alsa/alsa-driver/pci/Kconfig,v
retrieving revision 1.16
diff -u -r1.16 Kconfig
--- alsa-driver/pci/Kconfig 3 Apr 2004 14:20:01 -   1.16
+++ alsa-driver/pci/Kconfig 14 May 2004 13:27:22 -
@@ -18,4 +18,12 @@
  Say 'Y' or 'M' to include support for RME Hammerfall DSP MADI
  soundcards.
 
+config SND_EMU10K1X
+   tristate EMU10K1X (Dell OEM Version)
+   depends on SND
+   select SND_AC97_CODEC
+   help
+ Say 'Y' or 'M' to include support for Sound Blaster Live Dell
+ OEM version.
+
 endmenu
Index: alsa-driver/pci/emu10k1/Makefile
===
RCS file: /suse/tiwai/cvs/alsa/alsa-driver/pci/emu10k1/Makefile,v
retrieving revision 1.5
diff -u -r1.5 Makefile
--- alsa-driver/pci/emu10k1/Makefile11 Nov 2003 13:09:46 -  1.5
+++ alsa-driver/pci/emu10k1/Makefile14 May 2004 13:30:14 -
@@ -5,6 +5,10 @@
 include $(SND_TOPDIR)/toplevel.config
 include $(SND_TOPDIR)/Makefile.conf
 
+snd-emu10k1x-objs := emu10k1x.o
+
+obj-$(CONFIG_SND_EMU10K1X) += snd-emu10k1x.o
+
 export-objs  := emu10k1_main.o
 
 include $(SND_TOPDIR)/alsa-kernel/pci/emu10k1/Makefile
Index: alsa-driver/pci/emu10k1/emu10k1x.c
===
RCS file: alsa-driver/pci/emu10k1/emu10k1x.c
diff -N alsa-driver/pci/emu10k1/emu10k1x.c
--- /dev/null   1 Jan 1970 00:00:00 -
+++ alsa-driver/pci/emu10k1/emu10k1x.c  14 May 2004 13:32:26 -
@@ -0,0 +1,867 @@
+/*
+ *  Copyright (c) by Francisco Moraes [EMAIL PROTECTED]
+ *  Driver EMU10K1X chips
+ *
+ *  BUGS:
+ *--
+ *
+ *  TODO:
+ *--
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ */
+#include sound/driver.h
+#include linux/init.h
+#include linux/interrupt.h
+#include linux/pci.h
+#include linux/slab.h
+#include linux/moduleparam.h
+#include sound/core.h
+#include sound/initval.h
+#include sound/pcm.h
+#include sound/ac97_codec.h
+
+MODULE_AUTHOR(Francisco Moraes [EMAIL PROTECTED]);
+MODULE_DESCRIPTION(EMU10K1X);
+MODULE_LICENSE(GPL);
+MODULE_CLASSES({sound});
+MODULE_DEVICES({{Dell Creative Labs,SB Live!});
+
+// module parameters (see Module Parameters)
+static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
+static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
+static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
+static int boot_devs;
+
+module_param_array(index, int, boot_devs, 0444);
+MODULE_PARM_DESC(index, Index value for the EMU10K1X soundcard.);
+MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
+module_param_array(id, charp, boot_devs, 0444);
+MODULE_PARM_DESC(id, ID string for the EMU10K1X soundcard.);
+MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
+module_param_array(enable, bool, boot_devs, 0444);
+MODULE_PARM_DESC(enable, Enable the EMU10K1X soundcard.);
+MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
+
+
+// some definitions were borrowed from emu10k1 driver as they seem to be the same
+//
+/* PCI function 0 registers, address = val + PCIBASE0   
 */
+//
+
+#define PTR0x00/* Indexed register set pointer 
register*/
+   /* NOTE: The CHANNELNUM and 

Re: [Alsa-devel] Emu10k1x driver

2004-05-14 Thread fmoraes74

 i noticed that you set the irq mask IPR_CH_0_LOOP|IPR_CH_0_HALF_LOOP.
 does it mean that the chip generates interrupts twice per buffer?
 if yes, what we need is to limit the number of periods to 2.

The hardware can generate an interrupt at the beginning or the period (ptr = 0) and 
the middle of the period (halfway through the buffer). I didn't much time trying to 
understand all the internals of ALSA, so I submitted what worked. This latest version 
has alsaplayer working and the pcm test in alsa-lib.

I've two channels playback but the third one cannot be heard (there seems to be no 
mixer control for it), so we probably need the specs to figure that one out.

 the attached patch includes some fixes by me for the latest cvs, and
 changes the periods to 2.  I'll apply it to cvs now.

Thanks,

Francisco



The best thing to hit the Internet in years - NetZero HiSpeed!
Surf the Web up to FIVE TIMES FASTER!
Only $14.95/ month -visit www.netzero.com to sign up today!


---
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562alloc_id=6184op=click
___
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel


Re: [Alsa-devel] Emu10k1x driver

2004-05-14 Thread James Courtier-Dutton
Takashi Iwai wrote:
At Wed, 12 May 2004 03:16:14 +0100,
James Courtier-Dutton wrote:
[EMAIL PROTECTED] wrote:

Here's the first pass at the driver. I've tested it mainly with XMMS with the ALSA output plugin.

alsaplayer didn't work, not sure why. I've also tested with the pcm test in alsa-lib which seems to be jumping, so that's another problem.

I've removed the joystick support for now, but the only reason I added it was because the intel8x0.c driver has joystick support in it.

Enjoy,

Francisco


I would like to add some information that might help people modifying 
this for the Audigy LS.

The outputs for the card work in 2 modes.
1) Probably analogue on the output jacks.
snd_emu10k1x_ptr_write(chip, 0x41, 0, 0x70f);
snd_emu10k1x_ptr_write(chip, 0x45, 0, 0);


it's already in emu10k1x.c.


2) Probably digital spdif on the output jacks.
snd_emu10k1x_ptr_write(chip, 0x41, 0, 0x1000f);
snd_emu10k1x_ptr_write(chip, 0x45, 0, 0x700);


it's not.
Those (1) and (2) should work on bother the LS and the Dell OEM.


To enable this driver loading for the Audigy LS, have the following PCI IDs.
static struct pci_device_id snd_emu10k1x_ids[] = {
  { 0x1102, 0x0006, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },  /* Dell OEM 
version (EMU10K1X) */
  { 0x1102, 0x0007, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },  /* Audigy LS */
  { 0, }
};


so, just adding the pci id for audigy LS would suffice at least for
analog output?
I don't think so, because of all the extra code that will be needed in 
the interrupt routines.



Other information: -
value = snd_emu10k1x_ptr_read(chip, 0x74, 0);
printk(Some special chip ID = %04x\n,value);


what value on Dell OEM?
I don't know. Might be worth trying it on the Audigy 2 as well.



Further additions to the snd_emu10k1x_create() function, after the lines
snd_emu10k1x_ptr_write(chip, 0x41, 0, 0x70f); // ???
snd_emu10k1x_ptr_write(chip, 0x45, 0, 0);


hmm...


snd_emu10k1x_ptr_write(chip, 0x65, 0, 0x1000);
snd_emu10k1x_ptr_write(chip, 0x72, 0, 0xf0f003f);


routing?


snd_emu10k1x_ptr_write(chip, 0x71, 0, 0xf000);
snd_emu10k1x_ptr_write(chip, 0x61, 0, 0x0);
snd_emu10k1x_ptr_write(chip, 0x62, 0, 0x0);
The AudigyLS also seems to use the emu10k1x_ptr 0x75 a lot in interrupt 
routines, but the Dell OEM one does not.


what value is supposed to be on 0x75?
I have no idea. But some trial and error with some actual hardware 
should help.



Takashi


Takashi,

I am waiting for someone to donate an Audigy LS to me. I will then be 
able to build a driver for it.
It seems that the Audigy LS is quite a lot different from the Dell OEM, 
so I will probably create a new .c file for it.
Maybe at a later stage, when everything works well, we might decide to 
join the two drivers.

Also, if we get the Audigy LS working, it might shed some light on the 
P16 or P17 chip details in the Audigy 2.
For features like high sample rates etc.

I have had one offer so far for an Audigy LS, so, if it arrives, I will 
start work on it.

Cheers
James
---
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562alloc_id=6184op=click
___
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel


Re: [Alsa-devel] Emu10k1x driver

2004-05-14 Thread Takashi Iwai
At Fri, 14 May 2004 18:14:47 +0100,
James Courtier-Dutton wrote:
 
 I would like to add some information that might help people modifying 
 this for the Audigy LS.
 
 The outputs for the card work in 2 modes.
 1) Probably analogue on the output jacks.
 snd_emu10k1x_ptr_write(chip, 0x41, 0, 0x70f);
 snd_emu10k1x_ptr_write(chip, 0x45, 0, 0);
  
  
  it's already in emu10k1x.c.
  
  
 2) Probably digital spdif on the output jacks.
 snd_emu10k1x_ptr_write(chip, 0x41, 0, 0x1000f);
 snd_emu10k1x_ptr_write(chip, 0x45, 0, 0x700);
  
  
  it's not.
 
 Those (1) and (2) should work on bother the LS and the Dell OEM.

then, are they exclusive?

 To enable this driver loading for the Audigy LS, have the following PCI IDs.
 static struct pci_device_id snd_emu10k1x_ids[] = {
{ 0x1102, 0x0006, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },  /* Dell OEM 
 version (EMU10K1X) */
{ 0x1102, 0x0007, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },  /* Audigy LS */
{ 0, }
 };
  
  
  so, just adding the pci id for audigy LS would suffice at least for
  analog output?
 
 I don't think so, because of all the extra code that will be needed in 
 the interrupt routines.

ok...

(snip)
 Takashi,
 
 I am waiting for someone to donate an Audigy LS to me. I will then be 
 able to build a driver for it.
 It seems that the Audigy LS is quite a lot different from the Dell OEM, 
 so I will probably create a new .c file for it.
 Maybe at a later stage, when everything works well, we might decide to 
 join the two drivers.

that's fine.  meanwhile, emu10k1x.c is already on cvs.


Takashi


---
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562alloc_id=6184op=click
___
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel


Re: [Alsa-devel] Emu10k1x driver

2004-05-14 Thread James Courtier-Dutton
Takashi Iwai wrote:
At Fri, 14 May 2004 18:14:47 +0100,
James Courtier-Dutton wrote:
I would like to add some information that might help people modifying 
this for the Audigy LS.

The outputs for the card work in 2 modes.
1) Probably analogue on the output jacks.
snd_emu10k1x_ptr_write(chip, 0x41, 0, 0x70f);
snd_emu10k1x_ptr_write(chip, 0x45, 0, 0);

2) Probably digital spdif on the output jacks.
snd_emu10k1x_ptr_write(chip, 0x41, 0, 0x1000f);
snd_emu10k1x_ptr_write(chip, 0x45, 0, 0x700);

Those (1) and (2) should work on bother the LS and the Dell OEM.


then, are they exclusive?


I think you could add a mixer toggle switch for either (1) or (2).
I don't know what each bit in those registers does, so for now it could 
probably be exclusive.

I have also heard that the way to program the Audigy LS might also apply 
 in some way the Audigy 2 to get the high samples rates working on the 
Audigy 2.

Hopefully I will get certain answers soon.

Cheers
James
---
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562alloc_id=6184op=click
___
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel


Re: [Alsa-devel] Emu10k1x driver

2004-05-14 Thread fmoraes74

the attached patch includes some fixes by me for the latest cvs, and
changes the periods to 2.  i'll apply it to cvs now.

Is your patch for kernel 2.6?

Francisco


The best thing to hit the Internet in years - NetZero HiSpeed!
Surf the Web up to FIVE TIMES FASTER!
Only $14.95/ month -visit www.netzero.com to sign up today!


---
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562alloc_id=6184op=click
___
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel


Re: [Alsa-devel] Emu10k1x driver

2004-05-13 Thread Takashi Iwai
At Wed, 12 May 2004 18:36:56 GMT,
[EMAIL PROTECTED] wrote:
 
 
  nice, i'll add this to alsa-driver tree.
  i guess pci/emu10k1 is the best location.
 
 That's fine. I had it under pci on my system just because it was easier.
 
  would you mind to change the indentation level to 8, as described in
 Documentation/CodingStyle?
  kernel people prefer to have the codes with the same style.
 
 No problem but I won't be able to do that for a couple of days
 now. If someone wants to reformat the code, feel free to do it, as I
 haven't changed anything. 

ok, i'll do it when i put this to cvs tree.

  alsaplayer didn't work, not sure why. I've also tested with the pcm
  test in alsa-lib which seems to be jumping, so that's another
  problem. 
 
 Any ideas/suggestions on the alsaplayer? I will test it more once I
 have time, but it bothered me that it didn't work with my driver. 

what alsaplayer tells exactly?  the configuration failure, or you hear
weird sounds?


Takashi


---
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562alloc_id=6184op=click
___
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel


Re: [Alsa-devel] Emu10k1x driver

2004-05-12 Thread Takashi Iwai
At Wed, 12 May 2004 00:31:43 GMT,
[EMAIL PROTECTED] wrote:
 
 Here's the first pass at the driver. I've tested it mainly with XMMS with the ALSA 
 output plugin.

nice, i'll add this to alsa-driver tree.
i guess pci/emu10k1 is the best location.

would you mind to change the indentation level to 8, as described in
Documentation/CodingStyle?
kernel people prefer to have the codes with the same style.


 alsaplayer didn't work, not sure why. I've also tested with the pcm
 test in alsa-lib which seems to be jumping, so that's another
 problem. 
 
 I've removed the joystick support for now, but the only reason I
 added it was because the intel8x0.c driver has joystick support in
 it. 

as i wrote in another mail, it's better to split it out of the sound
driver as long as it's possible.


thanks,

Takashi


---
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson  Lucent use to deliver
higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
___
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel


Re: [Alsa-devel] Emu10k1x driver

2004-05-12 Thread fmoraes74

 nice, i'll add this to alsa-driver tree.
 i guess pci/emu10k1 is the best location.

That's fine. I had it under pci on my system just because it was easier.

 would you mind to change the indentation level to 8, as described in
Documentation/CodingStyle?
 kernel people prefer to have the codes with the same style.

No problem but I won't be able to do that for a couple of days now. If someone wants 
to reformat the code, feel free to do it, as I haven't changed anything.

 alsaplayer didn't work, not sure why. I've also tested with the pcm
 test in alsa-lib which seems to be jumping, so that's another
 problem. 

Any ideas/suggestions on the alsaplayer? I will test it more once I have time, but it 
bothered me that it didn't work with my driver.

Regards,

Francisco


The best thing to hit the Internet in years - NetZero HiSpeed!
Surf the Web up to FIVE TIMES FASTER!
Only $14.95/ month -visit www.netzero.com to sign up today!


---
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson  Lucent use to deliver
higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
___
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel


[Alsa-devel] Emu10k1x driver

2004-05-11 Thread fmoraes74
Here's the first pass at the driver. I've tested it mainly with XMMS with the ALSA 
output plugin.

alsaplayer didn't work, not sure why. I've also tested with the pcm test in alsa-lib 
which seems to be jumping, so that's another problem.

I've removed the joystick support for now, but the only reason I added it was because 
the intel8x0.c driver has joystick support in it.

Enjoy,

Francisco
/*
 *  Copyright (c) by Francisco Moraes [EMAIL PROTECTED]
 *  Driver EMU10K1X chips
 *
 *  BUGS:
 *--
 *
 *  TODO:
 *--
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 *
 */
#include sound/driver.h
#include linux/init.h
#include linux/pci.h
#include linux/slab.h
#include sound/core.h
#define SNDRV_GET_ID
#include sound/initval.h
#include sound/pcm.h
#include sound/ac97_codec.h

MODULE_AUTHOR(Francisco Moraes [EMAIL PROTECTED]);
MODULE_DESCRIPTION(EMU10K1X);
MODULE_LICENSE(GPL);
MODULE_CLASSES({sound});
MODULE_DEVICES({{Dell Creative Labs,SB Live!});

// module parameters (see Module Parameters)
static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;

// some definitions were borrowed from emu10k1 driver as they seem to be the same
//
/* PCI function 0 registers, address = val + PCIBASE0		*/
//

#define PTR			0x00		/* Indexed register set pointer register	*/
		/* NOTE: The CHANNELNUM and ADDRESS words can	*/
		/* be modified independently of each other.	*/

#define DATA			0x04		/* Indexed register set data register		*/

#define IPR			0x08		/* Global interrupt pending register		*/
		/* Clear pending interrupts by writing a 1 to	*/
		/* the relevant bits and zero to the other bits	*/
#define IPR_CH_0_LOOP   0x0800  /* Channel 0 loop   */
#define IPR_CH_0_HALF_LOOP  0x0100  /* Channel 0 half loop  */

#define INTE			0x0c		/* Interrupt enable register			*/
#define INTE_CH_0_LOOP  0x0800  /* Channel 0 loop   */
#define INTE_CH_0_HALF_LOOP 0x0100  /* Channel 0 half loop  */

#define HCFG			0x14		/* Hardware config register			*/

#define HCFG_LOCKSOUNDCACHE	0x0008	/* 1 = Cancel bustmaster accesses to soundcache */
		/* NOTE: This should generally never be used.  	*/
#define HCFG_AUDIOENABLE	0x0001	/* 0 = CODECs transmit zero-valued samples	*/
		/* Should be set to 1 when the EMU10K1 is	*/
		/* completely initialized.			*/


#define AC97DATA		0x1c		/* AC97 register set data register (16 bit)	*/

#define AC97ADDRESS		0x1e		/* AC97 register set address register (8 bit)	*/

#define SPCS0			0x42		/* SPDIF output Channel Status 0 register	*/

#define SPCS1			0x43		/* SPDIF output Channel Status 1 register	*/

#define SPCS2			0x44		/* SPDIF output Channel Status 2 register	*/

#define SPCS_CLKACCYMASK	0x3000	/* Clock accuracy*/
#define SPCS_CLKACCY_1000PPM	0x	/* 1000 parts per million			*/
#define SPCS_CLKACCY_50PPM	0x1000	/* 50 parts per million*/
#define SPCS_CLKACCY_VARIABLE	0x2000	/* Variable accuracy*/
#define SPCS_SAMPLERATEMASK	0x0f00	/* Sample rate	*/
#define SPCS_SAMPLERATE_44	0x	/* 44.1kHz sample rate*/
#define SPCS_SAMPLERATE_48	0x0200	/* 48kHz sample rate*/
#define SPCS_SAMPLERATE_32	0x0300	/* 32kHz sample rate*/
#define SPCS_CHANNELNUMMASK	0x00f0	/* Channel number*/
#define SPCS_CHANNELNUM_UNSPEC	0x	/* Unspecified channel number			*/
#define SPCS_CHANNELNUM_LEFT	0x0010	/* Left channel	*/
#define SPCS_CHANNELNUM_RIGHT	0x0020	/* Right channel*/
#define SPCS_SOURCENUMMASK	0x000f	/* Source number*/
#define SPCS_SOURCENUM_UNSPEC	0x	/* Unspecified source number			*/
#define SPCS_GENERATIONSTATUS	0x8000	/* Originality flag (see IEC-958 spec)		*/
#define SPCS_CATEGORYCODEMASK	0x7f00	/* Category code (see IEC-958 spec)		*/
#define SPCS_MODEMASK		0x00c0	/* Mode (see IEC-958 spec)			*/
#define SPCS_EMPHASISMASK	0x0038	/* 

Re: [Alsa-devel] Emu10k1x driver

2004-05-11 Thread James Courtier-Dutton
[EMAIL PROTECTED] wrote:
Here's the first pass at the driver. I've tested it mainly with XMMS with the ALSA output plugin.

alsaplayer didn't work, not sure why. I've also tested with the pcm test in alsa-lib which seems to be jumping, so that's another problem.

I've removed the joystick support for now, but the only reason I added it was because the intel8x0.c driver has joystick support in it.

Enjoy,

Francisco


I would like to add some information that might help people modifying 
this for the Audigy LS.

The outputs for the card work in 2 modes.
1) Probably analogue on the output jacks.
snd_emu10k1x_ptr_write(chip, 0x41, 0, 0x70f);
snd_emu10k1x_ptr_write(chip, 0x45, 0, 0);
2) Probably digital spdif on the output jacks.
snd_emu10k1x_ptr_write(chip, 0x41, 0, 0x1000f);
snd_emu10k1x_ptr_write(chip, 0x45, 0, 0x700);
To enable this driver loading for the Audigy LS, have the following PCI IDs.
static struct pci_device_id snd_emu10k1x_ids[] = {
  { 0x1102, 0x0006, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },  /* Dell OEM 
version (EMU10K1X) */
  { 0x1102, 0x0007, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },  /* Audigy LS */
  { 0, }
};

Other information: -
value = snd_emu10k1x_ptr_read(chip, 0x74, 0);
printk(Some special chip ID = %04x\n,value);
Further additions to the snd_emu10k1x_create() function, after the lines
snd_emu10k1x_ptr_write(chip, 0x41, 0, 0x70f); // ???
snd_emu10k1x_ptr_write(chip, 0x45, 0, 0);
snd_emu10k1x_ptr_write(chip, 0x65, 0, 0x1000);
snd_emu10k1x_ptr_write(chip, 0x72, 0, 0xf0f003f);
snd_emu10k1x_ptr_write(chip, 0x71, 0, 0xf000);
snd_emu10k1x_ptr_write(chip, 0x61, 0, 0x0);
snd_emu10k1x_ptr_write(chip, 0x62, 0, 0x0);
The AudigyLS also seems to use the emu10k1x_ptr 0x75 a lot in interrupt 
routines, but the Dell OEM one does not.

Cheers
James


---
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson  Lucent use to deliver
higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
___
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel


Re: [Alsa-devel] Emu10k1x driver

2004-05-11 Thread Francisco Moraes
I'd like to send special thanks for James Courtier-Dutton and Takashi 
Iwai for helping out with some of the questions I had during the driver. 
The frames concept took me a while and also the problem that I had 
initally of mismatched buffer size and sample rate.

Francisco



---
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson  Lucent use to deliver
higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
___
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel