Re: [PATCH 1/4 v1] gpio: Add support for hierarchical IRQ domains

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 24 2019 at 07:29 -0600, Linus Walleij wrote:
+static const struct irq_domain_ops gpiochip_hierarchy_domain_ops = {
+	.activate = gpiochip_irq_domain_activate,
+	.deactivate = gpiochip_irq_domain_deactivate,
+	.translate = gpiochip_hierarchy_irq_domain_translate,
+	.alloc = gpiochip_hierarchy_irq_domain_alloc,
+	.free = irq_domain_free_irqs_common,
+};
+
+static int gpiochip_hierarchy_add_domain(struct gpio_chip *gc)
+{
+	if (!gc->irq.parent_domain) {
+		chip_err(gc, "missing parent irqdomain\n");
+		return -EINVAL;
+	}
+
+	if (!gc->irq.parent_domain ||
+	    !gc->irq.child_to_parent_hwirq ||
+	    !gc->irq.fwnode) {
+		chip_err(gc, "missing irqdomain vital data\n");
+		return -EINVAL;
+	}
+
+	gc->irq.domain = irq_domain_create_hierarchy(
+		gc->irq.parent_domain,
+		IRQ_DOMAIN_FLAG_HIERARCHY,
+		gc->ngpio,
+		gc->irq.fwnode,
+		&gpiochip_hierarchy_domain_ops,
This should probably be used only if gc->irq.domain_ops is not set.
+		gc);
+
+	if (!gc->irq.domain) {
+		chip_err(gc, "failed to add hierarchical domain\n");
+		return -EINVAL;
+	}
+
+	gpiochip_set_hierarchical_irqchip(gc, gc->irq.chip);
+
+	chip_info(gc, "set up hierarchical irqdomain\n");
+
+	return 0;
+}
+

Thanks,
Lina



[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux