Message ID | 1448532010-30930-5-git-send-email-mschiller@tdt.de |
---|---|
State | New |
Headers | show |
On Thu, Nov 26, 2015 at 11:00 AM, Martin Schiller <mschiller@tdt.de> wrote: Please write a commit message. > From: John Crispin <blogic@openwrt.org> > > Signed-off-by: John Crispin <blogic@openwrt.org> > Signed-off-by: Martin Schiller <mschiller@tdt.de> > --- > Changes in v3: > - Moved this change into a separate patch (...) > +static int xway_gpio_to_irq(struct gpio_chip *chip, unsigned offset) > +{ > + struct ltq_pinmux_info *info = dev_get_drvdata(chip->dev); > + int i; > + > + for (i = 0; i < info->num_exin; i++) > + if (info->exin[i] == offset) > + return ltq_eiu_get_irq(i); > + > + return -1; > +} > + (...) > + .to_irq = xway_gpio_to_irq, Can you explain this a bit, and add a comment in the code as to what is going on? I take it that the Lantiq has a dedicated IRQ line for some of the GPIO lines, referred to as external interrupts, and then you just go in and grab that frm the external interrupt unit like this? Looks OK, just send an updated patch with some more explanations. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/pinctrl/pinctrl-xway.c b/drivers/pinctrl/pinctrl-xway.c index b78baaa..8ae99a8 100644 --- a/drivers/pinctrl/pinctrl-xway.c +++ b/drivers/pinctrl/pinctrl-xway.c @@ -1573,6 +1573,18 @@ static int xway_gpio_dir_out(struct gpio_chip *chip, unsigned int pin, int val) return 0; } +static int xway_gpio_to_irq(struct gpio_chip *chip, unsigned offset) +{ + struct ltq_pinmux_info *info = dev_get_drvdata(chip->dev); + int i; + + for (i = 0; i < info->num_exin; i++) + if (info->exin[i] == offset) + return ltq_eiu_get_irq(i); + + return -1; +} + static struct gpio_chip xway_chip = { .label = "gpio-xway", .direction_input = xway_gpio_dir_in, @@ -1581,6 +1593,7 @@ static struct gpio_chip xway_chip = { .set = xway_gpio_set, .request = gpiochip_generic_request, .free = gpiochip_generic_free, + .to_irq = xway_gpio_to_irq, .base = -1, };