From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: ALSA Driver for Sparc DBRI chips Date: Thu, 25 Nov 2004 15:01:56 +0100 Message-ID: References: <20041121095008.GA18392@palantir8> Mime-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: multipart/mixed; boundary="Multipart_Thu_Nov_25_15:01:56_2004-1" Return-path: In-Reply-To: <20041121095008.GA18392@palantir8> Sender: alsa-devel-admin@lists.sourceforge.net Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Martin Habets Cc: alsa-devel@lists.sourceforge.net, baccala@freesoft.org, rfkoenig@immd4.informatik.uni-erlangen.de List-Id: alsa-devel@alsa-project.org --Multipart_Thu_Nov_25_15:01:56_2004-1 Content-Type: text/plain; charset=US-ASCII 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 --Multipart_Thu_Nov_25_15:01:56_2004-1 Content-Type: text/plain; charset=US-ASCII --- ../../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++; --Multipart_Thu_Nov_25_15:01:56_2004-1-- ------------------------------------------------------- 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/