From: pwaechtler@mac.com
To: linux-kernel@vger.kernel.org
Cc: torvalds@transmeta.com
Subject: [PATCH] 10/10 sound/oss/dmasound/dmasound_q40.c
Date: Thu, 29 Aug 2002 21:56:27 +0200 [thread overview]
Message-ID: <200209091007.g89A7dOg000967@smtp-relay04-en1.mac.com> (raw)
--- vanilla-2.5.33/sound/oss/dmasound/dmasound_q40.c Sun Sep 8 21:52:50 2002
+++ linux-2.5-cli-oss/sound/oss/dmasound/dmasound_q40.c Mon Sep 9 00:41:06 2002
@@ -18,7 +18,7 @@
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/soundcard.h>
-
+#include <linux/spinlock.h>
#include <asm/uaccess.h>
#include <asm/q40ints.h>
#include <asm/q40_master.h>
@@ -49,8 +49,7 @@
static int Q40SetVolume(int volume);
static void Q40PlayNextFrame(int index);
static void Q40Play(void);
-static void Q40StereoInterrupt(int irq, void *dummy, struct pt_regs *fp);
-static void Q40MonoInterrupt(int irq, void *dummy, struct pt_regs *fp);
+static void Q40InterruptHandler(int irq, void *dummy, struct pt_regs *fp);
static void Q40Interrupt(void);
@@ -384,7 +383,7 @@
static int __init Q40IrqInit(void)
{
/* Register interrupt handler. */
- request_irq(Q40_IRQ_SAMPLE, Q40StereoInterrupt, 0,
+ request_irq(Q40_IRQ_SAMPLE, Q40InterruptHandler, 0,
"DMA sound", Q40Interrupt);
return(1);
@@ -430,23 +429,13 @@
speed=(dmasound.hard.speed==10000 ? 0 : 1);
master_outb( 0,SAMPLE_ENABLE_REG);
- free_irq(Q40_IRQ_SAMPLE, Q40Interrupt);
- if (dmasound.soft.stereo)
- request_irq(Q40_IRQ_SAMPLE, Q40StereoInterrupt, 0,
- "Q40 sound", Q40Interrupt);
- else
- request_irq(Q40_IRQ_SAMPLE, Q40MonoInterrupt, 0,
- "Q40 sound", Q40Interrupt);
-
master_outb( speed, SAMPLE_RATE_REG);
master_outb( 1,SAMPLE_CLEAR_REG);
master_outb( 1,SAMPLE_ENABLE_REG);
}
-static void Q40Play(void)
+static void __Q40Play(void)
{
- unsigned long flags;
-
if (write_sq.active || write_sq.count<=0 ) {
/* There's already a frame loaded */
return;
@@ -459,29 +448,35 @@
*/
return;
}
- save_flags(flags); cli();
Q40PlayNextFrame(1);
- restore_flags(flags);
}
-static void Q40StereoInterrupt(int irq, void *dummy, struct pt_regs *fp)
-{
- if (q40_sc>1){
- *DAC_LEFT=*q40_pp++;
- *DAC_RIGHT=*q40_pp++;
- q40_sc -=2;
- master_outb(1,SAMPLE_CLEAR_REG);
- }else Q40Interrupt();
-}
-static void Q40MonoInterrupt(int irq, void *dummy, struct pt_regs *fp)
+static void Q40Play(void)
{
- if (q40_sc>0){
- *DAC_LEFT=*q40_pp;
- *DAC_RIGHT=*q40_pp++;
- q40_sc --;
+ unsigned long flags;
+ spin_lock_irqsave(&dmasound.lock, flags);
+ __Q40Play();
+ spin_unlock_irqrestore(&dmasound.lock, flags);
+}
+
+static void Q40InterruptHandler(int irq, void *dummy, struct pt_regs *fp)
+{
+ spin_lock(&dmasound.lock);
+ if (q40_sc>1){
+ if (dmasound.soft.stereo){
+ *DAC_LEFT=*q40_pp++;
+ *DAC_RIGHT=*q40_pp++;
+ q40_sc -=2;
+ } else {
+ *DAC_LEFT=*q40_pp;
+ *DAC_RIGHT=*q40_pp++;
+ q40_sc --;
+ }
master_outb(1,SAMPLE_CLEAR_REG);
}else Q40Interrupt();
+ spin_unlock(&dmasound.lock);
}
+
static void Q40Interrupt(void)
{
if (!write_sq.active) {
@@ -493,7 +488,7 @@
goto exit;
} else write_sq.active=0;
write_sq.count--;
- Q40Play();
+ __Q40Play();
if (q40_sc<2)
{ /* there was nothing to play, disable irq */
next reply other threads:[~2002-09-09 10:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-29 19:56 pwaechtler [this message]
[not found] ` <20020911234500.B4476@linux-m68k.org>
2002-09-12 8:26 ` Richard Zidlicky
[not found] <200209091007.g89A7dZH010390@smtp-relay02.mac.com>
2002-09-09 16:07 ` Linus Torvalds
2002-09-09 17:20 ` Tomas Szepe
2002-09-09 17:32 ` Andreas Dilger
2002-09-09 17:32 ` David S. Miller
2002-09-09 19:47 ` pwaechtler
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=200209091007.g89A7dOg000967@smtp-relay04-en1.mac.com \
--to=pwaechtler@mac.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/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®