Skip to content

Commit

Permalink
regmap: add a new macro:REGMAP_IRQ_REG_LINE(_id, _reg_bits)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tony Xie authored and Mark Brown committed Nov 14, 2018
1 parent 6510223 commit 43fac32
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/linux/regmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down

0 comments on commit 43fac32

Please sign in to comment.