mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Adrian McMenamin" <adrianmcmenamin@gmail.com>
To: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	linuxsh-dev@lists.sourceforge.net
Cc: "Paul Mundt" <lethal@linux-sh.org>
Subject: [PATCH] Patch Dreamcast AICA driver to handle Maple bus support
Date: Sun, 9 Sep 2007 21:22:17 +0100	[thread overview]
Message-ID: <92a12cdb0709091322r5dd65f5dse0668cff4fbd43b0@mail.gmail.com> (raw)

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;
 }

             reply	other threads:[~2007-09-09 20:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-09 20:22 Adrian McMenamin [this message]
2007-09-10 21:26 ` [alsa-devel] " Takashi Iwai

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=92a12cdb0709091322r5dd65f5dse0668cff4fbd43b0@mail.gmail.com \
    --to=adrianmcmenamin@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxsh-dev@lists.sourceforge.net \
    /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 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®