aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/regmap.h
diff options
context:
space:
mode:
authorTony Xie <tony.xie@rock-chips.com>2018-10-30 18:07:56 +0800
committerMark Brown <broonie@kernel.org>2018-11-14 14:20:45 -0800
commit43fac3238c1d9363b2a93d8d56c2be0c29c64e6c (patch)
treecd92edbc17e84b16904ec38f23b69b4324e79b41 /include/linux/regmap.h
parentLinux 4.20-rc1 (diff)
downloadlinux-dev-43fac3238c1d9363b2a93d8d56c2be0c29c64e6c.tar.xz
linux-dev-43fac3238c1d9363b2a93d8d56c2be0c29c64e6c.zip
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/linux/regmap.h')
-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.
*