summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTony Xie <tony.xie@rock-chips.com>2018-10-30 13:07:56 +0300
committerMark Brown <broonie@kernel.org>2018-11-15 01:20:45 +0300
commit43fac3238c1d9363b2a93d8d56c2be0c29c64e6c (patch)
treecd92edbc17e84b16904ec38f23b69b4324e79b41 /include
parent651022382c7f8da46cb4872a545ee1da6d097d2a (diff)
downloadlinux-43fac3238c1d9363b2a93d8d56c2be0c29c64e6c.tar.xz
regmap: add a new macro:REGMAP_IRQ_REG_LINE(_id, _reg_bits)
if there are lots of irqs for a device and the register addresses for these irqs is continuous, we can use this macro to initialize regmap_irq value. Signed-off-by: Tony Xie <tony.xie@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/regmap.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index a367d59c301d..3930f3331652 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -1110,6 +1110,12 @@ struct regmap_irq {
#define REGMAP_IRQ_REG(_irq, _off, _mask) \
[_irq] = { .reg_offset = (_off), .mask = (_mask) }
+#define REGMAP_IRQ_REG_LINE(_id, _reg_bits) \
+ [_id] = { \
+ .mask = BIT((_id) % (_reg_bits)), \
+ .reg_offset = (_id) / (_reg_bits), \
+ }
+
/**
* struct regmap_irq_chip - Description of a generic regmap irq_chip.
*