regmap-irq: Introduce config registers for irq types
authorAidan MacDonald <aidanmacdonald.0x0@gmail.com>
Thu, 23 Jun 2022 21:14:16 +0000 (22:14 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 29 Jun 2022 17:13:13 +0000 (18:13 +0100)
commitfaa87ce9196dbb074d75bd4aecb8bacf18f19b4e
tree1f9f52fbde5226995816e47d68748416df556869
parentf7cc5062d6e5ca439708e8403b1a622cca75adf7
regmap-irq: Introduce config registers for irq types

Config registers provide a more uniform approach to handling irq type
registers. They are essentially an extension of the virtual registers
used by the qcom-pm8008 driver.

Config registers can be represented as a 2D array:

    config_base[0]      reg0,0      reg0,1      reg0,2      reg0,3
    config_base[1]      reg1,0      reg1,1      reg1,2      reg1,3
    config_base[2]      reg2,0      reg2,1      reg2,2      reg2,3

There are 'num_config_bases' base registers, each of which is used to
address 'num_config_regs' registers. The addresses are calculated in
the same way as for other bases. It is assumed that an irq's type is
controlled by one column of registers; that column is identified by
the irq's 'type_reg_offset'.

The set_type_config() callback is responsible for updating the config
register contents. It receives an array of buffers (each represents a
row of registers) and the index of the column to update, along with
the 'struct regmap_irq' description and requested irq type.

Buffered values are written to registers in regmap_irq_sync_unlock().
Note that the entire register contents are overwritten, which is a
minor change in behavior from type registers via 'type_base'.

Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
Link: https://lore.kernel.org/r/20220623211420.918875-9-aidanmacdonald.0x0@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/base/regmap/regmap-irq.c
include/linux/regmap.h