2 **********************************************************************
3 * irqmgr.c - IRQ manager for emu10k1 driver
4 * Copyright 1999, 2000 Creative Labs, Inc.
6 **********************************************************************
8 * Date Author Summary of changes
9 * ---- ------ ------------------
10 * October 20, 1999 Bertrand Lee base code release
12 **********************************************************************
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License as
16 * published by the Free Software Foundation; either version 2 of
17 * the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public
25 * License along with this program; if not, write to the Free
26 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
29 **********************************************************************
38 /* Interrupt handler */
40 void emu10k1_interrupt(int irq, void *dev_id, struct pt_regs *regs)
42 struct emu10k1_card *card = (struct emu10k1_card *) dev_id;
43 u32 irqstatus, irqstatus_tmp;
45 DPD(4, "emu10k1_interrupt called, irq = %u\n", irq);
49 ** We do a 'while loop' here cos on certain machines, with both
50 ** playback and recording going on at the same time, IRQs will
51 ** stop coming in after a while. Checking IPND indeed shows that
52 ** there are interrupts pending but the PIC says no IRQs pending.
53 ** I suspect that some boards need edge-triggered IRQs but are not
54 ** getting that condition if we don't completely clear the IPND
55 ** (make sure no more interrupts are pending).
59 while ((irqstatus = inl(card->iobase + IPR))) {
60 DPD(4, "irq status %#x\n", irqstatus);
62 irqstatus_tmp = irqstatus;
64 if (irqstatus & IRQTYPE_TIMER) {
65 emu10k1_timer_irqhandler(card);
66 irqstatus &= ~IRQTYPE_TIMER;
69 if (irqstatus & IRQTYPE_DSP) {
70 emu10k1_dsp_irqhandler(card);
71 irqstatus &= ~IRQTYPE_DSP;
74 if (irqstatus & IRQTYPE_MPUIN) {
75 emu10k1_mpuin_irqhandler(card);
76 irqstatus &= ~IRQTYPE_MPUIN;
79 if (irqstatus & IRQTYPE_MPUOUT) {
80 emu10k1_mpuout_irqhandler(card);
81 irqstatus &= ~IRQTYPE_MPUOUT;
84 if (irqstatus & IPR_MUTE) {
85 emu10k1_mute_irqhandler(card);
86 irqstatus &=~IPR_MUTE;
89 if (irqstatus & IPR_VOLINCR) {
90 emu10k1_volincr_irqhandler(card);
91 irqstatus &=~IPR_VOLINCR;
94 if (irqstatus & IPR_VOLDECR) {
95 emu10k1_voldecr_irqhandler(card);
96 irqstatus &=~IPR_VOLDECR;
100 printk(KERN_ERR "emu10k1: Warning, unhandled interrupt: %#08x\n", irqstatus);
101 //make sure any interrupts we don't handle are disabled:
102 emu10k1_irq_disable(card, ~(INTE_MIDIRXENABLE | INTE_MIDITXENABLE | INTE_INTERVALTIMERENB |
103 INTE_VOLDECRENABLE | INTE_VOLINCRENABLE | INTE_MUTEENABLE |
107 /* acknowledge interrupt */
108 outl(irqstatus_tmp, card->iobase + IPR);