[alsa-devel] [PATCH v2 5/7] ASoC: hda - add Skylake HD audio driver

Takashi Iwai tiwai at suse.de
Sun Apr 19 09:27:17 CEST 2015


At Fri, 17 Apr 2015 14:43:18 +0530,
Vinod Koul wrote:
> +irqreturn_t azx_interrupt(int irq, void *dev_id)
> +{
> +	struct hdac_bus *chip = dev_id;
> +	u32 status;
> +
> +#ifdef CONFIG_PM
> +	if (!pm_runtime_active(chip->dev))
> +		return IRQ_NONE;
> +#endif
> +
> +	spin_lock(&chip->reg_lock);
> +
> +	status = snd_hdac_chip_readl(chip, INTSTS);
> +	if (status == 0 || status == 0xffffffff) {
> +		spin_unlock(&chip->reg_lock);
> +		return IRQ_NONE;
> +	}
> +	spin_unlock(&chip->reg_lock);
> +
> +	return IRQ_WAKE_THREAD;
> +}
> +
> +irqreturn_t azx_threaded_handler(int irq, void *dev_id)
> +{
> +	struct hdac_bus *chip = dev_id;
> +	u32 status;
> +	unsigned long cookie;
> +
> +	status = snd_hdac_chip_readl(chip, INTSTS);
> +	spin_lock_irqsave(&chip->reg_lock, cookie);
> +
> +	snd_hdac_bus_handle_stream_irq(chip, status, &azx_position_check);
> +
> +	/* clear rirb int */
> +	status = snd_hdac_chip_readb(chip, RIRBSTS);
> +	if (status & RIRB_INT_MASK) {
> +		if (status & RIRB_INT_RESPONSE)
> +			snd_hdac_bus_update_rirb(chip);
> +		snd_hdac_chip_writeb(chip, RIRBSTS, RIRB_INT_MASK);
> +	}
> +
> +	spin_unlock_irqrestore(&chip->reg_lock, cookie);
> +
> +	return IRQ_HANDLED;
> +}

BTW, you don't need to use a threaded irq for this task.  Unlike DSP
driver, the PCM and CORB/RIRB irq doesn't need a long time to handle.


Takashi


More information about the Alsa-devel mailing list