Example #1
0
static irqreturn_t
snd_nm256_interrupt_zx(int irq, void *dev_id, struct pt_regs *dummy)
{
    nm256_t *chip = dev_id;
    u32 status;
    u8 cbyte;

    status = snd_nm256_readl(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 & NM2_PLAYBACK_INT) {
        status &= ~NM2_PLAYBACK_INT;
        NM2_ACK_INT(chip, NM2_PLAYBACK_INT);
        snd_nm256_playback_update(chip);
    }

    if (status & NM2_RECORD_INT) {
        status &= ~NM2_RECORD_INT;
        NM2_ACK_INT(chip, NM2_RECORD_INT);
        snd_nm256_capture_update(chip);
    }

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

    if (status & NM2_MISC_INT_2) {
        status &= ~NM2_MISC_INT_2;
        NM2_ACK_INT(chip, NM2_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. */
        NM2_ACK_INT(chip, status);
    }

    spin_unlock(&chip->reg_lock);
    return IRQ_HANDLED;
}
static irqreturn_t
snd_nm256_interrupt_zx(int irq, void *dev_id)
{
	struct nm256 *chip = dev_id;
	u32 status;
	u8 cbyte;

	status = snd_nm256_readl(chip, NM_INT_REG);

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

	chip->badintrcount = 0;

	

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

	if (status & NM2_RECORD_INT) {
		status &= ~NM2_RECORD_INT;
		NM2_ACK_INT(chip, NM2_RECORD_INT);
		snd_nm256_capture_update(chip);
	}

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

	if (status & NM2_MISC_INT_2) {
		status &= ~NM2_MISC_INT_2;
		NM2_ACK_INT(chip, NM2_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);
		
		NM2_ACK_INT(chip, status);
	}

	spin_unlock(&chip->reg_lock);
	return IRQ_HANDLED;
}
Example #3
0
static snd_pcm_uframes_t
snd_nm256_capture_pointer(snd_pcm_substream_t * substream)
{
    nm256_t *chip = snd_pcm_substream_chip(substream);
    nm256_stream_t *s = (nm256_stream_t*)substream->runtime->private_data;
    unsigned long curp;

    snd_assert(s != NULL, return 0);
    curp = snd_nm256_readl(chip, NM_RBUFFER_CURRP) - (unsigned long)s->buf;
    curp %= s->dma_size;
    return bytes_to_frames(substream->runtime, curp);
}
Example #4
0
/*
 * get the current pointer
 */
static snd_pcm_uframes_t
snd_nm256_playback_pointer(struct snd_pcm_substream *substream)
{
	struct nm256 *chip = snd_pcm_substream_chip(substream);
	struct nm256_stream *s = substream->runtime->private_data;
	unsigned long curp;

	snd_assert(s, return 0);
	curp = snd_nm256_readl(chip, NM_PBUFFER_CURRP) - (unsigned long)s->buf;
	curp %= s->dma_size;
	return bytes_to_frames(substream->runtime, curp);
}
Example #5
0
static snd_pcm_uframes_t
snd_nm256_capture_pointer(struct snd_pcm_substream *substream)
{
	struct nm256 *chip = snd_pcm_substream_chip(substream);
	struct nm256_stream *s = substream->runtime->private_data;
	unsigned long curp;

	if (snd_BUG_ON(!s))
		return 0;
	curp = snd_nm256_readl(chip, NM_RBUFFER_CURRP) - (unsigned long)s->buf;
	curp %= s->dma_size;	
	return bytes_to_frames(substream->runtime, curp);
}