Re: [Alsa-devel] [PATCH] Audigy LS support.

2004-05-28 Thread James Courtier-Dutton
Takashi Iwai wrote:
At Thu, 27 May 2004 20:17:17 +0100,
James Courtier-Dutton wrote:
Here is my first go at Audigy LS support.
It can play sound to the front speakers.

great!

/* hardware definition */
static snd_pcm_hardware_t snd_audigyls_playback_hw = {
	.info =			(SNDRV_PCM_INFO_MMAP | 
 SNDRV_PCM_INFO_INTERLEAVED |
 SNDRV_PCM_INFO_BLOCK_TRANSFER |
 SNDRV_PCM_INFO_MMAP_VALID),
	.formats =		SNDRV_PCM_FMTBIT_S16_LE,
	.rates =		SNDRV_PCM_RATE_48000,
	.rate_min =		48000,
	.rate_max =		48000,
	.channels_min =		2,
	.channels_max =		2,
	.buffer_bytes_max =	(32*1024),
	.period_bytes_min =	64,
	.period_bytes_max =	(16*1024),
	.periods_min =		2,
	.periods_max =		16,
^^
are you sure this is ok?
in the case of emu10k1, it generates irq twice per buffer (HALF and
BUFFER).  then periods_max must be 2.
With periods_max set to 2, sound plays, but has artifacts. With periods 
 2, the sound is smooth, without any clicks etc.


anyway, the driver code is quite similar with emu10k1x.c.
i checked the diff between them and the amount of difference is really
small.
how about merging them?  then we can understand / maintain the codes
better.
Takashi

I would like to keep the two drivers separate for a bit. That way I can 
keep changing stuff without caring if the emu10k1x.c stays working.
Once I get all the features working, we could then look at merging the two.
There is still a lot to go.
1) 24bit 192khz sound out.
2) 5.1 sound.
3) Digital SPDIF output.
4) Capture.
5) MIDI.
It seems that the changing of the sample rate etc. from the default is 
done via some sort of UART.

Also, I can change how often the interrupts happen, so I will need to 
implement that.

Cheers
James
---
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149alloc_id=8166op=click
___
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel


Re: [Alsa-devel] [PATCH] Audigy LS support.

2004-05-28 Thread Takashi Iwai
At Fri, 28 May 2004 12:16:09 +0100,
James Courtier-Dutton wrote:
 
 Takashi Iwai wrote:
  At Thu, 27 May 2004 20:17:17 +0100,
  James Courtier-Dutton wrote:
  
 Here is my first go at Audigy LS support.
 It can play sound to the front speakers.
  
  
  great!
  
  
  
 /* hardware definition */
 static snd_pcm_hardware_t snd_audigyls_playback_hw = {
 .info = (SNDRV_PCM_INFO_MMAP | 
  SNDRV_PCM_INFO_INTERLEAVED |
  SNDRV_PCM_INFO_BLOCK_TRANSFER |
  SNDRV_PCM_INFO_MMAP_VALID),
 .formats =  SNDRV_PCM_FMTBIT_S16_LE,
 .rates =SNDRV_PCM_RATE_48000,
 .rate_min = 48000,
 .rate_max = 48000,
 .channels_min = 2,
 .channels_max = 2,
 .buffer_bytes_max = (32*1024),
 .period_bytes_min = 64,
 .period_bytes_max = (16*1024),
 .periods_min =  2,
 .periods_max =  16,
  
  ^^
  are you sure this is ok?
  in the case of emu10k1, it generates irq twice per buffer (HALF and
  BUFFER).  then periods_max must be 2.
 
 With periods_max set to 2, sound plays, but has artifacts. With periods 
   2, the sound is smooth, without any clicks etc.

well, then the question is how the period size is controlled.
you have never set the period size/bytes on the hardware.


  anyway, the driver code is quite similar with emu10k1x.c.
  i checked the diff between them and the amount of difference is really
  small.
  how about merging them?  then we can understand / maintain the codes
  better.
  
  
  Takashi
  
  
 
 I would like to keep the two drivers separate for a bit. That way I can 
 keep changing stuff without caring if the emu10k1x.c stays working.

ok.  but it's also true that changing one of them can help to reveal
features of these chips.  anyway, keep tracking of cvs changes...


Takashi


 Once I get all the features working, we could then look at merging the two.
 There is still a lot to go.
 1) 24bit 192khz sound out.
 2) 5.1 sound.
 3) Digital SPDIF output.
 4) Capture.
 5) MIDI.
 It seems that the changing of the sample rate etc. from the default is 
 done via some sort of UART.
 
 Also, I can change how often the interrupts happen, so I will need to 
 implement that.
 
 Cheers
 James
 


---
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149alloc_id=8166op=click
___
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel


[Alsa-devel] [PATCH] Audigy LS support.

2004-05-27 Thread James Courtier-Dutton
Here is my first go at Audigy LS support.
It can play sound to the front speakers.
Only one mixer volume control does anything, that is the Front Volume 
control in alsamixer.

I attach 2 files. One is a new audigyls.c, and the other is a patch to 
get alsa-driver to build with it.

audigyls.c should be added to directory ./alsa-driver/pci/emu10k1/
Support for more output channels will be added later, but this is just a 
proof of concept, so that other people wishing to write audigyls drivers 
for other operating systems can make a start.

Cheers
James
Index: alsa-driver/pci/Kconfig
===
RCS file: /cvsroot/alsa/alsa-driver/pci/Kconfig,v
retrieving revision 1.19
diff -u -r1.19 Kconfig
--- alsa-driver/pci/Kconfig 24 May 2004 13:27:31 -  1.19
+++ alsa-driver/pci/Kconfig 27 May 2004 18:35:31 -
@@ -26,6 +26,14 @@
  Say 'Y' or 'M' to include support for Sound Blaster Live Dell
  OEM version.
 
+config SND_AUDIGYLS
+   tristate SB Audigy LS
+   depends on SND
+   select SND_AC97_CODEC
+   help
+ Say 'Y' or 'M' to include support for Sound Blaster Live Dell
+ OEM version.
+
 config SND_ATIIXP_MODEM
tristate ATI IXP 150/200/250 Modem
depends on SND
Index: alsa-driver/pci/emu10k1/Makefile
===
RCS file: /cvsroot/alsa/alsa-driver/pci/emu10k1/Makefile,v
retrieving revision 1.6
diff -u -r1.6 Makefile
--- alsa-driver/pci/emu10k1/Makefile14 May 2004 13:42:49 -  1.6
+++ alsa-driver/pci/emu10k1/Makefile27 May 2004 18:35:31 -
@@ -6,8 +6,10 @@
 include $(SND_TOPDIR)/Makefile.conf
 
 snd-emu10k1x-objs := emu10k1x.o
+snd-audigyls-objs := audigyls.o
 
 obj-$(CONFIG_SND_EMU10K1X) += snd-emu10k1x.o
+obj-$(CONFIG_SND_AUDIGYLS) += snd-audigyls.o
 
 export-objs  := emu10k1_main.o
 
/*
 *  Copyright (c) by James Courtier-Dutton [EMAIL PROTECTED]
 *  Driver AUDIGYLS chips
 *
 *  BUGS:
 *--
 *
 *  TODO:
 *Surround and Center/LFE playback.
 *Capture.
 *SPDIF playback.
 *Other rates apart from 48khz.
 *MIDI
 *--
 *
 *   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
#include sound/info.h

MODULE_AUTHOR(James Courtier-Dutton [EMAIL PROTECTED]);
MODULE_DESCRIPTION(AUDIGYLS);
MODULE_LICENSE(GPL);
MODULE_CLASSES({sound});
MODULE_DEVICES({{Creative SB Audigy LS});

// 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 AUDIGYLS soundcard.);
MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
module_param_array(id, charp, boot_devs, 0444);
MODULE_PARM_DESC(id, ID string for the AUDIGYLS soundcard.);
MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
module_param_array(enable, bool, boot_devs, 0444);
MODULE_PARM_DESC(enable, Enable the AUDIGYLS soundcard.);
MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);


//
/* 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