Commit bdf9b86c authored by Aidan MacDonald's avatar Aidan MacDonald Committed by Mark Brown

regmap-irq: Add get_irq_reg() callback

Replace the internal sub_irq_reg() function with a public callback
that drivers can use when they have more complex register layouts.
The default implementation is regmap_irq_get_irq_reg_linear(), used
if the chip doesn't provide its own callback.
Signed-off-by: default avatarAidan MacDonald <aidanmacdonald.0x0@gmail.com>
Link: https://lore.kernel.org/r/20220623211420.918875-12-aidanmacdonald.0x0@gmail.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent e8ffb12e
This diff is collapsed.
...@@ -1440,6 +1440,8 @@ struct regmap_irq_sub_irq_map { ...@@ -1440,6 +1440,8 @@ struct regmap_irq_sub_irq_map {
unsigned int *offset; unsigned int *offset;
}; };
struct regmap_irq_chip_data;
/** /**
* struct regmap_irq_chip - Description of a generic regmap irq_chip. * struct regmap_irq_chip - Description of a generic regmap irq_chip.
* *
...@@ -1531,6 +1533,13 @@ struct regmap_irq_sub_irq_map { ...@@ -1531,6 +1533,13 @@ struct regmap_irq_sub_irq_map {
* and configure virt regs. Deprecated, use @set_type_config * and configure virt regs. Deprecated, use @set_type_config
* callback and config registers instead. * callback and config registers instead.
* @set_type_config: Callback used for configuring irq types. * @set_type_config: Callback used for configuring irq types.
* @get_irq_reg: Callback for mapping (base register, index) pairs to register
* addresses. The base register will be one of @status_base,
* @mask_base, etc., @main_status, or any of @config_base.
* The index will be in the range [0, num_main_regs[ for the
* main status base, [0, num_type_settings[ for any config
* register base, and [0, num_regs[ for any other base.
* If unspecified then regmap_irq_get_irq_reg_linear() is used.
* @irq_drv_data: Driver specific IRQ data which is passed as parameter when * @irq_drv_data: Driver specific IRQ data which is passed as parameter when
* driver specific pre/post interrupt handler is called. * driver specific pre/post interrupt handler is called.
* *
...@@ -1585,11 +1594,13 @@ struct regmap_irq_chip { ...@@ -1585,11 +1594,13 @@ struct regmap_irq_chip {
unsigned long hwirq, int reg); unsigned long hwirq, int reg);
int (*set_type_config)(unsigned int **buf, unsigned int type, int (*set_type_config)(unsigned int **buf, unsigned int type,
const struct regmap_irq *irq_data, int idx); const struct regmap_irq *irq_data, int idx);
unsigned int (*get_irq_reg)(struct regmap_irq_chip_data *data,
unsigned int base, int index);
void *irq_drv_data; void *irq_drv_data;
}; };
struct regmap_irq_chip_data; unsigned int regmap_irq_get_irq_reg_linear(struct regmap_irq_chip_data *data,
unsigned int base, int index);
int regmap_irq_set_type_config_simple(unsigned int **buf, unsigned int type, int regmap_irq_set_type_config_simple(unsigned int **buf, unsigned int type,
const struct regmap_irq *irq_data, int idx); const struct regmap_irq *irq_data, int idx);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment