diff mbox series

[v6,1/6] regmap: add a new macro:REGMAP_IRQ_REG_LINE(_id, _reg_bits)

Message ID 1540894081-31270-2-git-send-email-tony.xie@rock-chips.com (mailing list archive)
State New, archived
Headers show
Series support a new type of PMIC, including two chips(rk817 and rk809) | expand

Commit Message

Tony Xie Oct. 30, 2018, 10:07 a.m. UTC
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>
---
 include/linux/regmap.h | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Mark Brown Nov. 14, 2018, 10:22 p.m. UTC | #1
On Tue, Oct 30, 2018 at 06:07:56PM +0800, Tony Xie wrote:
> 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.

The following changes since commit 651022382c7f8da46cb4872a545ee1da6d097d2a:

  Linux 4.20-rc1 (2018-11-04 15:37:52 -0800)

are available in the Git repository at:

  https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git tags/regmap-irq-line

for you to fetch changes up to 43fac3238c1d9363b2a93d8d56c2be0c29c64e6c:

  regmap: add a new macro:REGMAP_IRQ_REG_LINE(_id, _reg_bits) (2018-11-14 14:20:45 -0800)

----------------------------------------------------------------
regmap: Add an IRQ_LINE macro to help defining regmap-irq tables

----------------------------------------------------------------
Tony Xie (1):
      regmap: add a new macro:REGMAP_IRQ_REG_LINE(_id, _reg_bits)

 include/linux/regmap.h | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 4f38068..a468b81 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -1047,6 +1047,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.
  *