From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <bgolaszewski@baylibre.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-gpio@vger.kernel.org,
Mika Westerberg <mika.westerberg@linux.intel.com>,
ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>
Subject: Re: [PATCH v3 1/2] gpio: sch: Add edge event support
Date: Mon, 9 Dec 2019 18:36:58 +0200 [thread overview]
Message-ID: <20191209163658.GL32742@smile.fi.intel.com> (raw)
In-Reply-To: <5d7399ce-1776-18ef-3bb5-6e3e8e7e7524@siemens.com>
On Fri, Nov 22, 2019 at 04:33:05PM +0100, Jan Kiszka wrote:
> On 22.11.19 12:12, Andy Shevchenko wrote:
> > On Wed, Nov 20, 2019 at 08:20:13PM +0100, Jan Kiszka wrote:
> > > + switch (type & IRQ_TYPE_SENSE_MASK) {
> > > + case IRQ_TYPE_EDGE_RISING:
> > > + rising = 1;
> > > + break;
> > > + case IRQ_TYPE_EDGE_FALLING:
> > > + falling = 1;
> > > + break;
> > > + case IRQ_TYPE_EDGE_BOTH:
> > > + rising = 1;
> > > + falling = 1;
> > > + break;
> > > + default:
> > > + return -EINVAL;
> > > + }
> > Won't we need to set up IRQ handler here and use handle_bad_irq() during
> > initialization phase?
>
> Why? This is just defining the edge type, not whether an interrupt could be
> generated or not. Also, we only have edge events here, so no reason to
> switch types.
OK.
> > > + irq_base = devm_irq_alloc_descs(&pdev->dev, -1, 0, sch->chip.ngpio,
> > > + NUMA_NO_NODE);
> > > + if (irq_base < 0)
> > > + return irq_base;
> > > + sch->irq_base = irq_base;
> > > +
> > > + gc = devm_irq_alloc_generic_chip(&pdev->dev, "sch_gpio", 1, irq_base,
> > > + NULL, handle_simple_irq);
> > > + if (!gc)
> > > + return -ENOMEM;
> > > +
> > > + gc->private = sch;
> > > + ct = gc->chip_types;
> > > +
> > > + ct->chip.irq_mask = sch_irq_mask;
> > > + ct->chip.irq_unmask = sch_irq_unmask;
> > > + ct->chip.irq_set_type = sch_irq_type;
> > > +
> > > + ret = devm_irq_setup_generic_chip(&pdev->dev, gc,
> > > + IRQ_MSK(sch->chip.ngpio),
> > > + 0, IRQ_NOREQUEST | IRQ_NOPROBE, 0);
> > > + if (ret)
> > > + return ret;
> >
> > Shan't we do this in the (similar) way how it's done in pinctrl-cherryview.c
> > driver? (Keep in mind later patches which are going to be v5.5)
> >
>
> Can you be a bit more specific for me? Do you mean the pattern
> gpiochip_irqchip_add / gpiochip_set_chained_irqchip? What would be the
> difference / benefit? And how would I link sch_sci_handler to that pattern?
Now we have struct irq_chip is part of GPIO chip, so, we may use it and supply
needed callbacks and settings before calling gpiochip_add_data().
Will it work in this case?
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2019-12-09 16:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-20 19:20 [PATCH v3 0/2] gpio: sch: Interrupt support Jan Kiszka
2019-11-20 19:20 ` [PATCH v3 1/2] gpio: sch: Add edge event support Jan Kiszka
2019-11-22 10:41 ` Mika Westerberg
2019-11-22 11:12 ` Andy Shevchenko
2019-11-22 15:33 ` Jan Kiszka
2019-12-09 16:36 ` Andy Shevchenko [this message]
2019-11-28 9:33 ` Linus Walleij
2019-11-20 19:20 ` [PATCH v3 2/2] gpio: sch: Hook into ACPI SCI handler to catch GPIO edge events Jan Kiszka
2019-11-22 10:43 ` 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=20191209163658.GL32742@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=bgolaszewski@baylibre.com \
--cc=jan.kiszka@siemens.com \
--cc=linus.walleij@linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=rafael.j.wysocki@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox