lkml.org 
[lkml]   [2019]   [Jul]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 2/4] gpio: allow customizing hierarchical IRQ chips
On Mon, Jul 8, 2019 at 1:01 PM Brian Masney <masneyb@onstation.org> wrote:

> Now that the GPIO core has support for hierarchical IRQ chips, let's add
> support for three new callbacks in struct gpio_irq_chip:
>
> populate_parent_fwspec:
> This optional callback populates the struct irq_fwspec for the
> parent's IRQ domain. If this is not specified, then
> gpiochip_populate_parent_fwspec_twocell will be used. A four-cell
> variant named &gpiochip_populate_parent_fwspec_twocell is also
> available.
>
> child_pin_to_irq:
> This optional callback is used to translate the child's GPIO pin
> number to an IRQ number for the GPIO to_irq() callback. If this is
> not specified, then a default callback will be provided that
> returns the pin number.
>
> child_irq_domain_ops:
> The IRQ domain operations that will be used for this GPIO IRQ
> chip. If no operations are provided, then default callbacks will
> be populated to setup the IRQ hierarchy. Some drivers need to
> supply their own translate function.
>
> These will be initially used by Qualcomm's spmi-gpio and ssbi-gpio.
>
> Signed-off-by: Brian Masney <masneyb@onstation.org>

This is overall looking very appetizing!

I want to apply this on top of my patch and respin it
with some of Masahiro's comments as well and then let's
try to just apply all of this.

> Note: checkpatch doesn't like that child_irq_domain_ops is not const.

Hm? I suspect some janitor will find the problem and patch it for us.

> +static void gpiochip_add_default_irq_domain_ops(struct irq_domain_ops *ops)
> +{
> + if (!ops->activate)
> + ops->activate = gpiochip_irq_domain_activate;
> +
> + if (!ops->deactivate)
> + ops->deactivate = gpiochip_irq_domain_deactivate;
> +
> + if (!ops->translate)
> + ops->translate = gpiochip_hierarchy_irq_domain_translate;
> +
> + if (!ops->alloc)
> + ops->alloc = gpiochip_hierarchy_irq_domain_alloc;
> +
> + if (!ops->free)
> + ops->free = irq_domain_free_irqs_common;
> +}

I'm fine with translate(), this seems to be what Lina needs too.

But do we really need to make them all optional? activate() and
deactivate() will require the driver to lock the irq etc which is hairy.

Yours,
Linus Walleij

\
 
 \ /
  Last update: 2019-07-29 00:53    [W:0.122 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site