mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Patch Dreamcast AICA driver to handle Maple bus support
@ 2007-09-09 20:22 Adrian McMenamin
  2007-09-10 21:26 ` [alsa-devel] " Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Adrian McMenamin @ 2007-09-09 20:22 UTC (permalink / raw)
  To: alsa-devel, linux-kernel, linuxsh-dev; +Cc: Paul Mundt

This patches the AICA sound driver for the Dreamcast to handle the
well known flakiness of the Dreamcast's G2 bus.

This is dependent on getting Maple bus support (see
http://lkml.org/lkml/2007/9/9/70) into the kernel.

Signed-off by: Adrian McMenamin <adrian@mcmen.demon.co.uk>

diff --git a/sound/sh/aica.c b/sound/sh/aica.c
index 7397865..a42c58f 100644
--- a/sound/sh/aica.c
+++ b/sound/sh/aica.c
@@ -35,6 +35,7 @@
 #include <linux/timer.h>
 #include <linux/delay.h>
 #include <linux/workqueue.h>
+#include <linux/maple.h>
 #include <sound/driver.h>
 #include <sound/core.h>
 #include <sound/control.h>
@@ -43,7 +44,7 @@
 #include <sound/info.h>
 #include <asm/io.h>
 #include <asm/dma.h>
-#include <asm/dreamcast/sysasic.h>
+#include <asm/mach/sysasic.h>
 #include "aica.h"

 MODULE_AUTHOR("Adrian McMenamin <adrian@mcmen.demon.co.uk>");
@@ -218,6 +219,12 @@ static int aica_dma_transfer(int channels, int buffer_size,
 	period_offset = dreamcastcard->clicks;
 	period_offset %= (AICA_PERIOD_NUMBER / channels);
 	runtime = substream->runtime;
+	/* If maple dma is running, wait for it to finish */
+	do{ cpu_relax();}
+	while (!maple_dma_done());
+	/* Turn off the maple dma now */
+	ctrl_outl(0, MAPLE_ENABLE);
+	local_irq_disable();	
 	for (q = 0; q < channels; q++) {
 		err = dma_xfer(AICA_DMA_CHANNEL,
 			       (unsigned long) (runtime->dma_area +
@@ -232,6 +239,9 @@ static int aica_dma_transfer(int channels, int buffer_size,
 			break;
 		dma_wait_for_completion(AICA_DMA_CHANNEL);
 	}
+	/* restore maple dma */
+	local_irq_enable();
+	maplebus_init_hardware();
 	return err;
 }

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-09-10 21:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-09 20:22 [PATCH] Patch Dreamcast AICA driver to handle Maple bus support Adrian McMenamin
2007-09-10 21:26 ` [alsa-devel] " 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®