Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

regmap: Allow setting IRQ domain name suffix

When multiple IRQ domains are created from the same device-tree node they
will get the 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 a
domain name conflict when a device which provides more than one
interrupt line 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>
Link: https://patch.msgid.link/776bc4996969e5081bcf61b9bdb5517e537147a3.1723120028.git.mazziesaccount@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Matti Vaittinen and committed by
Mark Brown
dde286ee 1e7c0529

+30 -11
+26 -11
drivers/base/regmap/regmap-irq.c
··· 608 608 } 609 609 EXPORT_SYMBOL_GPL(regmap_irq_set_type_config_simple); 610 610 611 + static int regmap_irq_create_domain(struct fwnode_handle *fwnode, int irq_base, 612 + const struct regmap_irq_chip *chip, 613 + struct regmap_irq_chip_data *d) 614 + { 615 + struct irq_domain_info info = { 616 + .fwnode = fwnode, 617 + .size = chip->num_irqs, 618 + .hwirq_max = chip->num_irqs, 619 + .virq_base = irq_base, 620 + .ops = &regmap_domain_ops, 621 + .host_data = d, 622 + .name_suffix = chip->domain_suffix, 623 + }; 624 + 625 + d->domain = irq_domain_instantiate(&info); 626 + if (IS_ERR(d->domain)) { 627 + dev_err(d->map->dev, "Failed to create IRQ domain\n"); 628 + return PTR_ERR(d->domain); 629 + } 630 + 631 + return 0; 632 + } 633 + 634 + 611 635 /** 612 636 * regmap_add_irq_chip_fwnode() - Use standard regmap IRQ controller handling 613 637 * ··· 880 856 } 881 857 } 882 858 883 - if (irq_base) 884 - d->domain = irq_domain_create_legacy(fwnode, chip->num_irqs, 885 - irq_base, 0, 886 - &regmap_domain_ops, d); 887 - else 888 - d->domain = irq_domain_create_linear(fwnode, chip->num_irqs, 889 - &regmap_domain_ops, d); 890 - if (!d->domain) { 891 - dev_err(map->dev, "Failed to create IRQ domain\n"); 892 - ret = -ENOMEM; 859 + ret = regmap_irq_create_domain(fwnode, irq_base, chip, d); 860 + if (ret) 893 861 goto err_alloc; 894 - } 895 862 896 863 ret = request_threaded_irq(irq, NULL, regmap_irq_thread, 897 864 irq_flags | IRQF_ONESHOT,
+4
include/linux/regmap.h
··· 1521 1521 * struct regmap_irq_chip - Description of a generic regmap irq_chip. 1522 1522 * 1523 1523 * @name: Descriptive name for IRQ controller. 1524 + * @domain_suffix: Name suffix to be appended to end of IRQ domain name. Needed 1525 + * when multiple regmap-IRQ controllers are created from same 1526 + * device. 1524 1527 * 1525 1528 * @main_status: Base main status register address. For chips which have 1526 1529 * interrupts arranged in separate sub-irq blocks with own IRQ ··· 1609 1606 */ 1610 1607 struct regmap_irq_chip { 1611 1608 const char *name; 1609 + const char *domain_suffix; 1612 1610 1613 1611 unsigned int main_status; 1614 1612 unsigned int num_main_status_bits;