예제 #1
0
static int pm8xxx_read_config_irq(struct pm_irq_chip *chip, u8 bp, u8 cp, u8 *r)
{
	int	rc;

	spin_lock(&chip->pm_irq_lock);
	rc = pm8xxx_writeb(chip->dev,
			SSBI_REG_ADDR_IRQ_BLK_SEL(chip->base_addr), bp);
	if (rc) {
		pr_err("Failed Selecting Block %d rc=%d\n", bp, rc);
		goto bail;
	}

	rc = pm8xxx_writeb(chip->dev,
			SSBI_REG_ADDR_IRQ_CONFIG(chip->base_addr), cp);
	if (rc)
		pr_err("Failed Configuring IRQ rc=%d\n", rc);

	rc = pm8xxx_readb(chip->dev,
			SSBI_REG_ADDR_IRQ_CONFIG(chip->base_addr), r);
	if (rc)
		pr_err("Failed reading IRQ rc=%d\n", rc);
bail:
	spin_unlock(&chip->pm_irq_lock);
	return rc;
}
예제 #2
0
static int pm8xxx_write_config_irq(struct pm_irq_chip *chip, u8 bp, u8 cp)
{
    int	rc;

    spin_lock(&chip->pm_irq_lock);
    rc = pm8xxx_writeb(chip->dev,
                       SSBI_REG_ADDR_IRQ_BLK_SEL(chip->base_addr), bp);
    if (rc) {
        pr_err("Failed Selecting Block %d rc=%d\n", bp, rc);
        goto bail;
    }
    /*
     * Set the write bit here as this could be a unrequested irq
     * whose PM_IRQF_WRITE bit is not set
     */
    cp |= PM_IRQF_WRITE;
    rc = pm8xxx_writeb(chip->dev,
                       SSBI_REG_ADDR_IRQ_CONFIG(chip->base_addr), cp);
    if (rc)
        pr_err("Failed Configuring IRQ rc=%d\n", rc);
bail:
    spin_unlock(&chip->pm_irq_lock);
    return rc;
}