diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2013-08-20 05:07:25 +0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-08-20 05:07:25 +0400 |
commit | a849212f6e04dff5f977439d91c4642f2cdda775 (patch) | |
tree | 028a67efe151bc604f981149e490fd56c1f5bbbf /drivers | |
parent | 38c4faaea4ca71c69584ef71cca8d0735d5361c1 (diff) | |
parent | 68622bdfefb969fd7cf710545d7e758a732ab01d (diff) | |
download | linux-a849212f6e04dff5f977439d91c4642f2cdda775.tar.xz |
Merge tag 'regmap-irq-ack-mask' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap
regmap: Support for acknowledging masked IRQs
Some devices need interrupts to be clear when they are masked otherwise
the interrupt is not deasserted by the mask being set - add support for
this to regmap-irq from Philipp Zabel.
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/base/regmap/regmap-irq.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c index 1643e889bafc..d10456ffd811 100644 --- a/drivers/base/regmap/regmap-irq.c +++ b/drivers/base/regmap/regmap-irq.c @@ -418,6 +418,31 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags, reg, ret); goto err_alloc; } + + if (!chip->init_ack_masked) + continue; + + /* Ack masked but set interrupts */ + reg = chip->status_base + + (i * map->reg_stride * d->irq_reg_stride); + ret = regmap_read(map, reg, &d->status_buf[i]); + if (ret != 0) { + dev_err(map->dev, "Failed to read IRQ status: %d\n", + ret); + goto err_alloc; + } + + if (d->status_buf[i] && chip->ack_base) { + reg = chip->ack_base + + (i * map->reg_stride * d->irq_reg_stride); + ret = regmap_write(map, reg, + d->status_buf[i] & d->mask_buf[i]); + if (ret != 0) { + dev_err(map->dev, "Failed to ack 0x%x: %d\n", + reg, ret); + goto err_alloc; + } + } } /* Wake is disabled by default */ |