* [PATCH] ALSA AICA sound on SEGA Dreamcast - fix behaviour in poor resource conditions
@ 2007-07-05 22:07 Adrian McMenamin
2007-07-05 22:23 ` Adrian McMenamin
2007-07-06 9:25 ` [alsa-devel] " Takashi Iwai
0 siblings, 2 replies; 8+ messages in thread
From: Adrian McMenamin @ 2007-07-05 22:07 UTC (permalink / raw)
To: alsa-devel, Takashi Iwai; +Cc: linux-kernel
Patch against code in alsa-kernel - tested with patched up 2.6.21-rc7
and working well
Submitted by: Adrian McMenamin <adrian@mcmen.demon.co.uk>
Signed-off by: Adrian McMenamin <adrian@mcmen.demon.co.uk>
diff -ruN aicaold/aica.c aicanew/aica.c
--- aicaold/aica.c 2007-07-05 23:01:39.000000000 +0100
+++ aicanew/aica.c 2007-07-05 23:02:02.000000000 +0100
@@ -65,10 +65,6 @@
/* Use workqueue */
-static struct spu_work_holder {
- struct work_struct spu_dma_work;
- void *sspointer;
-} spu_working;
static struct workqueue_struct *aica_queue;
@@ -252,18 +248,15 @@
static void run_spu_dma(struct work_struct *work)
{
int buffer_size;
- struct snd_pcm_substream *substream;
struct snd_pcm_runtime *runtime;
struct snd_card_aica *dreamcastcard;
- struct spu_work_holder *holder = container_of(work, struct
spu_work_holder, spu_dma_work);
- substream = holder-> sspointer;
- dreamcastcard = substream->pcm->private_data;
- runtime = substream->runtime;
+ dreamcastcard = container_of(work, struct snd_card_aica, spu_dma_work);
+ runtime = dreamcastcard->substream->runtime;
if (unlikely(dreamcastcard->dma_check == 0)) {
buffer_size = frames_to_bytes(runtime, runtime->buffer_size);
if (runtime->channels > 1)
dreamcastcard->channel->flags |= 0x01;
- aica_dma_transfer(runtime->channels, buffer_size, substream);
+ aica_dma_transfer(runtime->channels, buffer_size, dreamcastcard->substream);
startup_aica(dreamcastcard);
dreamcastcard->clicks =
buffer_size / (AICA_PERIOD_SIZE * runtime->channels);
@@ -271,7 +264,7 @@
} else {
aica_dma_transfer(runtime->channels,
AICA_PERIOD_SIZE * runtime->channels,
- substream);
+ dreamcastcard->substream);
snd_pcm_period_elapsed(dreamcastcard->substream);
dreamcastcard->clicks++;
if (unlikely(dreamcastcard->clicks >= AICA_PERIOD_NUMBER))
@@ -307,7 +300,8 @@
dreamcastcard->current_period = play_period;
if (unlikely(dreamcastcard->dma_check == 0))
dreamcastcard->dma_check = 1;
- queue_work(aica_queue, &(spu_working.spu_dma_work));
+ queue_work(aica_queue, &(dreamcastcard->spu_dma_work));
+
}
static void spu_begin_dma(struct snd_pcm_substream *substream)
@@ -317,10 +311,8 @@
struct snd_pcm_runtime *runtime;
runtime = substream->runtime;
dreamcastcard = substream->pcm->private_data;
- /* Use queue to do the heavy lifting */
- spu_working.sspointer = substream;
- INIT_WORK(&(spu_working.spu_dma_work), run_spu_dma);
- queue_work(aica_queue, &(spu_working.spu_dma_work));
+ //get the queue to do the work
+ queue_work(aica_queue, &(dreamcastcard->spu_dma_work));
/* Timer may already be running */
if (unlikely(dreamcastcard->timer.data)) {
mod_timer(&dreamcastcard->timer, jiffies + 4);
@@ -366,7 +358,9 @@
*substream)
{
struct snd_card_aica *dreamcastcard = substream->pcm->private_data;
+ flush_workqueue(aica_queue);
del_timer(&dreamcastcard->timer);
+ aica_chn_halt();
kfree(dreamcastcard->channel);
spu_disable();
return 0;
@@ -402,17 +396,10 @@
static int snd_aicapcm_pcm_trigger(struct snd_pcm_substream
*substream, int cmd)
{
- struct snd_card_aica *dreamcastcard;
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
spu_begin_dma(substream);
break;
- case SNDRV_PCM_TRIGGER_STOP:
- dreamcastcard = substream->pcm->private_data;
- if (dreamcastcard->timer.data)
- del_timer(&dreamcastcard->timer);
- aica_chn_halt();
- break;
default:
return -EINVAL;
}
@@ -610,6 +597,8 @@
strcpy(dreamcastcard->card->shortname, SND_AICA_DRIVER);
strcpy(dreamcastcard->card->longname,
"Yamaha AICA Super Intelligent Sound Processor for SEGA Dreamcast");
+ //start the worker thread
+ INIT_WORK(&(dreamcastcard->spu_dma_work), run_spu_dma);
/* Load the PCM 'chip' */
err = snd_aicapcmchip(dreamcastcard, 0);
if (unlikely(err < 0))
diff -ruN aicaold/aica.h aicanew/aica.h
--- aicaold/aica.h 2007-07-05 23:01:39.000000000 +0100
+++ aicanew/aica.h 2007-07-05 23:02:02.000000000 +0100
@@ -69,6 +69,7 @@
};
struct snd_card_aica {
+ struct work_struct spu_dma_work;
struct snd_card *card;
struct aica_channel *channel;
struct snd_pcm_substream *substream;
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ALSA AICA sound on SEGA Dreamcast - fix behaviour in poor resource conditions
2007-07-05 22:07 [PATCH] ALSA AICA sound on SEGA Dreamcast - fix behaviour in poor resource conditions Adrian McMenamin
@ 2007-07-05 22:23 ` Adrian McMenamin
2007-07-06 9:25 ` [alsa-devel] " Takashi Iwai
1 sibling, 0 replies; 8+ messages in thread
From: Adrian McMenamin @ 2007-07-05 22:23 UTC (permalink / raw)
To: alsa-devel, Takashi Iwai; +Cc: linux-kernel
On 05/07/07, Adrian McMenamin <adrianmcmenamin@gmail.com> wrote:
> Patch against code in alsa-kernel - tested with patched up 2.6.21-rc7
> and working well
>
Apologies - obviously I mean 2.6.22-rc7 patched with the aica driver
now in alsa-kernel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [alsa-devel] [PATCH] ALSA AICA sound on SEGA Dreamcast - fix behaviour in poor resource conditions
2007-07-05 22:07 [PATCH] ALSA AICA sound on SEGA Dreamcast - fix behaviour in poor resource conditions Adrian McMenamin
2007-07-05 22:23 ` Adrian McMenamin
@ 2007-07-06 9:25 ` Takashi Iwai
2007-07-06 9:46 ` Adrian McMenamin
1 sibling, 1 reply; 8+ messages in thread
From: Takashi Iwai @ 2007-07-06 9:25 UTC (permalink / raw)
To: Adrian McMenamin; +Cc: alsa-devel, linux-kernel
At Thu, 5 Jul 2007 23:07:44 +0100,
Adrian McMenamin wrote:
> @@ -402,17 +396,10 @@
> static int snd_aicapcm_pcm_trigger(struct snd_pcm_substream
> *substream, int cmd)
> {
> - struct snd_card_aica *dreamcastcard;
> switch (cmd) {
> case SNDRV_PCM_TRIGGER_START:
> spu_begin_dma(substream);
> break;
> - case SNDRV_PCM_TRIGGER_STOP:
> - dreamcastcard = substream->pcm->private_data;
> - if (dreamcastcard->timer.data)
> - del_timer(&dreamcastcard->timer);
> - aica_chn_halt();
> - break;
> default:
> return -EINVAL;
> }
Is this a correct change? Then you'd have no control for stopping the
stream.
(BTW, your embedded patch was malformed...)
thanks,
Takashi
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [alsa-devel] [PATCH] ALSA AICA sound on SEGA Dreamcast - fix behaviour in poor resource conditions
2007-07-06 9:25 ` [alsa-devel] " Takashi Iwai
@ 2007-07-06 9:46 ` Adrian McMenamin
2007-07-06 9:56 ` Takashi Iwai
0 siblings, 1 reply; 8+ messages in thread
From: Adrian McMenamin @ 2007-07-06 9:46 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel, linux-kernel
On 06/07/07, Takashi Iwai <tiwai@suse.de> wrote:
> At Thu, 5 Jul 2007 23:07:44 +0100,
> Adrian McMenamin wrote:
> > @@ -402,17 +396,10 @@
> > static int snd_aicapcm_pcm_trigger(struct snd_pcm_substream
> > *substream, int cmd)
> > {
> > - struct snd_card_aica *dreamcastcard;
> > switch (cmd) {
> > case SNDRV_PCM_TRIGGER_START:
> > spu_begin_dma(substream);
> > break;
> > - case SNDRV_PCM_TRIGGER_STOP:
> > - dreamcastcard = substream->pcm->private_data;
> > - if (dreamcastcard->timer.data)
> > - del_timer(&dreamcastcard->timer);
> > - aica_chn_halt();
> > - break;
> > default:
> > return -EINVAL;
> > }
>
> Is this a correct change? Then you'd have no control for stopping the
> stream.
>
The shutdown is all done in the close() now, partly because
snd_aicapcm_pcm_trigger cannot sleep and close() can. Is there a
pressing reason to put code in snd_aicapcm_pcm_trigger?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [alsa-devel] [PATCH] ALSA AICA sound on SEGA Dreamcast - fix behaviour in poor resource conditions
2007-07-06 9:46 ` Adrian McMenamin
@ 2007-07-06 9:56 ` Takashi Iwai
2007-07-06 10:09 ` Adrian McMenamin
0 siblings, 1 reply; 8+ messages in thread
From: Takashi Iwai @ 2007-07-06 9:56 UTC (permalink / raw)
To: Adrian McMenamin; +Cc: alsa-devel, linux-kernel
At Fri, 6 Jul 2007 10:46:59 +0100,
Adrian McMenamin wrote:
>
> On 06/07/07, Takashi Iwai <tiwai@suse.de> wrote:
> > At Thu, 5 Jul 2007 23:07:44 +0100,
> > Adrian McMenamin wrote:
> > > @@ -402,17 +396,10 @@
> > > static int snd_aicapcm_pcm_trigger(struct snd_pcm_substream
> > > *substream, int cmd)
> > > {
> > > - struct snd_card_aica *dreamcastcard;
> > > switch (cmd) {
> > > case SNDRV_PCM_TRIGGER_START:
> > > spu_begin_dma(substream);
> > > break;
> > > - case SNDRV_PCM_TRIGGER_STOP:
> > > - dreamcastcard = substream->pcm->private_data;
> > > - if (dreamcastcard->timer.data)
> > > - del_timer(&dreamcastcard->timer);
> > > - aica_chn_halt();
> > > - break;
> > > default:
> > > return -EINVAL;
> > > }
> >
> > Is this a correct change? Then you'd have no control for stopping the
> > stream.
> >
>
> The shutdown is all done in the close() now, partly because
> snd_aicapcm_pcm_trigger cannot sleep and close() can. Is there a
> pressing reason to put code in snd_aicapcm_pcm_trigger?
I guess you shoud call del_timer() there at least. Otherwise the
timer handler (aica_period_elapsed()) might be called even if the
stream is not really running.
The below is some coding style fixes, BTW. I'm not sure whether
queue_work() is intended in the block if "if (dma_check == 0)" or
not.
Takashi
--- aica.c.old 2007-07-06 11:51:18.000000000 +0200
+++ aica.c 2007-07-06 11:52:10.000000000 +0200
@@ -256,7 +256,8 @@
buffer_size = frames_to_bytes(runtime, runtime->buffer_size);
if (runtime->channels > 1)
dreamcastcard->channel->flags |= 0x01;
- aica_dma_transfer(runtime->channels, buffer_size, dreamcastcard->substream);
+ aica_dma_transfer(runtime->channels, buffer_size,
+ dreamcastcard->substream);
startup_aica(dreamcastcard);
dreamcastcard->clicks =
buffer_size / (AICA_PERIOD_SIZE * runtime->channels);
@@ -268,9 +269,7 @@
snd_pcm_period_elapsed(dreamcastcard->substream);
dreamcastcard->clicks++;
if (unlikely(dreamcastcard->clicks >= AICA_PERIOD_NUMBER))
- {
dreamcastcard->clicks %= AICA_PERIOD_NUMBER;
- }
mod_timer(&dreamcastcard->timer, jiffies + 1);
}
}
@@ -300,8 +299,7 @@
dreamcastcard->current_period = play_period;
if (unlikely(dreamcastcard->dma_check == 0))
dreamcastcard->dma_check = 1;
- queue_work(aica_queue, &(dreamcastcard->spu_dma_work));
-
+ queue_work(aica_queue, &(dreamcastcard->spu_dma_work));
}
static void spu_begin_dma(struct snd_pcm_substream *substream)
@@ -311,7 +309,7 @@
struct snd_pcm_runtime *runtime;
runtime = substream->runtime;
dreamcastcard = substream->pcm->private_data;
- //get the queue to do the work
+ /* get the queue to do the work */
queue_work(aica_queue, &(dreamcastcard->spu_dma_work));
/* Timer may already be running */
if (unlikely(dreamcastcard->timer.data)) {
@@ -597,7 +595,7 @@
strcpy(dreamcastcard->card->shortname, SND_AICA_DRIVER);
strcpy(dreamcastcard->card->longname,
"Yamaha AICA Super Intelligent Sound Processor for SEGA Dreamcast");
- //start the worker thread
+ /* start the worker thread */
INIT_WORK(&(dreamcastcard->spu_dma_work), run_spu_dma);
/* Load the PCM 'chip' */
err = snd_aicapcmchip(dreamcastcard, 0);
@@ -631,7 +629,8 @@
.probe = snd_aica_probe,
.remove = snd_aica_remove,
.driver = {
- .name = SND_AICA_DRIVER},
+ .name = SND_AICA_DRIVER
+ },
};
static int __init aica_init(void)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [alsa-devel] [PATCH] ALSA AICA sound on SEGA Dreamcast - fix behaviour in poor resource conditions
2007-07-06 9:56 ` Takashi Iwai
@ 2007-07-06 10:09 ` Adrian McMenamin
2007-07-06 20:42 ` Adrian McMenamin
0 siblings, 1 reply; 8+ messages in thread
From: Adrian McMenamin @ 2007-07-06 10:09 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel, linux-kernel
On 06/07/07, Takashi Iwai <tiwai@suse.de> wrote:
> I guess you shoud call del_timer() there at least. Otherwise the
> timer handler (aica_period_elapsed()) might be called even if the
> stream is not really running.
>
Fair enough. I'll fix that and repost later.
> The below is some coding style fixes, BTW. I'm not sure whether
> queue_work() is intended in the block if "if (dma_check == 0)" or
> not.
>
It's just an aberrant indent - I think there was an independent block
there in earlier code, it got removed but the tab stayed :)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [alsa-devel] [PATCH] ALSA AICA sound on SEGA Dreamcast - fix behaviour in poor resource conditions
2007-07-06 10:09 ` Adrian McMenamin
@ 2007-07-06 20:42 ` Adrian McMenamin
2007-07-09 8:37 ` Takashi Iwai
0 siblings, 1 reply; 8+ messages in thread
From: Adrian McMenamin @ 2007-07-06 20:42 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 554 bytes --]
On 06/07/07, Adrian McMenamin <adrianmcmenamin@gmail.com> wrote:
> On 06/07/07, Takashi Iwai <tiwai@suse.de> wrote:
> > I guess you shoud call del_timer() there at least. Otherwise the
> > timer handler (aica_period_elapsed()) might be called even if the
> > stream is not really running.
> >
>
> Fair enough. I'll fix that and repost later.
>
>
Attached is a new patch, tidied with indent and with
SNDRV_PCM_TRIGGER_STOP being used.
Submitted by: Adrian McMenamin <adrian@mcmen.demon.co.uk>
Signed-off by: Adrian McMenamin <adrian@mcmen.demon.co.uk>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: aica.diff --]
[-- Type: text/x-patch; name="aica.diff", Size: 7581 bytes --]
diff -ruN aicaold/aica.c aicanew/aica.c
--- aicaold/aica.c 2007-07-05 23:01:39.000000000 +0100
+++ aicanew/aica.c 2007-07-06 21:36:55.000000000 +0100
@@ -64,12 +64,6 @@
MODULE_PARM_DESC(enable, "Enable " CARD_NAME " soundcard.");
/* Use workqueue */
-
-static struct spu_work_holder {
- struct work_struct spu_dma_work;
- void *sspointer;
-} spu_working;
-
static struct workqueue_struct *aica_queue;
/* Simple platform device */
@@ -100,9 +94,9 @@
break;
/* To ensure hardware failure doesn't wedge kernel */
time_count++;
- if (time_count > 0x10000)
- {
- snd_printk("WARNING: G2 FIFO appears to be blocked.\n");
+ if (time_count > 0x10000) {
+ snd_printk
+ ("WARNING: G2 FIFO appears to be blocked.\n");
break;
}
}
@@ -226,11 +220,11 @@
runtime = substream->runtime;
for (q = 0; q < channels; q++) {
err = dma_xfer(AICA_DMA_CHANNEL,
- (unsigned long)(runtime->dma_area +
- (AICA_BUFFER_SIZE * q) /
- channels +
- AICA_PERIOD_SIZE *
- period_offset),
+ (unsigned long) (runtime->dma_area +
+ (AICA_BUFFER_SIZE * q) /
+ channels +
+ AICA_PERIOD_SIZE *
+ period_offset),
AICA_CHANNEL0_OFFSET + q * CHANNEL_OFFSET +
AICA_PERIOD_SIZE * period_offset,
buffer_size / channels, AICA_DMA_MODE);
@@ -244,26 +238,25 @@
static void startup_aica(struct snd_card_aica *dreamcastcard)
{
spu_memload(AICA_CHANNEL0_CONTROL_OFFSET,
- dreamcastcard->channel,
- sizeof(struct aica_channel));
+ dreamcastcard->channel, sizeof(struct aica_channel));
aica_chn_start();
}
static void run_spu_dma(struct work_struct *work)
{
int buffer_size;
- struct snd_pcm_substream *substream;
struct snd_pcm_runtime *runtime;
struct snd_card_aica *dreamcastcard;
- struct spu_work_holder *holder = container_of(work, struct spu_work_holder, spu_dma_work);
- substream = holder-> sspointer;
- dreamcastcard = substream->pcm->private_data;
- runtime = substream->runtime;
+ dreamcastcard =
+ container_of(work, struct snd_card_aica, spu_dma_work);
+ runtime = dreamcastcard->substream->runtime;
if (unlikely(dreamcastcard->dma_check == 0)) {
- buffer_size = frames_to_bytes(runtime, runtime->buffer_size);
+ buffer_size =
+ frames_to_bytes(runtime, runtime->buffer_size);
if (runtime->channels > 1)
dreamcastcard->channel->flags |= 0x01;
- aica_dma_transfer(runtime->channels, buffer_size, substream);
+ aica_dma_transfer(runtime->channels, buffer_size,
+ dreamcastcard->substream);
startup_aica(dreamcastcard);
dreamcastcard->clicks =
buffer_size / (AICA_PERIOD_SIZE * runtime->channels);
@@ -271,13 +264,11 @@
} else {
aica_dma_transfer(runtime->channels,
AICA_PERIOD_SIZE * runtime->channels,
- substream);
+ dreamcastcard->substream);
snd_pcm_period_elapsed(dreamcastcard->substream);
dreamcastcard->clicks++;
if (unlikely(dreamcastcard->clicks >= AICA_PERIOD_NUMBER))
- {
dreamcastcard->clicks %= AICA_PERIOD_NUMBER;
- }
mod_timer(&dreamcastcard->timer, jiffies + 1);
}
}
@@ -289,7 +280,7 @@
struct snd_pcm_runtime *runtime;
struct snd_pcm_substream *substream;
struct snd_card_aica *dreamcastcard;
- substream = (struct snd_pcm_substream *)timer_var;
+ substream = (struct snd_pcm_substream *) timer_var;
runtime = substream->runtime;
dreamcastcard = substream->pcm->private_data;
/* Have we played out an additional period? */
@@ -307,27 +298,24 @@
dreamcastcard->current_period = play_period;
if (unlikely(dreamcastcard->dma_check == 0))
dreamcastcard->dma_check = 1;
- queue_work(aica_queue, &(spu_working.spu_dma_work));
+ queue_work(aica_queue, &(dreamcastcard->spu_dma_work));
}
static void spu_begin_dma(struct snd_pcm_substream *substream)
{
- /* Must be atomic */
struct snd_card_aica *dreamcastcard;
struct snd_pcm_runtime *runtime;
runtime = substream->runtime;
dreamcastcard = substream->pcm->private_data;
- /* Use queue to do the heavy lifting */
- spu_working.sspointer = substream;
- INIT_WORK(&(spu_working.spu_dma_work), run_spu_dma);
- queue_work(aica_queue, &(spu_working.spu_dma_work));
+ /*get the queue to do the work */
+ queue_work(aica_queue, &(dreamcastcard->spu_dma_work));
/* Timer may already be running */
if (unlikely(dreamcastcard->timer.data)) {
mod_timer(&dreamcastcard->timer, jiffies + 4);
return;
}
init_timer(&(dreamcastcard->timer));
- dreamcastcard->timer.data = (unsigned long)substream;
+ dreamcastcard->timer.data = (unsigned long) substream;
dreamcastcard->timer.function = aica_period_elapsed;
dreamcastcard->timer.expires = jiffies + 4;
add_timer(&(dreamcastcard->timer));
@@ -366,7 +354,9 @@
*substream)
{
struct snd_card_aica *dreamcastcard = substream->pcm->private_data;
- del_timer(&dreamcastcard->timer);
+ flush_workqueue(aica_queue);
+ if (dreamcastcard->timer.data)
+ del_timer(&dreamcastcard->timer);
kfree(dreamcastcard->channel);
spu_disable();
return 0;
@@ -385,7 +375,8 @@
{
/* Allocate a DMA buffer using ALSA built-ins */
return
- snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
+ snd_pcm_lib_malloc_pages(substream,
+ params_buffer_bytes(hw_params));
}
static int snd_aicapcm_pcm_prepare(struct snd_pcm_substream
@@ -402,15 +393,11 @@
static int snd_aicapcm_pcm_trigger(struct snd_pcm_substream
*substream, int cmd)
{
- struct snd_card_aica *dreamcastcard;
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
spu_begin_dma(substream);
break;
case SNDRV_PCM_TRIGGER_STOP:
- dreamcastcard = substream->pcm->private_data;
- if (dreamcastcard->timer.data)
- del_timer(&dreamcastcard->timer);
aica_chn_halt();
break;
default:
@@ -444,7 +431,8 @@
int err;
/* AICA has no capture ability */
err =
- snd_pcm_new(dreamcastcard->card, "AICA PCM", pcm_index, 1, 0, &pcm);
+ snd_pcm_new(dreamcastcard->card, "AICA PCM", pcm_index, 1, 0,
+ &pcm);
if (unlikely(err < 0))
return err;
pcm->private_data = dreamcastcard;
@@ -524,9 +512,7 @@
dreamcastcard->channel->vol = ucontrol->value.integer.value[0];
dreamcastcard->master_volume = ucontrol->value.integer.value[0];
spu_memload(AICA_CHANNEL0_CONTROL_OFFSET,
- dreamcastcard->channel,
- sizeof(struct aica_channel));
-
+ dreamcastcard->channel, sizeof(struct aica_channel));
return 1;
}
@@ -610,6 +596,8 @@
strcpy(dreamcastcard->card->shortname, SND_AICA_DRIVER);
strcpy(dreamcastcard->card->longname,
"Yamaha AICA Super Intelligent Sound Processor for SEGA Dreamcast");
+ /* Prepare to use the queue */
+ INIT_WORK(&(dreamcastcard->spu_dma_work), run_spu_dma);
/* Load the PCM 'chip' */
err = snd_aicapcmchip(dreamcastcard, 0);
if (unlikely(err < 0))
@@ -663,8 +651,10 @@
static void __exit aica_exit(void)
{
- /* Destroy the aica kernel thread */
- destroy_workqueue(aica_queue);
+ /* Destroy the aica kernel thread *
+ * being extra cautious to check if it exists*/
+ if (likely(aica_queue))
+ destroy_workqueue(aica_queue);
platform_device_unregister(pd);
platform_driver_unregister(&snd_aica_driver);
/* Kill any sound still playing and reset ARM7 to safe state */
diff -ruN aicaold/aica.h aicanew/aica.h
--- aicaold/aica.h 2007-07-05 23:01:39.000000000 +0100
+++ aicanew/aica.h 2007-07-06 21:37:38.000000000 +0100
@@ -69,6 +69,7 @@
};
struct snd_card_aica {
+ struct work_struct spu_dma_work;
struct snd_card *card;
struct aica_channel *channel;
struct snd_pcm_substream *substream;
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [alsa-devel] [PATCH] ALSA AICA sound on SEGA Dreamcast - fix behaviour in poor resource conditions
2007-07-06 20:42 ` Adrian McMenamin
@ 2007-07-09 8:37 ` Takashi Iwai
0 siblings, 0 replies; 8+ messages in thread
From: Takashi Iwai @ 2007-07-09 8:37 UTC (permalink / raw)
To: Adrian McMenamin; +Cc: alsa-devel, linux-kernel
At Fri, 6 Jul 2007 21:42:27 +0100,
Adrian McMenamin wrote:
>
> On 06/07/07, Adrian McMenamin <adrianmcmenamin@gmail.com> wrote:
> > On 06/07/07, Takashi Iwai <tiwai@suse.de> wrote:
> > > I guess you shoud call del_timer() there at least. Otherwise the
> > > timer handler (aica_period_elapsed()) might be called even if the
> > > stream is not really running.
> > >
> >
> > Fair enough. I'll fix that and repost later.
> >
> >
>
> Attached is a new patch, tidied with indent and with
> SNDRV_PCM_TRIGGER_STOP being used.
>
> Submitted by: Adrian McMenamin <adrian@mcmen.demon.co.uk>
> Signed-off by: Adrian McMenamin <adrian@mcmen.demon.co.uk>
Thanks, committed to ALSA tree now.
Takashi
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-07-09 8:37 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-05 22:07 [PATCH] ALSA AICA sound on SEGA Dreamcast - fix behaviour in poor resource conditions Adrian McMenamin
2007-07-05 22:23 ` Adrian McMenamin
2007-07-06 9:25 ` [alsa-devel] " Takashi Iwai
2007-07-06 9:46 ` Adrian McMenamin
2007-07-06 9:56 ` Takashi Iwai
2007-07-06 10:09 ` Adrian McMenamin
2007-07-06 20:42 ` Adrian McMenamin
2007-07-09 8:37 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®