All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Martin Habets <errandir_news@mph.eclipse.co.uk>
Cc: alsa-devel@lists.sourceforge.net, baccala@freesoft.org,
	rfkoenig@immd4.informatik.uni-erlangen.de
Subject: Re: ALSA Driver for Sparc DBRI chips
Date: Thu, 25 Nov 2004 15:01:56 +0100	[thread overview]
Message-ID: <s5hpt22ni23.wl@alsa2.suse.de> (raw)
In-Reply-To: <20041121095008.GA18392@palantir8>

[-- Attachment #1: Type: text/plain, Size: 1337 bytes --]

At Sun, 21 Nov 2004 09:50:08 +0000,
Martin Habets wrote:
> 
> 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 :)

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

[-- Attachment #2: Type: text/plain, Size: 3855 bytes --]

--- ../../dbri/dbri.c	2004-11-21 10:35:22.000000000 +0100
+++ dbri.c	2004-11-25 14:54:28.799223411 +0100
@@ -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++;

  reply	other threads:[~2004-11-25 14:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-21  9:50 ALSA Driver for Sparc DBRI chips Martin Habets
2004-11-25 14:01 ` Takashi Iwai [this message]
2004-11-25 15:55   ` Takashi Iwai
2004-12-01 13:58   ` Takashi Iwai
2004-12-18 15:15   ` Martin Habets

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hpt22ni23.wl@alsa2.suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=baccala@freesoft.org \
    --cc=errandir_news@mph.eclipse.co.uk \
    --cc=rfkoenig@immd4.informatik.uni-erlangen.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.