* [PATCH v2] pinctrl: intel: baytrail: Pass irqchip when adding gpiochip
@ 2019-10-05 20:47 Linus Walleij
2019-10-07 8:08 ` Andy Shevchenko
2019-10-10 13:28 ` Andy Shevchenko
0 siblings, 2 replies; 3+ messages in thread
From: Linus Walleij @ 2019-10-05 20:47 UTC (permalink / raw)
To: linux-gpio
Cc: Bartosz Golaszewski, Linus Walleij, Andy Shevchenko,
Mika Westerberg, Thierry Reding
We need to convert all old gpio irqchips to pass the irqchip
setup along when adding the gpio_chip. For more info see
drivers/gpio/TODO.
For chained irqchips this is a pretty straight-forward
conversion.
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Thierry Reding <treding@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v1->v2:
- Rebase on v5.4-rc1
---
drivers/pinctrl/intel/pinctrl-baytrail.c | 38 ++++++++++++++----------
1 file changed, 22 insertions(+), 16 deletions(-)
diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
index 9ffb22211d2b..64a59fc08b63 100644
--- a/drivers/pinctrl/intel/pinctrl-baytrail.c
+++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
@@ -1528,6 +1528,28 @@ static int byt_gpio_probe(struct byt_gpio *vg)
if (!vg->saved_context)
return -ENOMEM;
#endif
+
+ /* set up interrupts */
+ irq_rc = platform_get_resource(vg->pdev, IORESOURCE_IRQ, 0);
+ if (irq_rc && irq_rc->start) {
+ struct gpio_irq_chip *girq;
+
+ byt_gpio_irq_init_hw(vg);
+
+ girq = &gc->irq;
+ girq->chip = &byt_irqchip;
+ girq->parent_handler = byt_gpio_irq_handler;
+ girq->num_parents = 1;
+ girq->parents = devm_kcalloc(&vg->pdev->dev, 1,
+ sizeof(*girq->parents),
+ GFP_KERNEL);
+ if (!girq->parents)
+ return -ENOMEM;
+ girq->parents[0] = (unsigned int)irq_rc->start;
+ girq->default_type = IRQ_TYPE_NONE;
+ girq->handler = handle_bad_irq;
+ }
+
ret = devm_gpiochip_add_data(&vg->pdev->dev, gc, vg);
if (ret) {
dev_err(&vg->pdev->dev, "failed adding byt-gpio chip\n");
@@ -1541,22 +1563,6 @@ static int byt_gpio_probe(struct byt_gpio *vg)
return ret;
}
- /* set up interrupts */
- irq_rc = platform_get_resource(vg->pdev, IORESOURCE_IRQ, 0);
- if (irq_rc && irq_rc->start) {
- byt_gpio_irq_init_hw(vg);
- ret = gpiochip_irqchip_add(gc, &byt_irqchip, 0,
- handle_bad_irq, IRQ_TYPE_NONE);
- if (ret) {
- dev_err(&vg->pdev->dev, "failed to add irqchip\n");
- return ret;
- }
-
- gpiochip_set_chained_irqchip(gc, &byt_irqchip,
- (unsigned)irq_rc->start,
- byt_gpio_irq_handler);
- }
-
return ret;
}
--
2.21.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] pinctrl: intel: baytrail: Pass irqchip when adding gpiochip
2019-10-05 20:47 [PATCH v2] pinctrl: intel: baytrail: Pass irqchip when adding gpiochip Linus Walleij
@ 2019-10-07 8:08 ` Andy Shevchenko
2019-10-10 13:28 ` Andy Shevchenko
1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2019-10-07 8:08 UTC (permalink / raw)
To: Linus Walleij
Cc: linux-gpio, Bartosz Golaszewski, Mika Westerberg, Thierry Reding
On Sat, Oct 05, 2019 at 10:47:47PM +0200, Linus Walleij wrote:
> We need to convert all old gpio irqchips to pass the irqchip
> setup along when adding the gpio_chip. For more info see
> drivers/gpio/TODO.
>
> For chained irqchips this is a pretty straight-forward
> conversion.
>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
> Cc: Thierry Reding <treding@nvidia.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> ChangeLog v1->v2:
> - Rebase on v5.4-rc1
I would like to push it to my tree, I need to understand if the for-next is
the okay target for it.
> ---
> drivers/pinctrl/intel/pinctrl-baytrail.c | 38 ++++++++++++++----------
> 1 file changed, 22 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
> index 9ffb22211d2b..64a59fc08b63 100644
> --- a/drivers/pinctrl/intel/pinctrl-baytrail.c
> +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
> @@ -1528,6 +1528,28 @@ static int byt_gpio_probe(struct byt_gpio *vg)
> if (!vg->saved_context)
> return -ENOMEM;
> #endif
> +
> + /* set up interrupts */
> + irq_rc = platform_get_resource(vg->pdev, IORESOURCE_IRQ, 0);
> + if (irq_rc && irq_rc->start) {
> + struct gpio_irq_chip *girq;
> +
> + byt_gpio_irq_init_hw(vg);
> +
> + girq = &gc->irq;
> + girq->chip = &byt_irqchip;
> + girq->parent_handler = byt_gpio_irq_handler;
> + girq->num_parents = 1;
For consistency I would use this below.
I will update when applying.
> + girq->parents = devm_kcalloc(&vg->pdev->dev, 1,
> + sizeof(*girq->parents),
> + GFP_KERNEL);
> + if (!girq->parents)
> + return -ENOMEM;
> + girq->parents[0] = (unsigned int)irq_rc->start;
> + girq->default_type = IRQ_TYPE_NONE;
> + girq->handler = handle_bad_irq;
> + }
> +
> ret = devm_gpiochip_add_data(&vg->pdev->dev, gc, vg);
> if (ret) {
> dev_err(&vg->pdev->dev, "failed adding byt-gpio chip\n");
> @@ -1541,22 +1563,6 @@ static int byt_gpio_probe(struct byt_gpio *vg)
> return ret;
> }
>
> - /* set up interrupts */
> - irq_rc = platform_get_resource(vg->pdev, IORESOURCE_IRQ, 0);
> - if (irq_rc && irq_rc->start) {
> - byt_gpio_irq_init_hw(vg);
> - ret = gpiochip_irqchip_add(gc, &byt_irqchip, 0,
> - handle_bad_irq, IRQ_TYPE_NONE);
> - if (ret) {
> - dev_err(&vg->pdev->dev, "failed to add irqchip\n");
> - return ret;
> - }
> -
> - gpiochip_set_chained_irqchip(gc, &byt_irqchip,
> - (unsigned)irq_rc->start,
> - byt_gpio_irq_handler);
> - }
> -
> return ret;
> }
>
> --
> 2.21.0
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] pinctrl: intel: baytrail: Pass irqchip when adding gpiochip
2019-10-05 20:47 [PATCH v2] pinctrl: intel: baytrail: Pass irqchip when adding gpiochip Linus Walleij
2019-10-07 8:08 ` Andy Shevchenko
@ 2019-10-10 13:28 ` Andy Shevchenko
1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2019-10-10 13:28 UTC (permalink / raw)
To: Linus Walleij
Cc: linux-gpio, Bartosz Golaszewski, Mika Westerberg, Thierry Reding
On Sat, Oct 05, 2019 at 10:47:47PM +0200, Linus Walleij wrote:
> We need to convert all old gpio irqchips to pass the irqchip
> setup along when adding the gpio_chip. For more info see
> drivers/gpio/TODO.
>
> For chained irqchips this is a pretty straight-forward
> conversion.
> + byt_gpio_irq_init_hw(vg);
This has to use ->init_hw() callback.
So, please consider PR I have sent yesterday along with
converting the driver to use it.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-10 13:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-05 20:47 [PATCH v2] pinctrl: intel: baytrail: Pass irqchip when adding gpiochip Linus Walleij
2019-10-07 8:08 ` Andy Shevchenko
2019-10-10 13:28 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).