[PATCH v2 08/10] regmap: Allow setting IRQ domain name suffix

Matti Vaittinen
2024-05-24T08:19:20Z

[-- Attachment #1: Type: text/plain, Size: 2862 bytes --]

When multiple IRQ domains are created from same device-tree node they
will get same name based on the device-tree path. This will cause a
naming collision in debugFS when IRQ domain specific entries are
created.

The regmap-IRQ creates per instance IRQ domains. This will lead to the
domain name conflict when a device which provides more than one physical
IRQ uses the regmap-IRQ.

Add support for specifying an IRQ domain name suffix when creating a
regmap-IRQ controller.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
---
drivers/base/regmap/regmap-irq.c | 13 ++++++++-----
include/linux/regmap.h | 4 ++++
2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
index 45fd13ef13fc..e86964a9843b 100644
--- a/drivers/base/regmap/regmap-irq.c
+++ b/drivers/base/regmap/regmap-irq.c
@@ -857,12 +857,15 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
}

if (irq_base)
- d->domain = irq_domain_create_legacy(fwnode, chip->num_irqs,
- irq_base, 0,
- &regmap_domain_ops, d);
+ d->domain = irq_domain_create_legacy_named(fwnode,
+ chip->num_irqs, irq_base, 0,
+ &regmap_domain_ops, d,
+ chip->domain_suffix);
else
- d->domain = irq_domain_create_linear(fwnode, chip->num_irqs,
- &regmap_domain_ops, d);
+ d->domain = irq_domain_create_linear_named(fwnode,
+ chip->num_irqs, &regmap_domain_ops,
+ d, chip->domain_suffix);
+
if (!d->domain) {
dev_err(map->dev, "Failed to create IRQ domain\n");
ret = -ENOMEM;
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index b743241cfb7c..9df971986abb 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -1518,6 +1518,9 @@ struct regmap_irq_chip_data;
* struct regmap_irq_chip - Description of a generic regmap irq_chip.
*
* @name: Descriptive name for IRQ controller.
+ * @domain_suffix: Name suffix to be appended to end of IRQ domain name. Needed
+ * when multiple regmap-IRQ controllers are created from same
+ * device.
*
* @main_status: Base main status register address. For chips which have
* interrupts arranged in separate sub-irq blocks with own IRQ
@@ -1603,6 +1606,7 @@ struct regmap_irq_chip_data;
*/
struct regmap_irq_chip {
const char *name;
+ const char *domain_suffix;

unsigned int main_status;
unsigned int num_main_status_bits;