diff options
author | Maxim Kochetkov <fido_max@inbox.ru> | 2021-05-25 06:42:03 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2021-06-07 16:20:04 +0100 |
commit | bcd23f93d3984a94d64ce0b6bbfa3789c0e8ebaf (patch) | |
tree | f3183338d01ad85059cd0acfa4724b74e93c02e7 /drivers/base/regmap | |
parent | b24412aff37c58286a0aeafc5678fbdc6a527d54 (diff) | |
download | linux-stable-bcd23f93d3984a94d64ce0b6bbfa3789c0e8ebaf.tar.gz linux-stable-bcd23f93d3984a94d64ce0b6bbfa3789c0e8ebaf.tar.bz2 linux-stable-bcd23f93d3984a94d64ce0b6bbfa3789c0e8ebaf.zip |
regmap-irq: Introduce inverted status registers support
Some interrupt controllers have inverted status register:
cleared bits is active interrupts and set bits is inactive interrupts,
so add inverted status support to the framework.
Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>
Link: https://lore.kernel.org/r/20210525034204.5272-1-fido_max@inbox.ru
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/base/regmap')
-rw-r--r-- | drivers/base/regmap/regmap-irq.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c index 760296a4b606..d2656581a608 100644 --- a/drivers/base/regmap/regmap-irq.c +++ b/drivers/base/regmap/regmap-irq.c @@ -531,6 +531,10 @@ static irqreturn_t regmap_irq_thread(int irq, void *d) } } + if (chip->status_invert) + for (i = 0; i < data->chip->num_regs; i++) + data->status_buf[i] = ~data->status_buf[i]; + /* * Ignore masked IRQs and ack if we need to; we ack early so * there is no race between handling and acknowleding the @@ -800,6 +804,9 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode, goto err_alloc; } + if (chip->status_invert) + d->status_buf[i] = ~d->status_buf[i]; + if (d->status_buf[i] && (chip->ack_base || chip->use_ack)) { reg = sub_irq_reg(d, d->chip->ack_base, i); if (chip->ack_invert) |