Пример #1
0
static irqreturn_t
snd_nm256_interrupt(int irq, void *dev_id, struct pt_regs *dummy)
{
    nm256_t *chip = dev_id;
    u16 status;
    u8 cbyte;

    status = snd_nm256_readw(chip, NM_INT_REG);

    /* Not ours. */
    if (status == 0) {
        snd_nm256_intr_check(chip);
        return IRQ_NONE;
    }

    chip->badintrcount = 0;

    /* Rather boring; check for individual interrupts and process them. */

    spin_lock(&chip->reg_lock);
    if (status & NM_PLAYBACK_INT) {
        status &= ~NM_PLAYBACK_INT;
        NM_ACK_INT(chip, NM_PLAYBACK_INT);
        snd_nm256_playback_update(chip);
    }

    if (status & NM_RECORD_INT) {
        status &= ~NM_RECORD_INT;
        NM_ACK_INT(chip, NM_RECORD_INT);
        snd_nm256_capture_update(chip);
    }

    if (status & NM_MISC_INT_1) {
        status &= ~NM_MISC_INT_1;
        NM_ACK_INT(chip, NM_MISC_INT_1);
        snd_printd("NM256: Got misc interrupt #1\n");
        snd_nm256_writew(chip, NM_INT_REG, 0x8000);
        cbyte = snd_nm256_readb(chip, 0x400);
        snd_nm256_writeb(chip, 0x400, cbyte | 2);
    }

    if (status & NM_MISC_INT_2) {
        status &= ~NM_MISC_INT_2;
        NM_ACK_INT(chip, NM_MISC_INT_2);
        snd_printd("NM256: Got misc interrupt #2\n");
        cbyte = snd_nm256_readb(chip, 0x400);
        snd_nm256_writeb(chip, 0x400, cbyte & ~2);
    }

    /* Unknown interrupt. */
    if (status) {
        snd_printd("NM256: Fire in the hole! Unknown status 0x%x\n",
                   status);
        /* Pray. */
        NM_ACK_INT(chip, status);
    }

    spin_unlock(&chip->reg_lock);
    return IRQ_HANDLED;
}
Пример #2
0
static irqreturn_t
snd_nm256_interrupt(int irq, void *dev_id)
{
	struct nm256 *chip = dev_id;
	u16 status;
	u8 cbyte;

	status = snd_nm256_readw(chip, NM_INT_REG);

	
	if (status == 0)
		return snd_nm256_intr_check(chip);

	chip->badintrcount = 0;

	

	spin_lock(&chip->reg_lock);
	if (status & NM_PLAYBACK_INT) {
		status &= ~NM_PLAYBACK_INT;
		NM_ACK_INT(chip, NM_PLAYBACK_INT);
		snd_nm256_playback_update(chip);
	}

	if (status & NM_RECORD_INT) {
		status &= ~NM_RECORD_INT;
		NM_ACK_INT(chip, NM_RECORD_INT);
		snd_nm256_capture_update(chip);
	}

	if (status & NM_MISC_INT_1) {
		status &= ~NM_MISC_INT_1;
		NM_ACK_INT(chip, NM_MISC_INT_1);
		snd_printd("NM256: Got misc interrupt #1\n");
		snd_nm256_writew(chip, NM_INT_REG, 0x8000);
		cbyte = snd_nm256_readb(chip, 0x400);
		snd_nm256_writeb(chip, 0x400, cbyte | 2);
	}

	if (status & NM_MISC_INT_2) {
		status &= ~NM_MISC_INT_2;
		NM_ACK_INT(chip, NM_MISC_INT_2);
		snd_printd("NM256: Got misc interrupt #2\n");
		cbyte = snd_nm256_readb(chip, 0x400);
		snd_nm256_writeb(chip, 0x400, cbyte & ~2);
	}

	
	if (status) {
		snd_printd("NM256: Fire in the hole! Unknown status 0x%x\n",
			   status);
		
		NM_ACK_INT(chip, status);
	}

	spin_unlock(&chip->reg_lock);
	return IRQ_HANDLED;
}