All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <marc.zyngier@arm.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	linux-arm-kernel@lists.infradead.org
Cc: linux-gpio@vger.kernel.org,
	Linus Walleij <linus.walleij@linaro.org>,
	Graeme Gregory <graeme.gregory@linaro.org>,
	Masahisa Kojima <masahisa.kojima@linaro.org>
Subject: Re: [RFC PATCH 2/3] irqchip/exiu: implement ACPI gpiolib/irqchip support
Date: Thu, 25 Apr 2019 16:33:40 +0100	[thread overview]
Message-ID: <1fbbfc30-7389-5618-a046-ab8872882494@arm.com> (raw)
In-Reply-To: <20190425102020.21533-3-ard.biesheuvel@linaro.org>

Hi Ard,

On 25/04/2019 11:20, Ard Biesheuvel wrote:
> Expose the existing EXIU hierarchical irqchip domain code to permit
> the interrupt controller to be used as the irqchip component of a
> GPIO controller on ACPI systems.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  drivers/irqchip/irq-sni-exiu.c | 82 +++++++++++++++++---
>  1 file changed, 73 insertions(+), 9 deletions(-)
> 

[...]

> +int exiu_acpi_init(struct platform_device *pdev, struct gpio_chip *gc)
> +{
> +	struct irq_domain *parent_domain = NULL, *domain;
> +	struct resource *res;
> +	int irq;
> +
> +	irq = platform_get_irq(pdev, 0);
> +	if (irq > 0)
> +		parent_domain = irq_get_irq_data(irq)->domain;
> +
> +	if (!parent_domain) {
> +		dev_err(&pdev->dev, "unable to obtain parent domain\n");
> +		return -ENODEV;
> +	}
> +
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> +	if (!res) {
> +		dev_err(&pdev->dev, "failed to parse memory resource\n");
> +		return -ENXIO;
> +	}
> +
> +	domain = exiu_init(parent_domain, dev_fwnode(&pdev->dev), res);
> +	if (IS_ERR(domain)) {
> +		dev_err(&pdev->dev, "failed to create IRQ domain (%ld)\n",
> +			PTR_ERR(domain));
> +		return PTR_ERR(domain);
> +	}
> +
> +	gc->irq.domain = domain;
> +	gc->to_irq = exiu_acpi_gpio_to_irq;
> +
> +	dev_info(&pdev->dev, "%d interrupts forwarded\n", NUM_IRQS);
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL(exiu_acpi_init);
> +#endif
> 

I must say I'm not overly keen on this function. Why can't this be
probed as an ACPI device, creating the corresponding domain, and leaving
to the GPIO driver the task of doing the GPIO stuff?

I appreciate there is a dependency between the two, but that's something
we should be able to solve (probe deferral?).

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <marc.zyngier@arm.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	linux-arm-kernel@lists.infradead.org
Cc: linux-gpio@vger.kernel.org,
	Linus Walleij <linus.walleij@linaro.org>,
	Graeme Gregory <graeme.gregory@linaro.org>,
	Masahisa Kojima <masahisa.kojima@linaro.org>
Subject: Re: [RFC PATCH 2/3] irqchip/exiu: implement ACPI gpiolib/irqchip support
Date: Thu, 25 Apr 2019 16:33:40 +0100	[thread overview]
Message-ID: <1fbbfc30-7389-5618-a046-ab8872882494@arm.com> (raw)
In-Reply-To: <20190425102020.21533-3-ard.biesheuvel@linaro.org>

Hi Ard,

On 25/04/2019 11:20, Ard Biesheuvel wrote:
> Expose the existing EXIU hierarchical irqchip domain code to permit
> the interrupt controller to be used as the irqchip component of a
> GPIO controller on ACPI systems.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  drivers/irqchip/irq-sni-exiu.c | 82 +++++++++++++++++---
>  1 file changed, 73 insertions(+), 9 deletions(-)
> 

[...]

> +int exiu_acpi_init(struct platform_device *pdev, struct gpio_chip *gc)
> +{
> +	struct irq_domain *parent_domain = NULL, *domain;
> +	struct resource *res;
> +	int irq;
> +
> +	irq = platform_get_irq(pdev, 0);
> +	if (irq > 0)
> +		parent_domain = irq_get_irq_data(irq)->domain;
> +
> +	if (!parent_domain) {
> +		dev_err(&pdev->dev, "unable to obtain parent domain\n");
> +		return -ENODEV;
> +	}
> +
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> +	if (!res) {
> +		dev_err(&pdev->dev, "failed to parse memory resource\n");
> +		return -ENXIO;
> +	}
> +
> +	domain = exiu_init(parent_domain, dev_fwnode(&pdev->dev), res);
> +	if (IS_ERR(domain)) {
> +		dev_err(&pdev->dev, "failed to create IRQ domain (%ld)\n",
> +			PTR_ERR(domain));
> +		return PTR_ERR(domain);
> +	}
> +
> +	gc->irq.domain = domain;
> +	gc->to_irq = exiu_acpi_gpio_to_irq;
> +
> +	dev_info(&pdev->dev, "%d interrupts forwarded\n", NUM_IRQS);
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL(exiu_acpi_init);
> +#endif
> 

I must say I'm not overly keen on this function. Why can't this be
probed as an ACPI device, creating the corresponding domain, and leaving
to the GPIO driver the task of doing the GPIO stuff?

I appreciate there is a dependency between the two, but that's something
we should be able to solve (probe deferral?).

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2019-04-25 15:33 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-25 10:20 [RFC PATCH 0/3] synquacer: implement ACPI gpio/interrupt support Ard Biesheuvel
2019-04-25 10:20 ` Ard Biesheuvel
2019-04-25 10:20 ` [RFC PATCH 1/3] irqchip/exiu: preparatory refactor for ACPI support Ard Biesheuvel
2019-04-25 10:20   ` Ard Biesheuvel
2019-04-25 10:20 ` [RFC PATCH 2/3] irqchip/exiu: implement ACPI gpiolib/irqchip support Ard Biesheuvel
2019-04-25 10:20   ` Ard Biesheuvel
2019-04-25 13:14   ` Linus Walleij
2019-04-25 13:14     ` Linus Walleij
2019-04-25 15:33   ` Marc Zyngier [this message]
2019-04-25 15:33     ` Marc Zyngier
2019-04-26  8:24     ` Ard Biesheuvel
2019-04-26  8:24       ` Ard Biesheuvel
2019-04-26  8:44       ` Marc Zyngier
2019-04-26  8:44         ` Marc Zyngier
2019-04-26 11:45         ` Ard Biesheuvel
2019-04-26 11:45           ` Ard Biesheuvel
2019-04-26 22:27           ` Ard Biesheuvel
2019-04-26 22:27             ` Ard Biesheuvel
2019-04-29  9:09             ` Ard Biesheuvel
2019-04-29  9:09               ` Ard Biesheuvel
2019-04-29  9:35               ` Marc Zyngier
2019-04-29  9:35                 ` Marc Zyngier
2019-04-25 10:20 ` [RFC PATCH 3/3] gpio: mb86s70: enable ACPI and irqchip support Ard Biesheuvel
2019-04-25 10:20   ` Ard Biesheuvel
2019-04-25 13:23   ` Linus Walleij
2019-04-25 13:23     ` Linus Walleij
2019-04-25 13:35     ` Ard Biesheuvel
2019-04-25 13:35       ` Ard Biesheuvel
2019-04-25 14:27     ` Mika Westerberg
2019-04-25 14:27       ` Mika Westerberg
2019-04-26  8:19       ` Ard Biesheuvel
2019-04-26  8:19         ` Ard Biesheuvel
2019-04-26  9:15         ` Mika Westerberg
2019-04-26  9:15           ` Mika Westerberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1fbbfc30-7389-5618-a046-ab8872882494@arm.com \
    --to=marc.zyngier@arm.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=graeme.gregory@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=masahisa.kojima@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.