Skip to contentSkip to conversation

ALSA Driver for Sparc DBRI chips

DISCUSSION Martin Habets 2 participants 5 messages Nov 21, 2004 – Dec 18, 2004

lore
Share & tools
lore
#0 lore raw

Hi,

I have been working on an ALSA driver for the DBRI/CS4215 chip combo found in Sparc machines. It is a port of the 2.5 OSS driver.

Things are starting to work, but since this is my first major undertaking I'm looking for your comments. Ask early, ask often... At this point I expect playback to work to all possible outputs (there is some clipping on 16 bit formats). I have not been able to get recording output in a file, though it does seem to catch data.

So I look for anything from coding style to design issues to spelling to 'it worked' to 'I get an error' to the-meaning-of-the-universe. Just keep the phasers on stun, please :)

At: http://www.mph.eclipse.co.uk/pub/linux/dbri
you'll find these files:
- dbri.c Source code of the driver
- Alsa.patch Patch against Alsa-driver 1.0.7rc1, without the driver
code itself (pick up dbri.c and put it in alsa-kernel/sparc).
- Alsa-build.patch Patched to make Alsa build for sparc drivers. This
code is already in the current Alsa version, so you may not need it.
- Linux-2.6.8.patch Patch against the Linux kernel (including the driver
code). Will apply against other 2.6 kernels too.

Thanks for your time,

Signature · 12 lines
Martin
---------------------------------------------------------------------------
30 years from now GNU/Linux will be as redundant a term as UNIX/MERT is 
today. - Martin Habets
---------------------------------------------------------------------------


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
#1 lore raw

At Sun, 21 Nov 2004 09:50:08 +0000,

Quoted 12 lines · Martin Habets

Hi,

I have been working on an ALSA driver for the DBRI/CS4215 chip combo found in Sparc machines. It is a port of the 2.5 OSS driver.

Things are starting to work, but since this is my first major undertaking I'm looking for your comments. Ask early, ask often... At this point I expect playback to work to all possible outputs (there is some clipping on 16 bit formats). I have not been able to get recording output in a file, though it does seem to catch data.

Quoted 3 lines

So I look for anything from coding style to design issues to spelling to 'it worked' to 'I get an error' to the-meaning-of-the-universe. Just keep the phasers on stun, please :)

Thanks for the patch.

I modified some codes to adapt to the latest 2.6.10-rc2, and reduced compile warnings (just checked with the cross-compile environment.) ALso, the spin_lock() is changed to spin_lock_irq() in the prepare callback since the recent version is it became non-atomic. The patch is below.

If you think your driver is mature to merge to Linux kernel, let me
know. Otherwise I'll merge it to alsa-driver tree which is regarded
as the experimental tree and not submitted to mainstream kernel.

BTW, the build environment of alsa-driver for sparc has been fixed recently on CVS.

Takashi

dbri.c renamed from ../dbri/dbri.c +16 -11
@@ -72,13 +72,12 @@
 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;	/* Index 0-MAX */
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable this card */
-static int boot_devs;
 
-module_param_array(index, int, boot_devs, 0444);
+module_param_array(index, int, NULL, 0444);
 MODULE_PARM_DESC(index, "Index value for Sun DBRI soundcard.");
-module_param_array(id, charp, boot_devs, 0444);
+module_param_array(id, charp, NULL, 0444);
 MODULE_PARM_DESC(id, "ID string for Sun DBRI soundcard.");
-module_param_array(enable, bool, boot_devs, 0444);
+module_param_array(enable, bool, NULL, 0444);
 MODULE_PARM_DESC(enable, "Enable Sun DBRI soundcard.");
 
 #define DBRI_DEBUG
@@ -94,13 +93,13 @@
 module_param(dbri_debug, int, 0444);
 MODULE_PARM_DESC(dbri_debug, "Debug value for Sun DBRI soundcard.");
 
+#ifdef DBRI_DEBUG
 static char *cmds[] = {
 	"WAIT", "PAUSE", "JUMP", "IIQ", "REX", "SDP", "CDP", "DTS",
 	"SSP", "CHI", "NT", "TE", "CDEC", "TEST", "CDM", "RESRV"
 };
 
-#ifdef DBRI_DEBUG
-#define dprintk(a, x...) if(dbri_debug & a) snd_printd(KERN_DEBUG ## x)
+#define dprintk(a, x...) if(dbri_debug & a) printk(KERN_DEBUG x)
 
 #define DBRI_CMD(cmd, intr, value) ((cmd << 28) |			\
 				    (1 << 27) | \
@@ -321,7 +320,7 @@
 	volatile struct dbri_dma *dma;	/* Pointer to our DMA block */
 	u32 dma_dvma;		/* DBRI visible DMA address */
 
-	unsigned long regs;	/* dbri HW regs */
+	void __iomem *regs;	/* dbri HW regs */
 	int dbri_version;	/* 'e' and up is OK */
 	int dbri_irqp;		/* intr queue pointer */
 	int wait_seen;
@@ -1876,7 +1875,9 @@
 	int channel = D_INTR_GETCHAN(x);
 	int command = D_INTR_GETCMD(x);
 	int code = D_INTR_GETCODE(x);
+#ifdef DBRI_DEBUG
 	int rval = D_INTR_GETRVAL(x);
+#endif
 
 	if (channel == D_INTR_CMD) {
 		dprintk(D_CMD, "INTR: Command: %-5s  Value:%d\n",
@@ -2159,7 +2160,7 @@
 		info->left = info->size;	/* To trigger submittal */
 	}
 
-	spin_lock(&dbri->lock);
+	spin_lock_irq(&dbri->lock);
 
 	/* Setup the all the transmit/receive desciptors to cover the
 	 * whole DMA buffer.
@@ -2169,7 +2170,7 @@
 
 	runtime->stop_threshold = DBRI_TD_MAXCNT / runtime->channels;
 
-	spin_unlock(&dbri->lock);
+	spin_unlock_irq(&dbri->lock);
 
 	dprintk(D_USR, "prepare audio output. %d bytes\n", info->size);
 	return ret;
@@ -2184,7 +2185,7 @@
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_START:
 		dprintk(D_USR, "start audio, period is %d bytes\n",
-			snd_pcm_lib_period_bytes(substream));
+			(int)snd_pcm_lib_period_bytes(substream));
 		/* Enable & schedule the tasklet that re-submits the TDs. */
 		xmit_descs_task.data = (unsigned long)dbri;
 		tasklet_schedule(&xmit_descs_task);
@@ -2484,6 +2485,7 @@
 	snd_iprintf(buffer, "REG9: 0x%x\n", sbus_readl(dbri->regs + REG9));
 }
 
+#ifdef DBRI_DEBUG
 static void dbri_debug_read(snd_info_entry_t * entry,
 			    snd_info_buffer_t * buffer)
 {
@@ -2519,6 +2521,7 @@
 		dbri_debug = i & 0x3f;
 	}
 }
+#endif
 
 void snd_dbri_proc(snd_dbri_t * dbri)
 {
@@ -2528,11 +2531,13 @@
 	err = snd_card_proc_new(dbri->card, "regs", &entry);
 	snd_info_set_text_ops(entry, dbri, 1024, dbri_regs_read);
 
+#ifdef DBRI_DEBUG
 	err = snd_card_proc_new(dbri->card, "debug", &entry);
 	snd_info_set_text_ops(entry, dbri, 4096, dbri_debug_read);
 	entry->mode = S_IFREG | S_IRUGO | S_IWUSR; /* Writable for root */
 	entry->c.text.write_size = 256;
 	entry->c.text.write = dbri_debug_write;
+#endif
 }
 
 /*
@@ -2676,7 +2681,7 @@
 		return err;
 	}
 
-	printk(KERN_INFO "audio%d at 0x%lx (irq %d) is DBRI(%c)+CS4215(%d)\n",
+	printk(KERN_INFO "audio%d at %p (irq %d) is DBRI(%c)+CS4215(%d)\n",
 	       dev, dbri->regs,
 	       dbri->irq, dbri->dbri_version, dbri->mm.version);
 	dev++;
#2 lore raw

At Thu, 25 Nov 2004 15:01:56 +0100,

Quoted 20 lines · I wrote:

[1 <text/plain; US-ASCII (7bit)>]
At Sun, 21 Nov 2004 09:50:08 +0000,

Quoted 12 lines · Martin Habets

Hi,

I have been working on an ALSA driver for the DBRI/CS4215 chip combo found in Sparc machines. It is a port of the 2.5 OSS driver.

Things are starting to work, but since this is my first major undertaking I'm looking for your comments. Ask early, ask often... At this point I expect playback to work to all possible outputs (there is some clipping on 16 bit formats). I have not been able to get recording output in a file, though it does seem to catch data.

Quoted 3 lines

So I look for anything from coding style to design issues to spelling to 'it worked' to 'I get an error' to the-meaning-of-the-universe. Just keep the phasers on stun, please :)

Quoted 7 lines

Thanks for the patch.

I modified some codes to adapt to the latest 2.6.10-rc2, and reduced compile warnings (just checked with the cross-compile environment.) ALso, the spin_lock() is changed to spin_lock_irq() in the prepare callback since the recent version is it became non-atomic. The patch is below.

One thing forgot: the proc write for debug option isn't necessary. You can do the same via sysfs when you set the write permission to the option.

Takashi

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/

#3 lore raw
In reply to Takashi Iwai

At Thu, 25 Nov 2004 15:01:56 +0100,

Quoted 28 lines · I wrote:

[1 <text/plain; US-ASCII (7bit)>]
At Sun, 21 Nov 2004 09:50:08 +0000,

Quoted 12 lines · Martin Habets

Hi,

I have been working on an ALSA driver for the DBRI/CS4215 chip combo found in Sparc machines. It is a port of the 2.5 OSS driver.

Things are starting to work, but since this is my first major undertaking I'm looking for your comments. Ask early, ask often... At this point I expect playback to work to all possible outputs (there is some clipping on 16 bit formats). I have not been able to get recording output in a file, though it does seem to catch data.

Quoted 3 lines

So I look for anything from coding style to design issues to spelling to 'it worked' to 'I get an error' to the-meaning-of-the-universe. Just keep the phasers on stun, please :)

Thanks for the patch.

I modified some codes to adapt to the latest 2.6.10-rc2, and reduced compile warnings (just checked with the cross-compile environment.) ALso, the spin_lock() is changed to spin_lock_irq() in the prepare callback since the recent version is it became non-atomic. The patch is below.

Quoted 3 lines

If you think your driver is mature to merge to Linux kernel, let me
know. Otherwise I'll merge it to alsa-driver tree which is regarded
as the experimental tree and not submitted to mainstream kernel.

Well, no response yet, so I checked it into alsa-driver tree for the time being.

Takashi

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/

#4 lore raw
In reply to Takashi Iwai

Takashi,

Sorry for the late reply. I was travelling and forgot to check alsa-devel (shame on me!). Besides, it seems quite hard to get hold of a sparc32 to test on while on the road.

Quoted 9 lines · Takashi Iwai

I modified some codes to adapt to the latest 2.6.10-rc2, and reduced compile warnings (just checked with the cross-compile environment.) ALso, the spin_lock() is changed to spin_lock_irq() in the prepare callback since the recent version is it became non-atomic. The patch is below.

If you think your driver is mature to merge to Linux kernel, let me
know. Otherwise I'll merge it to alsa-driver tree which is regarded
as the experimental tree and not submitted to mainstream kernel.

I consider the code still expermental, so alsa-driver is okay. I'd like some other sparc folks to try it before it gets submitted to mainstream, even if it works okay for me.

Quoted 2 lines

BTW, the build environment of alsa-driver for sparc has been fixed recently on CVS.

Thanks for the tip. I'll check it out.

Martin

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/