* [PATCH v2] pinctrl: baytrail: lock IRQs when starting them
@ 2013-12-03 15:00 Linus Walleij
2013-12-03 16:02 ` Mathias Nyman
2013-12-04 13:26 ` Gerhard Sittig
0 siblings, 2 replies; 4+ messages in thread
From: Linus Walleij @ 2013-12-03 15:00 UTC (permalink / raw)
To: linux-arm-kernel
This uses the new API for tagging GPIO lines as in use by
IRQs. This enforces a few semantic checks on how the underlying
GPIO line is used.
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v1->v2:
- Actually make the change compile, doh.
---
drivers/pinctrl/pinctrl-baytrail.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/drivers/pinctrl/pinctrl-baytrail.c b/drivers/pinctrl/pinctrl-baytrail.c
index 1174ea86b6e9..998dbb0c4c93 100644
--- a/drivers/pinctrl/pinctrl-baytrail.c
+++ b/drivers/pinctrl/pinctrl-baytrail.c
@@ -372,11 +372,33 @@ static void byt_irq_mask(struct irq_data *d)
{
}
+static unsigned int byt_irq_startup(struct irq_data *d)
+{
+ struct byt_gpio *vg = irq_data_get_irq_handler_data(d);
+
+ if (gpio_lock_as_irq(&vg->chip, irqd_to_hwirq(d)))
+ dev_err(vg->chip.dev,
+ "unable to lock HW IRQ %lu for IRQ\n",
+ irqd_to_hwirq(d));
+ byt_irq_unmask(d);
+ return 0;
+}
+
+static void byt_irq_shutdown(struct irq_data *d)
+{
+ struct byt_gpio *vg = irq_data_get_irq_handler_data(d);
+
+ byt_irq_mask(d);
+ gpio_unlock_as_irq(&vg->chip, irqd_to_hwirq(d));
+}
+
static struct irq_chip byt_irqchip = {
.name = "BYT-GPIO",
.irq_mask = byt_irq_mask,
.irq_unmask = byt_irq_unmask,
.irq_set_type = byt_irq_type,
+ .irq_startup = byt_irq_startup,
+ .irq_shutdown = byt_irq_shutdown,
};
static void byt_gpio_irq_init_hw(struct byt_gpio *vg)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2] pinctrl: baytrail: lock IRQs when starting them
2013-12-03 15:00 [PATCH v2] pinctrl: baytrail: lock IRQs when starting them Linus Walleij
@ 2013-12-03 16:02 ` Mathias Nyman
2013-12-04 10:57 ` Mika Westerberg
2013-12-04 13:26 ` Gerhard Sittig
1 sibling, 1 reply; 4+ messages in thread
From: Mathias Nyman @ 2013-12-03 16:02 UTC (permalink / raw)
To: linux-arm-kernel
On 12/03/2013 05:00 PM, Linus Walleij wrote:
> This uses the new API for tagging GPIO lines as in use by
> IRQs. This enforces a few semantic checks on how the underlying
> GPIO line is used.
>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
> Cc: Mathias Nyman <mathias.nyman@linux.intel.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> ChangeLog v1->v2:
> - Actually make the change compile, doh.
> ---
> drivers/pinctrl/pinctrl-baytrail.c | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/drivers/pinctrl/pinctrl-baytrail.c b/drivers/pinctrl/pinctrl-baytrail.c
> index 1174ea86b6e9..998dbb0c4c93 100644
> --- a/drivers/pinctrl/pinctrl-baytrail.c
> +++ b/drivers/pinctrl/pinctrl-baytrail.c
> @@ -372,11 +372,33 @@ static void byt_irq_mask(struct irq_data *d)
> {
> }
>
> +static unsigned int byt_irq_startup(struct irq_data *d)
> +{
> + struct byt_gpio *vg = irq_data_get_irq_handler_data(d);
This should probably be:
struct byt_gpio *vg = irq_data_get_irq_chip_data(d);
As chip methods use irq_data->chip_data, not irq_data->handler_data
(Mika tested that it works on baytrail)
> +
> + if (gpio_lock_as_irq(&vg->chip, irqd_to_hwirq(d)))
> + dev_err(vg->chip.dev,
> + "unable to lock HW IRQ %lu for IRQ\n",
> + irqd_to_hwirq(d));
> + byt_irq_unmask(d);
> + return 0;
> +}
> +
> +static void byt_irq_shutdown(struct irq_data *d)
> +{
> + struct byt_gpio *vg = irq_data_get_irq_handler_data(d);
Same here.
-Mathias
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] pinctrl: baytrail: lock IRQs when starting them
2013-12-03 16:02 ` Mathias Nyman
@ 2013-12-04 10:57 ` Mika Westerberg
0 siblings, 0 replies; 4+ messages in thread
From: Mika Westerberg @ 2013-12-04 10:57 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Dec 03, 2013 at 06:02:18PM +0200, Mathias Nyman wrote:
> On 12/03/2013 05:00 PM, Linus Walleij wrote:
> >This uses the new API for tagging GPIO lines as in use by
> >IRQs. This enforces a few semantic checks on how the underlying
> >GPIO line is used.
> >
> >Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> >Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
> >Cc: Mathias Nyman <mathias.nyman@linux.intel.com>
> >Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> >---
> >ChangeLog v1->v2:
> >- Actually make the change compile, doh.
> >---
> > drivers/pinctrl/pinctrl-baytrail.c | 22 ++++++++++++++++++++++
> > 1 file changed, 22 insertions(+)
> >
> >diff --git a/drivers/pinctrl/pinctrl-baytrail.c b/drivers/pinctrl/pinctrl-baytrail.c
> >index 1174ea86b6e9..998dbb0c4c93 100644
> >--- a/drivers/pinctrl/pinctrl-baytrail.c
> >+++ b/drivers/pinctrl/pinctrl-baytrail.c
> >@@ -372,11 +372,33 @@ static void byt_irq_mask(struct irq_data *d)
> > {
> > }
> >
> >+static unsigned int byt_irq_startup(struct irq_data *d)
> >+{
> >+ struct byt_gpio *vg = irq_data_get_irq_handler_data(d);
>
> This should probably be:
>
> struct byt_gpio *vg = irq_data_get_irq_chip_data(d);
>
> As chip methods use irq_data->chip_data, not irq_data->handler_data
> (Mika tested that it works on baytrail)
Yes, if it uses irq_data_get_irq_handler_data() I get NULL vg pointer and
the kernel crashes. Using irq_data_get_irq_chip_data() makes it work.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] pinctrl: baytrail: lock IRQs when starting them
2013-12-03 15:00 [PATCH v2] pinctrl: baytrail: lock IRQs when starting them Linus Walleij
2013-12-03 16:02 ` Mathias Nyman
@ 2013-12-04 13:26 ` Gerhard Sittig
1 sibling, 0 replies; 4+ messages in thread
From: Gerhard Sittig @ 2013-12-04 13:26 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Dec 03, 2013 at 16:00 +0100, Linus Walleij wrote:
>
> --- a/drivers/pinctrl/pinctrl-baytrail.c
> +++ b/drivers/pinctrl/pinctrl-baytrail.c
> @@ -372,11 +372,33 @@ static void byt_irq_mask(struct irq_data *d)
> {
> }
>
> +static unsigned int byt_irq_startup(struct irq_data *d)
> +{
> + struct byt_gpio *vg = irq_data_get_irq_handler_data(d);
> +
> + if (gpio_lock_as_irq(&vg->chip, irqd_to_hwirq(d)))
> + dev_err(vg->chip.dev,
> + "unable to lock HW IRQ %lu for IRQ\n",
> + irqd_to_hwirq(d));
> + byt_irq_unmask(d);
> + return 0;
> +}
Just a thought: If failure to lock is non-fatal, should the
message be a warning then?
I do agree that failure to lock the GPIO should be non-fatal, as
there was debate and still might be concerns about how strict
locking should be.
virtually yours
Gerhard Sittig
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-12-04 13:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-03 15:00 [PATCH v2] pinctrl: baytrail: lock IRQs when starting them Linus Walleij
2013-12-03 16:02 ` Mathias Nyman
2013-12-04 10:57 ` Mika Westerberg
2013-12-04 13:26 ` Gerhard Sittig
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).