regmap: add a new macro:REGMAP_IRQ_REG_LINE(_id, _reg_bits)
authorTony Xie <tony.xie@rock-chips.com>
Tue, 30 Oct 2018 10:07:56 +0000 (18:07 +0800)
committerMark Brown <broonie@kernel.org>
Wed, 14 Nov 2018 22:20:45 +0000 (14:20 -0800)
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>
include/linux/regmap.h

index a367d59c301d8610f55f13e1210ae7253b41cd4e..3930f333165287c7cf3921b172dc97435d438ddc 100644 (file)
@@ -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.
  *